From 351cd66541415bc8c78946f8ca13d346974b3925 Mon Sep 17 00:00:00 2001 From: Gordon Matzigkeit Date: Tue, 1 Apr 1997 18:53:35 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 39 ++++++++++++ Makefile.am | 2 +- NEWS | 3 +- TODO | 14 ++--- configure.in | 2 +- demo/Makefile.am | 2 +- ltconfig.in | 57 +++++++++-------- ltmain.sh.in | 160 +++++++++++++++++++++++++++++++++++++++++------ 8 files changed, 220 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63d458763..6a5ba9c7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,41 @@ +Sun Dec 8 14:39:04 1996 Gordon Matzigkeit + + * Release 0.7. + + * Makefile.am (EXTRA_DIST): Add README-automake to the + distribution. + + * ltmain.sh.in (link): When linking libtool libraries, use + standard objects if they are PIC. This prevents spurious warnings + about invalid suffixes on AIX. + + * demo/Makefile.am: Rename libhell to libhello, so that we're not + quite as offensive. + + * ltconfig.in: Remove unnecessary host validity checking. + + * ltmain.sh.in: Don't force people to use libNAME.la: SOMETHING.la + is good enough (for consistency with *.a handling). + +Sat Dec 7 12:31:15 1996 Gordon Matzigkeit + + * ltmain.sh.in (link): Accept files ending in .a as standard + object files. Reported by Ulrich Drepper. + Remove support for creating profiled libraries (for now). + Transform all library objects into standard objects when linking a + program. + + * ltconfig.in (thisdir): How embarrassing! An error in the regexp + for finding the directory component of the script path. + Thu Dec 5 14:19:21 1996 Gordon Matzigkeit + * ltmain.sh.in (compile): Support `.S' (preprocessed assembler) + files. Reported by Anthony Green. + + * libtoolize.in: Give clearer instrutions for how to update + aclocal.m4. + * ltconfig.in, ltmain.sh.in (link): Add support for creating reloadable objects. @@ -77,3 +113,6 @@ Sun Nov 10 13:08:04 1996 Gordon Matzigkeit * New ChangeLog file for libtool-0.7, since I've totally rewritten libtool. +Fri Mar 15 14:21:15 1996 Gord Matzigkeit + + * For historical reasons: this is when I started writing libtool. diff --git a/Makefile.am b/Makefile.am index 868296f8f..c852ebd11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS = doc tests # Distribute ltconfig and ltmain.sh so that the demo directory works. EXTRA_DIST = libtool.m4 libtoolize.in ltconfig ltconfig.in \ - ltmain.sh ltmain.sh.in + ltmain.sh ltmain.sh.in README-automake CLEANFILES = libtool libtoolize # Files in the demo subdirectory that go in the distribution. diff --git a/NEWS b/NEWS index a40fae46a..5209a30d0 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -New in 0.6c: +New in 0.6d: * Total rewrite of libtool, along with a new model for library building. * Completely rewritten documentation for the new paradigm. * Sane handling of broken system linkers, such as the ones on AIX @@ -8,6 +8,7 @@ New in 0.6c: libtool program. * Automatic mode guessing, based on the command line. * Support for new `-static' linking flag. +* Support for stripping libraries during installation. * Library version information is now passed on the command line, not through a version file. * Quote metacharacters in arguments to compile mode. diff --git a/TODO b/TODO index 8b7eebfa0..691ee8bf4 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,11 @@ -* Find link_static_flag for every C compiler, currently at least -native cc's for AIX, HP-UX, OSF/1. - -* Configure test for a library-stripping program (strip -x on NetBSD) +* Find link_static_flag for every C compiler, (don't forget native +cc's for HP-UX and OSF/1). * Implement fuller support for profiled libraries (libNAME_p), and resolve naming difficulties for debuggable libraries (libNAME_g on Linux at least), old system 5 shared libraries (libNAME_s), etc. -* We should use the C compiler rather than the linker to create shared -libraries, if at all possible. This just involves looking up the $wl -values for system compilers. - * What should be done about the difference between -fpic and -fPIC? -* GCC docs imply that all rs6000 code is PIC. If that is true, then -implement it. +* GCC docs imply that all rs6000 code is PIC. See if it is true of +any other processors (like maybe powerpc). diff --git a/configure.in b/configure.in index f052de773..3698fea7e 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(ltmain.sh.in) -AM_INIT_AUTOMAKE(libtool, 0.6d) +AM_INIT_AUTOMAKE(libtool, 0.6e) pkgdatadir='${datadir}/libtool' AC_SUBST(pkgdatadir) diff --git a/demo/Makefile.am b/demo/Makefile.am index c1dedc874..6cf62df97 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -1,5 +1,5 @@ # A brief demonstration of using Automake with Libtool. -AUTOMAKE_OPTIONS = foreign +AUTOMAKE_OPTIONS = foreign no-dependencies EXTRA_DIST = libinfo diff --git a/ltconfig.in b/ltconfig.in index d54d78c14..f8cc57242 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -432,13 +432,13 @@ set dummy $CC compiler="$2" echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 -compile_flags= +pic_flag= profile_flag_pattern= wl= link_static_flag= if test "$with_gcc" = yes; then - compile_flags='-fPIC -DPIC' + pic_flag='-fPIC' profile_flag_pattern='-pg?' wl='-Wl,' link_static_flag='-static' @@ -446,35 +446,30 @@ else # PORTME Check for PIC flags for the system compiler. case "$host" in *-*-aix3* | *-*-aix4*) - # FIXME compile_flags, or are all AIX platforms PIC? - link_static_flags='-bnso -bI:/lib/syscalls.exp' + # FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform? + link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; *-*-hpux10*) - compile_flags='+Z -DPIC' + # FIXME link_static_flag? + pic_flag='+Z' ;; *-*-osf3*) - # FIXME - compile_flags, link_static_flag? - compile_flags='-DPIC' + # FIXME - pic_flag, link_static_flag? ;; *-*-solaris2*) - compile_flags='-KPIC -DPIC' + pic_flag='-KPIC' link_static_flag='-Bstatic' ;; *-*-sunos4*) - compile_flags='-PIC -DPIC' + pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' ;; - *-*-ultrix4*) - wl='-Wl' - can_build_shared=no - ;; - *) can_build_shared=no ;; @@ -484,13 +479,13 @@ fi case "$host" in rs6000-*-*) # Yippee! All rs/6000 code is position-independent. - compile_flags='-DPIC' + pic_flag= ;; esac -if test -n "$compile_flags"; then - echo $ac_t "$compile_flags" 1>&6 - compile_flags=" $compile_flags" +if test -n "$pic_flag"; then + echo $ac_t "$pic_flag" 1>&6 + pic_flag=" $pic_flag" else echo $ac_t none 1>&6 fi @@ -607,6 +602,14 @@ if test "$hardcode_shlibpath_var" = yes && test "$hardcode_minus_L" = yes; then echo "$PACKAGE will compensate by relinking binaries at install time." 1>&2 fi +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $linker option to reload object files... $ac_c" 1>&6 +# PORTME Some linker may need a different reload flag. +reload_flag='-r' +echo $ac_t "$reload_flag" +test -n "$reload_flag" && reload_flag=" $reload_flag" + # PORTME Fill in your ld.so characteristics can_build_shared=yes lib_names= @@ -750,6 +753,12 @@ cat < $ofile # The version of $progname that generated this script. LTCONFIG_VERSION="$VERSION" +# Whether or not to build libtool libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build old-style libraries. +build_old_libs=$enable_static + # The host system. host_alias="$host_alias" host="$host" @@ -757,17 +766,15 @@ host="$host" # The linker used to build libraries. LD='$LD' +# How to create reloadable object files. +reload_flag='$reload_flag' +reload_cmds='$reload_cmds' + # How to pass a linker flag through the compiler. wl='$wl' -# Whether or not to build libtool libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build old-style libraries. -build_old_libs=$enable_static - # Additional compiler flags for building library objects. -compile_flags='$compile_flags' +pic_flag='$pic_flag' # Compiler flag to prevent dynamic linking. link_static_flag='$link_static_flag' diff --git a/ltmain.sh.in b/ltmain.sh.in index e6d7f1d67..cdedce596 100644 --- a/ltmain.sh.in +++ b/ltmain.sh.in @@ -33,8 +33,10 @@ VERSION=@VERSION@ default_mode=NONE help="Try \`$progname --help' for more information." ln_s="ln -s" +cp_p="cp -p" magic="%%%MAGIC variable%%%" mkdir="mkdir" +mv="mv -f" objdir=.libs rm="rm -f" @@ -174,7 +176,7 @@ if test -z "$show_help"; then # Get the name of the library object. libobj=`echo "$srcfile" | sed -e 's%^.*/%%' -e 's/\.c$/.lo/'` case $libobj in - *.lo) ;; + *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; *) echo "$progname: cannot determine name of library object from \`$srcfile'" exit 1 @@ -187,19 +189,48 @@ if test -z "$show_help"; then exit 1 fi - # Delete any old library object. - $run $rm $libobj + # Delete any old library objects. + $run $rm $obj $libobj + trap "$run $rm $obj $libobj; exit 1" 1 2 15 - # Only use the compile flags if we are building libtool libraries. + # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then - base_compile="$base_compile$compile_flags" + # All platforms use -DPIC, to notify preprocessed assembler code. + $show "$base_compile$pic_flag -DPIC $srcfile" + if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then : + else + $run $rm $obj + exit 1 + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag"; then + $show "$ln_s $obj $libobj" + $run $ln_s $obj $libobj || $run $cp_p $obj $libobj + exit $? + fi + + # Just move the object, then go on to compile the next one + $show "$mv $obj $libobj" + $run $mv $obj $libobj || exit 1 fi - $show "$base_compile $srcfile -o $libobj" - eval "$run $base_compile $srcfile -o $libobj" + # Compile the position-dependent object. + $show "$base_compile $srcfile" + if eval "$run $base_compile $srcfile"; then : + else + $run $rm $obj $libobj + exit 1 + fi + + # Symlink or copy the object file into library object, if no PIC. + if test "$build_libtool_libs" != yes; then + $show "$ln_s $obj $libobj" + $run $ln_s $obj $libobj || $run $cp_p $obj $libobj + exit $? + fi - # Exit with the status of the compile command. - exit $? + exit 0 ;; # libtool link mode @@ -330,7 +361,7 @@ if test -z "$show_help"; then fi libdir= - . $file + . $dir/$file if test -z "$libdir"; then echo "$progname: \`$arg' contains no -rpath information" 1>&2 @@ -395,8 +426,8 @@ if test -z "$show_help"; then exit 1 fi - oldobjs= oldlib= + oldobjs= case "$output" in "") echo "$progname: you must specify an output file" 1>&2 @@ -596,6 +627,79 @@ if test -z "$show_help"; then exit 1 ;; + *.lo | *.o) + if test -n "$link_against_libtool_libs"; then + echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 + fi + + if test -n "$install_libdir"; then + echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2 + fi + + if test -n "$vinfo"; then + echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`echo "$output" | sed 's/\.lo$/.o/'` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Create the old-style object. + reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` + + output="$obj" + cmds=`eval echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + eval "$run $cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + test -z "$libobj" && exit 0 + + if test "$build_libtool_libs" = yes && test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs" + output="$libobj" + cmds=`eval echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + eval "$run $cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show "$ln_s $obj $libobj" + $run $ln_s $obj $libobj || $run $cp_p $obj $libobj || exit 1 + fi + + exit 0 + ;; + *) if test -n "$install_libdir"; then echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2 @@ -605,6 +709,11 @@ if test -z "$show_help"; then echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2 fi + if test -n "$libobjs"; then + # FIXME - transform all the library objects into standard objects. + echo "$progname: warning: library object files should not be used to build programs" 1>&2 + fi + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # We have no uninstalled library dependencies, so finalize right now. compile_command=`echo "$compile_command" | sed "s%-o $objdir/%-o %"` @@ -744,22 +853,22 @@ EOF # See if we need to build an old-fashioned archive. if test "$build_old_libs" = "yes"; then + # Transform .lo files to .o (and don't forget ansi2knr .l_o to ._o). + oldobjs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` case "$output" in *.la) # Now set the variables for building old libraries. oldlib="$objdir/$libname.a" - oldobjs="$libobjs" ;; *) oldlib="$output" - oldobjs="$objs$libobjs" $show "$rm $oldlib" $run $rm $oldlib ;; esac - cmds=`eval echo \"$old_archive_cmds\"` # Do each command in the archive commands. + cmds=`eval echo \"$old_archive_cmds\"` IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" @@ -913,7 +1022,11 @@ EOF library_names= old_library= - . $file + # If there is no directory component, then add one. + case "$file" in + */*) . $file ;; + *) . ./$file ;; + esac # Add the libdir to current_libdirs if it is the destination. if test "$destdir" = "$libdir"; then @@ -1002,7 +1115,7 @@ EOF link_against_libtool_libs= finalize_command= - # If there is no pathname component, then add one. + # If there is no directory component, then add one. case "$file" in */*) . $file ;; *) . ./$file ;; @@ -1019,7 +1132,11 @@ EOF # Check to see that each library is installed. libdir= if test -f "$lib"; then - . $lib + # If there is no directory component, then add one. + case "$lib" in + */*) . $lib ;; + *) . ./$lib ;; + esac fi libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" if test -z "$libdir"; then @@ -1085,7 +1202,7 @@ EOF $show "$old_striplib $oldlib" $run $old_striplib $oldlib || exit $? else - echo "$progname: warning: no library stripping program" 1>&2 + echo "$progname: warning: no static library stripping program" 1>&2 fi fi @@ -1106,7 +1223,7 @@ EOF if test -n "$current_libdirs"; then # Maybe just do a dry run. - test -n "$run" && current_libdirs="-n $current_libdirs" + test -n "$run" && current_libdirs=" -n$current_libdirs" exec $0 --finish$current_libdirs exit 1 fi @@ -1307,7 +1424,10 @@ library objects (\`.lo' or \`.l_o' files) may be specified, and the \`-rpath' option is required. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' -and \`ranlib'. Otherwise, an executable program is created. +and \`ranlib'. + +If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is +created, otherwise an executable program is created. EOF ;; -- 2.47.2