]> sjero.net Git - wget/blob - aclocal.m4
decbba7a19ab36cee2e2ddea9946f5a3f820d3a2
[wget] / aclocal.m4
1 AC_DEFUN(AM_C_PROTOTYPES,
2 [AC_REQUIRE([AM_PROG_CC_STDC])
3 AC_BEFORE([$0], [AC_C_INLINE])
4 AC_MSG_CHECKING([for function prototypes])
5 if test "$am_cv_prog_cc_stdc" != no; then
6   AC_MSG_RESULT(yes)
7   AC_DEFINE(PROTOTYPES)
8   U= ANSI2KNR=
9 else
10   AC_MSG_RESULT(no)
11   U=_ ANSI2KNR=./ansi2knr
12   # Ensure some checks needed by ansi2knr itself.
13   AC_HEADER_STDC
14   AC_CHECK_HEADERS(string.h)
15 fi
16 AC_SUBST(U)dnl
17 AC_SUBST(ANSI2KNR)dnl
18 ])
19
20
21 # serial 1
22
23 # @defmac AC_PROG_CC_STDC
24 # @maindex PROG_CC_STDC
25 # @ovindex CC
26 # If the C compiler in not in ANSI C mode by default, try to add an option
27 # to output variable @code{CC} to make it so.  This macro tries various
28 # options that select ANSI C on some system or another.  It considers the
29 # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
30 # handles function prototypes correctly.
31 #
32 # If you use this macro, you should check after calling it whether the C
33 # compiler has been set to accept ANSI C; if not, the shell variable
34 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
35 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
36 # program @code{ansi2knr}, which comes with Ghostscript.
37 # @end defmac
38
39 AC_DEFUN(AM_PROG_CC_STDC,
40 [AC_REQUIRE([AC_PROG_CC])
41 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
42 AC_CACHE_VAL(am_cv_prog_cc_stdc,
43 [am_cv_prog_cc_stdc=no
44 ac_save_CC="$CC"
45 # Don't try gcc -ansi; that turns off useful extensions and
46 # breaks some systems' header files.
47 # AIX                   -qlanglvl=ansi
48 # Ultrix and OSF/1      -std1
49 # HP-UX                 -Aa -D_HPUX_SOURCE
50 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
51 do
52   CC="$ac_save_CC $ac_arg"
53   AC_TRY_COMPILE(
54 [#if !defined(__STDC__)
55 choke me
56 #endif
57 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
58 #ifdef _SEQUENT_
59 # include <sys/types.h>
60 # include <sys/stat.h>
61 #endif
62 ], [
63 int test (int i, double x);
64 struct s1 {int (*f) (int a);};
65 struct s2 {int (*f) (double a);};],
66 [am_cv_prog_cc_stdc="$ac_arg"; break])
67 done
68 CC="$ac_save_CC"
69 ])
70 AC_MSG_RESULT($am_cv_prog_cc_stdc)
71 case "x$am_cv_prog_cc_stdc" in
72   x|xno) ;;
73   *) CC="$CC $am_cv_prog_cc_stdc" ;;
74 esac
75 ])
76
77 AC_DEFUN(WGET_STRUCT_UTIMBUF,
78 [AC_MSG_CHECKING(for struct utimbuf)
79 if test x"$ac_cv_header_utime_h" = xyes; then
80   AC_EGREP_CPP([struct[         ]+utimbuf],
81     [#include <utime.h>],
82     [AC_DEFINE(HAVE_STRUCT_UTIMBUF)
83       AC_MSG_RESULT(yes)],
84     AC_MSG_RESULT(no))
85 else
86   AC_MSG_RESULT(no)
87 fi])
88
89 \f
90 # This code originates from Ulrich Drepper's AM_WITH_NLS.
91
92 AC_DEFUN(WGET_WITH_NLS,
93   [AC_MSG_CHECKING([whether NLS is requested])
94     dnl Default is enabled NLS
95     AC_ARG_ENABLE(nls,
96       [  --disable-nls           do not use Native Language Support],
97       HAVE_NLS=$enableval, HAVE_NLS=yes)
98     AC_MSG_RESULT($HAVE_NLS)
99
100     dnl If something goes wrong, we may still decide not to use NLS.
101     dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
102     dnl last moment.
103
104     if test x"$HAVE_NLS" = xyes; then
105       AC_MSG_RESULT("language catalogs: $ALL_LINGUAS")
106       AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
107         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
108       AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
109           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
110       AC_SUBST(MSGFMT)
111       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
112       CATOBJEXT=.gmo
113       INSTOBJEXT=.mo
114       DATADIRNAME=share
115
116       dnl Test whether we really found GNU xgettext.
117       if test "$XGETTEXT" != ":"; then
118         dnl If it is no GNU xgettext we define it as : so that the
119         dnl Makefiles still can work.
120         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
121           : ;
122         else
123           AC_MSG_RESULT(
124             [found xgettext programs is not GNU xgettext; ignore it])
125           XGETTEXT=":"
126         fi
127       fi
128
129       AC_CHECK_HEADERS(locale.h libintl.h)
130
131       AC_CHECK_FUNCS(gettext, [], [
132         AC_CHECK_LIB(intl, gettext, [
133           dnl gettext is in libintl; announce the fact manually.
134           LIBS="-lintl $LIBS"
135           AC_DEFINE(HAVE_GETTEXT)
136         ], [
137           AC_MSG_RESULT(
138             [gettext not found; disabling NLS])
139           HAVE_NLS=no
140         ])
141       ])
142
143       dnl These rules are solely for the distribution goal.  While doing this
144       dnl we only have to keep exactly one list of the available catalogs
145       dnl in configure.in.
146       for lang in $ALL_LINGUAS; do
147         GMOFILES="$GMOFILES $lang.gmo"
148         POFILES="$POFILES $lang.po"
149       done
150       dnl Construct list of names of catalog files to be constructed.
151       for lang in $ALL_LINGUAS; do
152         CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
153       done
154
155       dnl Make all variables we use known to autoconf.
156       AC_SUBST(CATALOGS)
157       AC_SUBST(CATOBJEXT)
158       AC_SUBST(DATADIRNAME)
159       AC_SUBST(GMOFILES)
160       AC_SUBST(INSTOBJEXT)
161       AC_SUBST(INTLLIBS)
162       AC_SUBST(POFILES)
163     fi
164     AC_SUBST(HAVE_NLS)
165     dnl Some independently maintained files, such as po/Makefile.in,
166     dnl use `USE_NLS', so support it.
167     USE_NLS=$HAVE_NLS
168     AC_SUBST(USE_NLS)
169     if test "x$HAVE_NLS" = xyes; then
170       AC_DEFINE(HAVE_NLS)
171     fi
172   ])
173
174 dnl Generate list of files to be processed by xgettext which will
175 dnl be included in po/Makefile.
176 dnl
177 dnl This is not strictly an Autoconf macro, because it is run from
178 dnl within `config.status' rather than from within configure.  This
179 dnl is why special rules must be applied for it.
180 AC_DEFUN(WGET_PROCESS_PO,
181   [srcdir=$ac_given_srcdir # Advanced autoconf hackery
182    dnl I wonder what the following several lines do...
183    if test "x$srcdir" != "x."; then
184      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
185        posrcprefix="$srcdir/"
186      else
187        posrcprefix="../$srcdir/"
188      fi
189    else
190      posrcprefix="../"
191    fi
192    rm -f po/POTFILES
193    dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
194    dnl `config.status'.
195    echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
196    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\,"  \
197        -e "\$s/\(.*\) \\\\/\1/" \
198         < $srcdir/po/POTFILES.in > po/POTFILES
199    echo "creating po/Makefile"
200    sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
201   ])
202
203 # Search path for a program which passes the given test.
204 # Ulrich Drepper <drepper@cygnus.com>, 1996.
205 #
206 # This file may be copied and used freely without restrictions.  It
207 # can be used in projects which are not available under the GNU Public
208 # License but which still want to provide support for the GNU gettext
209 # functionality.  Please note that the actual code is *not* freely
210 # available.
211
212 # serial 1
213
214 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
215 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
216 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
217 [# Extract the first word of "$2", so it can be a program name with args.
218 set dummy $2; ac_word=[$]2
219 AC_MSG_CHECKING([for $ac_word])
220 AC_CACHE_VAL(ac_cv_path_$1,
221 [case "[$]$1" in
222   /*)
223   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
224   ;;
225   *)
226   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
227   for ac_dir in ifelse([$5], , $PATH, [$5]); do
228     test -z "$ac_dir" && ac_dir=.
229     if test -f $ac_dir/$ac_word; then
230       if [$3]; then
231         ac_cv_path_$1="$ac_dir/$ac_word"
232         break
233       fi
234     fi
235   done
236   IFS="$ac_save_ifs"
237 dnl If no 4th arg is given, leave the cache variable unset,
238 dnl so AC_PATH_PROGS will keep looking.
239 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
240 ])dnl
241   ;;
242 esac])dnl
243 $1="$ac_cv_path_$1"
244 if test -n "[$]$1"; then
245   AC_MSG_RESULT([$]$1)
246 else
247   AC_MSG_RESULT(no)
248 fi
249 AC_SUBST($1)dnl
250 ])
251
252
253 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
254 ## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
255 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
256 ##
257 ## This program is free software; you can redistribute it and/or modify
258 ## it under the terms of the GNU General Public License as published by
259 ## the Free Software Foundation; either version 2 of the License, or
260 ## (at your option) any later version.
261 ##
262 ## This program is distributed in the hope that it will be useful, but
263 ## WITHOUT ANY WARRANTY; without even the implied warranty of
264 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
265 ## General Public License for more details.
266 ##
267 ## You should have received a copy of the GNU General Public License
268 ## along with this program; if not, write to the Free Software
269 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
270 ##
271 ## As a special exception to the GNU General Public License, if you
272 ## distribute this file as part of a program that contains a
273 ## configuration script generated by Autoconf, you may include it under
274 ## the same distribution terms that you use for the rest of that program.
275
276 # serial 40 AC_PROG_LIBTOOL
277 AC_DEFUN(AC_PROG_LIBTOOL,
278 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
279
280 # Save cache, so that ltconfig can load it
281 AC_CACHE_SAVE
282
283 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
284 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
285 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
286 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
287 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
288 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
289 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
290 || AC_MSG_ERROR([libtool configure failed])
291
292 # Reload cache, that may have been modified by ltconfig
293 AC_CACHE_LOAD
294
295 # This can be used to rebuild libtool when needed
296 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
297
298 # Always use our own libtool.
299 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
300 AC_SUBST(LIBTOOL)dnl
301
302 # Redirect the config.log output again, so that the ltconfig log is not
303 # clobbered by the next message.
304 exec 5>>./config.log
305 ])
306
307 AC_DEFUN(AC_LIBTOOL_SETUP,
308 [AC_PREREQ(2.13)dnl
309 AC_REQUIRE([AC_ENABLE_SHARED])dnl
310 AC_REQUIRE([AC_ENABLE_STATIC])dnl
311 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
312 AC_REQUIRE([AC_CANONICAL_HOST])dnl
313 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
314 AC_REQUIRE([AC_PROG_RANLIB])dnl
315 AC_REQUIRE([AC_PROG_CC])dnl
316 AC_REQUIRE([AC_PROG_LD])dnl
317 AC_REQUIRE([AC_PROG_NM])dnl
318 AC_REQUIRE([AC_PROG_LN_S])dnl
319 dnl
320
321 case "$target" in
322 NONE) lt_target="$host" ;;
323 *) lt_target="$target" ;;
324 esac
325
326 # Check for any special flags to pass to ltconfig.
327 libtool_flags="--cache-file=$cache_file"
328 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
329 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
330 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
331 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
332 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
333 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
334 [libtool_flags="$libtool_flags --enable-dlopen"])
335 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
336 [libtool_flags="$libtool_flags --enable-win32-dll"])
337 AC_ARG_ENABLE(libtool-lock,
338   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
339 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
340 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
341
342 # Some flags need to be propagated to the compiler or linker for good
343 # libtool support.
344 case "$lt_target" in
345 *-*-irix6*)
346   # Find out which ABI we are using.
347   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
348   if AC_TRY_EVAL(ac_compile); then
349     case "`/usr/bin/file conftest.o`" in
350     *32-bit*)
351       LD="${LD-ld} -32"
352       ;;
353     *N32*)
354       LD="${LD-ld} -n32"
355       ;;
356     *64-bit*)
357       LD="${LD-ld} -64"
358       ;;
359     esac
360   fi
361   rm -rf conftest*
362   ;;
363
364 *-*-sco3.2v5*)
365   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
366   SAVE_CFLAGS="$CFLAGS"
367   CFLAGS="$CFLAGS -belf"
368   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
369     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
370   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
371     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
372     CFLAGS="$SAVE_CFLAGS"
373   fi
374   ;;
375
376 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
377 [*-*-cygwin* | *-*-mingw*)
378   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
379   AC_CHECK_TOOL(AS, as, false)
380   AC_CHECK_TOOL(OBJDUMP, objdump, false)
381   ;;
382 ])
383 esac
384 ])
385
386 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
387 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
388
389 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
390 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
391
392 # AC_ENABLE_SHARED - implement the --enable-shared flag
393 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
394 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
395 #   `yes'.
396 AC_DEFUN(AC_ENABLE_SHARED, [dnl
397 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
398 AC_ARG_ENABLE(shared,
399 changequote(<<, >>)dnl
400 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
401 changequote([, ])dnl
402 [p=${PACKAGE-default}
403 case "$enableval" in
404 yes) enable_shared=yes ;;
405 no) enable_shared=no ;;
406 *)
407   enable_shared=no
408   # Look at the argument we got.  We use all the common list separators.
409   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
410   for pkg in $enableval; do
411     if test "X$pkg" = "X$p"; then
412       enable_shared=yes
413     fi
414   done
415   IFS="$ac_save_ifs"
416   ;;
417 esac],
418 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
419 ])
420
421 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
422 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
423 AC_ENABLE_SHARED(no)])
424
425 # AC_ENABLE_STATIC - implement the --enable-static flag
426 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
427 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
428 #   `yes'.
429 AC_DEFUN(AC_ENABLE_STATIC, [dnl
430 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
431 AC_ARG_ENABLE(static,
432 changequote(<<, >>)dnl
433 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
434 changequote([, ])dnl
435 [p=${PACKAGE-default}
436 case "$enableval" in
437 yes) enable_static=yes ;;
438 no) enable_static=no ;;
439 *)
440   enable_static=no
441   # Look at the argument we got.  We use all the common list separators.
442   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
443   for pkg in $enableval; do
444     if test "X$pkg" = "X$p"; then
445       enable_static=yes
446     fi
447   done
448   IFS="$ac_save_ifs"
449   ;;
450 esac],
451 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
452 ])
453
454 # AC_DISABLE_STATIC - set the default static flag to --disable-static
455 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
456 AC_ENABLE_STATIC(no)])
457
458
459 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
460 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
461 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
462 #   `yes'.
463 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
464 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
465 AC_ARG_ENABLE(fast-install,
466 changequote(<<, >>)dnl
467 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
468 changequote([, ])dnl
469 [p=${PACKAGE-default}
470 case "$enableval" in
471 yes) enable_fast_install=yes ;;
472 no) enable_fast_install=no ;;
473 *)
474   enable_fast_install=no
475   # Look at the argument we got.  We use all the common list separators.
476   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
477   for pkg in $enableval; do
478     if test "X$pkg" = "X$p"; then
479       enable_fast_install=yes
480     fi
481   done
482   IFS="$ac_save_ifs"
483   ;;
484 esac],
485 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
486 ])
487
488 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
489 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
490 AC_ENABLE_FAST_INSTALL(no)])
491
492 # AC_PROG_LD - find the path to the GNU or non-GNU linker
493 AC_DEFUN(AC_PROG_LD,
494 [AC_ARG_WITH(gnu-ld,
495 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
496 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
497 AC_REQUIRE([AC_PROG_CC])dnl
498 AC_REQUIRE([AC_CANONICAL_HOST])dnl
499 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
500 ac_prog=ld
501 if test "$ac_cv_prog_gcc" = yes; then
502   # Check if gcc -print-prog-name=ld gives a path.
503   AC_MSG_CHECKING([for ld used by GCC])
504   ac_prog=`($CC -print-prog-name=ld) 2>&5`
505   case "$ac_prog" in
506     # Accept absolute paths.
507 changequote(,)dnl
508     [\\/]* | [A-Za-z]:[\\/]*)
509       re_direlt='/[^/][^/]*/\.\./'
510 changequote([,])dnl
511       # Canonicalize the path of ld
512       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
513       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
514         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
515       done
516       test -z "$LD" && LD="$ac_prog"
517       ;;
518   "")
519     # If it fails, then pretend we aren't using GCC.
520     ac_prog=ld
521     ;;
522   *)
523     # If it is relative, then search for the first ld in PATH.
524     with_gnu_ld=unknown
525     ;;
526   esac
527 elif test "$with_gnu_ld" = yes; then
528   AC_MSG_CHECKING([for GNU ld])
529 else
530   AC_MSG_CHECKING([for non-GNU ld])
531 fi
532 AC_CACHE_VAL(ac_cv_path_LD,
533 [if test -z "$LD"; then
534   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
535   for ac_dir in $PATH; do
536     test -z "$ac_dir" && ac_dir=.
537     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
538       ac_cv_path_LD="$ac_dir/$ac_prog"
539       # Check to see if the program is GNU ld.  I'd rather use --version,
540       # but apparently some GNU ld's only accept -v.
541       # Break only if it was the GNU/non-GNU ld that we prefer.
542       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
543         test "$with_gnu_ld" != no && break
544       else
545         test "$with_gnu_ld" != yes && break
546       fi
547     fi
548   done
549   IFS="$ac_save_ifs"
550 else
551   ac_cv_path_LD="$LD" # Let the user override the test with a path.
552 fi])
553 LD="$ac_cv_path_LD"
554 if test -n "$LD"; then
555   AC_MSG_RESULT($LD)
556 else
557   AC_MSG_RESULT(no)
558 fi
559 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
560 AC_PROG_LD_GNU
561 ])
562
563 AC_DEFUN(AC_PROG_LD_GNU,
564 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
565 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
566 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
567   ac_cv_prog_gnu_ld=yes
568 else
569   ac_cv_prog_gnu_ld=no
570 fi])
571 ])
572
573 # AC_PROG_NM - find the path to a BSD-compatible name lister
574 AC_DEFUN(AC_PROG_NM,
575 [AC_MSG_CHECKING([for BSD-compatible nm])
576 AC_CACHE_VAL(ac_cv_path_NM,
577 [if test -n "$NM"; then
578   # Let the user override the test.
579   ac_cv_path_NM="$NM"
580 else
581   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
582   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
583     test -z "$ac_dir" && ac_dir=.
584     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
585       # Check to see if the nm accepts a BSD-compat flag.
586       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
587       #   nm: unknown option "B" ignored
588       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
589         ac_cv_path_NM="$ac_dir/nm -B"
590         break
591       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
592         ac_cv_path_NM="$ac_dir/nm -p"
593         break
594       else
595         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
596         continue # so that we can try to find one that supports BSD flags
597       fi
598     fi
599   done
600   IFS="$ac_save_ifs"
601   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
602 fi])
603 NM="$ac_cv_path_NM"
604 AC_MSG_RESULT([$NM])
605 ])
606
607 # AC_CHECK_LIBM - check for math library
608 AC_DEFUN(AC_CHECK_LIBM,
609 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
610 LIBM=
611 case "$lt_target" in
612 *-*-beos* | *-*-cygwin*)
613   # These system don't have libm
614   ;;
615 *-ncr-sysv4.3*)
616   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
617   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
618   ;;
619 *)
620   AC_CHECK_LIB(m, main, LIBM="-lm")
621   ;;
622 esac
623 ])
624
625 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
626 # the libltdl convenience library and INCLTDL to the include flags for
627 # the libltdl header and adds --enable-ltdl-convenience to the
628 # configure arguments.  Note that LIBLTDL and INCLTDL are not
629 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
630 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
631 # with '${top_builddir}/' and INCLTDL will be prefixed with
632 # '${top_srcdir}/' (note the single quotes!).  If your package is not
633 # flat and you're not using automake, define top_builddir and
634 # top_srcdir appropriately in the Makefiles.
635 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
636   case "$enable_ltdl_convenience" in
637   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
638   "") enable_ltdl_convenience=yes
639       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
640   esac
641   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
642   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
643 ])
644
645 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
646 # the libltdl installable library and INCLTDL to the include flags for
647 # the libltdl header and adds --enable-ltdl-install to the configure
648 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
649 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
650 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
651 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
652 # with '${top_srcdir}/' (note the single quotes!).  If your package is
653 # not flat and you're not using automake, define top_builddir and
654 # top_srcdir appropriately in the Makefiles.
655 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
656 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
657   AC_CHECK_LIB(ltdl, main,
658   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
659   [if test x"$enable_ltdl_install" = xno; then
660      AC_MSG_WARN([libltdl not installed, but installation disabled])
661    else
662      enable_ltdl_install=yes
663    fi
664   ])
665   if test x"$enable_ltdl_install" = x"yes"; then
666     ac_configure_args="$ac_configure_args --enable-ltdl-install"
667     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
668     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
669   else
670     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
671     LIBLTDL="-lltdl"
672     INCLTDL=
673   fi
674 ])
675
676 dnl old names
677 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
678 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
679 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
680 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
681 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
682 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
683 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
684
685 dnl This is just to silence aclocal about the macro not being used
686 ifelse([AC_DISABLE_FAST_INSTALL])dnl