]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (lt_dlopen): use newhandle instead of handle
authorThomas Tanner <tanner@gmx.de>
Sun, 21 Feb 1999 15:38:02 +0000 (15:38 +0000)
committerThomas Tanner <tanner@gmx.de>
Sun, 21 Feb 1999 15:38:02 +0000 (15:38 +0000)
  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

ChangeLog
libltdl/ltdl.c
libtool.m4
ltmain.in

index b318cd0fa16f91c93245d8b73ef3b18e18dc1982..d5453015fd38a1925f33d8c0dafc060fac33e11e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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
index edc927861658a8e3ae8f0141735a0d365a4068a6..228126bfbfd7d86ab8136da10780664598887cc3 100644 (file)
@@ -1048,8 +1048,8 @@ lt_dlopen (filename)
                }
                handle->usage = 0;
                newhandle = handle;
-               if (tryall_dlopen(&handle, 0) != 0) {
-                       lt_dlfree(newhandle);
+               if (tryall_dlopen(&newhandle, 0) != 0) {
+                       lt_dlfree(handle);
                        return 0;
                }
                goto register_handle;
index 3d4fbe4965718d8eb4bb22f9a88109cb3cfbd0e9..ec4f032e89bff41ff46b75627af6d5930c8a111d 100644 (file)
@@ -121,21 +121,21 @@ exec 5>>./config.log
 # 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>
index 880e537a55d5e8b3ec06f79ec61e85f1b70bf4ae..428e4b77009ccb64de42047bdbaf5fd97fe43791 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -802,6 +802,7 @@ compiler."
     avoid_version=no
     dlfiles=
     dlprefiles=
+    dlself=no
     export_dynamic=no
     export_symbols=
     export_symbols_regex=
@@ -865,6 +866,13 @@ compiler."
          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"
@@ -949,12 +957,6 @@ compiler."
          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
        ;;
 
@@ -2008,9 +2010,9 @@ EOF
        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\"
@@ -2028,9 +2030,10 @@ EOF
              $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.
@@ -2168,6 +2171,11 @@ EOF
        $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
@@ -2226,7 +2234,7 @@ EOF
       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
@@ -2270,7 +2278,7 @@ extern \"C\" {
 /* 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
@@ -2330,7 +2338,7 @@ lt_preloaded_symbols[] =
 {\
 "
 
-           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},"