Changes to use automake-generated Makefile.ins everywhere
[bpt/guile.git] / libguile / aclocal.m4
CommitLineData
733943b9
TT
1dnl aclocal.m4 generated automatically by aclocal 1.1i
2
2420229d
JB
3dnl On the NeXT, #including <utime.h> doesn't give you a definition for
4dnl struct utime, unless you #define _POSIX_SOURCE.
5
6AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
e7247600
JB
7 AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
8 guile_cv_struct_utimbuf_needs_posix,
2420229d
JB
9 [AC_TRY_CPP([
10#ifdef __EMX__
11#include <sys/utime.h>
12#else
13#include <utime.h>
14#endif
15struct utime blah;
16],
17 guile_cv_struct_utimbuf_needs_posix=no,
e7247600
JB
18 guile_cv_struct_utimbuf_needs_posix=yes)])
19 if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
20 AC_DEFINE(UTIMBUF_NEEDS_POSIX)
21 fi])
3594582b
JB
22
23
24
25
26dnl
27dnl Apparently, at CMU they have a weird version of libc.h that is
28dnl installed in /usr/local/include and conflicts with unistd.h.
29dnl In these situations, we should not #include libc.h.
30dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
31dnl present on the system, and is safe to #include.
32dnl
33AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
34 [
35 AC_CHECK_HEADERS(libc.h unistd.h)
36 AC_CACHE_CHECK(
37 "whether libc.h and unistd.h can be included together",
38 guile_cv_header_libc_with_unistd,
39 [
40 if test "$ac_cv_header_libc_h" = "no"; then
41 guile_cv_header_libc_with_unistd="no"
42 elif test "$ac_cv_header_unistd.h" = "no"; then
43 guile_cv_header_libc_with_unistd="yes"
44 else
45 AC_TRY_COMPILE(
46 [
47# include <libc.h>
48# include <unistd.h>
49 ],
50 [],
51 [guile_cv_header_libc_with_unistd=yes],
52 [guile_cv_header_libc_with_unistd=no]
53 )
54 fi
55 ]
56 )
57 if test "$guile_cv_header_libc_with_unistd" = yes; then
58 AC_DEFINE(LIBC_H_WITH_UNISTD_H)
59 fi
60 ]
61)
733943b9
TT
62
63# Like AC_CONFIG_HEADER, but automatically create stamp file.
64
65AC_DEFUN(AM_CONFIG_HEADER,
66[AC_PREREQ([2.12])
67AC_CONFIG_HEADER([$1])
68dnl When config.status generates a header, we must update the stamp-h file.
69dnl This file resides in the same directory as the config header
70dnl that is generated. We must strip everything past the first ":",
71dnl and everything past the last "/".
72AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
73test -z "<<$>>CONFIG_HEADER" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
74changequote([,]))])
75
76
77dnl Usage: AM_INIT_GUILE_MODULE(module-name)
78dnl This macro will automatically get the guile version from the
79dnl top-level srcdir, and will initialize automake. It also
80dnl defines the `module' variable.
81AC_DEFUN([AM_INIT_GUILE_MODULE],[
82. $srcdir/../GUILE-VERSION
83AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
84AC_CONFIG_AUX_DIR(..)
85module=[$1]
86AC_SUBST(module)])
87
88# Do all the work for Automake. This macro actually does too much --
89# some checks are only needed if your package does certain things.
90# But this isn't really a big deal.
91
92# serial 1
93
94dnl Usage:
95dnl AM_INIT_AUTOMAKE(package,version)
96
97AC_DEFUN(AM_INIT_AUTOMAKE,
98[AC_REQUIRE([AM_PROG_INSTALL])
99PACKAGE=[$1]
100AC_SUBST(PACKAGE)
101AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
102VERSION=[$2]
103AC_SUBST(VERSION)
104AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
105AM_SANITY_CHECK
106AC_ARG_PROGRAM
107AC_PROG_MAKE_SET])
108
109
110# serial 1
111
112AC_DEFUN(AM_PROG_INSTALL,
113[AC_REQUIRE([AC_PROG_INSTALL])
114test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
115AC_SUBST(INSTALL_SCRIPT)dnl
116])
117
118#
119# Check to make sure that the build environment is sane.
120#
121
122AC_DEFUN(AM_SANITY_CHECK,
123[AC_MSG_CHECKING([whether build environment is sane])
124echo timestamp > conftestfile
125# Do this in a subshell so we don't clobber the current shell's
126# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test?
127if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile)
128then
129 # Ok.
130 :
131else
132 AC_MSG_ERROR([newly created file is older than distributed files!
133Check your system clock])
134fi
135rm -f conftest*
136AC_MSG_RESULT(yes)])
137
138dnl
139dnl CY_AC_WITH_THREADS determines which thread library the user intends
140dnl to put underneath guile. Pass it the path to find the guile top-level
141dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
142dnl
143
144AC_DEFUN([CY_AC_WITH_THREADS],[
145AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
146AC_CACHE_VAL(cy_cv_threads_cflags,[
147AC_CACHE_VAL(cy_cv_threads_libs,[
148use_threads=no;
149AC_ARG_WITH(threads,[ --with-threads thread interface],
150 use_threads=$withval, use_threads=no)
151test -n "$use_threads" || use_threads=qt
152threads_package=unknown
153if test "$use_threads" != no; then
154dnl
155dnl Test for the qt threads package - used for cooperative threads
156dnl This may not necessarily be built yet - so just check for the
157dnl header files.
158dnl
159 if test "$use_threads" = yes || test "$use_threads" = qt; then
160 # Look for qt in source directory. This is a hack: we look in
161 # "./qt" because this check might be run at the top level.
162 if test -f $srcdir/../qt/qt.c || test -f $srcdir/qt/qt.c; then
163 threads_package=COOP
164 cy_cv_threads_cflags="-I$srcdir/../qt -I../qt"
165 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
166 fi
167 else
168 if test -f $use_threads/qt.c; then
169 # FIXME seems as though we should try to use an installed qt here.
170 threads_package=COOP
171 cy_cv_threads_cflags="-I$use_threads -I../qt"
172 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
173 fi
174 fi
175 if test "$use_threads" = pthreads; then
176 # Look for pthreads in srcdir. See above to understand why
177 # we always set threads_package.
178 if test -f $srcdir/../../pthreads/pthreads/queue.c \
179 || test -f $srcdir/../pthreads/pthreads/queue.c; then
180 threads_package=MIT
181 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
182 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
183 fi
184 fi
185 saved_CPP="$CPPFLAGS"
186 saved_LD="$LDFLAGS"
187 saved_LIBS="$LIBS"
188 if test "$threads_package" = unknown; then
189dnl
190dnl Test for the FSU threads package
191dnl
192 CPPFLAGS="-I$use_threads/include"
193 LDFLAGS="-L$use_threads/lib"
194 LIBS="-lgthreads -lmalloc"
195 AC_TRY_LINK([#include <pthread.h>],[
196pthread_equal(NULL,NULL);
197], threads_package=FSU)
198 fi
199 if test "$threads_package" = unknown; then
200dnl
201dnl Test for the MIT threads package
202dnl
203 LIBS="-lpthread"
204 AC_TRY_LINK([#include <pthread.h>],[
205pthread_equal(NULL,NULL);
206], threads_package=MIT)
207 fi
208 if test "$threads_package" = unknown; then
209dnl
210dnl Test for the PCthreads package
211dnl
212 LIBS="-lpthreads"
213 AC_TRY_LINK([#include <pthread.h>],[
214pthread_equal(NULL,NULL);
215], threads_package=PCthreads)
216 fi
217dnl
218dnl Set the appropriate flags!
219dnl
220 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
221 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
222 cy_cv_threads_package=$threads_package
223 CPPFLAGS="$saved_CPP"
224 LDFLAGS="$saved_LD"
225 LIBS="$saved_LIBS"
226 if test "$threads_package" = unknown; then
227 AC_MSG_ERROR("cannot find thread library installation")
228 fi
229fi
230])
231])
232],
233dnl
234dnl Set flags according to what is cached.
235dnl
236CPPFLAGS="$cy_cv_threads_cflags"
237LIBS="$cy_cv_threads_libs"
238)
239])
240