Switch to automake-1.1p.
[bpt/guile.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.1p
2
3 dnl On the NeXT, #including <utime.h> doesn't give you a definition for
4 dnl struct utime, unless you #define _POSIX_SOURCE.
5
6 AC_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
15 struct 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
26 dnl
27 dnl Apparently, at CMU they have a weird version of libc.h that is
28 dnl installed in /usr/local/include and conflicts with unistd.h.
29 dnl In these situations, we should not #include libc.h.
30 dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
31 dnl present on the system, and is safe to #include.
32 dnl
33 AC_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
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
69 dnl Usage:
70 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
71
72 AC_DEFUN(AM_INIT_AUTOMAKE,
73 [AC_REQUIRE([AM_PROG_INSTALL])
74 PACKAGE=[$1]
75 AC_SUBST(PACKAGE)
76 VERSION=[$2]
77 AC_SUBST(VERSION)
78 dnl test to see if srcdir already configured
79 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
80 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
81 fi
82 ifelse([$3],,
83 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
84 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
85 AM_SANITY_CHECK
86 AC_ARG_PROGRAM
87 dnl FIXME This is truly gross.
88 missing_dir=`cd $ac_aux_dir && pwd`
89 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
90 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
91 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
92 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
93 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
94 AC_PROG_MAKE_SET])
95
96
97 # serial 1
98
99 AC_DEFUN(AM_PROG_INSTALL,
100 [AC_REQUIRE([AC_PROG_INSTALL])
101 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
102 AC_SUBST(INSTALL_SCRIPT)dnl
103 ])
104
105 #
106 # Check to make sure that the build environment is sane.
107 #
108
109 AC_DEFUN(AM_SANITY_CHECK,
110 [AC_MSG_CHECKING([whether build environment is sane])
111 # Just in case
112 sleep 1
113 echo timestamp > conftestfile
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).
119 if (
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 )
127 then
128 # Ok.
129 :
130 else
131 AC_MSG_ERROR([newly created file is older than distributed files!
132 Check your system clock])
133 fi
134 rm -f conftest*
135 AC_MSG_RESULT(yes)])
136
137 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
138 dnl The program must properly implement --version.
139 AC_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.
143 # Redirect stdin to placate older versions of autoconf. Sigh.
144 if ($2 --version) < /dev/null > /dev/null 2>&1; then
145 $1=$2
146 AC_MSG_RESULT(found)
147 else
148 $1="$3/missing $2"
149 AC_MSG_RESULT(missing)
150 fi
151 AC_SUBST($1)])
152
153 # Add --enable-maintainer-mode option to configure.
154 # From Jim Meyering
155
156 # serial 1
157
158 AC_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
176 # Like AC_CONFIG_HEADER, but automatically create stamp file.
177
178 AC_DEFUN(AM_CONFIG_HEADER,
179 [AC_PREREQ([2.12])
180 AC_CONFIG_HEADER([$1])
181 dnl When config.status generates a header, we must update the stamp-h file.
182 dnl This file resides in the same directory as the config header
183 dnl that is generated. We must strip everything past the first ":",
184 dnl and everything past the last "/".
185 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
186 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
187 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
188 <<am_indx=1
189 for 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`
196 done<<>>dnl>>)
197 changequote([,]))])
198
199
200 # serial 4 AM_PROG_LIBTOOL
201 AC_DEFUN(AM_PROG_LIBTOOL,
202 [AC_REQUIRE([AC_CANONICAL_HOST])
203 AC_REQUIRE([AC_PROG_CC])
204 AC_REQUIRE([AC_PROG_RANLIB])
205
206 # Always use our own libtool.
207 LIBTOOL='$(top_builddir)/libtool'
208 AC_SUBST(LIBTOOL)
209
210 dnl Allow the --disable-shared flag to stop us from building shared libs.
211 AC_ARG_ENABLE(shared,
212 [ --enable-shared build shared libraries [default=yes]],
213 test "$enableval" = no && libtool_shared=" --disable-shared",
214 libtool_shared=)
215
216 libtool_flags="$libtool_shared"
217 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
218 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
219
220 [case "$host" in
221 *-*-irix6*)
222 # For IRIX 6, ld needs -n32 if cc uses it.
223 if echo " $CC $CFLAGS " | egrep -e '[ ]-n32[ ]' > /dev/null; then
224 LD="${LD-ld} -n32"
225 fi
226 ;;
227
228 *-*-sco3.2v5*)
229 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
230 CFLAGS="$CFLAGS -belf"
231 ;;
232 esac]
233
234 # Actually configure libtool. ac_aux_dir is where install-sh is found.
235 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \
236 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
237 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
238 || AC_MSG_ERROR([libtool configure failed])
239 ])
240
241 dnl
242 dnl CY_AC_WITH_THREADS determines which thread library the user intends
243 dnl to put underneath guile. Pass it the path to find the guile top-level
244 dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
245 dnl
246
247 AC_DEFUN([CY_AC_WITH_THREADS],[
248 AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
249 AC_CACHE_VAL(cy_cv_threads_cflags,[
250 AC_CACHE_VAL(cy_cv_threads_libs,[
251 use_threads=no;
252 AC_ARG_WITH(threads,[ --with-threads thread interface],
253 use_threads=$withval, use_threads=no)
254 test -n "$use_threads" || use_threads=qt
255 threads_package=unknown
256 if test "$use_threads" != no; then
257 dnl
258 dnl Test for the qt threads package - used for cooperative threads
259 dnl This may not necessarily be built yet - so just check for the
260 dnl header files.
261 dnl
262 if test "$use_threads" = yes || test "$use_threads" = qt; then
263 # Look for qt in source directory.
264 if test -f $srcdir/qt/qt.c; then
265 qtsrcdir="`(cd $srcdir; pwd)`/qt"
266 threads_package=COOP
267 cy_cv_threads_cflags="-I$qtsrcdir -I../qt"
268 cy_cv_threads_libs="../qt/libqt.a"
269 fi
270 else
271 if test -f $use_threads/qt.c; then
272 # FIXME seems as though we should try to use an installed qt here.
273 threads_package=COOP
274 cy_cv_threads_cflags="-I$use_threads -I../qt"
275 cy_cv_threads_libs="../qt/libqt.a"
276 fi
277 fi
278 if test "$use_threads" = pthreads; then
279 # Look for pthreads in srcdir. See above to understand why
280 # we always set threads_package.
281 if test -f $srcdir/../../pthreads/pthreads/queue.c \
282 || test -f $srcdir/../pthreads/pthreads/queue.c; then
283 threads_package=MIT
284 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
285 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
286 fi
287 fi
288 saved_CPP="$CPPFLAGS"
289 saved_LD="$LDFLAGS"
290 saved_LIBS="$LIBS"
291 if test "$threads_package" = unknown; then
292 dnl
293 dnl Test for the FSU threads package
294 dnl
295 CPPFLAGS="-I$use_threads/include"
296 LDFLAGS="-L$use_threads/lib"
297 LIBS="-lgthreads -lmalloc"
298 AC_TRY_LINK([#include <pthread.h>],[
299 pthread_equal(NULL,NULL);
300 ], threads_package=FSU)
301 fi
302 if test "$threads_package" = unknown; then
303 dnl
304 dnl Test for the MIT threads package
305 dnl
306 LIBS="-lpthread"
307 AC_TRY_LINK([#include <pthread.h>],[
308 pthread_equal(NULL,NULL);
309 ], threads_package=MIT)
310 fi
311 if test "$threads_package" = unknown; then
312 dnl
313 dnl Test for the PCthreads package
314 dnl
315 LIBS="-lpthreads"
316 AC_TRY_LINK([#include <pthread.h>],[
317 pthread_equal(NULL,NULL);
318 ], threads_package=PCthreads)
319 fi
320 dnl
321 dnl Set the appropriate flags!
322 dnl
323 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
324 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
325 cy_cv_threads_package=$threads_package
326 CPPFLAGS="$saved_CPP"
327 LDFLAGS="$saved_LD"
328 LIBS="$saved_LIBS"
329 if test "$threads_package" = unknown; then
330 AC_MSG_ERROR("cannot find thread library installation")
331 fi
332 fi
333 ])
334 ])
335 ],
336 dnl
337 dnl Set flags according to what is cached.
338 dnl
339 CPPFLAGS="$cy_cv_threads_cflags"
340 LIBS="$cy_cv_threads_libs"
341 )
342 ])
343