]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/config/ltmain.m4sh (func_write_libtool_object):
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 22 Apr 2006 18:57:04 +0000 (18:57 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 22 Apr 2006 18:57:04 +0000 (18:57 +0000)
New function, factored out from..
(func_mode_compile): .. here.  Call it to generate the libtool
object file (the `.lo' file) in one step.

ChangeLog
libltdl/config/ltmain.m4sh

index 55892c25925e22f63b548b2e0d0d22158ac5fb4d..75c089326e8d2a82f38684dffedf9a660e8ddfe5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/config/ltmain.m4sh (func_write_libtool_object):
+       New function, factored out from..
+       (func_mode_compile): .. here.  Call it to generate the libtool
+       object file (the `.lo' file) in one step.
+
 2006-04-03  Peter O'Gorman  <peter@pogma.com>
 
        * libltdl/loaders/preopen.c: Don't allow lt_dlopen if the
index 88271561776e91bd9e0719de1dc543fef2d00d6d..596c9d29fd7c104465dfc114c466466d3f404354 100644 (file)
@@ -1136,6 +1136,44 @@ func_extract_archives ()
 }
 
 
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      mv -f "${write_libobj}T" "${write_libobj}"
+    }
+}
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -1385,18 +1423,6 @@ compiler."
 
     $opt_dry_run || $RM "$libobj" "${libobj}T"
 
-    # Create a libtool object file (analogous to a ".la" file),
-    # but don't create it if we're doing a dry run.
-    $opt_dry_run || cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
     # Only build a PIC object if we are building libtool libraries.
     if test "$build_libtool_libs" = yes; then
       # Without this assignment, base_compile gets emptied.
@@ -1447,23 +1473,10 @@ compiler."
          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
       fi
 
-      # Append the name of the PIC object to the libtool object file.
-      $opt_dry_run || cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
       # Allow error messages only from the first compilation.
       if test "$suppress_opt" = yes; then
        suppress_output=' >/dev/null 2>&1'
       fi
-    else
-      # No PIC object so indicate it doesn't exist in the libtool
-      # object file.
-      $opt_dry_run || cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
     fi
 
     # Only build a position-dependent object if we build old libraries.
@@ -1509,26 +1522,10 @@ compiler."
        func_show_eval '$MV "$output_obj" "$obj"' \
          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
       fi
-
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      $opt_dry_run || cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
-    else
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      $opt_dry_run || cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
     fi
 
     $opt_dry_run || {
-      $MV "${libobj}T" "${libobj}"
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 
       # Unlock the critical section if it was locked
       if test "$need_locks" != no; then