Updated
[bpt/guile.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl On the NeXT, #including <utime.h> doesn't give you a definition for
14 dnl struct utime, unless you #define _POSIX_SOURCE.
15
16 AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
17 AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
18 guile_cv_struct_utimbuf_needs_posix,
19 [AC_TRY_CPP([
20 #ifdef __EMX__
21 #include <sys/utime.h>
22 #else
23 #include <utime.h>
24 #endif
25 struct utime blah;
26 ],
27 guile_cv_struct_utimbuf_needs_posix=no,
28 guile_cv_struct_utimbuf_needs_posix=yes)])
29 if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
30 AC_DEFINE(UTIMBUF_NEEDS_POSIX)
31 fi])
32
33
34
35
36 dnl
37 dnl Apparently, at CMU they have a weird version of libc.h that is
38 dnl installed in /usr/local/include and conflicts with unistd.h.
39 dnl In these situations, we should not #include libc.h.
40 dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
41 dnl present on the system, and is safe to #include.
42 dnl
43 AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
44 [
45 AC_CHECK_HEADERS(libc.h unistd.h)
46 AC_CACHE_CHECK(
47 "whether libc.h and unistd.h can be included together",
48 guile_cv_header_libc_with_unistd,
49 [
50 if test "$ac_cv_header_libc_h" = "no"; then
51 guile_cv_header_libc_with_unistd="no"
52 elif test "$ac_cv_header_unistd.h" = "no"; then
53 guile_cv_header_libc_with_unistd="yes"
54 else
55 AC_TRY_COMPILE(
56 [
57 # include <libc.h>
58 # include <unistd.h>
59 ],
60 [],
61 [guile_cv_header_libc_with_unistd=yes],
62 [guile_cv_header_libc_with_unistd=no]
63 )
64 fi
65 ]
66 )
67 if test "$guile_cv_header_libc_with_unistd" = yes; then
68 AC_DEFINE(LIBC_H_WITH_UNISTD_H)
69 fi
70 ]
71 )
72
73
74
75 dnl This is needed when we want to check for the same function repeatedly
76 dnl with other parameters, such as libraries, varying.
77 dnl
78 dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
79 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
80 AC_DEFUN(GUILE_NAMED_CHECK_FUNC,
81 [AC_MSG_CHECKING([for $1])
82 AC_CACHE_VAL(ac_cv_func_$1_$2,
83 [AC_TRY_LINK(
84 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
85 dnl which includes <sys/select.h> which contains a prototype for
86 dnl select. Similarly for bzero.
87 [/* System header to define __stub macros and hopefully few prototypes,
88 which can conflict with char $1(); below. */
89 #include <assert.h>
90 /* Override any gcc2 internal prototype to avoid an error. */
91 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
92 extern "C"
93 #endif
94 ])dnl
95 [/* We use char because int might match the return type of a gcc2
96 builtin and then its argument prototype would still apply. */
97 char $1();
98 ], [
99 /* The GNU C library defines this for functions which it implements
100 to always fail with ENOSYS. Some functions are actually named
101 something starting with __ and the normal name is an alias. */
102 #if defined (__stub_$1) || defined (__stub___$1)
103 choke me
104 #else
105 $1();
106 #endif
107 ], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
108 if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
109 AC_MSG_RESULT(yes)
110 ifelse([$3], , :, [$3])
111 else
112 AC_MSG_RESULT(no)
113 ifelse([$4], , , [$4
114 ])dnl
115 fi
116 ])
117
118
119
120 dnl Check checks whether dlsym (if present) requires a leading underscore.
121 dnl Written by Dan Hagerty <hag@ai.mit.edu> for scsh-0.5.0.
122 AC_DEFUN(GUILE_DLSYM_USCORE, [
123 AC_MSG_CHECKING(for underscore before symbols)
124 AC_CACHE_VAL(guile_cv_uscore,[
125 echo "main(){int i=1;}
126 fnord(){int i=23; int ltuae=42;}" > conftest.c
127 ${CC} conftest.c > /dev/null
128 if (nm a.out | grep _fnord) > /dev/null; then
129 guile_cv_uscore=yes
130 else
131 guile_cv_uscore=no
132 fi])
133 AC_MSG_RESULT($guile_cv_uscore)
134 rm -f conftest.c a.out
135
136 if test $guile_cv_uscore = yes; then
137 AC_DEFINE(USCORE)
138
139 if test $ac_cv_func_dlopen = yes -o $ac_cv_lib_dl_dlopen = yes ; then
140 AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
141 AC_CACHE_VAL(guile_cv_dlsym_adds_uscore,AC_TRY_RUN( [
142 #include <dlfcn.h>
143 #include <stdio.h>
144 fnord() { int i=42;}
145 main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
146 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
147 if(ptr1 && !ptr2) exit(0); } exit(1); }
148 ], [guile_cv_dlsym_adds_uscore=yes
149 AC_DEFINE(DLSYM_ADDS_USCORE) ], guile_cv_dlsym_adds_uscore=no,
150 guile_cv_dlsym_adds_uscore=no))
151
152 AC_MSG_RESULT($guile_cv_dlsym_adds_uscore)
153 fi
154 fi
155 ])
156
157 # Do all the work for Automake. This macro actually does too much --
158 # some checks are only needed if your package does certain things.
159 # But this isn't really a big deal.
160
161 # serial 1
162
163 dnl Usage:
164 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
165
166 AC_DEFUN(AM_INIT_AUTOMAKE,
167 [AC_REQUIRE([AM_PROG_INSTALL])
168 PACKAGE=[$1]
169 AC_SUBST(PACKAGE)
170 VERSION=[$2]
171 AC_SUBST(VERSION)
172 dnl test to see if srcdir already configured
173 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
174 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
175 fi
176 ifelse([$3],,
177 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
178 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
179 AC_REQUIRE([AM_SANITY_CHECK])
180 AC_REQUIRE([AC_ARG_PROGRAM])
181 dnl FIXME This is truly gross.
182 missing_dir=`cd $ac_aux_dir && pwd`
183 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
184 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
185 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
186 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
187 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
188 AC_REQUIRE([AC_PROG_MAKE_SET])])
189
190
191 # serial 1
192
193 AC_DEFUN(AM_PROG_INSTALL,
194 [AC_REQUIRE([AC_PROG_INSTALL])
195 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
196 AC_SUBST(INSTALL_SCRIPT)dnl
197 ])
198
199 #
200 # Check to make sure that the build environment is sane.
201 #
202
203 AC_DEFUN(AM_SANITY_CHECK,
204 [AC_MSG_CHECKING([whether build environment is sane])
205 # Just in case
206 sleep 1
207 echo timestamp > conftestfile
208 # Do `set' in a subshell so we don't clobber the current shell's
209 # arguments. Must try -L first in case configure is actually a
210 # symlink; some systems play weird games with the mod time of symlinks
211 # (eg FreeBSD returns the mod time of the symlink's containing
212 # directory).
213 if (
214 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
215 if test "[$]*" = "X"; then
216 # -L didn't work.
217 set X `ls -t $srcdir/configure conftestfile`
218 fi
219 if test "[$]*" != "X $srcdir/configure conftestfile" \
220 && test "[$]*" != "X conftestfile $srcdir/configure"; then
221
222 # If neither matched, then we have a broken ls. This can happen
223 # if, for instance, CONFIG_SHELL is bash and it inherits a
224 # broken ls alias from the environment. This has actually
225 # happened. Such a system could not be considered "sane".
226 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
227 alias in your environment])
228 fi
229
230 test "[$]2" = conftestfile
231 )
232 then
233 # Ok.
234 :
235 else
236 AC_MSG_ERROR([newly created file is older than distributed files!
237 Check your system clock])
238 fi
239 rm -f conftest*
240 AC_MSG_RESULT(yes)])
241
242 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
243 dnl The program must properly implement --version.
244 AC_DEFUN(AM_MISSING_PROG,
245 [AC_MSG_CHECKING(for working $2)
246 # Run test in a subshell; some versions of sh will print an error if
247 # an executable is not found, even if stderr is redirected.
248 # Redirect stdin to placate older versions of autoconf. Sigh.
249 if ($2 --version) < /dev/null > /dev/null 2>&1; then
250 $1=$2
251 AC_MSG_RESULT(found)
252 else
253 $1="$3/missing $2"
254 AC_MSG_RESULT(missing)
255 fi
256 AC_SUBST($1)])
257
258 # Add --enable-maintainer-mode option to configure.
259 # From Jim Meyering
260
261 # serial 1
262
263 AC_DEFUN(AM_MAINTAINER_MODE,
264 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
265 dnl maintainer-mode is disabled by default
266 AC_ARG_ENABLE(maintainer-mode,
267 [ --enable-maintainer-mode enable make rules and dependencies not useful
268 (and sometimes confusing) to the casual installer],
269 USE_MAINTAINER_MODE=$enableval,
270 USE_MAINTAINER_MODE=no)
271 AC_MSG_RESULT($USE_MAINTAINER_MODE)
272 if test $USE_MAINTAINER_MODE = yes; then
273 MAINT=
274 else
275 MAINT='#M#'
276 fi
277 AC_SUBST(MAINT)dnl
278 ]
279 )
280
281 # Like AC_CONFIG_HEADER, but automatically create stamp file.
282
283 AC_DEFUN(AM_CONFIG_HEADER,
284 [AC_PREREQ([2.12])
285 AC_CONFIG_HEADER([$1])
286 dnl When config.status generates a header, we must update the stamp-h file.
287 dnl This file resides in the same directory as the config header
288 dnl that is generated. We must strip everything past the first ":",
289 dnl and everything past the last "/".
290 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
291 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
292 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
293 <<am_indx=1
294 for am_file in <<$1>>; do
295 case " <<$>>CONFIG_HEADERS " in
296 *" <<$>>am_file "*<<)>>
297 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
298 ;;
299 esac
300 am_indx=`expr "<<$>>am_indx" + 1`
301 done<<>>dnl>>)
302 changequote([,]))])
303
304
305 # serial 24 AM_PROG_LIBTOOL
306 AC_DEFUN(AM_PROG_LIBTOOL,
307 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
308 AC_REQUIRE([AM_ENABLE_STATIC])dnl
309 AC_REQUIRE([AC_CANONICAL_HOST])dnl
310 AC_REQUIRE([AC_PROG_RANLIB])dnl
311 AC_REQUIRE([AC_PROG_CC])dnl
312 AC_REQUIRE([AM_PROG_LD])dnl
313 AC_REQUIRE([AM_PROG_NM])dnl
314 AC_REQUIRE([AC_PROG_LN_S])dnl
315 dnl
316 # Always use our own libtool.
317 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
318 AC_SUBST(LIBTOOL)dnl
319
320 # Check for any special flags to pass to ltconfig.
321 libtool_flags=
322 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
323 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
324 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
325 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
326 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
327
328 # Some flags need to be propagated to the compiler or linker for good
329 # libtool support.
330 case "$host" in
331 *-*-irix6*)
332 # Find out which ABI we are using.
333 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
334 if AC_TRY_EVAL(ac_compile); then
335 case "`/usr/bin/file conftest.o`" in
336 *32-bit*)
337 LD="${LD-ld} -32"
338 ;;
339 *N32*)
340 LD="${LD-ld} -n32"
341 ;;
342 *64-bit*)
343 LD="${LD-ld} -64"
344 ;;
345 esac
346 fi
347 rm -rf conftest*
348 ;;
349
350 *-*-sco3.2v5*)
351 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
352 CFLAGS="$CFLAGS -belf"
353 ;;
354 esac
355
356 # Actually configure libtool. ac_aux_dir is where install-sh is found.
357 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
358 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
359 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
360 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
361 || AC_MSG_ERROR([libtool configure failed])
362 ])
363
364 # AM_ENABLE_SHARED - implement the --enable-shared flag
365 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
366 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
367 # `yes'.
368 AC_DEFUN(AM_ENABLE_SHARED,
369 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
370 AC_ARG_ENABLE(shared,
371 changequote(<<, >>)dnl
372 << --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
373 changequote([, ])dnl
374 [ --enable-shared=PKGS only build shared libraries if the current package
375 appears as an element in the PKGS list],
376 [p=${PACKAGE-default}
377 case "$enableval" in
378 yes) enable_shared=yes ;;
379 no) enable_shared=no ;;
380 *)
381 enable_shared=no
382 # Look at the argument we got. We use all the common list separators.
383 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
384 for pkg in $enableval; do
385 if test "X$pkg" = "X$p"; then
386 enable_shared=yes
387 fi
388 done
389 IFS="$ac_save_ifs"
390 ;;
391 esac],
392 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
393 ])
394
395 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
396 AC_DEFUN(AM_DISABLE_SHARED,
397 [AM_ENABLE_SHARED(no)])
398
399 # AM_DISABLE_STATIC - set the default static flag to --disable-static
400 AC_DEFUN(AM_DISABLE_STATIC,
401 [AM_ENABLE_STATIC(no)])
402
403 # AM_ENABLE_STATIC - implement the --enable-static flag
404 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
405 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
406 # `yes'.
407 AC_DEFUN(AM_ENABLE_STATIC,
408 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
409 AC_ARG_ENABLE(static,
410 changequote(<<, >>)dnl
411 << --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
412 changequote([, ])dnl
413 [ --enable-static=PKGS only build shared libraries if the current package
414 appears as an element in the PKGS list],
415 [p=${PACKAGE-default}
416 case "$enableval" in
417 yes) enable_static=yes ;;
418 no) enable_static=no ;;
419 *)
420 enable_static=no
421 # Look at the argument we got. We use all the common list separators.
422 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
423 for pkg in $enableval; do
424 if test "X$pkg" = "X$p"; then
425 enable_static=yes
426 fi
427 done
428 IFS="$ac_save_ifs"
429 ;;
430 esac],
431 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
432 ])
433
434
435 # AM_PROG_LD - find the path to the GNU or non-GNU linker
436 AC_DEFUN(AM_PROG_LD,
437 [AC_ARG_WITH(gnu-ld,
438 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
439 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
440 AC_REQUIRE([AC_PROG_CC])
441 ac_prog=ld
442 if test "$ac_cv_prog_gcc" = yes; then
443 # Check if gcc -print-prog-name=ld gives a path.
444 AC_MSG_CHECKING([for ld used by GCC])
445 ac_prog=`($CC -print-prog-name=ld) 2>&5`
446 case "$ac_prog" in
447 # Accept absolute paths.
448 /* | [A-Za-z]:\\*)
449 test -z "$LD" && LD="$ac_prog"
450 ;;
451 "")
452 # If it fails, then pretend we aren't using GCC.
453 ac_prog=ld
454 ;;
455 *)
456 # If it is relative, then search for the first ld in PATH.
457 with_gnu_ld=unknown
458 ;;
459 esac
460 elif test "$with_gnu_ld" = yes; then
461 AC_MSG_CHECKING([for GNU ld])
462 else
463 AC_MSG_CHECKING([for non-GNU ld])
464 fi
465 AC_CACHE_VAL(ac_cv_path_LD,
466 [if test -z "$LD"; then
467 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
468 for ac_dir in $PATH; do
469 test -z "$ac_dir" && ac_dir=.
470 if test -f "$ac_dir/$ac_prog"; then
471 ac_cv_path_LD="$ac_dir/$ac_prog"
472 # Check to see if the program is GNU ld. I'd rather use --version,
473 # but apparently some GNU ld's only accept -v.
474 # Break only if it was the GNU/non-GNU ld that we prefer.
475 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
476 test "$with_gnu_ld" != no && break
477 else
478 test "$with_gnu_ld" != yes && break
479 fi
480 fi
481 done
482 IFS="$ac_save_ifs"
483 else
484 ac_cv_path_LD="$LD" # Let the user override the test with a path.
485 fi])
486 LD="$ac_cv_path_LD"
487 if test -n "$LD"; then
488 AC_MSG_RESULT($LD)
489 else
490 AC_MSG_RESULT(no)
491 fi
492 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
493 AC_SUBST(LD)
494 AM_PROG_LD_GNU
495 ])
496
497 AC_DEFUN(AM_PROG_LD_GNU,
498 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
499 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
500 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
501 ac_cv_prog_gnu_ld=yes
502 else
503 ac_cv_prog_gnu_ld=no
504 fi])
505 ])
506
507 # AM_PROG_NM - find the path to a BSD-compatible name lister
508 AC_DEFUN(AM_PROG_NM,
509 [AC_MSG_CHECKING([for BSD-compatible nm])
510 AC_CACHE_VAL(ac_cv_path_NM,
511 [case "$NM" in
512 /* | [A-Za-z]:\\*)
513 ac_cv_path_NM="$NM" # Let the user override the test with a path.
514 ;;
515 *)
516 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
517 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
518 test -z "$ac_dir" && ac_dir=.
519 if test -f $ac_dir/nm; then
520 # Check to see if the nm accepts a BSD-compat flag.
521 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
522 # nm: unknown option "B" ignored
523 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
524 ac_cv_path_NM="$ac_dir/nm -B"
525 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
526 ac_cv_path_NM="$ac_dir/nm -p"
527 else
528 ac_cv_path_NM="$ac_dir/nm"
529 fi
530 break
531 fi
532 done
533 IFS="$ac_save_ifs"
534 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
535 ;;
536 esac])
537 NM="$ac_cv_path_NM"
538 AC_MSG_RESULT([$NM])
539 AC_SUBST(NM)
540 ])
541
542 dnl
543 dnl CY_AC_WITH_THREADS determines which thread library the user intends
544 dnl to put underneath guile. Pass it the path to find the guile top-level
545 dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
546 dnl
547
548 AC_DEFUN([CY_AC_WITH_THREADS],[
549 AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
550 AC_CACHE_VAL(cy_cv_threads_cflags,[
551 AC_CACHE_VAL(cy_cv_threads_libs,[
552 use_threads=no;
553 AC_ARG_WITH(threads,[ --with-threads thread interface],
554 use_threads=$withval, use_threads=no)
555 test -n "$use_threads" || use_threads=qt
556 threads_package=unknown
557 if test "$use_threads" != no; then
558 dnl
559 dnl Test for the qt threads package - used for cooperative threads
560 dnl This may not necessarily be built yet - so just check for the
561 dnl header files.
562 dnl
563 if test "$use_threads" = yes || test "$use_threads" = qt; then
564 # Look for qt in source directory.
565 if test -f $srcdir/qt/qt.c; then
566 qtsrcdir="`(cd $srcdir; pwd)`/qt"
567 threads_package=COOP
568 cy_cv_threads_cflags="-I$qtsrcdir -I../qt"
569 cy_cv_threads_libs="../qt/libqthreads.a"
570 fi
571 else
572 if test -f $use_threads/qt.c; then
573 # FIXME seems as though we should try to use an installed qt here.
574 threads_package=COOP
575 cy_cv_threads_cflags="-I$use_threads -I../qt"
576 cy_cv_threads_libs="../qt/libqthreads.a"
577 fi
578 fi
579 if test "$use_threads" = pthreads; then
580 # Look for pthreads in srcdir. See above to understand why
581 # we always set threads_package.
582 if test -f $srcdir/../../pthreads/pthreads/queue.c \
583 || test -f $srcdir/../pthreads/pthreads/queue.c; then
584 threads_package=MIT
585 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
586 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
587 fi
588 fi
589 saved_CPP="$CPPFLAGS"
590 saved_LD="$LDFLAGS"
591 saved_LIBS="$LIBS"
592 if test "$threads_package" = unknown; then
593 dnl
594 dnl Test for the FSU threads package
595 dnl
596 CPPFLAGS="-I$use_threads/include"
597 LDFLAGS="-L$use_threads/lib"
598 LIBS="-lgthreads -lmalloc"
599 AC_TRY_LINK([#include <pthread.h>],[
600 pthread_equal(NULL,NULL);
601 ], threads_package=FSU)
602 fi
603 if test "$threads_package" = unknown; then
604 dnl
605 dnl Test for the MIT threads package
606 dnl
607 LIBS="-lpthread"
608 AC_TRY_LINK([#include <pthread.h>],[
609 pthread_equal(NULL,NULL);
610 ], threads_package=MIT)
611 fi
612 if test "$threads_package" = unknown; then
613 dnl
614 dnl Test for the PCthreads package
615 dnl
616 LIBS="-lpthreads"
617 AC_TRY_LINK([#include <pthread.h>],[
618 pthread_equal(NULL,NULL);
619 ], threads_package=PCthreads)
620 fi
621 dnl
622 dnl Set the appropriate flags!
623 dnl
624 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
625 cy_cv_threads_package=$threads_package
626 CPPFLAGS="$saved_CPP"
627 LDFLAGS="$saved_LD"
628 LIBS="$saved_LIBS"
629 if test "$threads_package" = unknown; then
630 AC_MSG_ERROR("cannot find thread library installation")
631 fi
632 fi
633 ])
634 ])
635 ],
636 dnl
637 dnl Set flags according to what is cached.
638 dnl
639 CPPFLAGS="$cy_cv_threads_cflags"
640 LIBS="$cy_cv_threads_libs"
641 )
642 ])
643