libtool/libltdl/configure.in
Alexandre Oliva 981a66b4df * libltdl/configure.in: reintroduce code to detect native library
extension
* libltdl/ltdl.c (lt_dlopen): if a .la file name is given, that's
all.  Otherwise, lt_dlopen now tries to append .la first.  If this
fails, it tries the given filename, and, at last, tries to append
the native library extension to the given filename.
* doc/libtool.texi (lt_dlopen): explain new lookup strategy
1999-01-21 05:08:23 +00:00

145 lines
3.5 KiB
Plaintext

dnl Process this file with autoconf to create configure.
dnl Initialize the libltdl package.
AC_INIT(ltdl.c)
AM_INIT_AUTOMAKE(libltdl,1.0,-)
AM_MAINTAINER_MODE
AC_ARG_ENABLE(ltdl-install,
[--enable-ltdl-install install libltdl])
AM_CONDITIONAL(INSTALL_LTDL, test x$enable_ltdl_install = xyes)
if test x$enable_ltdl_install = xyes; then
LIBLIBS=libltdl.la
NOINSTLIBS=
else
LIBLIBS=
NOINSTLIBS=libltdl.la
fi
AC_SUBST(LIBLIBS)
AC_SUBST(NOINSTLIBS)
AC_PROG_CC
AC_C_CONST
AC_C_INLINE
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CACHE_CHECK([which extension is used for shared libraries],
libltdl_cv_shlibext, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
last=
for spec in $library_names_spec; do
last="$spec"
done
rm -f conftest
changequote(, )
echo "$last" | sed 's/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
changequote([, ])
)
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext")
fi
AC_CACHE_CHECK([which variable specifies run-time library path],
libltdl_cv_shlibpath_var, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
rm -f conftest
echo "$shlibpath_var" > conftest
)
libltdl_cv_shlibpath_var=`cat conftest`
rm -f conftest
])
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
fi
AC_CACHE_CHECK([for objdir],
libltdl_cv_objdir, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
rm -f conftest
echo "$objdir" > conftest
)
libltdl_cv_objdir=`cat conftest`
rm -f conftest
])
test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir")
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
libltdl_cv_preloaded_symbols, [dnl
if grep '^global_symbol_pipe=..*$' ./libtool >/dev/null; then
libltdl_cv_preloaded_symbols=yes
else
libltdl_cv_preloaded_symbols=no
fi
])
if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
AC_DEFINE(HAVE_PRELOADED_SYMBOLS)
fi
test_dlerror=no
LIBADD_DL=
AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL) test_dlerror=yes],
[AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL) LIBADD_DL="-ldl" test_dlerror=yes],
[AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD) LIBADD_DL="-ldld"],
[AC_CHECK_FUNCS(shl_load, AC_DEFINE(HAVE_SHL_LOAD))]
)]
)]
)
AC_SUBST(LIBADD_DL)
if test "$test_dlerror" = yes; then
LIBS_SAVE="$LIBS"
LIBS="$LIBS $LIBADD_DL"
AC_CHECK_FUNCS(dlerror)
LIBS="$LIBS_SAVE"
fi
AM_SYS_SYMBOL_UNDERSCORE
if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then
if test x"$ac_cv_func_dlopen" = xyes ||
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
libltdl_cv_need_uscore, [dnl
AC_TRY_RUN([
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) exit(0); } exit(1); }
], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
libltdl_cv_need_uscore=no
)])
fi
fi
if test x"$libltdl_cv_need_uscore" = xyes; then
AC_DEFINE(NEED_USCORE)
fi
dnl Output the makefile
AC_OUTPUT(Makefile)
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End: