Changes for reduced Guile distribution: one configure script,
[bpt/guile.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.1n
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 ifelse([$3],,
79 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
80 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
81 AM_SANITY_CHECK
82 AC_ARG_PROGRAM
83 dnl FIXME This is truly gross.
84 missing_dir=`cd $ac_aux_dir && pwd`
85 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
86 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
87 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
88 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
89 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
90 AC_PROG_MAKE_SET])
91
92
93 # serial 1
94
95 AC_DEFUN(AM_PROG_INSTALL,
96 [AC_REQUIRE([AC_PROG_INSTALL])
97 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
98 AC_SUBST(INSTALL_SCRIPT)dnl
99 ])
100
101 #
102 # Check to make sure that the build environment is sane.
103 #
104
105 AC_DEFUN(AM_SANITY_CHECK,
106 [AC_MSG_CHECKING([whether build environment is sane])
107 # Just in case
108 sleep 1
109 echo timestamp > conftestfile
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).
115 if (
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 )
123 then
124 # Ok.
125 :
126 else
127 AC_MSG_ERROR([newly created file is older than distributed files!
128 Check your system clock])
129 fi
130 rm -f conftest*
131 AC_MSG_RESULT(yes)])
132
133 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
134 dnl The program must properly implement --version.
135 AC_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.
139 if ($2 --version) > /dev/null 2>&1; then
140 $1=$2
141 AC_MSG_RESULT(found)
142 else
143 $1="$3/missing $2"
144 AC_MSG_RESULT(missing)
145 fi
146 AC_SUBST($1)])
147
148 # Add --enable-maintainer-mode option to configure.
149 # From Jim Meyering
150
151 # serial 1
152
153 AC_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
171 # Like AC_CONFIG_HEADER, but automatically create stamp file.
172
173 AC_DEFUN(AM_CONFIG_HEADER,
174 [AC_PREREQ([2.12])
175 AC_CONFIG_HEADER([$1])
176 dnl When config.status generates a header, we must update the stamp-h file.
177 dnl This file resides in the same directory as the config header
178 dnl that is generated. We must strip everything past the first ":",
179 dnl and everything past the last "/".
180 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
181 test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
182 changequote([,]))])
183
184
185 # serial 4 AM_PROG_LIBTOOL
186 AC_DEFUN(AM_PROG_LIBTOOL,
187 [AC_REQUIRE([AC_CANONICAL_HOST])
188 AC_REQUIRE([AC_PROG_CC])
189 AC_REQUIRE([AC_PROG_RANLIB])
190
191 # Always use our own libtool.
192 LIBTOOL='$(top_builddir)/libtool'
193 AC_SUBST(LIBTOOL)
194
195 dnl Allow the --disable-shared flag to stop us from building shared libs.
196 AC_ARG_ENABLE(shared,
197 [ --enable-shared build shared libraries [default=yes]],
198 test "$enableval" = no && libtool_shared=" --disable-shared",
199 libtool_shared=)
200
201 libtool_flags="$libtool_shared"
202 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
203 test "$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 ;;
217 esac]
218
219 # Actually configure libtool. ac_aux_dir is where install-sh is found.
220 CC="$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
226 dnl
227 dnl CY_AC_WITH_THREADS determines which thread library the user intends
228 dnl to put underneath guile. Pass it the path to find the guile top-level
229 dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
230 dnl
231
232 AC_DEFUN([CY_AC_WITH_THREADS],[
233 AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
234 AC_CACHE_VAL(cy_cv_threads_cflags,[
235 AC_CACHE_VAL(cy_cv_threads_libs,[
236 use_threads=no;
237 AC_ARG_WITH(threads,[ --with-threads thread interface],
238 use_threads=$withval, use_threads=no)
239 test -n "$use_threads" || use_threads=qt
240 threads_package=unknown
241 if test "$use_threads" != no; then
242 dnl
243 dnl Test for the qt threads package - used for cooperative threads
244 dnl This may not necessarily be built yet - so just check for the
245 dnl header files.
246 dnl
247 if test "$use_threads" = yes || test "$use_threads" = qt; then
248 # Look for qt in source directory. This is a hack: we look in
249 # "./qt" because this check might be run at the top level.
250 if test -f $srcdir/../qt/qt.c || test -f $srcdir/qt/qt.c; then
251 threads_package=COOP
252 cy_cv_threads_cflags="-I$srcdir/../qt -I../qt"
253 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
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"
260 cy_cv_threads_libs="../threads/libthreads.a ../qt/libqt.a"
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
277 dnl
278 dnl Test for the FSU threads package
279 dnl
280 CPPFLAGS="-I$use_threads/include"
281 LDFLAGS="-L$use_threads/lib"
282 LIBS="-lgthreads -lmalloc"
283 AC_TRY_LINK([#include <pthread.h>],[
284 pthread_equal(NULL,NULL);
285 ], threads_package=FSU)
286 fi
287 if test "$threads_package" = unknown; then
288 dnl
289 dnl Test for the MIT threads package
290 dnl
291 LIBS="-lpthread"
292 AC_TRY_LINK([#include <pthread.h>],[
293 pthread_equal(NULL,NULL);
294 ], threads_package=MIT)
295 fi
296 if test "$threads_package" = unknown; then
297 dnl
298 dnl Test for the PCthreads package
299 dnl
300 LIBS="-lpthreads"
301 AC_TRY_LINK([#include <pthread.h>],[
302 pthread_equal(NULL,NULL);
303 ], threads_package=PCthreads)
304 fi
305 dnl
306 dnl Set the appropriate flags!
307 dnl
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
317 fi
318 ])
319 ])
320 ],
321 dnl
322 dnl Set flags according to what is cached.
323 dnl
324 CPPFLAGS="$cy_cv_threads_cflags"
325 LIBS="$cy_cv_threads_libs"
326 )
327 ])
328