]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltconfig.in (compile_c_lo): Removed the test that checks if
authorOssama Othman <ossama@debian.org>
Mon, 31 Jan 2000 19:23:44 +0000 (19:23 +0000)
committerOssama Othman <ossama@debian.org>
Mon, 31 Jan 2000 19:23:44 +0000 (19:23 +0000)
compiler support "-c -o file.lo" since the changes made to
ltmain.in remove the need to do this.
* ltmain.in:  Changed compile mode to generate `.lo' libtool
objects, instead of generating PIC objects that end in `.lo'.
These are analogous to libtool archive `.la' files.  They contain
the name of the PIC and non-PIC objects.  All PIC objects will now
be placed in `$objdir' (usually `.libs').  No changes to existing
Makefiles should be necessary.  Libtool should work the same as it
did prior to this change.  This change was necessary to correct a
problem with Sun C++'s template repository mechanism since it
couldn't handle repository objects ending in `.lo'.  This change
causes some tests to fail, so it still needs some work.  The tests
that fail are: dryrun.test, build-relink2.test, link-2.test.  The
quote.test and sh.test tests also fail but they failed after the
initial multi-language changes were made.

ChangeLog
ltconfig.in
ltmain.in

index d64e2add58e4dbbf94deecc850be571431a94da8..284edded824566378986fdc953b4a57dee7eb502 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2000-01-31 Ossama Othman  <ossama@debian.org>
+
+       * ltconfig.in (compile_c_lo): Removed the test that checks if
+       compiler support "-c -o file.lo" since the changes made to
+       ltmain.in remove the need to do this.
+       * ltmain.in:  Changed compile mode to generate `.lo' libtool
+       objects, instead of generating PIC objects that end in `.lo'.
+       These are analogous to libtool archive `.la' files.  They contain
+       the name of the PIC and non-PIC objects.  All PIC objects will now
+       be placed in `$objdir' (usually `.libs').  No changes to existing
+       Makefiles should be necessary.  Libtool should work the same as it
+       did prior to this change.  This change was necessary to correct a
+       problem with Sun C++'s template repository mechanism since it
+       couldn't handle repository objects ending in `.lo'.  This change
+       causes some tests to fail, so it still needs some work.  The tests
+       that fail are: dryrun.test, build-relink2.test, link-2.test.  The
+       quote.test and sh.test tests also fail but they failed after the
+       initial multi-language changes were made.
+
 2000-01-25  Ossama Othman  <ossama@uci.edu>
 
        * libtool.m4, ltconfig.in, ltmain.in:  Merged updates found in
index 0e176397e6ac17f004ae266a92c69ffecfe4ebc4..0672736f7d611614702d93d15dee9c2b3fbbf3ca 100755 (executable)
@@ -798,37 +798,6 @@ cd ..
 rmdir conftest
 $rm -r conftest 2>/dev/null
 
-if test x"$compiler_c_o" = x"yes"; then
-  # Check to see if we can write to a .lo
-  echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
-  $rm conftest*
-  echo $lt_simple_compile_test_code > conftest.$ac_ext
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -c -o conftest.lo"
-  echo "$progname:@LINENO@: checking if $compiler supports -c -o file.lo" >&5
-if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
-
-    # The compiler can only warn and ignore the option if not recognized
-    # So say no if there are warnings
-      if test -s conftest.err; then
-       echo "$ac_t"no 1>&6
-       compiler_o_lo=no
-      else
-       echo "$ac_t"yes 1>&6
-       compiler_o_lo=yes
-      fi
-  else
-    # Append any errors to the config.log.
-    cat conftest.err 1>&5
-    compiler_o_lo=no
-    echo "$ac_t"no 1>&6
-  fi
-  CFLAGS="$save_CFLAGS"
-  $rm conftest*
-else
-  compiler_o_lo=no
-fi
-
 # Check to see if we can do hard links to lock some files if needed
 hard_links="nottested"
 if test "$compiler_c_o" = no && test "$need_locks" != no; then
@@ -1952,7 +1921,7 @@ case "$ltmain" in
     finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
     hardcode_libdir_flag_spec hardcode_libdir_separator  \
     sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+    compiler_c_o need_locks exclude_expsyms include_expsyms; do
 
     case "$var" in
     reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
@@ -2139,9 +2108,6 @@ pic_mode=$pic_mode
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$compiler_c_o
 
-# Can we write directly to a .lo ?
-compiler_o_lo=$compiler_o_lo
-
 # Must we lock files when doing compilation ?
 need_locks=$need_locks
 
index 253e2734796979f590e3d0d43749e43b16403212..458e03081ac553181aa8d77f9a07849fe6e3b67d 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -470,9 +470,9 @@ if test -z "$show_help"; then
 
     # Delete any leftover library objects.
     if test "$build_old_libs" = yes; then
-      removelist="$obj $libobj"
+      removelist="$obj $objdir/$obj $libobj"
     else
-      removelist="$libobj"
+      removelist="$objdir/$obj $libobj"
     fi
 
     $run $rm $removelist
@@ -520,6 +520,19 @@ compiler."
       eval srcfile=\"$fix_srcfile_path\"
     fi
 
+    $run $rm "libobj"
+
+    # Create a libtool object file (analogous to a `.la' file)
+    cat > $libobj <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# 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.
@@ -532,35 +545,27 @@ compiler."
        # Don't build PIC code
        command="$base_compile $srcfile"
       fi
-      if test "$build_old_libs" = yes; then
-       lo_libobj="$libobj"
-       dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
-       if test "X$dir" = "X$libobj"; then
-         dir="$objdir"
-       else
-         dir="$dir/$objdir"
-       fi
-       libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
-       if test -d "$dir"; then
-         $show "$rm $libobj"
-         $run $rm $libobj
-       else
-         $show "$mkdir $dir"
-         $run $mkdir $dir
-         status=$?
-         if test $status -ne 0 && test ! -d $dir; then
-           exit $status
-         fi
-       fi
-      fi
-      if test "$compiler_o_lo" = yes; then
-       output_obj="$libobj"
-       command="$command -o $output_obj"
-      elif test "$compiler_c_o" = yes; then
-       output_obj="$obj"
-       command="$command -o $output_obj"
-      fi
+      if test ! -d $objdir; then
+       $show "$mkdir $objdir"
+       $run $mkdir $objdir
+       status=$?
+       if test $status -ne 0 && test ! -d $dir; then
+         exit $status
+        fi
+      fi 
+
+      # Place PIC objects in $objdir
+      output_obj="$objdir/$obj"
+      command="$command -o $output_obj"
+
+      $run $rm "$output_obj"
+
+      # Append the name of the PIC object to the libtool object file.
+      cat >> $libobj <<EOF
+object_name='$output_obj'
+
+EOF
 
       $run $rm "$output_obj"
       $show "$command"
@@ -591,45 +596,9 @@ compiler."
       fi
 
       # Just move the object if needed, then go on to compile the next one
-      if test x"$output_obj" != x"$libobj"; then
-       $show "$mv $output_obj $libobj"
-       if $run $mv $output_obj $libobj; then :
-       else
-         error=$?
-         $run $rm $removelist
-         exit $error
-       fi
-      fi
-
-      # If we have no pic_flag, then copy the object into place and finish.
-      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
-        test "$build_old_libs" = yes; then
-       # Rename the .lo from within objdir to obj
-       if test -f $obj; then
-         $show $rm $obj
-         $run $rm $obj
-       fi
-
-       $show "$mv $libobj $obj"
-       if $run $mv $libobj $obj; then :
-       else
-         error=$?
-         $run $rm $removelist
-         exit $error
-       fi
-
-       xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-       if test "X$xdir" = "X$obj"; then
-         xdir="."
-       else
-         xdir="$xdir"
-       fi
-       baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
-       libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
-       # Now arrange that obj and lo_libobj become the same file
-       $show "(cd $xdir && $LN_S $baseobj $libobj)"
-       if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
-         exit 0
+      if test x"$output_obj" != x"$objdir/$obj"; then
+       $show "$mv $output_obj $objdir/$obj"
+       if $run $mv $output_obj $objdir/$obj; then :
        else
          error=$?
          $run $rm $removelist
@@ -639,6 +608,13 @@ compiler."
 
       # Allow error messages only from the first compilation.
       suppress_output=' >/dev/null 2>&1'
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      cat >> $libobj <<EOF
+object_name=none
+
+EOF
     fi
 
     # Only build a position-dependent object if we build old libraries.
@@ -655,6 +631,14 @@ compiler."
        output_obj="$obj"
       fi
 
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      cat >> $libobj <<EOF
+# Name of the non-PIC object.
+old_object='$obj'
+
+EOF
+
       # Suppress compiler output if we already did a PIC compilation.
       command="$command$suppress_output"
       $run $rm "$output_obj"
@@ -695,22 +679,14 @@ compiler."
          exit $error
        fi
       fi
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      cat >> $libobj <<EOF
+# Name of the non-PIC object.
+old_object=none
 
-      # Create an invalid libtool object if no PIC, so that we do not
-      # accidentally link it into a program.
-      if test "$build_libtool_libs" != yes; then
-       $show "echo timestamp > $libobj"
-       $run eval "echo timestamp > \$libobj" || exit $?
-      else
-       # Move the .lo from within objdir
-       $show "$mv $libobj $lo_libobj"
-       if $run $mv $libobj $lo_libobj; then :
-       else
-         error=$?
-         $run $rm $removelist
-         exit $error
-       fi
-      fi
+EOF
     fi
 
     # Unlock the critical section if it was locked
@@ -775,6 +751,7 @@ compiler."
     module=no
     no_install=no
     objs=
+    old_objects=
     prefer_static_libs=no
     preload=no
     prev=
@@ -1192,27 +1169,60 @@ compiler."
        ;;
 
       *.lo)
-       # A library object.
-       if test "$prev" = dlfiles; then
-         dlfiles="$dlfiles $arg"
-         if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
-           prev=
-           continue
-         else
-           # If libtool objects are unsupported, then we need to preload.
-           prev=dlprefiles
-         fi
-       fi
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+          object_name=
+          old_object=
+
+          # Read the .lo file
+          # If there is no directory component, then add one.
+          case "$arg" in
+          */* | *\\*) . $arg ;;
+          *) . ./$arg ;;
+          esac
+
+          if test -z "$object_name" || test -z "$old_object"; then
+            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+            exit 1
+          fi
+
+          if test "$object_name" != none; then
+           if test "$prev" = dlfiles; then
+             dlfiles="$dlfiles $object_name"
+             if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
 
-       if test "$prev" = dlprefiles; then
-         # Preload the old-style object.
-         dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
-         prev=
+           # CHECK ME:  I think I busted this.  -Ossama
+            if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             dlprefiles="$dlprefiles $object_name"
+             prev=
+            fi
+
+            # A PIC object.
+           libobjs="$libobjs $object_name"
+          fi
+
+          # Non-PIC object.
+          if test "$old_object" != none; then
+            # A standard non-PIC object
+            old_objects="$old_objects $old_object"
+          fi
+        else
+          $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+          exit 1
        fi
-       libobjs="$libobjs $arg"
        ;;
 
-      *.a | *.lib)
+      *.$libext)
        # An archive.
        deplibs="$deplibs $arg"
        old_deplibs="$old_deplibs $arg"
@@ -1366,9 +1376,9 @@ compiler."
       $echo "$help" 1>&2
       exit 1
       ;;
-    *.a | *.lib)
+    *.$libext)
       linkmode=oldlib ;;
-    *.lo | *.o | *.obj)
+    *.lo | *.$objext)
       linkmode=obj ;;
     *.la)
       linkmode=lib ;;
@@ -1465,7 +1475,7 @@ compiler."
            continue
          fi
          ;;
-       *.a | *.lib)
+       *.$libext)
          if test $linkmode = prog; then
            if test $pass = scan; then
              deplibs="$deplibs $deplib"
@@ -2293,9 +2303,22 @@ compiler."
       fi
 
       if test "$mode" != relink; then
-       # Remove our outputs.
-       $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
-       $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+       # Remove our outputs, but don't remove object files since they
+        # may have been created when compiling PIC objects.
+        removelist=
+        tempremovelist=`echo $output_objdir/* | $Xsed -e "s/.*\.$objext//"`
+       for p in $tempremovelist; do
+          case "$p" in
+            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+               removelist="$removelist $p"
+               ;;
+            *) ;;
+          esac
+        done
+        if test -n "$removelist"; then
+         $show "${rm}r $removelist"
+         $run ${rm}r $removelist
+        fi
       fi
 
       # Now set the variables for building old libraries.
@@ -2624,22 +2647,22 @@ EOF
          linknames="$linknames $link"
        done
 
-       # Ensure that we have .o objects for linkers which dislike .lo
-       # (e.g. aix) in case we are running --disable-static
-       for obj in $libobjs; do
-         xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-         if test "X$xdir" = "X$obj"; then
-           xdir="."
-         else
-           xdir="$xdir"
-         fi
-         baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
-         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
-         if test ! -f $xdir/$oldobj; then
-           $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
-           $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
-         fi
-       done
+#      # Ensure that we have .o objects for linkers which dislike .lo
+#      # (e.g. aix) in case we are running --disable-static
+#      for obj in $libobjs; do
+#        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+#        if test "X$xdir" = "X$obj"; then
+#          xdir="."
+#        else
+#          xdir="$xdir"
+#        fi
+#        baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+#        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+#        if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
+#          $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+#          $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+#        fi
+#      done
 
        # Use standard objects if they are pic
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
@@ -2881,8 +2904,8 @@ EOF
 
        # Create an invalid libtool object if no PIC, so that we don't
        # accidentally link it into a program.
-       $show "echo timestamp > $libobj"
-       $run eval "echo timestamp > $libobj" || exit $?
+       $show "echo timestamp > $libobj"
+       $run eval "echo timestamp > $libobj" || exit $?
        exit 0
       fi
 
@@ -2898,20 +2921,20 @@ EOF
          $run eval "$cmd" || exit $?
        done
        IFS="$save_ifs"
-      else
-       # Just create a symlink.
-       $show $rm $libobj
-       $run $rm $libobj
-       xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
-       if test "X$xdir" = "X$libobj"; then
-         xdir="."
-       else
-         xdir="$xdir"
-       fi
-       baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-       oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
-       $show "(cd $xdir && $LN_S $oldobj $baseobj)"
-       $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+#     else
+#      # Just create a symlink.
+#      $show $rm $libobj
+#      $run $rm $libobj
+#      xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+#      if test "X$xdir" = "X$libobj"; then
+#        xdir="."
+#      else
+#        xdir="$xdir"
+#      fi
+#      baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+#      oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+#      $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+#      $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
       fi
 
       if test -n "$gentop"; then
@@ -3553,7 +3576,7 @@ fi\
          oldobjs="$libobjs_save"
          build_libtool_libs=no
        else
-         oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+         oldobjs="$objs$old_deplibs $old_objects"
        fi
        addlibs="$old_convenience"
       fi
@@ -3591,7 +3614,7 @@ fi\
          $show "(cd $xdir && $AR x $xabs)"
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
-         oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+         oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
        done
       fi
 
@@ -3599,23 +3622,23 @@ fi\
       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
        eval cmds=\"$old_archive_from_new_cmds\"
       else
-       # Ensure that we have .o objects in place in case we decided
-       # not to build a shared library, and have fallen back to building
-       # static libs even though --disable-static was passed!
-       for oldobj in $oldobjs; do
-         if test ! -f $oldobj; then
-           xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
-           if test "X$xdir" = "X$oldobj"; then
-             xdir="."
-           else
-             xdir="$xdir"
-           fi
-           baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
-           obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
-           $show "(cd $xdir && ${LN_S} $obj $baseobj)"
-           $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
-         fi
-       done
+#      # Ensure that we have .o objects in place in case we decided
+#      # not to build a shared library, and have fallen back to building
+#      # static libs even though --disable-static was passed!
+#      for oldobj in $oldobjs; do
+#        if test ! -f $oldobj; then
+#          xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+#          if test "X$xdir" = "X$oldobj"; then
+#            xdir="."
+#          else
+#            xdir="$xdir"
+#          fi
+#          baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+#          obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+#          $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+#          $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+#        fi
+#      done
 
        eval cmds=\"$old_archive_cmds\"
       fi
@@ -3867,7 +3890,7 @@ relink_command=\"$relink_command\""
 
       # Do each installation.
       case "$file" in
-      *.a | *.lib)
+      *.$libext)
        # Do the static libraries later.
        staticlibs="$staticlibs $file"
        ;;