* semantics.c (finish_handler): End the scope of the handler
[official-gcc.git] / boehm-gc / aclocal.m4
blob6a4111921a2b32f6cf22561f94d975519a523270
1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file 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.
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.
13 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
14 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
15 # are probably using a cross compiler, which will not be able to fully
16 # link an executable.  This should really be fixed in autoconf
17 # itself.
19 AC_DEFUN(BOEHM_CONFIGURE,
21 dnl Default to --enable-multilib
22 AC_ARG_ENABLE(multilib,
23 [  --enable-multilib       build many library versions (default)],
24 [case "${enableval}" in
25   yes) multilib=yes ;;
26   no)  multilib=no ;;
27   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
28  esac], [multilib=yes])dnl
30 dnl We may get other options which we don't document:
31 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
33 if test "[$]{srcdir}" = "."; then
34   if test "[$]{with_target_subdir}" != "."; then
35     boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
36   else
37     boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
38   fi
39 else
40   boehm_gc_basedir="[$]{srcdir}/$1"
42 AC_SUBST(boehm_gc_basedir)
44 AC_CANONICAL_HOST
46 AM_INIT_AUTOMAKE(boehm-gc, 4.13a2, no-define)
48 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
49 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
50 # are probably using a cross compiler, which will not be able to fully
51 # link an executable.  This should really be fixed in autoconf
52 # itself.
54 AC_DEFUN(LIB_AC_PROG_CC,
55 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
56 dnl Fool anybody using AC_PROG_CC.
57 AC_PROVIDE([AC_PROG_CC])
58 AC_CHECK_PROG(CC, gcc, gcc)
59 if test -z "$CC"; then
60   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
61   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
64 AC_PROG_CC_GNU
66 if test $ac_cv_prog_gcc = yes; then
67   GCC=yes
68 dnl Check whether -g works, even if CFLAGS is set, in case the package
69 dnl plays around with CFLAGS (such as to build both debugging and
70 dnl normal versions of a library), tasteless as that idea is.
71   ac_test_CFLAGS="${CFLAGS+set}"
72   ac_save_CFLAGS="$CFLAGS"
73   CFLAGS=
74   AC_PROG_CC_G
75   if test "$ac_test_CFLAGS" = set; then
76     CFLAGS="$ac_save_CFLAGS"
77   elif test $ac_cv_prog_cc_g = yes; then
78     CFLAGS="-g -O2"
79   else
80     CFLAGS="-O2"
81   fi
82 else
83   GCC=
84   test "${CFLAGS+set}" = set || CFLAGS="-g"
88 LIB_AC_PROG_CC
90 # Likewise for AC_PROG_CXX.
91 AC_DEFUN(LIB_AC_PROG_CXX,
92 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
93 dnl Fool anybody using AC_PROG_CXX.
94 AC_PROVIDE([AC_PROG_CXX])
95 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
96 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
98 AC_PROG_CXX_GNU
100 if test $ac_cv_prog_gxx = yes; then
101   GXX=yes
102 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
103 dnl plays around with CXXFLAGS (such as to build both debugging and
104 dnl normal versions of a library), tasteless as that idea is.
105   ac_test_CXXFLAGS="${CXXFLAGS+set}"
106   ac_save_CXXFLAGS="$CXXFLAGS"
107   CXXFLAGS=
108   AC_PROG_CXX_G
109   if test "$ac_test_CXXFLAGS" = set; then
110     CXXFLAGS="$ac_save_CXXFLAGS"
111   elif test $ac_cv_prog_cxx_g = yes; then
112     CXXFLAGS="-g -O2"
113   else
114     CXXFLAGS="-O2"
115   fi
116 else
117   GXX=
118   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
122 LIB_AC_PROG_CXX
124 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
125 # run it explicitly here, it will be run implicitly before
126 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
127 # be run before AC_CANONICAL_HOST.
128 AC_CANONICAL_BUILD
130 AC_CHECK_TOOL(AS, as)
131 AC_CHECK_TOOL(AR, ar)
132 AC_CHECK_TOOL(RANLIB, ranlib, :)
134 AC_PROG_INSTALL
136 AM_MAINTAINER_MODE
138 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
139 # at least currently, we never actually build a program, so we never
140 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
141 # fails, because we are probably configuring with a cross compiler
142 # which can't create executables.  So we include AC_EXEEXT to keep
143 # automake happy, but we don't execute it, since we don't care about
144 # the result.
145 if false; then
146   AC_EXEEXT
149 . [$]{boehm_gc_basedir}/configure.host
151 case [$]{boehm_gc_basedir} in
152 /* | [A-Za-z]:[/\\]*) boehm_gc_flagbasedir=[$]{boehm_gc_basedir} ;;
153 *) boehm_gc_flagbasedir='[$](top_builddir)/'[$]{boehm_gc_basedir} ;;
154 esac
156 boehm_gc_cflags="[$]{boehm_gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{boehm_gc_flagbasedir}/libc/include"
157 case "${host}" in
158   *-*-cygwin32*)
159     boehm_gc_cflags="[$]{boehm_gc_cflags} -I[$]{boehm_gc_flagbasedir}/../winsup/include"
160     ;;
161 esac
163 boehm_gc_cflags="[$]{boehm_gc_cflags} -fno-builtin"
165 BOEHM_GC_CFLAGS=${boehm_gc_cflags}
166 AC_SUBST(BOEHM_GC_CFLAGS)
169 ))))
171 # Do all the work for Automake.  This macro actually does too much --
172 # some checks are only needed if your package does certain things.
173 # But this isn't really a big deal.
175 # serial 1
177 dnl Usage:
178 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
180 AC_DEFUN(AM_INIT_AUTOMAKE,
181 [AC_REQUIRE([AC_PROG_INSTALL])
182 PACKAGE=[$1]
183 AC_SUBST(PACKAGE)
184 VERSION=[$2]
185 AC_SUBST(VERSION)
186 dnl test to see if srcdir already configured
187 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
188   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
190 ifelse([$3],,
191 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
192 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
193 AC_REQUIRE([AM_SANITY_CHECK])
194 AC_REQUIRE([AC_ARG_PROGRAM])
195 dnl FIXME This is truly gross.
196 missing_dir=`cd $ac_aux_dir && pwd`
197 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
198 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
199 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
200 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
201 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
202 AC_REQUIRE([AC_PROG_MAKE_SET])])
205 # Check to make sure that the build environment is sane.
208 AC_DEFUN(AM_SANITY_CHECK,
209 [AC_MSG_CHECKING([whether build environment is sane])
210 # Just in case
211 sleep 1
212 echo timestamp > conftestfile
213 # Do `set' in a subshell so we don't clobber the current shell's
214 # arguments.  Must try -L first in case configure is actually a
215 # symlink; some systems play weird games with the mod time of symlinks
216 # (eg FreeBSD returns the mod time of the symlink's containing
217 # directory).
218 if (
219    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
220    if test "[$]*" = "X"; then
221       # -L didn't work.
222       set X `ls -t $srcdir/configure conftestfile`
223    fi
224    if test "[$]*" != "X $srcdir/configure conftestfile" \
225       && test "[$]*" != "X conftestfile $srcdir/configure"; then
227       # If neither matched, then we have a broken ls.  This can happen
228       # if, for instance, CONFIG_SHELL is bash and it inherits a
229       # broken ls alias from the environment.  This has actually
230       # happened.  Such a system could not be considered "sane".
231       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
232 alias in your environment])
233    fi
235    test "[$]2" = conftestfile
236    )
237 then
238    # Ok.
239    :
240 else
241    AC_MSG_ERROR([newly created file is older than distributed files!
242 Check your system clock])
244 rm -f conftest*
245 AC_MSG_RESULT(yes)])
247 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
248 dnl The program must properly implement --version.
249 AC_DEFUN(AM_MISSING_PROG,
250 [AC_MSG_CHECKING(for working $2)
251 # Run test in a subshell; some versions of sh will print an error if
252 # an executable is not found, even if stderr is redirected.
253 # Redirect stdin to placate older versions of autoconf.  Sigh.
254 if ($2 --version) < /dev/null > /dev/null 2>&1; then
255    $1=$2
256    AC_MSG_RESULT(found)
257 else
258    $1="$3/missing $2"
259    AC_MSG_RESULT(missing)
261 AC_SUBST($1)])
263 # Add --enable-maintainer-mode option to configure.
264 # From Jim Meyering
266 # serial 1
268 AC_DEFUN(AM_MAINTAINER_MODE,
269 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
270   dnl maintainer-mode is disabled by default
271   AC_ARG_ENABLE(maintainer-mode,
272 [  --enable-maintainer-mode enable make rules and dependencies not useful
273                           (and sometimes confusing) to the casual installer],
274       USE_MAINTAINER_MODE=$enableval,
275       USE_MAINTAINER_MODE=no)
276   AC_MSG_RESULT($USE_MAINTAINER_MODE)
277   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
278   MAINT=$MAINTAINER_MODE_TRUE
279   AC_SUBST(MAINT)dnl
283 # Define a conditional.
285 AC_DEFUN(AM_CONDITIONAL,
286 [AC_SUBST($1_TRUE)
287 AC_SUBST($1_FALSE)
288 if $2; then
289   $1_TRUE=
290   $1_FALSE='#'
291 else
292   $1_TRUE='#'
293   $1_FALSE=
294 fi])
297 # serial 35 AC_PROG_LIBTOOL
298 AC_DEFUN(AC_PROG_LIBTOOL,
299 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
301 # Save cache, so that ltconfig can load it
302 AC_CACHE_SAVE
304 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
305 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
306 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
307 DLLTOOL="$DLLTOOL" AS="$AS" \
308 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
309 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
310 || AC_MSG_ERROR([libtool configure failed])
312 # Reload cache, that may have been modified by ltconfig
313 AC_CACHE_LOAD
315 # This can be used to rebuild libtool when needed
316 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
318 # Always use our own libtool.
319 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
320 AC_SUBST(LIBTOOL)dnl
322 # Redirect the config.log output again, so that the ltconfig log is not
323 # clobbered by the next message.
324 exec 5>>./config.log
327 AC_DEFUN(AC_LIBTOOL_SETUP,
328 [AC_PREREQ(2.13)dnl
329 AC_REQUIRE([AC_ENABLE_SHARED])dnl
330 AC_REQUIRE([AC_ENABLE_STATIC])dnl
331 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
332 AC_REQUIRE([AC_CANONICAL_HOST])dnl
333 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
334 AC_REQUIRE([AC_PROG_RANLIB])dnl
335 AC_REQUIRE([AC_PROG_CC])dnl
336 AC_REQUIRE([AC_PROG_LD])dnl
337 AC_REQUIRE([AC_PROG_NM])dnl
338 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
339 AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
340 AC_REQUIRE([AC_PROG_LN_S])dnl
343 # Check for any special flags to pass to ltconfig.
344 libtool_flags="--cache-file=$cache_file"
345 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
346 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
347 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
348 test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
349 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
350 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
351 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
353 # Some flags need to be propagated to the compiler or linker for good
354 # libtool support.
355 case "$host" in
356 *-*-irix6*)
357   # Find out which ABI we are using.
358   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
359   if AC_TRY_EVAL(ac_compile); then
360     case "`/usr/bin/file conftest.o`" in
361     *32-bit*)
362       LD="${LD-ld} -32"
363       ;;
364     *N32*)
365       LD="${LD-ld} -n32"
366       ;;
367     *64-bit*)
368       LD="${LD-ld} -64"
369       ;;
370     esac
371   fi
372   rm -rf conftest*
373   ;;
375 *-*-sco3.2v5*)
376   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
377   SAVE_CFLAGS="$CFLAGS"
378   CFLAGS="$CFLAGS -belf"
379   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
380     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
381   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
382     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
383     CFLAGS="$SAVE_CFLAGS"
384   fi
385   ;;
387 *-*-cygwin*)
388   AC_SYS_LIBTOOL_CYGWIN
389   ;;
391 esac
393 # enable the --disable-libtool-lock switch
395 AC_ARG_ENABLE(libtool-lock,
396 [  --disable-libtool-lock  force libtool not to do file locking],
397 need_locks=$enableval,
398 need_locks=yes)
400 if test x"$need_locks" = xno; then
401   libtool_flags="$libtool_flags --disable-lock"
405 # AC_LIBTOOL_DLOPEN - check for dlopen support
406 AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
408 # AC_ENABLE_SHARED - implement the --enable-shared flag
409 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
410 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
411 #   `yes'.
412 AC_DEFUN(AC_ENABLE_SHARED,
413 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
414 AC_ARG_ENABLE(shared,
415 changequote(<<, >>)dnl
416 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
417 changequote([, ])dnl
418 [p=${PACKAGE-default}
419 case "$enableval" in
420 yes) enable_shared=yes ;;
421 no) enable_shared=no ;;
423   enable_shared=no
424   # Look at the argument we got.  We use all the common list separators.
425   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
426   for pkg in $enableval; do
427     if test "X$pkg" = "X$p"; then
428       enable_shared=yes
429     fi
430   done
431   IFS="$ac_save_ifs"
432   ;;
433 esac],
434 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
437 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
438 AC_DEFUN(AC_DISABLE_SHARED,
439 [AC_ENABLE_SHARED(no)])
441 # AC_ENABLE_STATIC - implement the --enable-static flag
442 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
443 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
444 #   `yes'.
445 AC_DEFUN(AC_ENABLE_STATIC,
446 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
447 AC_ARG_ENABLE(static,
448 changequote(<<, >>)dnl
449 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
450 changequote([, ])dnl
451 [p=${PACKAGE-default}
452 case "$enableval" in
453 yes) enable_static=yes ;;
454 no) enable_static=no ;;
456   enable_static=no
457   # Look at the argument we got.  We use all the common list separators.
458   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
459   for pkg in $enableval; do
460     if test "X$pkg" = "X$p"; then
461       enable_static=yes
462     fi
463   done
464   IFS="$ac_save_ifs"
465   ;;
466 esac],
467 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
470 # AC_DISABLE_STATIC - set the default static flag to --disable-static
471 AC_DEFUN(AC_DISABLE_STATIC,
472 [AC_ENABLE_STATIC(no)])
475 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
476 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
477 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
478 #   `yes'.
479 AC_DEFUN(AC_ENABLE_FAST_INSTALL,
480 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
481 AC_ARG_ENABLE(fast-install,
482 changequote(<<, >>)dnl
483 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
484 changequote([, ])dnl
485 [p=${PACKAGE-default}
486 case "$enableval" in
487 yes) enable_fast_install=yes ;;
488 no) enable_fast_install=no ;;
490   enable_fast_install=no
491   # Look at the argument we got.  We use all the common list separators.
492   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
493   for pkg in $enableval; do
494     if test "X$pkg" = "X$p"; then
495       enable_fast_install=yes
496     fi
497   done
498   IFS="$ac_save_ifs"
499   ;;
500 esac],
501 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
504 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
505 AC_DEFUN(AC_DISABLE_FAST_INSTALL,
506 [AC_ENABLE_FAST_INSTALL(no)])
509 # AC_PROG_LD - find the path to the GNU or non-GNU linker
510 AC_DEFUN(AC_PROG_LD,
511 [AC_ARG_WITH(gnu-ld,
512 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
513 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
514 AC_REQUIRE([AC_PROG_CC])dnl
515 AC_REQUIRE([AC_CANONICAL_HOST])dnl
516 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
517 ac_prog=ld
518 if test "$ac_cv_prog_gcc" = yes; then
519   # Check if gcc -print-prog-name=ld gives a path.
520   AC_MSG_CHECKING([for ld used by GCC])
521   ac_prog=`($CC -print-prog-name=ld) 2>&5`
522   case "$ac_prog" in
523     # Accept absolute paths.
524 changequote(,)dnl
525     /* | [A-Za-z]:[\\/]*)
526       re_direlt='/[^/][^/]*/\.\./'
527 changequote([,])dnl
528       # Canonicalize the path of ld
529       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
530       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
531         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
532       done
533       test -z "$LD" && LD="$ac_prog"
534       ;;
535   "")
536     # If it fails, then pretend we aren't using GCC.
537     ac_prog=ld
538     ;;
539   *)
540     # If it is relative, then search for the first ld in PATH.
541     with_gnu_ld=unknown
542     ;;
543   esac
544 elif test "$with_gnu_ld" = yes; then
545   AC_MSG_CHECKING([for GNU ld])
546 else
547   AC_MSG_CHECKING([for non-GNU ld])
549 AC_CACHE_VAL(ac_cv_path_LD,
550 [if test -z "$LD"; then
551   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
552   for ac_dir in $PATH; do
553     test -z "$ac_dir" && ac_dir=.
554     if test -f "$ac_dir/$ac_prog"; then
555       ac_cv_path_LD="$ac_dir/$ac_prog"
556       # Check to see if the program is GNU ld.  I'd rather use --version,
557       # but apparently some GNU ld's only accept -v.
558       # Break only if it was the GNU/non-GNU ld that we prefer.
559       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
560         test "$with_gnu_ld" != no && break
561       else
562         test "$with_gnu_ld" != yes && break
563       fi
564     fi
565   done
566   IFS="$ac_save_ifs"
567 else
568   ac_cv_path_LD="$LD" # Let the user override the test with a path.
569 fi])
570 LD="$ac_cv_path_LD"
571 if test -n "$LD"; then
572   AC_MSG_RESULT($LD)
573 else
574   AC_MSG_RESULT(no)
576 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
577 AC_SUBST(LD)
578 AC_PROG_LD_GNU
581 AC_DEFUN(AC_PROG_LD_GNU,
582 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
583 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
584 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
585   ac_cv_prog_gnu_ld=yes
586 else
587   ac_cv_prog_gnu_ld=no
588 fi])
591 # AC_PROG_NM - find the path to a BSD-compatible name lister
592 AC_DEFUN(AC_PROG_NM,
593 [AC_MSG_CHECKING([for BSD-compatible nm])
594 AC_CACHE_VAL(ac_cv_path_NM,
595 [if test -n "$NM"; then
596   # Let the user override the test.
597   ac_cv_path_NM="$NM"
598 else
599   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
600   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
601     test -z "$ac_dir" && ac_dir=.
602     if test -f $ac_dir/nm; then
603       # Check to see if the nm accepts a BSD-compat flag.
604       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
605       #   nm: unknown option "B" ignored
606       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
607         ac_cv_path_NM="$ac_dir/nm -B"
608         break
609       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
610         ac_cv_path_NM="$ac_dir/nm -p"
611         break
612       else
613         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
614         continue # so that we can try to find one that supports BSD flags
615       fi
616     fi
617   done
618   IFS="$ac_save_ifs"
619   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
620 fi])
621 NM="$ac_cv_path_NM"
622 AC_MSG_RESULT([$NM])
623 AC_SUBST(NM)
626 # AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
627 # by C symbol name from nm.
628 AC_DEFUN(AC_SYS_NM_PARSE,
629 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
630 AC_REQUIRE([AC_PROG_NM])dnl
631 # Check for command to grab the raw symbol name followed by C symbol from nm.
632 AC_MSG_CHECKING([command to parse $NM output])
633 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
634 [# These are sane defaults that work on at least a few old systems.
635 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
637 changequote(,)dnl
638 # Character class describing NM global symbol codes.
639 ac_symcode='[BCDEGRST]'
641 # Regexp to match symbols that can be accessed directly from C.
642 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
644 # Transform the above into a raw symbol and a C symbol.
645 ac_symxfrm='\1 \2\3 \3'
647 # Transform an extracted symbol line into a proper C declaration
648 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
650 # Define system-specific variables.
651 case "$host_os" in
652 aix*)
653   ac_symcode='[BCDT]'
654   ;;
655 cygwin* | mingw*)
656   ac_symcode='[ABCDGISTW]'
657   ;;
658 hpux*)
659   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
660   ;;
661 irix*)
662   ac_symcode='[BCDEGRST]'
663   ;;
664 solaris*)
665   ac_symcode='[BDT]'
666   ;;
667 esac
669 # If we're using GNU nm, then use its standard symbol codes.
670 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
671   ac_symcode='[ABCDGISTW]'
673 changequote([,])dnl
675 # Try without a prefix undercore, then with it.
676 for ac_symprfx in "" "_"; do
678   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[       ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
680   # Check to see that the pipe works correctly.
681   ac_pipe_works=no
682   rm -f conftest.$ac_ext
683   cat > conftest.$ac_ext <<EOF
684 #ifdef __cplusplus
685 extern "C" {
686 #endif
687 char nm_test_var;
688 void nm_test_func(){}
689 #ifdef __cplusplus
691 #endif
692 int main(){nm_test_var='a';nm_test_func;return 0;}
695   if AC_TRY_EVAL(ac_compile); then
696     # Now try to grab the symbols.
697     ac_nlist=conftest.nm
698   
699     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
701       # Try sorting and uniquifying the output.
702       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
703         mv -f "$ac_nlist"T "$ac_nlist"
704       else
705         rm -f "$ac_nlist"T
706       fi
708       # Make sure that we snagged all the symbols we need.
709       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
710         if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
711           cat <<EOF > conftest.c
712 #ifdef __cplusplus
713 extern "C" {
714 #endif
717           # Now generate the symbol file.
718           eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
720           cat <<EOF >> conftest.c
721 #if defined (__STDC__) && __STDC__
722 # define lt_ptr_t void *
723 #else
724 # define lt_ptr_t char *
725 # define const
726 #endif
728 /* The mapping between symbol names and symbols. */
729 const struct {
730   const char *name;
731   lt_ptr_t address;
733 changequote(,)dnl
734 lt_preloaded_symbols[] =
735 changequote([,])dnl
738         sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
739         cat <<\EOF >> conftest.c
740   {0, (lt_ptr_t) 0}
743 #ifdef __cplusplus
745 #endif
747           # Now try linking the two files.
748           mv conftest.$ac_objext conftestm.$ac_objext
749           ac_save_LIBS="$LIBS"
750           ac_save_CFLAGS="$CFLAGS"
751           LIBS="conftestm.$ac_objext"
752           CFLAGS="$CFLAGS$no_builtin_flag"
753           if AC_TRY_EVAL(ac_link) && test -s conftest; then
754             ac_pipe_works=yes
755           else
756             echo "configure: failed program was:" >&AC_FD_CC
757             cat conftest.c >&AC_FD_CC
758           fi
759           LIBS="$ac_save_LIBS"
760           CFLAGS="$ac_save_CFLAGS"
761         else
762           echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
763         fi
764       else
765         echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
766       fi
767     else
768       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
769     fi
770   else
771     echo "$progname: failed program was:" >&AC_FD_CC
772     cat conftest.c >&AC_FD_CC
773   fi
774   rm -rf conftest*
776   # Do not use the global_symbol_pipe unless it works.
777   if test "$ac_pipe_works" = yes; then
778     if test x"$ac_symprfx" = x"_"; then
779       ac_cv_sys_symbol_underscore=yes
780     else
781       ac_cv_sys_symbol_underscore=no
782     fi
783     break
784   else
785     ac_cv_sys_global_symbol_pipe=
786   fi
787 done
790 ac_result=yes
791 if test -z "$ac_cv_sys_global_symbol_pipe"; then
792    ac_result=no
794 AC_MSG_RESULT($ac_result)
797 # AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
798 AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
799 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
800 AC_CHECK_TOOL(AS, as, false)
803 # AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
804 #                            with an underscore?
805 AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
806 [AC_REQUIRE([AC_PROG_NM])dnl
807 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
808 AC_MSG_CHECKING([for _ prefix in compiled symbols])
809 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
810 [ac_cv_sys_symbol_underscore=no
811 cat > conftest.$ac_ext <<EOF
812 void nm_test_func(){}
813 int main(){nm_test_func;return 0;}
815 if AC_TRY_EVAL(ac_compile); then
816   # Now try to grab the symbols.
817   ac_nlist=conftest.nm
818   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
819     # See whether the symbols have a leading underscore.
820     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
821       ac_cv_sys_symbol_underscore=yes
822     else
823       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
824         :
825       else
826         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
827       fi
828     fi
829   else
830     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
831   fi
832 else
833   echo "configure: failed program was:" >&AC_FD_CC
834   cat conftest.c >&AC_FD_CC
836 rm -rf conftest*
838 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
839 USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
840 AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
843 # AC_CHECK_LIBM - check for math library
844 AC_DEFUN(AC_CHECK_LIBM, [
845 AC_CHECK_LIB(mw, _mwvalidcheckl)
846 AC_CHECK_LIB(m, cos)
849 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
850 # the libltdl convenience library, adds --enable-ltdl-convenience to
851 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
852 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
853 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
854 # '${top_builddir}/' (note the single quotes!) if your package is not
855 # flat, and, if you're not using automake, define top_builddir as
856 # appropriate in the Makefiles.
857 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
858   case "$enable_ltdl_convenience" in
859   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
860   "") enable_ltdl_convenience=yes
861       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
862   esac
863   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
866 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
867 # the libltdl installable library, and adds --enable-ltdl-install to
868 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
869 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
870 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
871 # '${top_builddir}/' (note the single quotes!) if your package is not
872 # flat, and, if you're not using automake, define top_builddir as
873 # appropriate in the Makefiles.
874 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
875 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
876   AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
877     case "$enable_ltdl_install" in
878     no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
879     "") enable_ltdl_install=yes
880         ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
881     esac
882   ])
883   if test x"$enable_ltdl_install" != x"no"; then
884     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
885   fi
888 dnl old names
889 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
890 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
891 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
892 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
893 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
894 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
895 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
896 AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
897 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
898 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl