+1999-02-21 Thomas Tanner <tanner@gmx.de>
+
+ * libltdl/ltdl.c (lt_dlopen): use newhandle instead of handle
+ when dlopening the executable
+ * libtool.m4 (AC_LIBTOOL_DLOPEN): removed the redundant "yes: "
+ prefix for lt_cv_dlopen, renamed lt_cv_dlopen_LIBS
+ to lt_cv_dlopen_libs (more consistent)
+ * ltmain.in: implemented -dl[pre]open self, necessary for
+ lt_dlopen(NULL), generation of exported symbols was broken
+
1999-02-20 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltmain.in: avoid duplication of -L switches, it sometimes breaks
# AC_LIBTOOL_DLOPEN - check for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN,
[AC_CACHE_VAL(lt_cv_dlopen,
-[lt_cv_dlopen=no lt_cv_dlopen_LIBS=
-AC_CHECK_FUNC(dlopen, [lt_cv_dlopen="yes: dlopen"],
- [AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="yes: dlopen" lt_cv_dlopen_LIBS="-ldl"],
- [AC_CHECK_LIB(dld, dld_link, [lt_cv_dlopen="yes: dld_link" lt_cv_dlopen_LIBS="-ldld"],
- [AC_CHECK_FUNC(shl_load, [lt_cv_dlopen="yes: shl_load"],
- [AC_CHECK_FUNC(LoadLibrary, [lt_cv_dlopen="yes: LoadLibrary"])]
+[lt_cv_dlopen=no lt_cv_dlopen_libs=
+AC_CHECK_FUNC(dlopen, [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB(dld, dld_link, [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC(shl_load, [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_FUNC(LoadLibrary, [lt_cv_dlopen="LoadLibrary"])]
)]
)]
)]
)])
case "$lt_cv_dlopen" in
-"yes: dlopen")
+dlopen)
AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self,
- [LT_SAVE_LIBS="$LIBS"; LIBS="$lt_cv_dlopen_LIBS $LIBS"
+ [LT_SAVE_LIBS="$LIBS"; LIBS="$lt_cv_dlopen_libs $LIBS"
AC_TRY_RUN([
#include <dlfcn.h>
#include <stdio.h>
avoid_version=no
dlfiles=
dlprefiles=
+ dlself=no
export_dynamic=no
export_symbols=
export_symbols_regex=
fi
case "$arg" in
*.la | *.lo) ;; # We handle these cases below.
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" = no; then
+ dlself=yes
+ fi
+ ;;
*)
dlprefiles="$dlprefiles $arg"
test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
else
arg=
fi
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
fi
;;
fi
# Prepare the list of exported symbols
- if test -z "$run" && test -z "$export_symbols"; then
- $show "extracting global symbols from \`$libname'"
+ if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "extracting global symbols from \`$libname'"
export_symbols="$objdir/$libname.exp"
$run $rm $export_symbols
eval cmds=\"$export_symbols_cmds\"
$run eval '$mv "$export_symbols"T "$export_symbols"'
fi
fi
- if test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
fi
# Do each of the archive commands.
$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
fi
+ if test "$dlself" = yes && test "$export_dynamic" = no; then
+ $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
+ exit 1
+ fi
+
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
fi
dlsyms=
- if test -n "$dlfiles$dlprefiles"; then
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
if test -n "$NM" && test -n "$global_symbol_pipe"; then
dlsyms="${outputname}S.c"
else
/* External symbol declarations for the compiler. */\
"
- if test "$export_dynamic" = yes && test "$dlopen_self" = no; then
+ if test "$dlself" = yes; then
if test -n "$export_symbols"; then
$run eval 'sed -e "s/^\(.*\)/\1 \1/" < "$export_symbols" > "$nlist"'
else
{\
"
- if test "$export_dynamic" = yes && test "$dlopen_self" = no; then
+ if test "$dlself" = yes; then
# First entry is the program itself
echo >> "$output_objdir/$dlsyms" "\
{\"@PROGRAM@\", (lt_ptr_t) 0},"