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