* stime.c (scm_mktime): #ifndef HAVE_TM_ZONE, Use lt.tm_zone, not
[bpt/guile.git] / libguile / aclocal.m4
CommitLineData
1dc9c5b0 1dnl aclocal.m4 generated automatically by aclocal 1.1n
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
1dc9c5b0 73test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
733943b9
TT
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
0705ea15 83AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
1dc9c5b0
JB
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, [no-define])
96
97AC_DEFUN(AM_INIT_AUTOMAKE,
98[AC_REQUIRE([AM_PROG_INSTALL])
99PACKAGE=[$1]
733943b9 100AC_SUBST(PACKAGE)
1dc9c5b0 101VERSION=[$2]
733943b9 102AC_SUBST(VERSION)
1dc9c5b0
JB
103ifelse([$3],,
104AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
105AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
733943b9
TT
106AM_SANITY_CHECK
107AC_ARG_PROGRAM
1dc9c5b0
JB
108dnl FIXME This is truly gross.
109missing_dir=`cd $ac_aux_dir && pwd`
110AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
111AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
112AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
113AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
114AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
115AC_PROG_MAKE_SET])
733943b9
TT
116
117
118# serial 1
119
120AC_DEFUN(AM_PROG_INSTALL,
121[AC_REQUIRE([AC_PROG_INSTALL])
122test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
123AC_SUBST(INSTALL_SCRIPT)dnl
124])
125
126#
127# Check to make sure that the build environment is sane.
128#
129
130AC_DEFUN(AM_SANITY_CHECK,
131[AC_MSG_CHECKING([whether build environment is sane])
1dc9c5b0
JB
132# Just in case
133sleep 1
733943b9 134echo timestamp > conftestfile
1dc9c5b0
JB
135# Do `set' in a subshell so we don't clobber the current shell's
136# arguments. Must try -L first in case configure is actually a
137# symlink; some systems play weird games with the mod time of symlinks
138# (eg FreeBSD returns the mod time of the symlink's containing
139# directory).
140if (
141 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
142 if test "$@" = "X"; then
143 # -L didn't work.
144 set X `ls -t $srcdir/configure conftestfile`
145 fi
146 test "[$]2" = conftestfile
147 )
733943b9
TT
148then
149 # Ok.
150 :
151else
152 AC_MSG_ERROR([newly created file is older than distributed files!
153Check your system clock])
154fi
155rm -f conftest*
156AC_MSG_RESULT(yes)])
157
1dc9c5b0
JB
158dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
159dnl The program must properly implement --version.
160AC_DEFUN(AM_MISSING_PROG,
161[AC_MSG_CHECKING(for working $2)
162# Run test in a subshell; some versions of sh will print an error if
163# an executable is not found, even if stderr is redirected.
164if ($2 --version) > /dev/null 2>&1; then
165 $1=$2
166 AC_MSG_RESULT(found)
167else
168 $1="$3/missing $2"
169 AC_MSG_RESULT(missing)
170fi
171AC_SUBST($1)])
172
15ae1bee
MD
173# Add --enable-maintainer-mode option to configure.
174# From Jim Meyering
175
176# serial 1
177
178AC_DEFUN(AM_MAINTAINER_MODE,
179[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
180 dnl maintainer-mode is disabled by default
181 AC_ARG_ENABLE(maintainer-mode,
182[ --enable-maintainer-mode enable make rules and dependencies not useful
183 (and sometimes confusing) to the casual installer],
184 USE_MAINTAINER_MODE=$enableval,
185 USE_MAINTAINER_MODE=no)
186 AC_MSG_RESULT($USE_MAINTAINER_MODE)
187 if test $USE_MAINTAINER_MODE = yes; then
188 MAINT=
189 else
190 MAINT='#M#'
191 fi
192 AC_SUBST(MAINT)dnl
193]
194)
195
1dc9c5b0
JB
196
197# serial 4 AM_PROG_LIBTOOL
1bb9f4db
MV
198AC_DEFUN(AM_PROG_LIBTOOL,
199[AC_REQUIRE([AC_CANONICAL_HOST])
200AC_REQUIRE([AC_PROG_CC])
201AC_REQUIRE([AC_PROG_RANLIB])
202
203# Always use our own libtool.
204LIBTOOL='$(top_builddir)/libtool'
205AC_SUBST(LIBTOOL)
206
207dnl Allow the --disable-shared flag to stop us from building shared libs.
208AC_ARG_ENABLE(shared,
209[ --enable-shared build shared libraries [default=yes]],
210test "$enableval" = no && libtool_shared=" --disable-shared",
211libtool_shared=)
212
213libtool_flags="$libtool_shared"
214test "$silent" = yes && libtool_flags="$libtool_flags --silent"
215test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
216
1dc9c5b0
JB
217[case "$host" in
218*-*-irix6*)
219 # For IRIX 6, ld needs -n32 if cc uses it.
220 if echo " $CC $CFLAGS " | egrep -e '[ ]-n32[ ]' > /dev/null; then
221 LD="${LD-ld} -n32"
222 fi
223 ;;
224
225*-*-sco3.2v5*)
226 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
227 CFLAGS="$CFLAGS -belf"
228 ;;
229esac]
230
1bb9f4db
MV
231# Actually configure libtool. ac_aux_dir is where install-sh is found.
232CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
1dc9c5b0
JB
233${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
234$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
1bb9f4db
MV
235|| AC_MSG_ERROR([libtool configure failed])
236])
237
733943b9
TT
238dnl
239dnl CY_AC_WITH_THREADS determines which thread library the user intends
240dnl to put underneath guile. Pass it the path to find the guile top-level
241dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
242dnl
243
244AC_DEFUN([CY_AC_WITH_THREADS],[
245AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
246AC_CACHE_VAL(cy_cv_threads_cflags,[
247AC_CACHE_VAL(cy_cv_threads_libs,[
248use_threads=no;
249AC_ARG_WITH(threads,[ --with-threads thread interface],
250 use_threads=$withval, use_threads=no)
251test -n "$use_threads" || use_threads=qt
252threads_package=unknown
253if test "$use_threads" != no; then
254dnl
255dnl Test for the qt threads package - used for cooperative threads
256dnl This may not necessarily be built yet - so just check for the
257dnl header files.
258dnl
259 if test "$use_threads" = yes || test "$use_threads" = qt; then
260 # Look for qt in source directory. This is a hack: we look in
261 # "./qt" because this check might be run at the top level.
262 if test -f $srcdir/../qt/qt.c || test -f $srcdir/qt/qt.c; then
263 threads_package=COOP
264 cy_cv_threads_cflags="-I$srcdir/../qt -I../qt"
265 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
266 fi
267 else
268 if test -f $use_threads/qt.c; then
269 # FIXME seems as though we should try to use an installed qt here.
270 threads_package=COOP
271 cy_cv_threads_cflags="-I$use_threads -I../qt"
272 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
273 fi
274 fi
275 if test "$use_threads" = pthreads; then
276 # Look for pthreads in srcdir. See above to understand why
277 # we always set threads_package.
278 if test -f $srcdir/../../pthreads/pthreads/queue.c \
279 || test -f $srcdir/../pthreads/pthreads/queue.c; then
280 threads_package=MIT
281 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
282 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
283 fi
284 fi
285 saved_CPP="$CPPFLAGS"
286 saved_LD="$LDFLAGS"
287 saved_LIBS="$LIBS"
288 if test "$threads_package" = unknown; then
289dnl
290dnl Test for the FSU threads package
291dnl
292 CPPFLAGS="-I$use_threads/include"
293 LDFLAGS="-L$use_threads/lib"
294 LIBS="-lgthreads -lmalloc"
295 AC_TRY_LINK([#include <pthread.h>],[
296pthread_equal(NULL,NULL);
297], threads_package=FSU)
298 fi
299 if test "$threads_package" = unknown; then
300dnl
301dnl Test for the MIT threads package
302dnl
303 LIBS="-lpthread"
304 AC_TRY_LINK([#include <pthread.h>],[
305pthread_equal(NULL,NULL);
306], threads_package=MIT)
307 fi
308 if test "$threads_package" = unknown; then
309dnl
310dnl Test for the PCthreads package
311dnl
312 LIBS="-lpthreads"
313 AC_TRY_LINK([#include <pthread.h>],[
314pthread_equal(NULL,NULL);
315], threads_package=PCthreads)
316 fi
317dnl
318dnl Set the appropriate flags!
319dnl
320 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
321 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
322 cy_cv_threads_package=$threads_package
323 CPPFLAGS="$saved_CPP"
324 LDFLAGS="$saved_LD"
325 LIBS="$saved_LIBS"
326 if test "$threads_package" = unknown; then
327 AC_MSG_ERROR("cannot find thread library installation")
328 fi
329fi
330])
331])
332],
333dnl
334dnl Set flags according to what is cached.
335dnl
336CPPFLAGS="$cy_cv_threads_cflags"
337LIBS="$cy_cv_threads_libs"
338)
339])
340