* update all copyright notices to 2000
* doc/libtool.texi (using libltdl): document new lt_dlinfo struct,
replace NULL with @code{NULL}, document lt_dlsetdata(),
lt_dlgetdata() and lt_dlgetinfo()
* libltdl/Makefile.am: increment interface version number
* libltdl/configure.in: set version number to 1.1
* libltdl/ltdl.c: make some variables public by moving them
to the info struct, add support for application specific data
within module handles, new lt_dlsetdata(), lt_dlgetdata() and
lt_dlgetinfo() functions,
fix memory leaks, minor cleanups
* libltdl/ltdl.h: ditto
* mdemo/main.c: demonstrate use of lt_dlgetinfo,
improved handling of errors
* ltconfig.in: set hardcode_into_libs = yes for GNU/Hurd, Linux
and Solaris, only hardcode *all* run-paths if hardcode_into_libs
is set to 'all', otherwise hardcode only user-specified rpaths
into libraries
* ltmain.in: minor cleanups, we don't need to add user-specified
rpaths to compile_rpath, finalize_rpath is sufficient
* ltconfig.in: transform linux* -> *linux-gnu* _after_ host_os has
been set! (reported by Bruno Haible <haible@ilog.fr>)
* configure.in: AC_SUBST reload_flag, deplibs_check_method
and file_magic_cmd
* README: use 'libtool --version' instead of 'ltconfig --version'
(suggested by Francios Pinard <pinard@iro.umontreal.ca>
2000-01-13 08:28:09 +08:00
|
|
|
## ltdl.m4 - Configure ltdl for the target system. -*-Shell-script-*-
|
|
|
|
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
|
1999-12-07 18:52:53 +08:00
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful, but
|
|
|
|
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
## General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, write to the Free Software
|
|
|
|
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
##
|
|
|
|
## As a special exception to the GNU General Public License, if you
|
|
|
|
## distribute this file as part of a program that contains a
|
|
|
|
## configuration script generated by Autoconf, you may include it under
|
|
|
|
## the same distribution terms that you use for the rest of that program.
|
|
|
|
|
2001-06-26 08:50:39 +08:00
|
|
|
# serial 3 AC_LIB_LTDL
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LIB_LTDL
|
|
|
|
# -----------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LIB_LTDL,
|
|
|
|
[AC_PREREQ(2.13)dnl
|
1999-12-13 21:44:29 +08:00
|
|
|
AC_REQUIRE([AC_PROG_CC])dnl
|
|
|
|
AC_REQUIRE([AC_C_CONST])dnl
|
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# Perform all the checks necessary for compilation of the ltdl objects
|
|
|
|
# -- including compiler checks (above) and header checks (below).
|
1999-12-13 21:44:29 +08:00
|
|
|
AC_REQUIRE([AC_HEADER_STDC])dnl
|
2001-06-26 08:50:39 +08:00
|
|
|
AC_REQUIRE([AC_HEADER_DIRENT])dnl
|
2000-12-02 03:13:20 +08:00
|
|
|
AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
|
1999-12-13 21:44:29 +08:00
|
|
|
|
2001-04-23 06:50:54 +08:00
|
|
|
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dl.h sys/dl.h dld.h)
|
1999-12-13 21:44:29 +08:00
|
|
|
AC_CHECK_HEADERS(string.h strings.h, break)
|
|
|
|
AC_CHECK_FUNCS(strchr index, break)
|
|
|
|
AC_CHECK_FUNCS(strrchr rindex, break)
|
2001-01-05 17:33:39 +08:00
|
|
|
AC_CHECK_FUNCS(memcpy bcopy, break)
|
2000-02-03 06:43:14 +08:00
|
|
|
AC_CHECK_FUNCS(strcmp)
|
1999-12-13 21:44:29 +08:00
|
|
|
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])dnl
|
|
|
|
AC_REQUIRE([AC_LTDL_SHLIBEXT])dnl
|
|
|
|
AC_REQUIRE([AC_LTDL_SHLIBPATH])dnl
|
2000-01-20 04:34:37 +08:00
|
|
|
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])dnl
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_REQUIRE([AC_LTDL_OBJDIR])dnl
|
|
|
|
AC_REQUIRE([AC_LTDL_DLPREOPEN])dnl
|
|
|
|
AC_REQUIRE([AC_LTDL_DLLIB])dnl
|
|
|
|
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
|
2000-11-21 07:15:09 +08:00
|
|
|
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])dnl
|
2001-02-03 03:02:38 +08:00
|
|
|
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])dnl
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LIB_LTDL
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_ENABLE_INSTALL
|
|
|
|
# ----------------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_ENABLE_INSTALL,
|
2000-01-25 04:34:46 +08:00
|
|
|
[AC_ARG_ENABLE(ltdl-install,
|
1999-12-07 18:52:53 +08:00
|
|
|
[ --enable-ltdl-install install libltdl])
|
|
|
|
|
|
|
|
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
|
|
|
|
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
|
2000-09-17 04:08:07 +08:00
|
|
|
])])# AC_LTDL_ENABLE_INSTALL
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2001-02-03 03:02:38 +08:00
|
|
|
# AC_LTDL_SYS_DLOPEN_DEPLIBS
|
|
|
|
# --------------------------
|
|
|
|
AC_DEFUN(AC_LTDL_SYS_DLOPEN_DEPLIBS,
|
|
|
|
[AC_REQUIRE([AC_CANONICAL_HOST])
|
|
|
|
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
|
|
|
|
libltdl_cv_sys_dlopen_deplibs, [dnl
|
|
|
|
# PORTME does your system automatically load deplibs for dlopen()?
|
|
|
|
libltdl_cv_sys_dlopen_deplibs=unknown
|
|
|
|
case "$host_os" in
|
|
|
|
linux*)
|
|
|
|
libltdl_cv_sys_dlopen_deplibs=yes
|
|
|
|
;;
|
2001-02-05 08:24:55 +08:00
|
|
|
netbsd*)
|
|
|
|
libltdl_cv_sys_dlopen_deplibs=yes
|
|
|
|
;;
|
2001-02-03 03:02:38 +08:00
|
|
|
solaris*)
|
|
|
|
libltdl_cv_sys_dlopen_deplibs=yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
|
|
|
|
AC_DEFINE(LTDL_DLOPEN_DEPLIBS, 1,
|
|
|
|
[Define if the OS needs help to load dependent libraries for dlopen(). ])
|
|
|
|
fi
|
|
|
|
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
|
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_SHLIBEXT
|
|
|
|
# ----------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_SHLIBEXT,
|
2000-09-17 04:08:07 +08:00
|
|
|
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_CACHE_CHECK([which extension is used for shared libraries],
|
2000-09-17 04:08:07 +08:00
|
|
|
libltdl_cv_shlibext,
|
|
|
|
[ac_last=
|
|
|
|
for ac_spec in $library_names_spec; do
|
|
|
|
ac_last="$ac_spec"
|
1999-12-07 18:52:53 +08:00
|
|
|
done
|
2000-09-17 04:08:07 +08:00
|
|
|
echo "$ac_last" | [sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//'] > conftest
|
1999-12-07 18:52:53 +08:00
|
|
|
libltdl_cv_shlibext=`cat conftest`
|
|
|
|
rm -f conftest
|
|
|
|
])
|
|
|
|
if test -n "$libltdl_cv_shlibext"; then
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
|
|
|
|
[Define to the extension used for shared libraries, say, ".so". ])
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_SHLIBEXT
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_SHLIBPATH
|
|
|
|
# -----------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_SHLIBPATH,
|
2000-09-17 04:08:07 +08:00
|
|
|
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_CACHE_CHECK([which variable specifies run-time library path],
|
|
|
|
libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
|
|
|
|
if test -n "$libltdl_cv_shlibpath_var"; then
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
|
|
|
|
[Define to the name of the environment variable that determines the dynamic library search path. ])
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_SHLIBPATH
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_SYSSEARCHPATH
|
|
|
|
# ---------------------
|
2000-01-20 04:34:37 +08:00
|
|
|
AC_DEFUN(AC_LTDL_SYSSEARCHPATH,
|
2000-09-17 04:08:07 +08:00
|
|
|
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
|
2000-01-20 04:34:37 +08:00
|
|
|
AC_CACHE_CHECK([for the default library search path],
|
|
|
|
libltdl_cv_sys_search_path, [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
|
|
|
|
if test -n "$libltdl_cv_sys_search_path"; then
|
2000-09-03 07:06:57 +08:00
|
|
|
case "$host" in
|
2000-01-20 04:34:37 +08:00
|
|
|
*-*-mingw*) pathsep=";" ;;
|
|
|
|
*) pathsep=":" ;;
|
|
|
|
esac
|
|
|
|
sys_search_path=
|
|
|
|
for dir in $libltdl_cv_sys_search_path; do
|
|
|
|
if test -z "$sys_search_path"; then
|
|
|
|
sys_search_path="$dir"
|
|
|
|
else
|
|
|
|
sys_search_path="$sys_search_path$pathsep$dir"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
|
|
|
|
[Define to the system default library search path. ])
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_SYSSEARCHPATH
|
2000-01-20 04:34:37 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_OBJDIR
|
|
|
|
# --------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_OBJDIR,
|
|
|
|
[AC_CACHE_CHECK([for objdir],
|
|
|
|
libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"
|
|
|
|
if test -n "$objdir"; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
rm -f .libs 2>/dev/null
|
|
|
|
mkdir .libs 2>/dev/null
|
|
|
|
if test -d .libs; then
|
|
|
|
libltdl_cv_objdir=.libs
|
|
|
|
else
|
|
|
|
# MS-DOS does not allow filenames that begin with a dot.
|
|
|
|
libltdl_cv_objdir=_libs
|
|
|
|
fi
|
|
|
|
rmdir .libs 2>/dev/null
|
|
|
|
fi])
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
|
|
|
|
[Define to the sub-directory in which libtool stores uninstalled libraries. ])
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_OBJDIR
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_DLPREOPEN
|
|
|
|
# -----------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_DLPREOPEN,
|
2000-09-17 01:55:00 +08:00
|
|
|
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
|
|
|
|
libltdl_cv_preloaded_symbols, [dnl
|
|
|
|
if test -n "$global_symbol_pipe"; 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, 1,
|
|
|
|
[Define if libtool can extract symbol lists from object files. ])
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_DLPREOPEN
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_DLLIB
|
|
|
|
# -------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_DLLIB,
|
|
|
|
[LIBADD_DL=
|
1999-12-10 07:35:14 +08:00
|
|
|
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
|
|
|
|
[Define if you have the libdl library or equivalent. ]) LIBADD_DL="-ldl"],
|
|
|
|
[AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
|
2000-09-04 09:41:59 +08:00
|
|
|
[Define if you have the libdl library or equivalent.])],
|
|
|
|
[AC_CHECK_LIB(svld, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
|
|
|
|
[Define if you have the libdl library or equivalent.]) LIBADD_DL="-lsvld"]
|
|
|
|
)])])
|
1999-12-10 07:35:14 +08:00
|
|
|
AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
|
|
|
|
[Define if you have the shl_load function.])],
|
|
|
|
[AC_CHECK_LIB(dld, shl_load,
|
|
|
|
[AC_DEFINE(HAVE_SHL_LOAD, 1,
|
|
|
|
[Define if you have the shl_load function.])
|
|
|
|
LIBADD_DL="$LIBADD_DL -ldld"])
|
|
|
|
])
|
|
|
|
AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
|
|
|
|
[Define if you have the GNU dld library.])dnl
|
1999-12-07 18:52:53 +08:00
|
|
|
test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
|
|
|
|
AC_SUBST(LIBADD_DL)
|
|
|
|
|
|
|
|
if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
|
|
|
|
LIBS_SAVE="$LIBS"
|
|
|
|
LIBS="$LIBS $LIBADD_DL"
|
|
|
|
AC_CHECK_FUNCS(dlerror)
|
|
|
|
LIBS="$LIBS_SAVE"
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_DLLIB
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_SYMBOL_USCORE
|
|
|
|
# ---------------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_SYMBOL_USCORE,
|
|
|
|
[dnl does the compiler prefix global symbols with an underscore?
|
2000-09-17 01:55:00 +08:00
|
|
|
AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_MSG_CHECKING([for _ prefix in compiled symbols])
|
|
|
|
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
|
|
|
|
[ac_cv_sys_symbol_underscore=no
|
|
|
|
cat > conftest.$ac_ext <<EOF
|
|
|
|
void nm_test_func(){}
|
|
|
|
int main(){nm_test_func;return 0;}
|
|
|
|
EOF
|
|
|
|
if AC_TRY_EVAL(ac_compile); then
|
|
|
|
# Now try to grab the symbols.
|
|
|
|
ac_nlist=conftest.nm
|
2000-09-17 01:55:00 +08:00
|
|
|
if AC_TRY_EVAL(NM conftest.$ac_objext \| $global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
1999-12-07 18:52:53 +08:00
|
|
|
# See whether the symbols have a leading underscore.
|
|
|
|
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
|
|
|
|
ac_cv_sys_symbol_underscore=yes
|
|
|
|
else
|
|
|
|
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
2000-09-17 01:55:00 +08:00
|
|
|
echo "configure: cannot run $global_symbol_pipe" >&AC_FD_CC
|
1999-12-07 18:52:53 +08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "configure: failed program was:" >&AC_FD_CC
|
2000-12-02 03:13:20 +08:00
|
|
|
cat conftest.c >&AC_FD_CC
|
1999-12-07 18:52:53 +08:00
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_SYMBOL_USCORE
|
1999-12-07 18:52:53 +08:00
|
|
|
|
2000-12-02 03:13:20 +08:00
|
|
|
|
2000-09-17 04:08:07 +08:00
|
|
|
# AC_LTDL_DLSYM_USCORE
|
|
|
|
# --------------------
|
1999-12-07 18:52:53 +08:00
|
|
|
AC_DEFUN(AC_LTDL_DLSYM_USCORE,
|
|
|
|
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
|
|
|
|
if test x"$ac_cv_sys_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
|
2000-12-02 03:13:20 +08:00
|
|
|
libltdl_cv_need_uscore=unknown
|
2001-04-23 08:34:53 +08:00
|
|
|
save_LIBS="$LIBS"
|
|
|
|
LIBS="$LIBS $LIBADD_DL"
|
2000-12-02 03:13:20 +08:00
|
|
|
_LT_AC_TRY_DLOPEN_SELF(
|
|
|
|
libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
|
|
|
|
[], libltdl_cv_need_uscore=cross)
|
2001-04-23 08:34:53 +08:00
|
|
|
LIBS="$save_LIBS"
|
2000-12-02 03:13:20 +08:00
|
|
|
])
|
1999-12-07 18:52:53 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$libltdl_cv_need_uscore" = xyes; then
|
|
|
|
AC_DEFINE(NEED_USCORE, 1,
|
|
|
|
[Define if dlsym() requires a leading underscode in symbol names. ])
|
|
|
|
fi
|
2000-09-17 04:08:07 +08:00
|
|
|
])# AC_LTDL_DLSYM_USCORE
|