*** empty log message ***
[bpt/guile.git] / libguile / aclocal.m4
CommitLineData
f9d81b6b 1dnl aclocal.m4 generated automatically by aclocal 1.1l
733943b9 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
1bb9f4db
MV
138# serial 1 AM_PROG_LIBTOOL
139AC_DEFUN(AM_PROG_LIBTOOL,
140[AC_REQUIRE([AC_CANONICAL_HOST])
141AC_REQUIRE([AC_PROG_CC])
142AC_REQUIRE([AC_PROG_RANLIB])
143
144# Always use our own libtool.
145LIBTOOL='$(top_builddir)/libtool'
146AC_SUBST(LIBTOOL)
147
148dnl Allow the --disable-shared flag to stop us from building shared libs.
149AC_ARG_ENABLE(shared,
150[ --enable-shared build shared libraries [default=yes]],
151test "$enableval" = no && libtool_shared=" --disable-shared",
152libtool_shared=)
153
154libtool_flags="$libtool_shared"
155test "$silent" = yes && libtool_flags="$libtool_flags --silent"
156test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
157
158# Actually configure libtool. ac_aux_dir is where install-sh is found.
159CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
160$ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
161|| AC_MSG_ERROR([libtool configure failed])
162])
163
733943b9
TT
164dnl
165dnl CY_AC_WITH_THREADS determines which thread library the user intends
166dnl to put underneath guile. Pass it the path to find the guile top-level
167dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
168dnl
169
170AC_DEFUN([CY_AC_WITH_THREADS],[
171AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
172AC_CACHE_VAL(cy_cv_threads_cflags,[
173AC_CACHE_VAL(cy_cv_threads_libs,[
174use_threads=no;
175AC_ARG_WITH(threads,[ --with-threads thread interface],
176 use_threads=$withval, use_threads=no)
177test -n "$use_threads" || use_threads=qt
178threads_package=unknown
179if test "$use_threads" != no; then
180dnl
181dnl Test for the qt threads package - used for cooperative threads
182dnl This may not necessarily be built yet - so just check for the
183dnl header files.
184dnl
185 if test "$use_threads" = yes || test "$use_threads" = qt; then
186 # Look for qt in source directory. This is a hack: we look in
187 # "./qt" because this check might be run at the top level.
188 if test -f $srcdir/../qt/qt.c || test -f $srcdir/qt/qt.c; then
189 threads_package=COOP
190 cy_cv_threads_cflags="-I$srcdir/../qt -I../qt"
191 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
192 fi
193 else
194 if test -f $use_threads/qt.c; then
195 # FIXME seems as though we should try to use an installed qt here.
196 threads_package=COOP
197 cy_cv_threads_cflags="-I$use_threads -I../qt"
198 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
199 fi
200 fi
201 if test "$use_threads" = pthreads; then
202 # Look for pthreads in srcdir. See above to understand why
203 # we always set threads_package.
204 if test -f $srcdir/../../pthreads/pthreads/queue.c \
205 || test -f $srcdir/../pthreads/pthreads/queue.c; then
206 threads_package=MIT
207 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
208 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
209 fi
210 fi
211 saved_CPP="$CPPFLAGS"
212 saved_LD="$LDFLAGS"
213 saved_LIBS="$LIBS"
214 if test "$threads_package" = unknown; then
215dnl
216dnl Test for the FSU threads package
217dnl
218 CPPFLAGS="-I$use_threads/include"
219 LDFLAGS="-L$use_threads/lib"
220 LIBS="-lgthreads -lmalloc"
221 AC_TRY_LINK([#include <pthread.h>],[
222pthread_equal(NULL,NULL);
223], threads_package=FSU)
224 fi
225 if test "$threads_package" = unknown; then
226dnl
227dnl Test for the MIT threads package
228dnl
229 LIBS="-lpthread"
230 AC_TRY_LINK([#include <pthread.h>],[
231pthread_equal(NULL,NULL);
232], threads_package=MIT)
233 fi
234 if test "$threads_package" = unknown; then
235dnl
236dnl Test for the PCthreads package
237dnl
238 LIBS="-lpthreads"
239 AC_TRY_LINK([#include <pthread.h>],[
240pthread_equal(NULL,NULL);
241], threads_package=PCthreads)
242 fi
243dnl
244dnl Set the appropriate flags!
245dnl
246 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
247 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
248 cy_cv_threads_package=$threads_package
249 CPPFLAGS="$saved_CPP"
250 LDFLAGS="$saved_LD"
251 LIBS="$saved_LIBS"
252 if test "$threads_package" = unknown; then
253 AC_MSG_ERROR("cannot find thread library installation")
254 fi
255fi
256])
257])
258],
259dnl
260dnl Set flags according to what is cached.
261dnl
262CPPFLAGS="$cy_cv_threads_cflags"
263LIBS="$cy_cv_threads_libs"
264)
265])
266