* simpos.h: prototype for scm_primitive_exit.
[bpt/guile.git] / aclocal.m4
CommitLineData
c7b6463e 1dnl aclocal.m4 generated automatically by aclocal 1.1p
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)
c7b6463e
JB
78dnl test to see if srcdir already configured
79if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
80 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
81fi
1dc9c5b0
JB
82ifelse([$3],,
83AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
84AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
733943b9
TT
85AM_SANITY_CHECK
86AC_ARG_PROGRAM
1dc9c5b0
JB
87dnl FIXME This is truly gross.
88missing_dir=`cd $ac_aux_dir && pwd`
89AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
90AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
91AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
92AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
93AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
733943b9
TT
94AC_PROG_MAKE_SET])
95
96
97# serial 1
98
99AC_DEFUN(AM_PROG_INSTALL,
100[AC_REQUIRE([AC_PROG_INSTALL])
101test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
102AC_SUBST(INSTALL_SCRIPT)dnl
ebf50833 103])
733943b9
TT
104
105#
106# Check to make sure that the build environment is sane.
107#
108
109AC_DEFUN(AM_SANITY_CHECK,
110[AC_MSG_CHECKING([whether build environment is sane])
1dc9c5b0
JB
111# Just in case
112sleep 1
733943b9 113echo timestamp > conftestfile
1dc9c5b0
JB
114# Do `set' in a subshell so we don't clobber the current shell's
115# arguments. Must try -L first in case configure is actually a
116# symlink; some systems play weird games with the mod time of symlinks
117# (eg FreeBSD returns the mod time of the symlink's containing
118# directory).
119if (
120 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
121 if test "$@" = "X"; then
122 # -L didn't work.
123 set X `ls -t $srcdir/configure conftestfile`
124 fi
125 test "[$]2" = conftestfile
126 )
733943b9
TT
127then
128 # Ok.
129 :
130else
131 AC_MSG_ERROR([newly created file is older than distributed files!
132Check your system clock])
133fi
134rm -f conftest*
135AC_MSG_RESULT(yes)])
136
1dc9c5b0
JB
137dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
138dnl The program must properly implement --version.
139AC_DEFUN(AM_MISSING_PROG,
140[AC_MSG_CHECKING(for working $2)
141# Run test in a subshell; some versions of sh will print an error if
142# an executable is not found, even if stderr is redirected.
c7b6463e
JB
143# Redirect stdin to placate older versions of autoconf. Sigh.
144if ($2 --version) < /dev/null > /dev/null 2>&1; then
1dc9c5b0
JB
145 $1=$2
146 AC_MSG_RESULT(found)
147else
148 $1="$3/missing $2"
149 AC_MSG_RESULT(missing)
150fi
151AC_SUBST($1)])
152
15ae1bee
MD
153# Add --enable-maintainer-mode option to configure.
154# From Jim Meyering
155
156# serial 1
157
158AC_DEFUN(AM_MAINTAINER_MODE,
159[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
160 dnl maintainer-mode is disabled by default
161 AC_ARG_ENABLE(maintainer-mode,
162[ --enable-maintainer-mode enable make rules and dependencies not useful
163 (and sometimes confusing) to the casual installer],
164 USE_MAINTAINER_MODE=$enableval,
165 USE_MAINTAINER_MODE=no)
166 AC_MSG_RESULT($USE_MAINTAINER_MODE)
167 if test $USE_MAINTAINER_MODE = yes; then
168 MAINT=
169 else
170 MAINT='#M#'
171 fi
172 AC_SUBST(MAINT)dnl
173]
174)
175
3a629497
JB
176# Like AC_CONFIG_HEADER, but automatically create stamp file.
177
178AC_DEFUN(AM_CONFIG_HEADER,
179[AC_PREREQ([2.12])
180AC_CONFIG_HEADER([$1])
181dnl When config.status generates a header, we must update the stamp-h file.
182dnl This file resides in the same directory as the config header
183dnl that is generated. We must strip everything past the first ":",
184dnl and everything past the last "/".
185AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
c7b6463e
JB
186ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
187<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
188<<am_indx=1
189for am_file in <<$1>>; do
190 case " <<$>>CONFIG_HEADERS " in
191 *" <<$>>am_file "*<<)>>
192 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
193 ;;
194 esac
195 am_indx=`expr "<<$>>am_indx" + 1`
196done<<>>dnl>>)
3a629497
JB
197changequote([,]))])
198
199
7228e897 200# serial 7 AM_PROG_LIBTOOL
3a629497
JB
201AC_DEFUN(AM_PROG_LIBTOOL,
202[AC_REQUIRE([AC_CANONICAL_HOST])
203AC_REQUIRE([AC_PROG_CC])
204AC_REQUIRE([AC_PROG_RANLIB])
7228e897 205AC_REQUIRE([AM_PATH_PROG_LD])
3a629497
JB
206
207# Always use our own libtool.
208LIBTOOL='$(top_builddir)/libtool'
209AC_SUBST(LIBTOOL)
210
211dnl Allow the --disable-shared flag to stop us from building shared libs.
212AC_ARG_ENABLE(shared,
213[ --enable-shared build shared libraries [default=yes]],
214test "$enableval" = no && libtool_shared=" --disable-shared",
215libtool_shared=)
216
7228e897
JB
217dnl Allow the --disable-static flag to stop us from building static libs.
218AC_ARG_ENABLE(static,
219[ --enable-static build static libraries [default=yes]],
220test "$enableval" = no && libtool_static=" --disable-static",
221libtool_static=)
222
223libtool_flags="$libtool_shared$libtool_static"
3a629497
JB
224test "$silent" = yes && libtool_flags="$libtool_flags --silent"
225test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
226
7228e897
JB
227# Some flags need to be propagated to the compiler or linker for good
228# libtool support.
3a629497
JB
229[case "$host" in
230*-*-irix6*)
7228e897
JB
231 for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do
232 if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
233 LD="${LD-ld} $f"
234 fi
235 done
3a629497
JB
236 ;;
237
238*-*-sco3.2v5*)
239 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
240 CFLAGS="$CFLAGS -belf"
241 ;;
242esac]
243
244# Actually configure libtool. ac_aux_dir is where install-sh is found.
245CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
246${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
247$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
248|| AC_MSG_ERROR([libtool configure failed])
249])
250
7228e897
JB
251# AM_PATH_PROG_LD - find out which linker is being used by the C compiler
252AC_DEFUN(AM_PATH_PROG_LD,
253[AC_REQUIRE([AC_PROG_CC])
254AC_MSG_CHECKING([for ld used by the C compiler ($CC $CFLAGS $LDFLAGS)])
255AC_CACHE_VAL(am_cv_path_LD,
256[case "$LD" in
257 /*)
787d7283 258 am_cv_path_LD="$LD" # Let the user override the test with a path.
7228e897
JB
259 ;;
260 *)
261 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
262 for ac_dir in $PATH; do
263 test -z "$ac_dir" && ac_dir=.
264 if test -f "$ac_dir/ld"; then
265 # Check to see if the program is GNU ld. I'd rather use --version,
266 # but apparently some GNU ld's only accept -v.
267 if "$ac_dir/ld" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
268 # If it was GNU ld, only accept it if we're using GCC.
269 am_cv_path_LD="$ac_dir/ld"
270 test "$ac_cv_prog_gcc" = yes && break
271 else
272 # If it was not GNU ld, and we are not using GCC, then accept it.
273 am_cv_path_LD="$ac_dir/ld"
274 break
275 fi
276 fi
277 done
278 IFS="$ac_save_ifs"
279 ;;
280esac])
281LD="$am_cv_path_LD"
282if test -n "$LD"; then
283 AC_MSG_RESULT($LD)
284else
285 AC_MSG_RESULT(no)
286fi
287test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
288AC_SUBST(LD)
289])
290
3a629497
JB
291dnl
292dnl CY_AC_WITH_THREADS determines which thread library the user intends
293dnl to put underneath guile. Pass it the path to find the guile top-level
294dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
295dnl
296
297AC_DEFUN([CY_AC_WITH_THREADS],[
298AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
299AC_CACHE_VAL(cy_cv_threads_cflags,[
300AC_CACHE_VAL(cy_cv_threads_libs,[
301use_threads=no;
302AC_ARG_WITH(threads,[ --with-threads thread interface],
303 use_threads=$withval, use_threads=no)
304test -n "$use_threads" || use_threads=qt
305threads_package=unknown
306if test "$use_threads" != no; then
307dnl
308dnl Test for the qt threads package - used for cooperative threads
309dnl This may not necessarily be built yet - so just check for the
310dnl header files.
311dnl
312 if test "$use_threads" = yes || test "$use_threads" = qt; then
ec06dd30
AG
313 # Look for qt in source directory.
314 if test -f $srcdir/qt/qt.c; then
315 qtsrcdir="`(cd $srcdir; pwd)`/qt"
3a629497 316 threads_package=COOP
ec06dd30 317 cy_cv_threads_cflags="-I$qtsrcdir -I../qt"
42d5fe64 318 cy_cv_threads_libs="../qt/libqt.a"
3a629497
JB
319 fi
320 else
321 if test -f $use_threads/qt.c; then
322 # FIXME seems as though we should try to use an installed qt here.
323 threads_package=COOP
324 cy_cv_threads_cflags="-I$use_threads -I../qt"
42d5fe64 325 cy_cv_threads_libs="../qt/libqt.a"
3a629497
JB
326 fi
327 fi
328 if test "$use_threads" = pthreads; then
329 # Look for pthreads in srcdir. See above to understand why
330 # we always set threads_package.
331 if test -f $srcdir/../../pthreads/pthreads/queue.c \
332 || test -f $srcdir/../pthreads/pthreads/queue.c; then
333 threads_package=MIT
334 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
335 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
336 fi
337 fi
338 saved_CPP="$CPPFLAGS"
339 saved_LD="$LDFLAGS"
340 saved_LIBS="$LIBS"
341 if test "$threads_package" = unknown; then
342dnl
343dnl Test for the FSU threads package
344dnl
345 CPPFLAGS="-I$use_threads/include"
346 LDFLAGS="-L$use_threads/lib"
347 LIBS="-lgthreads -lmalloc"
348 AC_TRY_LINK([#include <pthread.h>],[
349pthread_equal(NULL,NULL);
350], threads_package=FSU)
351 fi
352 if test "$threads_package" = unknown; then
353dnl
354dnl Test for the MIT threads package
355dnl
356 LIBS="-lpthread"
357 AC_TRY_LINK([#include <pthread.h>],[
358pthread_equal(NULL,NULL);
359], threads_package=MIT)
360 fi
361 if test "$threads_package" = unknown; then
362dnl
363dnl Test for the PCthreads package
364dnl
365 LIBS="-lpthreads"
366 AC_TRY_LINK([#include <pthread.h>],[
367pthread_equal(NULL,NULL);
368], threads_package=PCthreads)
369 fi
370dnl
371dnl Set the appropriate flags!
372dnl
373 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
374 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
375 cy_cv_threads_package=$threads_package
376 CPPFLAGS="$saved_CPP"
377 LDFLAGS="$saved_LD"
378 LIBS="$saved_LIBS"
379 if test "$threads_package" = unknown; then
380 AC_MSG_ERROR("cannot find thread library installation")
381 fi
382fi
383])
384])
385],
386dnl
387dnl Set flags according to what is cached.
388dnl
389CPPFLAGS="$cy_cv_threads_cflags"
390LIBS="$cy_cv_threads_libs"
391)
392])
393