diff --git a/ChangeLog b/ChangeLog index b6105397..723c68cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 1999-01-20 Alexandre Oliva + * ltmain.in (compile): when compiling both PIC and non-PIC, write + the PIC object to .libs/.lo and only rename it to .lo after + compiling the .o, to avoid fooling make dependencies + * mdemo/main.c (LTDL_PREOPENED_SYMBOLS): remove 1999-01-20 Gary V. Vaughan diff --git a/ltmain.in b/ltmain.in index ab1cf752..46e0e059 100644 --- a/ltmain.in +++ b/ltmain.in @@ -372,9 +372,9 @@ if test -z "$show_help"; then # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj $lockfile" + removelist="$obj $libobj" else - removelist="$libobj $lockfile" + removelist="$libobj" fi $run $rm $removelist @@ -429,12 +429,34 @@ compiler." # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile$pic_flag -DPIC $srcfile" + 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 - command="$command -o $libobj" output_obj="$libobj" + command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then - command="$command -o $obj" output_obj="$obj" + command="$command -o $output_obj" fi $show "$command" @@ -465,7 +487,7 @@ compiler." fi # Just move the object if needed, then go on to compile the next one - if test "$compiler_o_lo" = no && test x"$output_obj" != x"$libobj"; then + if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else @@ -476,11 +498,24 @@ compiler." fi # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag"; then - $show $rm $obj - $run $rm $obj - $show "$LN_S $libobj $obj" - if $run $LN_S $libobj $obj; then + if test -z "$pic_flag" && 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 + + # Now arrange that obj and lo_libobj become the same file + $show "$LN_S $obj $lo_libobj" + if $run $LN_S $obj $lo_libobj; then exit 0 else error=$? @@ -531,7 +566,7 @@ compiler." fi # Just move the object if needed - if test "$compiler_c_o" = no && test x"$output_obj" != x"$obj"; then + if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -540,6 +575,22 @@ compiler." exit $error fi fi + + # 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 fi # Unlock the critical section if it was locked @@ -547,13 +598,6 @@ compiler." $rm "$lockfile" fi - # 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 $? - fi - exit 0 ;;