OSDN Git Service

2002-04-23 Jeff Johnston <jjohnstn@redhat.com>
[pf3gnuchains/sourceware.git] / newlib / 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 dnl This provides configure definitions used by all the newlib
14 dnl configure.in files.
15
16 dnl Basic newlib configury.  This calls basic introductory stuff,
17 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
18 dnl configure.host.  The only argument is the relative path to the top
19 dnl newlib directory.
20
21 AC_DEFUN(NEWLIB_CONFIGURE,
22 [
23 dnl Default to --enable-multilib
24 AC_ARG_ENABLE(multilib,
25 [  --enable-multilib         build many library versions (default)],
26 [case "${enableval}" in
27   yes) multilib=yes ;;
28   no)  multilib=no ;;
29   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
30  esac], [multilib=yes])dnl
31
32 dnl Support --enable-target-optspace
33 AC_ARG_ENABLE(target-optspace,
34 [  --enable-target-optspace  optimize for space],
35 [case "${enableval}" in
36   yes) target_optspace=yes ;;
37   no)  target_optspace=no ;;
38   *)   AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
39  esac], [target_optspace=])dnl
40
41 dnl Support --enable-malloc-debugging - currently only supported for Cygwin
42 AC_ARG_ENABLE(malloc-debugging,
43 [  --enable-malloc-debugging indicate malloc debugging requested],
44 [case "${enableval}" in
45   yes) malloc_debugging=yes ;;
46   no)  malloc_debugging=no ;;
47   *)   AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
48  esac], [malloc_debugging=])dnl
49
50 dnl Support --enable-newlib-mb
51 AC_ARG_ENABLE(newlib-mb,
52 [  --enable-newlib-mb        enable multibyte support],
53 [case "${enableval}" in
54   yes) newlib_mb=yes ;;
55   no)  newlib_mb=no ;;
56   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
57  esac], [newlib_mb=no])dnl
58
59 dnl Support --disable-newlib-io-float
60 AC_ARG_ENABLE(newlib-io-float,
61 [  --disable-newlib-io-float disable printf/scanf family float support],
62 [case "${enableval}" in
63   yes) newlib_io_float=yes ;;
64   no)  newlib_io_float=no ;;
65   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
66  esac], [newlib_io_float=yes])dnl
67
68
69 dnl We may get other options which we don't document:
70 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
71
72 test -z "[$]{with_target_subdir}" && with_target_subdir=.
73
74 if test "[$]{srcdir}" = "."; then
75   if test "[$]{with_target_subdir}" != "."; then
76     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
77   else
78     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
79   fi
80 else
81   newlib_basedir="[$]{srcdir}/$1"
82 fi
83 AC_SUBST(newlib_basedir)
84
85 AC_CANONICAL_HOST
86
87 AM_INIT_AUTOMAKE(newlib, 1.10.0)
88
89 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
90 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
91 # are probably using a cross compiler, which will not be able to fully
92 # link an executable.  This should really be fixed in autoconf
93 # itself.
94
95 AC_DEFUN(LIB_AC_PROG_CC,
96 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
97 AC_CHECK_PROG(CC, gcc, gcc)
98 if test -z "$CC"; then
99   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
100   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
101 fi
102
103 AC_PROG_CC_GNU
104
105 if test $ac_cv_prog_gcc = yes; then
106   GCC=yes
107 dnl Check whether -g works, even if CFLAGS is set, in case the package
108 dnl plays around with CFLAGS (such as to build both debugging and
109 dnl normal versions of a library), tasteless as that idea is.
110   ac_test_CFLAGS="${CFLAGS+set}"
111   ac_save_CFLAGS="$CFLAGS"
112   CFLAGS=
113   AC_PROG_CC_G
114   if test "$ac_test_CFLAGS" = set; then
115     CFLAGS="$ac_save_CFLAGS"
116   elif test $ac_cv_prog_cc_g = yes; then
117     CFLAGS="-g -O2"
118   else
119     CFLAGS="-O2"
120   fi
121 else
122   GCC=
123   test "${CFLAGS+set}" = set || CFLAGS="-g"
124 fi
125 ])
126
127 LIB_AC_PROG_CC
128
129 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
130 # run it explicitly here, it will be run implicitly before
131 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
132 # be run before AC_CANONICAL_HOST.
133 AC_CANONICAL_BUILD
134
135 AC_CHECK_TOOL(AS, as)
136 AC_CHECK_TOOL(AR, ar)
137 AC_CHECK_TOOL(RANLIB, ranlib, :)
138
139 AC_PROG_INSTALL
140
141 AM_MAINTAINER_MODE
142
143 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
144 # at least currently, we never actually build a program, so we never
145 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
146 # fails, because we are probably configuring with a cross compiler
147 # which can't create executables.  So we include AC_EXEEXT to keep
148 # automake happy, but we don't execute it, since we don't care about
149 # the result.
150 if false; then
151   AC_EXEEXT
152 fi
153
154 . [$]{newlib_basedir}/configure.host
155
156 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
157
158 NEWLIB_CFLAGS=${newlib_cflags}
159 AC_SUBST(NEWLIB_CFLAGS)
160
161 LDFLAGS=${ldflags}
162 AC_SUBST(LDFLAGS)
163
164 AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
165 AC_SUBST(oext)
166 AC_SUBST(aext)
167
168 AC_SUBST(libm_machine_dir)
169 AC_SUBST(machine_dir)
170 AC_SUBST(sys_dir)
171 ])
172
173 # Do all the work for Automake.  This macro actually does too much --
174 # some checks are only needed if your package does certain things.
175 # But this isn't really a big deal.
176
177 # serial 1
178
179 dnl Usage:
180 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
181
182 AC_DEFUN(AM_INIT_AUTOMAKE,
183 [AC_REQUIRE([AC_PROG_INSTALL])
184 PACKAGE=[$1]
185 AC_SUBST(PACKAGE)
186 VERSION=[$2]
187 AC_SUBST(VERSION)
188 dnl test to see if srcdir already configured
189 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
190   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
191 fi
192 ifelse([$3],,
193 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
194 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
195 AC_REQUIRE([AM_SANITY_CHECK])
196 AC_REQUIRE([AC_ARG_PROGRAM])
197 dnl FIXME This is truly gross.
198 missing_dir=`cd $ac_aux_dir && pwd`
199 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
200 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
201 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
202 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
203 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
204 AC_REQUIRE([AC_PROG_MAKE_SET])])
205
206 #
207 # Check to make sure that the build environment is sane.
208 #
209
210 AC_DEFUN(AM_SANITY_CHECK,
211 [AC_MSG_CHECKING([whether build environment is sane])
212 # Just in case
213 sleep 1
214 echo timestamp > conftestfile
215 # Do `set' in a subshell so we don't clobber the current shell's
216 # arguments.  Must try -L first in case configure is actually a
217 # symlink; some systems play weird games with the mod time of symlinks
218 # (eg FreeBSD returns the mod time of the symlink's containing
219 # directory).
220 if (
221    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
222    if test "[$]*" = "X"; then
223       # -L didn't work.
224       set X `ls -t $srcdir/configure conftestfile`
225    fi
226    if test "[$]*" != "X $srcdir/configure conftestfile" \
227       && test "[$]*" != "X conftestfile $srcdir/configure"; then
228
229       # If neither matched, then we have a broken ls.  This can happen
230       # if, for instance, CONFIG_SHELL is bash and it inherits a
231       # broken ls alias from the environment.  This has actually
232       # happened.  Such a system could not be considered "sane".
233       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
234 alias in your environment])
235    fi
236
237    test "[$]2" = conftestfile
238    )
239 then
240    # Ok.
241    :
242 else
243    AC_MSG_ERROR([newly created file is older than distributed files!
244 Check your system clock])
245 fi
246 rm -f conftest*
247 AC_MSG_RESULT(yes)])
248
249 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
250 dnl The program must properly implement --version.
251 AC_DEFUN(AM_MISSING_PROG,
252 [AC_MSG_CHECKING(for working $2)
253 # Run test in a subshell; some versions of sh will print an error if
254 # an executable is not found, even if stderr is redirected.
255 # Redirect stdin to placate older versions of autoconf.  Sigh.
256 if ($2 --version) < /dev/null > /dev/null 2>&1; then
257    $1=$2
258    AC_MSG_RESULT(found)
259 else
260    $1="$3/missing $2"
261    AC_MSG_RESULT(missing)
262 fi
263 AC_SUBST($1)])
264
265 # Add --enable-maintainer-mode option to configure.
266 # From Jim Meyering
267
268 # serial 1
269
270 AC_DEFUN(AM_MAINTAINER_MODE,
271 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
272   dnl maintainer-mode is disabled by default
273   AC_ARG_ENABLE(maintainer-mode,
274 [  --enable-maintainer-mode enable make rules and dependencies not useful
275                           (and sometimes confusing) to the casual installer],
276       USE_MAINTAINER_MODE=$enableval,
277       USE_MAINTAINER_MODE=no)
278   AC_MSG_RESULT($USE_MAINTAINER_MODE)
279   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
280   MAINT=$MAINTAINER_MODE_TRUE
281   AC_SUBST(MAINT)dnl
282 ]
283 )
284
285 # Define a conditional.
286
287 AC_DEFUN(AM_CONDITIONAL,
288 [AC_SUBST($1_TRUE)
289 AC_SUBST($1_FALSE)
290 if $2; then
291   $1_TRUE=
292   $1_FALSE='#'
293 else
294   $1_TRUE='#'
295   $1_FALSE=
296 fi])
297
298
299 # serial 40 AC_PROG_LIBTOOL
300 AC_DEFUN(AC_PROG_LIBTOOL,
301 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
302
303 # Save cache, so that ltconfig can load it
304 AC_CACHE_SAVE
305
306 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
307 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
308 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
309 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
310 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
311 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
312 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
313 || AC_MSG_ERROR([libtool configure failed])
314
315 # Reload cache, that may have been modified by ltconfig
316 AC_CACHE_LOAD
317
318 # This can be used to rebuild libtool when needed
319 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
320
321 # Always use our own libtool.
322 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
323 AC_SUBST(LIBTOOL)dnl
324
325 # Redirect the config.log output again, so that the ltconfig log is not
326 # clobbered by the next message.
327 exec 5>>./config.log
328 ])
329
330 AC_DEFUN(AC_LIBTOOL_SETUP,
331 [AC_PREREQ(2.13)dnl
332 AC_REQUIRE([AC_ENABLE_SHARED])dnl
333 AC_REQUIRE([AC_ENABLE_STATIC])dnl
334 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
335 AC_REQUIRE([AC_CANONICAL_HOST])dnl
336 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
337 AC_REQUIRE([AC_PROG_RANLIB])dnl
338 AC_REQUIRE([AC_PROG_CC])dnl
339 AC_REQUIRE([AC_PROG_LD])dnl
340 AC_REQUIRE([AC_PROG_NM])dnl
341 AC_REQUIRE([AC_PROG_LN_S])dnl
342 dnl
343
344 # Check for any special flags to pass to ltconfig.
345 libtool_flags="--cache-file=$cache_file"
346 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
347 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
348 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
349 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
350 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
351 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
352 [libtool_flags="$libtool_flags --enable-dlopen"])
353 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
354 [libtool_flags="$libtool_flags --enable-win32-dll"])
355 AC_ARG_ENABLE(libtool-lock,
356   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
357 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
358 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
359
360 # Some flags need to be propagated to the compiler or linker for good
361 # libtool support.
362 case "$host" in
363 *-*-irix6*)
364   # Find out which ABI we are using.
365   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
366   if AC_TRY_EVAL(ac_compile); then
367     case "`/usr/bin/file conftest.o`" in
368     *32-bit*)
369       LD="${LD-ld} -32"
370       ;;
371     *N32*)
372       LD="${LD-ld} -n32"
373       ;;
374     *64-bit*)
375       LD="${LD-ld} -64"
376       ;;
377     esac
378   fi
379   rm -rf conftest*
380   ;;
381
382 *-*-sco3.2v5*)
383   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
384   SAVE_CFLAGS="$CFLAGS"
385   CFLAGS="$CFLAGS -belf"
386   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
387     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
388   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
389     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
390     CFLAGS="$SAVE_CFLAGS"
391   fi
392   ;;
393
394 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
395 [*-*-cygwin* | *-*-mingw*)
396   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
397   AC_CHECK_TOOL(AS, as, false)
398   AC_CHECK_TOOL(OBJDUMP, objdump, false)
399   ;;
400 ])
401 esac
402 ])
403
404 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
405 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
406
407 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
408 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
409
410 # AC_ENABLE_SHARED - implement the --enable-shared flag
411 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
412 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
413 #   `yes'.
414 AC_DEFUN(AC_ENABLE_SHARED, [dnl
415 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
416 AC_ARG_ENABLE(shared,
417 changequote(<<, >>)dnl
418 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
419 changequote([, ])dnl
420 [p=${PACKAGE-default}
421 case "$enableval" in
422 yes) enable_shared=yes ;;
423 no) enable_shared=no ;;
424 *)
425   enable_shared=no
426   # Look at the argument we got.  We use all the common list separators.
427   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
428   for pkg in $enableval; do
429     if test "X$pkg" = "X$p"; then
430       enable_shared=yes
431     fi
432   done
433   IFS="$ac_save_ifs"
434   ;;
435 esac],
436 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
437 ])
438
439 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
440 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
441 AC_ENABLE_SHARED(no)])
442
443 # AC_ENABLE_STATIC - implement the --enable-static flag
444 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
445 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
446 #   `yes'.
447 AC_DEFUN(AC_ENABLE_STATIC, [dnl
448 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
449 AC_ARG_ENABLE(static,
450 changequote(<<, >>)dnl
451 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
452 changequote([, ])dnl
453 [p=${PACKAGE-default}
454 case "$enableval" in
455 yes) enable_static=yes ;;
456 no) enable_static=no ;;
457 *)
458   enable_static=no
459   # Look at the argument we got.  We use all the common list separators.
460   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
461   for pkg in $enableval; do
462     if test "X$pkg" = "X$p"; then
463       enable_static=yes
464     fi
465   done
466   IFS="$ac_save_ifs"
467   ;;
468 esac],
469 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
470 ])
471
472 # AC_DISABLE_STATIC - set the default static flag to --disable-static
473 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
474 AC_ENABLE_STATIC(no)])
475
476
477 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
478 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
479 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
480 #   `yes'.
481 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
482 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
483 AC_ARG_ENABLE(fast-install,
484 changequote(<<, >>)dnl
485 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
486 changequote([, ])dnl
487 [p=${PACKAGE-default}
488 case "$enableval" in
489 yes) enable_fast_install=yes ;;
490 no) enable_fast_install=no ;;
491 *)
492   enable_fast_install=no
493   # Look at the argument we got.  We use all the common list separators.
494   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
495   for pkg in $enableval; do
496     if test "X$pkg" = "X$p"; then
497       enable_fast_install=yes
498     fi
499   done
500   IFS="$ac_save_ifs"
501   ;;
502 esac],
503 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
504 ])
505
506 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
507 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
508 AC_ENABLE_FAST_INSTALL(no)])
509
510 # AC_PROG_LD - find the path to the GNU or non-GNU linker
511 AC_DEFUN(AC_PROG_LD,
512 [AC_ARG_WITH(gnu-ld,
513 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
514 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
515 AC_REQUIRE([AC_PROG_CC])dnl
516 AC_REQUIRE([AC_CANONICAL_HOST])dnl
517 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
518 ac_prog=ld
519 if test "$ac_cv_prog_gcc" = yes; then
520   # Check if gcc -print-prog-name=ld gives a path.
521   AC_MSG_CHECKING([for ld used by GCC])
522   ac_prog=`($CC -print-prog-name=ld) 2>&5`
523   case "$ac_prog" in
524     # Accept absolute paths.
525 changequote(,)dnl
526     [\\/]* | [A-Za-z]:[\\/]*)
527       re_direlt='/[^/][^/]*/\.\./'
528 changequote([,])dnl
529       # Canonicalize the path of ld
530       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
531       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
532         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
533       done
534       test -z "$LD" && LD="$ac_prog"
535       ;;
536   "")
537     # If it fails, then pretend we aren't using GCC.
538     ac_prog=ld
539     ;;
540   *)
541     # If it is relative, then search for the first ld in PATH.
542     with_gnu_ld=unknown
543     ;;
544   esac
545 elif test "$with_gnu_ld" = yes; then
546   AC_MSG_CHECKING([for GNU ld])
547 else
548   AC_MSG_CHECKING([for non-GNU ld])
549 fi
550 AC_CACHE_VAL(ac_cv_path_LD,
551 [if test -z "$LD"; then
552   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
553   for ac_dir in $PATH; do
554     test -z "$ac_dir" && ac_dir=.
555     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
556       ac_cv_path_LD="$ac_dir/$ac_prog"
557       # Check to see if the program is GNU ld.  I'd rather use --version,
558       # but apparently some GNU ld's only accept -v.
559       # Break only if it was the GNU/non-GNU ld that we prefer.
560       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
561         test "$with_gnu_ld" != no && break
562       else
563         test "$with_gnu_ld" != yes && break
564       fi
565     fi
566   done
567   IFS="$ac_save_ifs"
568 else
569   ac_cv_path_LD="$LD" # Let the user override the test with a path.
570 fi])
571 LD="$ac_cv_path_LD"
572 if test -n "$LD"; then
573   AC_MSG_RESULT($LD)
574 else
575   AC_MSG_RESULT(no)
576 fi
577 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
578 AC_PROG_LD_GNU
579 ])
580
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])
589 ])
590
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}${PATH_SEPARATOR-:}"
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 || test -f $ac_dir/nm$ac_exeext ; 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 ])
624
625 # AC_CHECK_LIBM - check for math library
626 AC_DEFUN(AC_CHECK_LIBM,
627 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
628 LIBM=
629 case "$host" in
630 *-*-beos* | *-*-cygwin*)
631   # These system don't have libm
632   ;;
633 *-ncr-sysv4.3*)
634   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
635   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
636   ;;
637 *)
638   AC_CHECK_LIB(m, main, LIBM="-lm")
639   ;;
640 esac
641 ])
642
643 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
644 # the libltdl convenience library, adds --enable-ltdl-convenience to
645 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
646 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
647 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
648 # '${top_builddir}/' (note the single quotes!) if your package is not
649 # flat, and, if you're not using automake, define top_builddir as
650 # appropriate in the Makefiles.
651 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
652   case "$enable_ltdl_convenience" in
653   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
654   "") enable_ltdl_convenience=yes
655       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
656   esac
657   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
658   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
659 ])
660
661 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
662 # the libltdl installable library, and adds --enable-ltdl-install to
663 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
664 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
665 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
666 # '${top_builddir}/' (note the single quotes!) if your package is not
667 # flat, and, if you're not using automake, define top_builddir as
668 # appropriate in the Makefiles.
669 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
670 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
671   AC_CHECK_LIB(ltdl, main,
672   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
673   [if test x"$enable_ltdl_install" = xno; then
674      AC_MSG_WARN([libltdl not installed, but installation disabled])
675    else
676      enable_ltdl_install=yes
677    fi
678   ])
679   if test x"$enable_ltdl_install" = x"yes"; then
680     ac_configure_args="$ac_configure_args --enable-ltdl-install"
681     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
682     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
683   else
684     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
685     LIBLTDL="-lltdl"
686     INCLTDL=
687   fi
688 ])
689
690 dnl old names
691 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
692 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
693 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
694 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
695 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
696 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
697 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
698
699 dnl This is just to silence aclocal about the macro not being used
700 ifelse([AC_DISABLE_FAST_INSTALL])dnl
701