1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
14 # serial 39 AC_PROG_LIBTOOL
15 AC_DEFUN(AC_PROG_LIBTOOL,
16 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
18 # Save cache, so that ltconfig can load it
22 # Actually configure libtool. ac_aux_dir is where install-sh is found.
23 AR="$AR" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
24 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
25 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
26 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
27 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
28 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
29 || AC_MSG_ERROR([libtool configure failed])
31 # Reload cache, that may have been modified by ltconfig
34 # This can be used to rebuild libtool when needed
35 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
37 # Always use our own libtool.
38 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
41 # Redirect the config.log output again, so that the ltconfig log is not
42 # clobbered by the next message.
46 AC_DEFUN(AC_LIBTOOL_SETUP,
48 AC_REQUIRE([AC_ENABLE_SHARED])dnl
49 AC_REQUIRE([AC_ENABLE_STATIC])dnl
50 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
51 AC_REQUIRE([AC_CANONICAL_HOST])dnl
52 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
53 AC_REQUIRE([AC_PROG_RANLIB])dnl
54 AC_REQUIRE([AC_PROG_CC])dnl
55 AC_REQUIRE([AC_PROG_LD])dnl
56 AC_REQUIRE([AC_PROG_NM])dnl
57 AC_REQUIRE([AC_PROG_LN_S])dnl
60 # Check for any special flags to pass to ltconfig.
61 libtool_flags="--cache-file=$cache_file"
62 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
63 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
64 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
65 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
66 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
67 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
68 [libtool_flags="$libtool_flags --enable-dlopen"])
69 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
70 [libtool_flags="$libtool_flags --enable-win32-dll"])
71 AC_ARG_ENABLE(libtool-lock,
72 [ --disable-libtool-lock avoid locking (might break parallel builds)])
73 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
74 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
76 # Some flags need to be propagated to the compiler or linker for good
80 # Find out which ABI we are using.
81 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
82 if AC_TRY_EVAL(ac_compile); then
83 case "`/usr/bin/file conftest.o`" in
99 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
100 SAVE_CFLAGS="$CFLAGS"
101 CFLAGS="$CFLAGS -belf"
102 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
103 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
104 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
105 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
106 CFLAGS="$SAVE_CFLAGS"
110 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
111 [*-*-cygwin* | *-*-mingw*)
112 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
113 AC_CHECK_TOOL(AS, as, false)
114 AC_CHECK_TOOL(OBJDUMP, objdump, false)
120 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
121 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
123 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
124 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
126 # AC_ENABLE_SHARED - implement the --enable-shared flag
127 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
128 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
130 AC_DEFUN(AC_ENABLE_SHARED, [dnl
131 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
132 AC_ARG_ENABLE(shared,
133 changequote(<<, >>)dnl
134 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
136 [p=${PACKAGE-default}
138 yes) enable_shared=yes ;;
139 no) enable_shared=no ;;
142 # Look at the argument we got. We use all the common list separators.
143 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
144 for pkg in $enableval; do
145 if test "X$pkg" = "X$p"; then
152 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
155 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
156 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
157 AC_ENABLE_SHARED(no)])
159 # AC_ENABLE_STATIC - implement the --enable-static flag
160 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
161 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
163 AC_DEFUN(AC_ENABLE_STATIC, [dnl
164 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
165 AC_ARG_ENABLE(static,
166 changequote(<<, >>)dnl
167 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
169 [p=${PACKAGE-default}
171 yes) enable_static=yes ;;
172 no) enable_static=no ;;
175 # Look at the argument we got. We use all the common list separators.
176 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
177 for pkg in $enableval; do
178 if test "X$pkg" = "X$p"; then
185 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
188 # AC_DISABLE_STATIC - set the default static flag to --disable-static
189 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
190 AC_ENABLE_STATIC(no)])
193 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
194 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
195 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
197 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
198 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
199 AC_ARG_ENABLE(fast-install,
200 changequote(<<, >>)dnl
201 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
203 [p=${PACKAGE-default}
205 yes) enable_fast_install=yes ;;
206 no) enable_fast_install=no ;;
208 enable_fast_install=no
209 # Look at the argument we got. We use all the common list separators.
210 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
211 for pkg in $enableval; do
212 if test "X$pkg" = "X$p"; then
213 enable_fast_install=yes
219 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
222 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
223 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
224 AC_ENABLE_FAST_INSTALL(no)])
226 # AC_PROG_LD - find the path to the GNU or non-GNU linker
229 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
230 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
231 AC_REQUIRE([AC_PROG_CC])dnl
232 AC_REQUIRE([AC_CANONICAL_HOST])dnl
233 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
235 if test "$ac_cv_prog_gcc" = yes; then
236 # Check if gcc -print-prog-name=ld gives a path.
237 AC_MSG_CHECKING([for ld used by GCC])
238 ac_prog=`($CC -print-prog-name=ld) 2>&5`
240 # Accept absolute paths.
242 [\\/]* | [A-Za-z]:[\\/]*)
243 re_direlt='/[^/][^/]*/\.\./'
245 # Canonicalize the path of ld
246 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
247 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
248 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
250 test -z "$LD" && LD="$ac_prog"
253 # If it fails, then pretend we aren't using GCC.
257 # If it is relative, then search for the first ld in PATH.
261 elif test "$with_gnu_ld" = yes; then
262 AC_MSG_CHECKING([for GNU ld])
264 AC_MSG_CHECKING([for non-GNU ld])
266 AC_CACHE_VAL(ac_cv_path_LD,
267 [if test -z "$LD"; then
268 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
269 for ac_dir in $PATH; do
270 test -z "$ac_dir" && ac_dir=.
271 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
272 ac_cv_path_LD="$ac_dir/$ac_prog"
273 # Check to see if the program is GNU ld. I'd rather use --version,
274 # but apparently some GNU ld's only accept -v.
275 # Break only if it was the GNU/non-GNU ld that we prefer.
276 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
277 test "$with_gnu_ld" != no && break
279 test "$with_gnu_ld" != yes && break
285 ac_cv_path_LD="$LD" # Let the user override the test with a path.
288 if test -n "$LD"; then
293 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
298 AC_DEFUN(AC_PROG_LD_GNU,
299 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
300 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
301 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
302 ac_cv_prog_gnu_ld=yes
308 # AC_PROG_NM - find the path to a BSD-compatible name lister
310 [AC_MSG_CHECKING([for BSD-compatible nm])
311 AC_CACHE_VAL(ac_cv_path_NM,
312 [if test -n "$NM"; then
313 # Let the user override the test.
316 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
317 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
318 test -z "$ac_dir" && ac_dir=.
319 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
320 # Check to see if the nm accepts a BSD-compat flag.
321 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
322 # nm: unknown option "B" ignored
323 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
324 ac_cv_path_NM="$ac_dir/nm -B"
326 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
327 ac_cv_path_NM="$ac_dir/nm -p"
330 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
331 continue # so that we can try to find one that supports BSD flags
336 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
343 # AC_CHECK_LIBM - check for math library
344 AC_DEFUN(AC_CHECK_LIBM,
345 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
348 *-*-beos* | *-*-cygwin*)
349 # These system don't have libm
352 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
353 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
356 AC_CHECK_LIB(m, main, LIBM="-lm")
361 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
362 # the libltdl convenience library, adds --enable-ltdl-convenience to
363 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
364 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
365 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
366 # '${top_builddir}/' (note the single quotes!) if your package is not
367 # flat, and, if you're not using automake, define top_builddir as
368 # appropriate in the Makefiles.
369 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
370 case "$enable_ltdl_convenience" in
371 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
372 "") enable_ltdl_convenience=yes
373 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
375 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
378 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
379 # the libltdl installable library, and adds --enable-ltdl-install to
380 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
381 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
382 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
383 # '${top_builddir}/' (note the single quotes!) if your package is not
384 # flat, and, if you're not using automake, define top_builddir as
385 # appropriate in the Makefiles.
386 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
387 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
388 AC_CHECK_LIB(ltdl, main,
389 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
390 [if test x"$enable_ltdl_install" = xno; then
391 AC_MSG_WARN([libltdl not installed, but installation disabled])
393 enable_ltdl_install=yes
396 if test x"$enable_ltdl_install" = x"yes"; then
397 ac_configure_args="$ac_configure_args --enable-ltdl-install"
398 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
400 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
406 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
407 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
408 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
409 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
410 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
411 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
412 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
414 dnl This is just to quiet aclocal about the macro not being used
415 dnl if(a,b,[AC_DISABLE_FAST_INSTALL])dnl
417 # Do all the work for Automake. This macro actually does too much --
418 # some checks are only needed if your package does certain things.
419 # But this isn't really a big deal.
424 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
426 AC_DEFUN(AM_INIT_AUTOMAKE,
427 [AC_REQUIRE([AC_PROG_INSTALL])
432 dnl test to see if srcdir already configured
433 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
434 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
437 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
438 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
439 AC_REQUIRE([AM_SANITY_CHECK])
440 AC_REQUIRE([AC_ARG_PROGRAM])
441 dnl FIXME This is truly gross.
442 missing_dir=`cd $ac_aux_dir && pwd`
443 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
444 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
445 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
446 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
447 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
448 AC_REQUIRE([AC_PROG_MAKE_SET])])
451 # Check to make sure that the build environment is sane.
454 AC_DEFUN(AM_SANITY_CHECK,
455 [AC_MSG_CHECKING([whether build environment is sane])
458 echo timestamp > conftestfile
459 # Do `set' in a subshell so we don't clobber the current shell's
460 # arguments. Must try -L first in case configure is actually a
461 # symlink; some systems play weird games with the mod time of symlinks
462 # (eg FreeBSD returns the mod time of the symlink's containing
465 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
466 if test "[$]*" = "X"; then
468 set X `ls -t $srcdir/configure conftestfile`
470 if test "[$]*" != "X $srcdir/configure conftestfile" \
471 && test "[$]*" != "X conftestfile $srcdir/configure"; then
473 # If neither matched, then we have a broken ls. This can happen
474 # if, for instance, CONFIG_SHELL is bash and it inherits a
475 # broken ls alias from the environment. This has actually
476 # happened. Such a system could not be considered "sane".
477 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
478 alias in your environment])
481 test "[$]2" = conftestfile
487 AC_MSG_ERROR([newly created file is older than distributed files!
488 Check your system clock])
493 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
494 dnl The program must properly implement --version.
495 AC_DEFUN(AM_MISSING_PROG,
496 [AC_MSG_CHECKING(for working $2)
497 # Run test in a subshell; some versions of sh will print an error if
498 # an executable is not found, even if stderr is redirected.
499 # Redirect stdin to placate older versions of autoconf. Sigh.
500 if ($2 --version) < /dev/null > /dev/null 2>&1; then
505 AC_MSG_RESULT(missing)
509 # Like AC_CONFIG_HEADER, but automatically create stamp file.
511 AC_DEFUN(AM_CONFIG_HEADER,
513 AC_CONFIG_HEADER([$1])
514 dnl When config.status generates a header, we must update the stamp-h file.
515 dnl This file resides in the same directory as the config header
516 dnl that is generated. We must strip everything past the first ":",
517 dnl and everything past the last "/".
518 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
519 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
520 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
522 for am_file in <<$1>>; do
523 case " <<$>>CONFIG_HEADERS " in
524 *" <<$>>am_file "*<<)>>
525 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
528 am_indx=`expr "<<$>>am_indx" + 1`
532 # Add --enable-maintainer-mode option to configure.
537 AC_DEFUN(AM_MAINTAINER_MODE,
538 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
539 dnl maintainer-mode is disabled by default
540 AC_ARG_ENABLE(maintainer-mode,
541 [ --enable-maintainer-mode enable make rules and dependencies not useful
542 (and sometimes confusing) to the casual installer],
543 USE_MAINTAINER_MODE=$enableval,
544 USE_MAINTAINER_MODE=no)
545 AC_MSG_RESULT($USE_MAINTAINER_MODE)
546 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
547 MAINT=$MAINTAINER_MODE_TRUE
552 # Define a conditional.
554 AC_DEFUN(AM_CONDITIONAL,
566 # serial 1 AC_LIB_LTDL
568 AC_DEFUN(AC_LIB_LTDL,
570 AC_REQUIRE([AC_PROG_CC])dnl
571 AC_REQUIRE([AC_C_CONST])dnl
572 AC_REQUIRE([AC_C_INLINE])dnl
574 dnl AC_LIB_LTDL must perform all the checks necessary for compilation
575 dnl of the ltdl objects -- including compiler checks (above) and header
577 AC_REQUIRE([AC_HEADER_STDC])dnl
579 AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
580 AC_CHECK_HEADERS(string.h strings.h, break)
581 AC_CHECK_FUNCS(strchr index, break)
582 AC_CHECK_FUNCS(strrchr rindex, break)
583 AC_CHECK_FUNCS(strcmp)
585 AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])dnl
586 AC_REQUIRE([AC_LTDL_SHLIBEXT])dnl
587 AC_REQUIRE([AC_LTDL_SHLIBPATH])dnl
588 AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])dnl
589 AC_REQUIRE([AC_LTDL_OBJDIR])dnl
590 AC_REQUIRE([AC_LTDL_DLPREOPEN])dnl
591 AC_REQUIRE([AC_LTDL_DLLIB])dnl
592 AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
595 AC_DEFUN(AC_LTDL_ENABLE_INSTALL,
596 [AC_ARG_ENABLE(ltdl-install,
597 [ --enable-ltdl-install install libltdl])
599 AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
600 AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
604 AC_DEFUN(AC_LTDL_SNARF_CONFIG,
605 [# Read the libtool configuration
607 ./libtool --config > conftest
612 AC_DEFUN(AC_LTDL_SHLIBEXT,
613 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
614 AC_CACHE_CHECK([which extension is used for shared libraries],
615 libltdl_cv_shlibext, [dnl
618 for spec in $library_names_spec; do
622 echo "$last" | sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
625 libltdl_cv_shlibext=`cat conftest`
628 if test -n "$libltdl_cv_shlibext"; then
629 AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
630 [Define to the extension used for shared libraries, say, ".so". ])
634 AC_DEFUN(AC_LTDL_SHLIBPATH,
635 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
636 AC_CACHE_CHECK([which variable specifies run-time library path],
637 libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
638 if test -n "$libltdl_cv_shlibpath_var"; then
639 AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
640 [Define to the name of the environment variable that determines the dynamic library search path. ])
644 AC_DEFUN(AC_LTDL_SYSSEARCHPATH,
645 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
646 AC_CACHE_CHECK([for the default library search path],
647 libltdl_cv_sys_search_path, [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
648 if test -n "$libltdl_cv_sys_search_path"; then
650 *-*-mingw*) pathsep=";" ;;
654 for dir in $libltdl_cv_sys_search_path; do
655 if test -z "$sys_search_path"; then
656 sys_search_path="$dir"
658 sys_search_path="$sys_search_path$pathsep$dir"
661 AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
662 [Define to the system default library search path. ])
666 AC_DEFUN(AC_LTDL_OBJDIR,
667 [AC_CACHE_CHECK([for objdir],
668 libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"
669 if test -n "$objdir"; then
672 rm -f .libs 2>/dev/null
673 mkdir .libs 2>/dev/null
674 if test -d .libs; then
675 libltdl_cv_objdir=.libs
677 # MS-DOS does not allow filenames that begin with a dot.
678 libltdl_cv_objdir=_libs
680 rmdir .libs 2>/dev/null
682 AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
683 [Define to the sub-directory in which libtool stores uninstalled libraries. ])
686 AC_DEFUN(AC_LTDL_DLPREOPEN,
687 [AC_REQUIRE([AC_LTDL_GLOBAL_SYMBOL_PIPE])dnl
688 AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
689 libltdl_cv_preloaded_symbols, [dnl
690 if test -n "$global_symbol_pipe"; then
691 libltdl_cv_preloaded_symbols=yes
693 libltdl_cv_preloaded_symbols=no
696 if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
697 AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
698 [Define if libtool can extract symbol lists from object files. ])
702 AC_DEFUN(AC_LTDL_DLLIB,
704 AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
705 [Define if you have the libdl library or equivalent. ]) LIBADD_DL="-ldl"],
706 [AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
707 [Define if you have the libdl library or equivalent.])])])
708 AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
709 [Define if you have the shl_load function.])],
710 [AC_CHECK_LIB(dld, shl_load,
711 [AC_DEFINE(HAVE_SHL_LOAD, 1,
712 [Define if you have the shl_load function.])
713 LIBADD_DL="$LIBADD_DL -ldld"])
715 AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
716 [Define if you have the GNU dld library.])dnl
717 test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
720 if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
722 LIBS="$LIBS $LIBADD_DL"
723 AC_CHECK_FUNCS(dlerror)
728 AC_DEFUN(AC_LTDL_GLOBAL_SYMBOL_PIPE,
729 [dnl Check for command to grab the raw symbol name followed
730 dnl by C symbol name from nm.
731 AC_REQUIRE([AC_CANONICAL_HOST])dnl
732 AC_REQUIRE([AC_PROG_NM])dnl
733 # Check for command to grab the raw symbol name followed by C symbol from nm.
734 AC_MSG_CHECKING([command to parse $NM output])
735 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
736 [# These are sane defaults that work on at least a few old systems.
737 # {They come from Ultrix. What could be older than Ultrix?!! ;)}
740 # Character class describing NM global symbol codes.
741 ac_symcode='[BCDEGRST]'
743 # Regexp to match symbols that can be accessed directly from C.
744 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
746 # Transform the above into a raw symbol and a C symbol.
747 ac_symxfrm='\1 \2\3 \3'
749 # Transform an extracted symbol line into a proper C declaration
750 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
752 # Define system-specific variables.
758 ac_symcode='[ABCDGISTW]'
761 ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
764 ac_symcode='[BCDEGRST]'
771 # If we're using GNU nm, then use its standard symbol codes.
772 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
773 ac_symcode='[ABCDGISTW]'
777 # Try without a prefix undercore, then with it.
778 for ac_symprfx in "" "_"; do
780 ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
782 # Check to see that the pipe works correctly.
784 rm -f conftest.$ac_ext
785 cat > conftest.$ac_ext <<EOF
790 void nm_test_func(){}
794 int main(){nm_test_var='a';nm_test_func;return 0;}
797 if AC_TRY_EVAL(ac_compile); then
798 # Now try to grab the symbols.
801 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
803 # Try sorting and uniquifying the output.
804 if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
805 mv -f "$ac_nlist"T "$ac_nlist"
810 # Make sure that we snagged all the symbols we need.
811 if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
812 if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
813 cat <<EOF > conftest.c
819 # Now generate the symbol file.
820 eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
822 cat <<EOF >> conftest.c
823 #if defined (__STDC__) && __STDC__
824 # define lt_ptr_t void *
826 # define lt_ptr_t char *
830 /* The mapping between symbol names and symbols. */
836 lt_preloaded_symbols[] =
840 sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
841 cat <<\EOF >> conftest.c
849 # Now try linking the two files.
850 mv conftest.$ac_objext conftstm.$ac_objext
852 ac_save_CFLAGS="$CFLAGS"
853 LIBS="conftstm.$ac_objext"
854 CFLAGS="$CFLAGS$no_builtin_flag"
855 if AC_TRY_EVAL(ac_link) && test -s conftest; then
858 echo "configure: failed program was:" >&AC_FD_CC
859 cat conftest.c >&AC_FD_CC
862 CFLAGS="$ac_save_CFLAGS"
864 echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
867 echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
870 echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
873 echo "$progname: failed program was:" >&AC_FD_CC
874 cat conftest.c >&AC_FD_CC
876 rm -rf conftest* conftst*
878 # Do not use the global_symbol_pipe unless it works.
879 if test "$ac_pipe_works" = yes; then
880 if test x"$ac_symprfx" = x"_"; then
881 ac_cv_sys_symbol_underscore=yes
883 ac_cv_sys_symbol_underscore=no
887 ac_cv_sys_global_symbol_pipe=
893 if test -z "$ac_cv_sys_global_symbol_pipe"; then
896 AC_MSG_RESULT($ac_result)
899 AC_DEFUN(AC_LTDL_SYMBOL_USCORE,
900 [dnl does the compiler prefix global symbols with an underscore?
901 AC_REQUIRE([AC_LTDL_GLOBAL_SYMBOL_PIPE])dnl
902 AC_MSG_CHECKING([for _ prefix in compiled symbols])
903 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
904 [ac_cv_sys_symbol_underscore=no
905 cat > conftest.$ac_ext <<EOF
906 void nm_test_func(){}
907 int main(){nm_test_func;return 0;}
909 if AC_TRY_EVAL(ac_compile); then
910 # Now try to grab the symbols.
912 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
913 # See whether the symbols have a leading underscore.
914 if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
915 ac_cv_sys_symbol_underscore=yes
917 if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
920 echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
924 echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
927 echo "configure: failed program was:" >&AC_FD_CC
928 cat conftest.c >&AC_FD_CC
932 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
936 AC_DEFUN(AC_LTDL_DLSYM_USCORE,
937 [AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
938 if test x"$ac_cv_sys_symbol_underscore" = xyes; then
939 if test x"$ac_cv_func_dlopen" = xyes ||
940 test x"$ac_cv_lib_dl_dlopen" = xyes ; then
941 AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
942 libltdl_cv_need_uscore, [dnl
951 # define LTDL_GLOBAL RTLD_GLOBAL
954 # define LTDL_GLOBAL DL_GLOBAL
956 # define LTDL_GLOBAL 0
960 /* We may have to define LTDL_LAZY_OR_NOW in the command line if we
961 find out it does not work in some platform. */
962 #ifndef LTDL_LAZY_OR_NOW
964 # define LTDL_LAZY_OR_NOW RTLD_LAZY
967 # define LTDL_LAZY_OR_NOW DL_LAZY
970 # define LTDL_LAZY_OR_NOW RTLD_NOW
973 # define LTDL_LAZY_OR_NOW DL_NOW
975 # define LTDL_LAZY_OR_NOW 0
983 main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
984 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
985 if(ptr1 && !ptr2) { dlclose(self); exit(0); } } exit(1); }
986 ], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
987 libltdl_cv_need_uscore=cross
992 if test x"$libltdl_cv_need_uscore" = xyes; then
993 AC_DEFINE(NEED_USCORE, 1,
994 [Define if dlsym() requires a leading underscode in symbol names. ])