1 dnl local autoconf macros
2 dnl Bruno Haible 2001-02-04
3 dnl Marcus Daniels 1997-04-10
7 dnl without AC_MSG_...: with AC_MSG_... and caching:
8 dnl AC_TRY_CPP CL_CPP_CHECK
9 dnl AC_TRY_COMPILE CL_COMPILE_CHECK
10 dnl AC_TRY_LINK CL_LINK_CHECK
11 dnl AC_TRY_RUN CL_RUN_CHECK - would require cross-compiling support
13 dnl AC_TRY_CPP(INCLUDES,
14 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
15 dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID,
17 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
18 dnl AC_TRY_xxx(INCLUDES, FUNCTION-BODY,
19 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
20 dnl CL_xxx_CHECK(ECHO-TEXT, CACHE-ID,
21 dnl INCLUDES, FUNCTION-BODY,
22 dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
25 [AC_MSG_CHECKING(for $1)
27 AC_TRY_CPP([$3], $2=yes, $2=no)
30 if test [$]$2 = yes; then
31 ifelse([$4], , :, [$4])
32 ifelse([$5], , , [else
38 define(CL_COMPILE_CHECK,
39 [AC_MSG_CHECKING(for $1)
41 AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
44 if test [$]$2 = yes; then
45 ifelse([$5], , :, [$5])
46 ifelse([$6], , , [else
53 [AC_MSG_CHECKING(for $1)
55 AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
58 if test [$]$2 = yes; then
59 ifelse([$5], , :, [$5])
60 ifelse([$6], , , [else
66 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
68 [AC_MSG_CHECKING([for $1 declaration])
69 AC_CACHE_VAL(cl_cv_proto_[$1], [$2
71 cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
72 AC_MSG_RESULTPROTO([$]cl_cv_proto_$1)
75 dnl CL_PROTO_RET(INCLUDES, DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
79 ], [], $3="$4", $3="$5")
82 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
86 [#if defined(__STDC__) || defined(__cplusplus)
94 dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
95 define(CL_PROTO_CONST,
96 [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
100 dnl performs ACTION, with AC_MSG_CHECKING and AC_MSG_RESULT being defined away.
102 [pushdef([AC_MSG_CHECKING],[:])dnl
103 pushdef([AC_CHECKING],[:])dnl
104 pushdef([AC_MSG_RESULT],[:])dnl
105 pushdef([AC_MSG_RESULTPROTO],[:])dnl
107 popdef([AC_MSG_RESULTPROTO])dnl
108 popdef([AC_MSG_RESULT])dnl
109 popdef([AC_CHECKING])dnl
110 popdef([AC_MSG_CHECKING])dnl
113 AC_DEFUN(CL_PROG_RANLIB, [AC_CHECK_PROG(RANLIB, ranlib, ranlib, true)])dnl
115 AC_DEFUN(CL_PROG_INSTALL,
116 [dnl This is mostly copied from AC_PROG_INSTALL.
117 # Find a good install program. We prefer a C program (faster),
118 # so one script is as good as another. But avoid the broken or
119 # incompatible versions:
120 # SysV /etc/install, /usr/sbin/install
121 # SunOS /usr/etc/install
124 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
125 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
126 # ./install, which can be erroneously created by make from ./install.sh.
127 AC_MSG_CHECKING(for a BSD compatible install)
128 if test -z "$INSTALL"; then
129 AC_CACHE_VAL(cl_cv_path_install,
130 [ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
131 for ac_dir in $PATH; do
132 # Account for people who put trailing slashes in PATH elements.
134 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
136 # OSF1 and SCO ODT 3.0 have their own names for install.
137 for ac_prog in ginstall installbsd scoinst install; do
138 if test -f $ac_dir/$ac_prog; then
139 if test $ac_prog = install &&
140 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
141 # AIX install. It has an incompatible calling convention.
142 # OSF/1 installbsd also uses dspmsg, but is usable.
145 if test $ac_prog = installbsd &&
146 grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then
147 # AIX installbsd doesn't work without option "-g".
150 cl_cv_path_install="$ac_dir/$ac_prog -c"
160 # As a last resort, use cp.
161 test -z "$cl_cv_path_install" && cl_cv_path_install="cp"
163 INSTALL="$cl_cv_path_install"
165 dnl We do special magic for INSTALL instead of AC_SUBST, to get
166 dnl relative paths right.
167 AC_MSG_RESULT($INSTALL)
169 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
170 # It thinks the first close brace ends the variable substitution.
171 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)'
172 AC_SUBST(INSTALL_PROGRAM)dnl
173 if test -z "$INSTALL_DATA"; then
175 cp | */cp ) INSTALL_DATA='$(INSTALL)' ;;
176 * ) INSTALL_DATA='$(INSTALL) -m 644' ;;
179 AC_SUBST(INSTALL_DATA)dnl
183 [AC_CACHE_CHECK(how to copy files, cl_cv_prog_cp, [
184 echo "blabla" > conftest.x
185 err=`/bin/sh -c "cp -p conftest.x conftest.y 2>&1"`
186 if test -z "$err"; then
187 cl_cv_prog_cp='cp -p'
198 [AC_REQUIRE([CL_PROG_CP])dnl
199 AC_CACHE_CHECK(how to make hard links, cl_cv_prog_LN, [
200 rm -f conftestdata conftestfile
201 echo data > conftestfile
202 if ln conftestfile conftestdata 2>/dev/null; then
205 cl_cv_prog_LN="$cl_cv_prog_cp"
207 rm -f conftestdata conftestfile
213 AC_DEFUN(CL_PROG_LN_S,
214 [AC_REQUIRE([CL_PROG_LN])dnl
215 dnl Make a symlink if possible; otherwise try a hard link. On filesystems
216 dnl which support neither symlink nor hard link, use a plain copy.
217 AC_MSG_CHECKING(whether ln -s works)
218 AC_CACHE_VAL(cl_cv_prog_LN_S, [
220 if ln -s X conftestdata 2>/dev/null; then
221 cl_cv_prog_LN_S="ln -s"
223 cl_cv_prog_LN_S="$cl_cv_prog_LN"
227 if test "$cl_cv_prog_LN_S" = "ln -s"; then
232 LN_S="$cl_cv_prog_LN_S"
236 AC_DEFUN(CL_CANONICAL_HOST,
237 [AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS])
238 dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it.
239 ac_aux_dir=${srcdir}/$1
240 dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh.
241 ac_config_guess=$ac_aux_dir/config.guess
242 ac_config_sub=$ac_aux_dir/config.sub
243 AC_CACHE_CHECK(host system type, cl_cv_host, [
244 dnl Mostly copied from AC_CANONICAL_HOST.
245 # Make sure we can run config.sub.
246 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
247 else AC_MSG_ERROR(can not run $ac_config_sub)
250 case "$host_alias" in
253 NONE) dnl config.guess needs to compile things
254 host_alias=`export CC; ${CONFIG_SHELL-/bin/sh} $ac_config_guess` ;;
255 *) host_alias=$nonopt ;;
258 # Don't fail just because the system is not listed in GNU's database.
259 if test -n "$host_alias"; then
260 host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
263 host=unknown-unknown-unknown
265 cl_cv_host_alias="$host_alias"
268 host_alias="$cl_cv_host_alias"
271 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
272 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
273 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
276 AC_SUBST(host_cpu)dnl
277 AC_SUBST(host_vendor)dnl
279 dnl We have defined $ac_aux_dir.
280 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
281 dnl We have defined $host_alias and $host.
282 AC_PROVIDE([AC_CANONICAL_HOST])dnl
286 [dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
287 dnl those with the standalone libiconv installed).
288 AC_CACHE_CHECK(for iconv, cl_cv_func_iconv, [
291 AC_TRY_LINK([#include <stdlib.h>
293 [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);],
294 cl_cv_func_iconv=yes)
295 if test "$cl_cv_func_iconv" = no; then
298 AC_TRY_LINK([#include <stdlib.h>
300 [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);],
302 cl_cv_func_iconv=yes)
306 if test "$cl_cv_func_iconv" = yes; then
307 AC_DEFINE(HAVE_ICONV)
314 #include <sys/types.h>
316 ], [size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t* outbytesleft);],
318 cl_cv_proto_iconv_arg1)],
319 [extern size_t iconv (iconv_t cd, $cl_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t* outbytesleft);])
320 AC_DEFINE_UNQUOTED(ICONV_CONST,$cl_cv_proto_iconv_arg1)
323 if test "$cl_cv_lib_iconv" = yes; then
329 AC_DEFUN(CL_WORDS_LITTLEENDIAN,
330 [AC_CACHE_CHECK(byte ordering, cl_cv_sys_endian, [
331 AC_TRY_RUN([int main () {
332 /* Are we little or big endian? From Harbison&Steele. */
336 char c[sizeof (long)];
341 cl_cv_sys_endian="big endian",
342 cl_cv_sys_endian="little endian",
343 : # must guess the endianness
345 if test -z "$cl_cv_sys_endian"; then
346 AC_EGREP_CPP(yes,[#if defined(m68k) || defined(__m68k__) || defined(mc68000) || defined(mc68020) || defined(__mc68020__) || defined(sparc) || defined(__sparc__) || defined(MIPSEB) || defined(__MIPSEB__) || defined(hppa) || defined(__hppa) || defined(m88000) || defined(__m88k__)
349 ], cl_cv_sys_endian="big endian")
351 if test -z "$cl_cv_sys_endian"; then
352 AC_EGREP_CPP(yes,[#if defined(i386) || defined(__i386) || defined(__i386__) || defined(_I386) || defined(MIPSEL) || defined(__MIPSEL__) || defined(__alpha)
355 ], cl_cv_sys_endian="little endian")
357 if test -z "$cl_cv_sys_endian"; then
358 cl_cv_sys_endian="guessing little endian"
361 case "$cl_cv_sys_endian" in
362 *little*) AC_DEFINE(WORDS_LITTLEENDIAN) ;;
367 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
368 ## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
369 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
371 ## This program is free software; you can redistribute it and/or modify
372 ## it under the terms of the GNU General Public License as published by
373 ## the Free Software Foundation; either version 2 of the License, or
374 ## (at your option) any later version.
376 ## This program is distributed in the hope that it will be useful, but
377 ## WITHOUT ANY WARRANTY; without even the implied warranty of
378 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
379 ## General Public License for more details.
381 ## You should have received a copy of the GNU General Public License
382 ## along with this program; if not, write to the Free Software
383 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
385 ## As a special exception to the GNU General Public License, if you
386 ## distribute this file as part of a program that contains a
387 ## configuration script generated by Autoconf, you may include it under
388 ## the same distribution terms that you use for the rest of that program.
390 # serial 40 AC_PROG_LIBTOOL
391 AC_DEFUN(AC_PROG_LIBTOOL,
392 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
394 # Save cache, so that ltconfig can load it
397 # Actually configure libtool. ac_aux_dir is where install-sh is found.
398 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
399 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
400 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
401 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
402 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
403 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
404 || AC_MSG_ERROR([libtool configure failed])
406 # Reload cache, that may have been modified by ltconfig
409 # This can be used to rebuild libtool when needed
410 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
412 # Always use our own libtool.
413 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
416 # Redirect the config.log output again, so that the ltconfig log is not
417 # clobbered by the next message.
421 AC_DEFUN(AC_LIBTOOL_SETUP,
423 AC_REQUIRE([AC_ENABLE_SHARED])dnl
424 AC_REQUIRE([AC_ENABLE_STATIC])dnl
425 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
426 AC_REQUIRE([CL_CANONICAL_HOST])dnl
427 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
428 AC_REQUIRE([CL_PROG_RANLIB])dnl
429 AC_REQUIRE([AC_PROG_CC])dnl
430 AC_REQUIRE([AC_PROG_LD])dnl
431 AC_REQUIRE([AC_PROG_NM])dnl
432 AC_REQUIRE([CL_PROG_LN_S])dnl
436 NONE) lt_target="$host" ;;
437 *) lt_target="$target" ;;
440 # Check for any special flags to pass to ltconfig.
441 libtool_flags="--cache-file=$cache_file"
442 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
443 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
444 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
445 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
446 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
447 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
448 [libtool_flags="$libtool_flags --enable-dlopen"])
449 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
450 [libtool_flags="$libtool_flags --enable-win32-dll"])
451 AC_ARG_ENABLE(libtool-lock,
452 [ --disable-libtool-lock avoid locking (might break parallel builds)])
453 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
454 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
456 # Some flags need to be propagated to the compiler or linker for good
460 # Find out which ABI we are using.
461 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
462 if AC_TRY_EVAL(ac_compile); then
463 case "`/usr/bin/file conftest.o`" in
479 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
480 SAVE_CFLAGS="$CFLAGS"
481 CFLAGS="$CFLAGS -belf"
482 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
483 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
484 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
485 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
486 CFLAGS="$SAVE_CFLAGS"
490 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
491 [*-*-cygwin* | *-*-mingw*)
492 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
493 AC_CHECK_TOOL(AS, as, false)
494 AC_CHECK_TOOL(OBJDUMP, objdump, false)
500 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
501 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
503 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
504 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
506 # AC_ENABLE_SHARED - implement the --enable-shared flag
507 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
508 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
510 AC_DEFUN(AC_ENABLE_SHARED, [dnl
511 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
512 AC_ARG_ENABLE(shared,
513 changequote(<<, >>)dnl
514 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
516 [p=${PACKAGE-default}
518 yes) enable_shared=yes ;;
519 no) enable_shared=no ;;
522 # Look at the argument we got. We use all the common list separators.
523 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
524 for pkg in $enableval; do
525 if test "X$pkg" = "X$p"; then
532 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
535 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
536 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
537 AC_ENABLE_SHARED(no)])
539 # AC_ENABLE_STATIC - implement the --enable-static flag
540 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
541 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
543 AC_DEFUN(AC_ENABLE_STATIC, [dnl
544 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
545 AC_ARG_ENABLE(static,
546 changequote(<<, >>)dnl
547 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
549 [p=${PACKAGE-default}
551 yes) enable_static=yes ;;
552 no) enable_static=no ;;
555 # Look at the argument we got. We use all the common list separators.
556 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
557 for pkg in $enableval; do
558 if test "X$pkg" = "X$p"; then
565 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
568 # AC_DISABLE_STATIC - set the default static flag to --disable-static
569 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
570 AC_ENABLE_STATIC(no)])
573 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
574 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
575 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
577 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
578 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
579 AC_ARG_ENABLE(fast-install,
580 changequote(<<, >>)dnl
581 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
583 [p=${PACKAGE-default}
585 yes) enable_fast_install=yes ;;
586 no) enable_fast_install=no ;;
588 enable_fast_install=no
589 # Look at the argument we got. We use all the common list separators.
590 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
591 for pkg in $enableval; do
592 if test "X$pkg" = "X$p"; then
593 enable_fast_install=yes
599 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
602 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
603 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
604 AC_ENABLE_FAST_INSTALL(no)])
606 # AC_PROG_LD - find the path to the GNU or non-GNU linker
609 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
610 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
611 AC_REQUIRE([AC_PROG_CC])dnl
612 AC_REQUIRE([CL_CANONICAL_HOST])dnl
613 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
615 if test "$ac_cv_prog_gcc" = yes; then
616 # Check if gcc -print-prog-name=ld gives a path.
617 AC_MSG_CHECKING([for ld used by GCC])
618 ac_prog=`($CC -print-prog-name=ld) 2>&5`
620 # Accept absolute paths.
622 [\\/]* | [A-Za-z]:[\\/]*)
623 re_direlt='/[^/][^/]*/\.\./'
625 # Canonicalize the path of ld
626 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
627 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
628 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
630 test -z "$LD" && LD="$ac_prog"
633 # If it fails, then pretend we aren't using GCC.
637 # If it is relative, then search for the first ld in PATH.
641 elif test "$with_gnu_ld" = yes; then
642 AC_MSG_CHECKING([for GNU ld])
644 AC_MSG_CHECKING([for non-GNU ld])
646 AC_CACHE_VAL(ac_cv_path_LD,
647 [if test -z "$LD"; then
648 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
649 for ac_dir in $PATH; do
650 test -z "$ac_dir" && ac_dir=.
651 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
652 ac_cv_path_LD="$ac_dir/$ac_prog"
653 # Check to see if the program is GNU ld. I'd rather use --version,
654 # but apparently some GNU ld's only accept -v.
655 # Break only if it was the GNU/non-GNU ld that we prefer.
656 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
657 test "$with_gnu_ld" != no && break
659 test "$with_gnu_ld" != yes && break
665 ac_cv_path_LD="$LD" # Let the user override the test with a path.
668 if test -n "$LD"; then
673 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
677 AC_DEFUN(AC_PROG_LD_GNU,
678 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
679 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
680 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
681 ac_cv_prog_gnu_ld=yes
687 # AC_PROG_NM - find the path to a BSD-compatible name lister
689 [AC_MSG_CHECKING([for BSD-compatible nm])
690 AC_CACHE_VAL(ac_cv_path_NM,
691 [if test -n "$NM"; then
692 # Let the user override the test.
695 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
696 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
697 test -z "$ac_dir" && ac_dir=.
698 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
699 # Check to see if the nm accepts a BSD-compat flag.
700 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
701 # nm: unknown option "B" ignored
702 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
703 ac_cv_path_NM="$ac_dir/nm -B"
705 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
706 ac_cv_path_NM="$ac_dir/nm -p"
709 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
710 continue # so that we can try to find one that supports BSD flags
715 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
721 # AC_CHECK_LIBM - check for math library
722 AC_DEFUN(AC_CHECK_LIBM,
723 [AC_REQUIRE([CL_CANONICAL_HOST])dnl
726 *-*-beos* | *-*-cygwin*)
727 # These system don't have libm
730 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
731 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
734 AC_CHECK_LIB(m, main, LIBM="-lm")
739 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
740 # the libltdl convenience library and INCLTDL to the include flags for
741 # the libltdl header and adds --enable-ltdl-convenience to the
742 # configure arguments. Note that LIBLTDL and INCLTDL are not
743 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
744 # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
745 # with '${top_builddir}/' and INCLTDL will be prefixed with
746 # '${top_srcdir}/' (note the single quotes!). If your package is not
747 # flat and you're not using automake, define top_builddir and
748 # top_srcdir appropriately in the Makefiles.
749 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
750 case "$enable_ltdl_convenience" in
751 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
752 "") enable_ltdl_convenience=yes
753 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
755 LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
756 INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
759 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
760 # the libltdl installable library and INCLTDL to the include flags for
761 # the libltdl header and adds --enable-ltdl-install to the configure
762 # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
763 # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
764 # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
765 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
766 # with '${top_srcdir}/' (note the single quotes!). If your package is
767 # not flat and you're not using automake, define top_builddir and
768 # top_srcdir appropriately in the Makefiles.
769 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
770 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
771 AC_CHECK_LIB(ltdl, main,
772 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
773 [if test x"$enable_ltdl_install" = xno; then
774 AC_MSG_WARN([libltdl not installed, but installation disabled])
776 enable_ltdl_install=yes
779 if test x"$enable_ltdl_install" = x"yes"; then
780 ac_configure_args="$ac_configure_args --enable-ltdl-install"
781 LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
782 INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
784 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
791 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
792 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
793 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
794 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
795 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
796 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
797 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
799 dnl This is just to silence aclocal about the macro not being used
800 ifelse([AC_DISABLE_FAST_INSTALL])dnl
805 # BeOS 5 has <wchar.h> but does not define mbstate_t,
806 # so you can't declare an object of that type.
807 # Check for this incompatibility with Standard C.
809 # Include stdlib.h first, because otherwise this test would fail on Linux
810 # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
811 # a syntax error in wchar.h due to the use of undefined __int32_t.
813 AC_DEFUN(AC_MBSTATE_T,
815 AC_CHECK_HEADERS(stdlib.h)
817 AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
823 [mbstate_t x; return sizeof x;],
824 ac_cv_type_mbstate_t=yes,
825 ac_cv_type_mbstate_t=no)])
826 if test $ac_cv_type_mbstate_t = no; then
827 AC_DEFINE(mbstate_t, int,
828 [Define to a type if <wchar.h> does not define.])