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