From: Gordon Matzigkeit Date: Tue, 1 Apr 1997 18:59:30 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release-1-0a~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=185ee37bb4683fb33a1eb8e7e1bbfaa0d37ab543;p=thirdparty%2Flibtool.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 83c71c6f3..5d0765da0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Thu Jan 16 17:57:38 1997 Gordon Matzigkeit + + * ltmain.sh.in (link): If linking with $link_static_flag fails, + then retry without it, but still use the .a versions of + uninstalled libtool archives. + +Wed Jan 15 08:59:22 1997 Gordon Matzigkeit + + * ltmain.sh.in (link): Eval $link_static_flag. Reported by Bruno + Haible. + + * PLATFORMS: Add to distribution. Suggested by Bruno Haible. + +Mon Jan 13 12:59:29 1997 Gordon Matzigkeit + + * ltconfig.in: Add support for SCO OpenServer 5.x. + + (can_build_shared): Initialize at the top of the file, so that + shared libraries aren't built on platforms that don't support + them. + +Sat Jan 11 13:29:08 1997 Gordon Matzigkeit + + * ltmain.sh.in, ltconfig.in, libtoolize.in, doc/libtool.texi: + Update the copyright completion years. + Wed Jan 8 15:01:06 1997 Gordon Matzigkeit * ltconfig.in: Port to IRIX 5.3, 6.2. diff --git a/Makefile.am b/Makefile.am index 4e37034b3..0945b4149 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = gnits SUBDIRS = doc tests # Distribute ltconfig and ltmain.sh so that the demo directory works. -EXTRA_DIST = libtool.m4 libtoolize.in ltconfig ltconfig.in \ +EXTRA_DIST = PLATFORMS libtool.m4 libtoolize.in ltconfig ltconfig.in \ ltmain.sh ltmain.sh.in README-automake CLEANFILES = libtool libtoolize MAINTAINERCLEANFILES = ltconfig ltmain.sh diff --git a/NEWS b/NEWS index b0ab55cb8..d7f388d5c 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -New in 0.6e: +New in 0.7: * 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 @@ -13,7 +13,6 @@ New in 0.6e: * 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. Version 0.6 was never released. diff --git a/TODO b/TODO index 1273ab2ea..3881b2e78 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +* Implement `ld -r' on all platforms. + * Don't forget to find link_static_flag for native cc's on HP-UX and OSF/1. * Write installcheck for the demo directory. @@ -11,3 +13,6 @@ based on cflags. * GCC docs imply that all rs6000 code is PIC. See if it is true of any other processors (like maybe powerpc). + +* Maybe choosing between ln -s and cp -p should be done in ltconfig, +not ltmain.sh? diff --git a/configure.in b/configure.in index 84d209e89..d22b8c3bb 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,11 @@ AC_INIT(ltmain.sh.in) -AM_INIT_AUTOMAKE(libtool, 0.7) +AM_INIT_AUTOMAKE(libtool, 0.7a) pkgdatadir='${datadir}/libtool' AC_SUBST(pkgdatadir) aclocaldir='${datadir}/aclocal' AC_SUBST(aclocaldir) +localedir='${datadir}/locale' +AC_SUBST(localedir) AC_OUTPUT([Makefile doc/Makefile tests/Makefile]) diff --git a/demo/Makefile.am b/demo/Makefile.am index 94a091503..a79539905 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -1,7 +1,7 @@ # A brief demonstration of using Automake with Libtool. AUTOMAKE_OPTIONS = ansi2knr foreign -EXTRA_DIST = $(TESTS) +EXTRA_DIST = $(TESTS) acinclude.m4 # Build a libtool library, libhell.la for installation in libdir. lib_PROGRAMS = libhell.la @@ -10,13 +10,20 @@ libhell_la_LDFLAGS = -version-info 3:12:1 -rpath $(libdir) include_HEADERS = foo.h +bin_PROGRAMS = hell hell.static + # Build hell from main.c and libhell.la -bin_PROGRAMS = hell hell_SOURCES = main.c hell_LDADD = libhell.la +# Create a statically-linked version of hell. +hell_static_SOURCES = main.c +hell_static_LDADD = libhell.la +hell_static_LDFLAGS = -static + TESTS = run.test -# Regenerate the acinclude.m4 from the parent, if it doesn't exist. -$(top_srcdir)/acinclude.m4: - ln -s $(top_srcdir)/../libtool.m4 $(top_srcdir)/acinclude.m4 +# Regenerate our acinclude.m4 only if it doesn't exist. +$(srcdir)/acinclude.m4: + rm -f $(srcdir)/acinclude.m4 + ln -s ../libtool.m4 $(srcdir)/acinclude.m4 diff --git a/doc/libtool.texi b/doc/libtool.texi index 528d9bac9..a021a6e09 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1000,15 +1000,21 @@ First, to link a program against a libtool library, just use the @samp{program_LDADD} variable: @example +bin_PROGRAMS = hell hell.static + # Build hell from main.c and libhell.la -bin_PROGRAMS = hell hell_SOURCES = main.c hell_LDADD = libhell.la + +# Create a statically-linked version of hell. +hell_static_SOURCES = main.c +hell_static_LDADD = libhell.la +hell_static_LDFLAGS = -static @end example You may use the @samp{program_LDFLAGS} variable to stuff in any flags -you want to pass to libtool while linking @samp{program}, such as -@samp{-static}. +you want to pass to libtool while linking @samp{program} (such as +@samp{-static} to create a statically-linked executable). Building a libtool library is almost as trivial@dots{} note the use of @samp{libhell_la_LDFLAGS} to pass the @samp{-version-info} @@ -1106,6 +1112,9 @@ The C compiler that will be used by the generated @file{libtool}. @item CFLAGS Compiler flags used to generate standard object files. +@item CPPFLAGS +C preprocessor flags. + @item LD The system linker to use (if the generated @file{libtool} requires one). diff --git a/ltconfig.in b/ltconfig.in index b1bc5c7a0..e2208c2f7 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -1,6 +1,7 @@ #! /bin/sh # ltconfig - Create a system-specific libtool. +# When updating this script, search for LINENUM and fix line number refs. # @configure_input@ # Copyright (C) 1996, Free Software Foundation, Inc. # Gordon Matzigkeit , 1996 @@ -242,7 +243,7 @@ elif test "$host" = NONE; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 -else +else host_alias=$host fi @@ -280,69 +281,6 @@ if test -n "$RANLIB"; then old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib" fi -# FIXME: this is simplistic, and doesn't allow for cross-compiling. -echo $ac_n "checking for library strip program... $ac_c" 1>&6 -striplib= -if strip -x /dev/null 2>&1 | grep '/dev/null' >/dev/null 2>&1; then - # strip: /dev/null: Inappropriate file type or format - striplib="strip -x" -fi - -if test -n "$striplib"; then - echo $ac_t "$striplib" 1>&6 -else - echo $ac_t none 1>&6 -fi - - -# Check if old-style libraries may be stripped. -old_striplib= -if test -n "$striplib"; then - echo $ac_n "checking if $striplib works for static archives... $ac_c" 1>&6 - old_striplib="$striplib" - trap 'rm -rf conftest*; exit 1' 1 2 15 - cat > conftest.c <&5; (eval $ac_compile) 2>&5; }; then - oldlib=conftest.a - oldobjs=' conftest.o' - - # Do each of the archive commands. - cmds=`eval echo \"$old_archive_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - if { (echo $progname:317: \"$cmd\") 1>&5; ($cmd) 2>&5; }; then : - else - old_striplib= - break - fi - done - IFS="$save_ifs" - - if test -n "$old_striplib"; then - if { (echo $progname:326: \"$old_striplib conftest.a\") 1>&5; ($old_striplib conftest.a) 2>&5; }; then : - else - old_striplib= - fi - fi - else - old_striplib= - fi - rm -rf conftest* - trap '' 1 2 15 - - if test -n "$old_striplib"; then - echo "$ac_t""yes" 1>&6 - else - echo "$ac_t""no" 1>&6 - fi -fi - - # Check to see if we are using GCC. if test "$with_gcc" = no; then # If CC is not set, then try to find GCC or a usable CC. @@ -421,7 +359,8 @@ if test "$with_gcc" = no; then yes; #endif EOF - if eval "$CC -E conftest.c" | egrep yes >/dev/null 2>&1; then : + # LINENUM + if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c @@ -448,16 +387,27 @@ else case "$host" in *-*-aix3* | *-*-aix4*) # FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform? + pic_flag= link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; - *-*-hpux10*) - # FIXME link_static_flag? + *-*-hpux9* | *-*-hpux10*) + # FIXME is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag='${wl}-a ${wl}archive' pic_flag='+Z' ;; + *-*-irix5* | *-*-irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + pic_flag= + ;; + *-*-osf3*) - # FIXME - pic_flag, link_static_flag? + # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf* + link_static_flag='-non_shared' ;; *-*-solaris2*) @@ -478,12 +428,14 @@ else fi case "$host" in -rs6000-*-*) - # Yippee! All rs/6000 code is position-independent. +rs6000-*-* | powerpc-*-* | powerpcle-*-*) + # Yippee! All RS/6000 and PowerPC code is position-independent. pic_flag= ;; esac +# FIXME actually try compiling an object file with the pic flag? + if test -n "$pic_flag"; then echo $ac_t "$pic_flag" 1>&6 pic_flag=" $pic_flag" @@ -545,7 +497,7 @@ else # PORTME fill in a description of your system's linker (not GNU ld) case "$host" in *-*-aix3*) - archive_cmds='$rm $lib.exp;/ucb/nm$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;ar cru $lib $objdir/$soname' + archive_cmds='$rm $lib.exp;/usr/ucb/nm$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;ar cru $lib $objdir/$soname' hardcode_shlibpath_var=yes hardcode_minus_L=yes ;; @@ -561,13 +513,18 @@ else hardcode_minus_L=yes ;; - *-*-hpux10*) + *-*-hpux9* | *-*-hpux10*) archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' link_rpath_flag='${wl}+b ${wl}$libdir' hardcode_minus_L=yes hardcode_shlibpath_var=yes ;; + *-*-irix5* | *-*-irix6*) + archive_cmds='$LD -shared -o $lib -soname $install_libdir/$soname -set_version $verstring$libobjs -lc$deplibs' + link_rpath_flag='${wl}-rpath ${wl}$libdir' + ;; + *-*-netbsd*) # Tested with NetBSD 1.2 ld archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' @@ -575,7 +532,7 @@ else ;; *-*-osf3*) - archive_cmds='$LD -shared -o $lib -rpath $install_libdir -soname $soname -set_version $verstring$libobjs -lc$deplibs' + archive_cmds='$LD -shared -o $lib -soname $install_libdir/$soname -set_version $verstring$libobjs -lc$deplibs' link_rpath_flag='${wl}-rpath ${wl}$libdir' ;; @@ -585,7 +542,7 @@ else ;; *-*-sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' link_rpath_flag='-L$libdir' hardcode_minus_L=yes ;; @@ -648,7 +605,7 @@ case "$host" in shlibpath_var=LD_LIBRARY_PATH ;; -*-*-hpux10*) +*-*-hpux9* | *-*-hpux10*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" @@ -660,6 +617,13 @@ case "$host" in postinstall_cmds='chmod 555 $lib' ;; +*-*-irix5*) + version_type=osf + soname_spec='$libname.so.$major' + lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + # No shared lib support for linuxoldld or linuxaout. *-*-linuxoldld* | *-*-linuxaout*) dynamic_linker=no @@ -683,8 +647,8 @@ case "$host" in *-*-osf3*) version_type=osf - soname_spec='$libname.so' - lib_names='$libname.so.$versuffix $libname.so' + soname_spec='$libname.so.$major' + lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -710,6 +674,29 @@ esac echo "$ac_t""$dynamic_linker" +# FIXME need to add library stripping features +# strip -x works for most platforms, though not for static libraries on NetBSD +# HP-UX requires "-r" for library stripping +striplib= +old_striplib= + +#echo $ac_n "checking for static library strip program... $ac_c" 1>&6 +#if test -n "$old_striplib"; then +# echo $ac_t "$old_striplib" 1>&6 +#else +# echo $ac_t none 1>&6 +#fi + +#if test "$can_build_shared" = yes; then +# echo $ac_n "checking for shared library strip program... $ac_c" 1>&6 +# +# if test -n "$striplib"; then +# echo $ac_t "$striplib" 1>&6 +# else +# echo $ac_t none 1>&6 +# fi +#fi + # Report the consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 diff --git a/ltmain.sh.in b/ltmain.sh.in index ccdf41ec8..b045ebd3b 100644 --- a/ltmain.sh.in +++ b/ltmain.sh.in @@ -1,6 +1,6 @@ # ltmain.sh - Provide generalized library-building support services. # @configure_input@ -# Copyright (C) 1996 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -174,7 +174,21 @@ if test -z "$show_help"; then done # Get the name of the library object. - libobj=`echo "$srcfile" | sed -e 's%^.*/%%; s/\.[Sc]$/.lo/'` + libobj=`echo "$srcfile" | sed -e 's%^.*/%%` + + # Recognize several different file suffixes. + xform='[cCFSf]' + case $libobj in + *.c++) xform='c\+\+' ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform='for' ;; + esac + + libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"` + case $libobj in *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; *) @@ -285,7 +299,6 @@ if test -z "$show_help"; then case "$arg" in -L*) - deplibs="$deplibs $arg" dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` case "$dir" in /*) @@ -295,6 +308,7 @@ if test -z "$show_help"; then exit 1 ;; esac + deplibs="$deplibs $arg" ;; -l*) deplibs="$deplibs $arg" ;; @@ -319,14 +333,12 @@ if test -z "$show_help"; then -*) cc="$cc $arg" ;; # Some other compiler flag. - # Automake's ansi2knr support code uses the "._o" and ".l_o" object - # suffixes. - *.o | *._o | *.a) + *.o | *.a) # A standard object. objs="$objs $arg" ;; - *.lo | *.l_o) + *.lo) # A library object. libobjs="$libobjs $arg" ;; @@ -521,11 +533,6 @@ if test -z "$show_help"; then case "$version_type" in none) ;; - libtool) - version_vars="$version_vars versuffix" - versuffix="$current.$age.$revision" - ;; - linux) version_vars="$version_vars major versuffix" major=`expr $current - $age` @@ -534,6 +541,7 @@ if test -z "$show_help"; then osf) version_vars="$version_vars versuffix verstring" + major=`expr $current - $age` versuffix="$current.$age.$revision" verstring="$versuffix" @@ -562,9 +570,6 @@ if test -z "$show_help"; then ;; esac - # Maybe add a suffix. - test -n "$suffix" && libname=$libname"_$suffix" - # Create the output directory, or remove our outputs if we need to. if test -d $objdir; then $show "$rm $objdir/$libname.*" @@ -595,7 +600,7 @@ if test -z "$show_help"; then done # Use standard objects if they are PIC. - test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` + test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` # Do each of the archive commands. cmds=`eval echo \"$archive_cmds\"` @@ -652,7 +657,7 @@ if test -z "$show_help"; then $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'` + reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` output="$obj" cmds=`eval echo \"$reload_cmds\"` @@ -699,8 +704,7 @@ if test -z "$show_help"; then if test -n "$libobjs"; then # Transform all the library objects into standard objects. - compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` - + compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//g'` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then @@ -751,7 +755,8 @@ if test -z "$show_help"; then elif test "$hardcode_shlibpath_var" != yes; then # We just need to export the shlibpath for the link command. $show "$shlibpath_var=$linkrpath $compile_command" - eval "export $shlibpath_var=$linkrpath" + eval "$shlibpath_var=$linkrpath" + eval "export $shlibpath_var" else # AGH! Flame the AIX and HP-UX people for me, will ya? @@ -842,8 +847,8 @@ 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'` + # Transform .lo files to .o + oldobjs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` case "$output" in *.la) # Now set the variables for building old libraries. @@ -1130,7 +1135,7 @@ EOF libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" if test -z "$libdir"; then echo "$progname: warning: \`$lib' contains no -rpath information" - elif test -f "$libfile"; then : + elif test -f "$libfile"; then : else echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no @@ -1166,7 +1171,7 @@ EOF ;; esac done - + # FIXME Install any profiled libraries, too. # newfiles= # for file in $staticlibs; do @@ -1299,7 +1304,7 @@ EOF $show "$rm $file" $run $rm $file done - exit 0 + exit 0 ;; NONE) @@ -1409,8 +1414,7 @@ treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only -library objects (\`.lo' or \`.l_o' files) may be specified, and the \`-rpath' -option is required. +library objects (\`.lo' files) may be specified, and \`-rpath' is required. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' and \`ranlib'.