diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-02-24 23:41:28 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-02-24 23:41:28 +0000 |
commit | 96abf47dfc4b2fa432c65d9533661f2389194707 (patch) | |
tree | b5294adbd48d890604341e5da9d52af3328da9fb | |
parent | 15ae1beecfb3909bbbf0175722ca2ef53d35a23f (diff) | |
download | guile-96abf47dfc4b2fa432c65d9533661f2389194707.tar.gz |
* ltconfig, ltmain.sh: New versions from libtool-0.9.
-rwxr-xr-x | ltconfig | 260 | ||||
-rw-r--r-- | ltmain.sh | 346 |
2 files changed, 381 insertions, 225 deletions
@@ -1,8 +1,9 @@ #! /bin/sh # ltconfig - Create a system-specific libtool. +# When updating this script, search for LINENUM and fix line number refs. # Generated automatically from ltconfig.in by configure. -# Copyright (C) 1996, Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, Free Software Foundation, Inc. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This file is free software; you can redistribute it and/or modify it @@ -32,13 +33,14 @@ progname=`echo "$0" | sed 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool -VERSION=0.7 +VERSION=0.9 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: +can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking. enable_static=yes @@ -242,7 +244,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 +282,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 <<EOF -#line 305 "$progname" -int external_func() { return 1; } -static int hidden_func() { return 2; } -EOF - if { (eval echo $progname:308: \"$ac_compile\") 1>&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 +360,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 @@ -435,6 +375,7 @@ compiler="$2" echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= profile_flag_pattern= +special_shlib_compile_flags= wl= link_static_flag= @@ -448,16 +389,34 @@ 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* + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + *-*-sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' ;; *-*-solaris2*) @@ -478,8 +437,8 @@ 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 @@ -491,6 +450,16 @@ else echo $ac_t none 1>&6 fi +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + echo $ac_n "checking for $compiler option to statically link programs... $ac_c" 1>&6 if test -n "$link_static_flag"; then echo $ac_t "$link_static_flag" 1>&6 @@ -515,9 +484,10 @@ echo $ac_t "$with_gnu_ld" 1>&6 echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6 archive_cmds= -link_rpath_flag= +hardcode_libdir_flag= +hardcode_direct=no hardcode_minus_L=no -hardcode_shlibpath_var=no +hardcode_shlibpath_var=unsupported ld_shlibs=yes if test "$with_gnu_ld" = yes; then @@ -526,6 +496,8 @@ if test "$with_gnu_ld" = yes; then case "$host" in *-*-sunos4*) ld_shlibs=yes + hardcode_direct=yes + hardcode_shlibpath_var=no ;; *) @@ -539,55 +511,79 @@ if test "$with_gnu_ld" = yes; then if test "$ld_shlibs" = yes; then archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' - link_rpath_flag='${wl}-rpath $wl$libdir' + hardcode_libdir_flag='${wl}-rpath $wl$libdir' fi 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' - hardcode_shlibpath_var=yes + archive_cmds='/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' + test "$with_gcc" != yes && hardcode_direct=yes hardcode_minus_L=yes ;; *-*-aix4*) - archive_cmds='$rm $lib.exp;/bin/nm -B$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;ar cru $lib $objdir/$soname' - hardcode_shlibpath_var=yes + archive_cmds='/bin/nm -B$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;ar cru $lib $objdir/$soname' + test "$with_gcc" != yes && hardcode_direct=yes hardcode_minus_L=yes ;; *-*-freebsd*) archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + *-*-hpux9*) + archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' + hardcode_libdir_flag='${wl}+b ${wl}$libdir' + hardcode_direct=yes hardcode_minus_L=yes ;; *-*-hpux10*) archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' - link_rpath_flag='${wl}+b ${wl}$libdir' + hardcode_libdir_flag='${wl}+b ${wl}$libdir' + hardcode_direct=yes hardcode_minus_L=yes - hardcode_shlibpath_var=yes + ;; + + *-*-irix5* | *-*-irix6*) + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' + hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' ;; *-*-netbsd*) # Tested with NetBSD 1.2 ld archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' - link_rpath_flag='-R$libdir' + hardcode_libdir_flag='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no ;; *-*-osf3*) - archive_cmds='$LD -shared -o $lib -rpath $install_libdir -soname $soname -set_version $verstring$libobjs -lc$deplibs' - link_rpath_flag='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' + hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' + ;; + + *-*-sco3.2v5*) + archive_cmds='$LD -G -o $lib$libobjs$deplibs' + hardcode_direct=yes ;; *-*-solaris2*) archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' - link_rpath_flag='-R$libdir' + hardcode_libdir_flag='-R$libdir' + hardcode_shlibpath_var=no ;; *-*-sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' - link_rpath_flag='-L$libdir' + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' + hardcode_libdir_flag='-L$libdir' + hardcode_direct=yes hardcode_minus_L=yes + hardcode_shlibpath_var=no ;; *) @@ -598,10 +594,33 @@ else fi echo $ac_t "$ld_shlibs" 1>&6 -if test "$hardcode_shlibpath_var" = yes && test "$hardcode_minus_L" = yes; then - echo "$progname: warning: $LD needlessly hardcodes library paths into binaries" 1>&2 - echo "$PACKAGE will compensate by relinking binaries at install time." 1>&2 +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag"; then + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + test "$hardcode_minus_L" != no && + test "$hardcode_shlibpath_var" != no; then + + # Can't link without hardcoding. + hardcode_action=relink + else + hardcode_action=rpath + fi +elif test "$hardcode_direct" = yes || + test "$hardcode_minus_L" = yes || + test "$hardcode_shlibpath_var" = yes; then + + # We can't hardcode non-existant directories, but we can existing ones. + hardcode_action=relink +else + # We can't hardcode anything. + hardcode_action=unsupported fi +echo $ac_t "$hardcode_action" 1>&6 +test "$hardcode_action" = unsupported && can_build_shared=no + reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' @@ -612,7 +631,6 @@ 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= soname_spec= postinstall_cmds= @@ -648,7 +666,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 +678,13 @@ case "$host" in postinstall_cmds='chmod 555 $lib' ;; +*-*-irix5* | *-*-irix6*) + version_type=osf + soname_spec='$libname.so' + lib_names='$libname.so.$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + # No shared lib support for linuxoldld or linuxaout. *-*-linuxoldld* | *-*-linuxaout*) dynamic_linker=no @@ -688,6 +713,13 @@ case "$host" in shlibpath_var=LD_LIBRARY_PATH ;; +*-*-sco3.2v5*) + version_type=osf + soname_spec='$libname.so.$major' + lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + *-*-solaris2*) version_type=linux lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' @@ -710,6 +742,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 @@ -787,6 +842,7 @@ profile_flag_pattern='$profile_flag_pattern' version_type=$version_type # List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. lib_names='$lib_names' # The coded name of the library, if different from the real name. @@ -804,9 +860,6 @@ postinstall_cmds='$postinstall_cmds' # Commands used to finish a libtool library installation in a directory. finish_cmds='$finish_cmds' -# The flag that specifies a runtime search path when linking. -link_rpath_flag='$link_rpath_flag' - # How to strip a library file. striplib='$striplib' old_striplib='$old_striplib' @@ -814,14 +867,25 @@ old_striplib='$old_striplib' # This is the shared library path variable. shlibpath_var=$shlibpath_var -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag='$hardcode_libdir_flag' + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + EOF # Detect if we are using a relative or absolute path to ltmain.sh. @@ -1,6 +1,6 @@ # ltmain.sh - Provide generalized library-building support services. # Generated automatically from ltmain.sh.in by configure. -# Copyright (C) 1996 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ progname=`echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=0.7 +VERSION=0.9 default_mode=NONE help="Try \`$progname --help' for more information." @@ -89,6 +89,21 @@ do run=: ;; + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; @@ -110,7 +125,7 @@ done if test -n "$prevopt"; then echo "$progname: option \`$prevopt' requires an argument" 1>&2 - echo "$help" + echo "$help" 1>&2 exit 1 fi @@ -174,11 +189,25 @@ if test -z "$show_help"; then done # Get the name of the library object. - libobj=`echo "$srcfile" | sed -e 's%^.*/%%; s/\.[Sc]$/.lo/'` - case $libobj in + 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/'` ;; *) - echo "$progname: cannot determine name of library object from \`$srcfile'" + echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2 exit 1 ;; esac @@ -240,6 +269,8 @@ if test -z "$show_help"; then args="$cc" compile_command="$cc" finalize_command="$cc" + compile_shlibpath= + finalize_shlibpath= deplibs= install_libdir= libobjs= @@ -261,14 +292,24 @@ if test -z "$show_help"; then # suffix= # fi + # We need to know -static, to get the right output filenames. + case " $@ " in + *" -static "*) build_libtool_libs=no ;; + esac + for arg do # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) - compile_command="$compile_command $objdir/$arg" - finalize_command="$finalize_command $objdir/$arg"T + if test "$build_libtool_libs" = yes; then + compile_command="$compile_command $objdir/$arg" + finalize_command="$finalize_command $objdir/$arg"T + else + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi args="$args $arg" ;; esac @@ -279,13 +320,11 @@ if test -z "$show_help"; then continue fi - # The finalize and compile arguments. - farg="$arg" - carg="$arg" + args="$args $arg" + prevarg="$arg" case "$arg" in -L*) - deplibs="$deplibs $arg" dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` case "$dir" in /*) @@ -295,18 +334,22 @@ if test -z "$show_help"; then exit 1 ;; esac + deplibs="$deplibs $arg" ;; -l*) deplibs="$deplibs $arg" ;; -o) prev=output ;; - -rpath) prev=install_libdir carg= farg= ;; + -rpath) + prev=install_libdir + continue + ;; -static) - build_libtool_libs=no - farg="$link_static_flag" - carg="$farg" + link_static="`eval echo \"$link_static_flag\"`" + compile_command="$compile_command $link_static" + continue ;; -version-file) @@ -315,34 +358,66 @@ if test -z "$show_help"; then exit 1 ;; - -version-info) prev=vinfo carg= farg= ;; + -version-info) + prev=vinfo + continue + ;; -*) 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" ;; *.la) # A libtool-controlled library. + + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : + else + echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If there is no directory component, then add one. + case "$arg" in + */*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$libdir"; then + echo "$progname: \`$arg' contains no -rpath information" 1>&2 + exit 1 + fi + + # Get the name of the link library. + linklib= + for linklib in $library_names; do + : + done + + # Find the relevant object directory and library name. + name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'` dir=`echo "$arg" | sed 's%/[^/]*$%%'` - test "$dir" = "$arg" && dir=. - file=`echo "$arg" | sed 's%^.*/%%'` + if test "$dir" = "$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi link_against_libtool_libs="$link_against_libtool_libs $arg" - if test "$build_libtool_libs" = yes; then - # Specify the library as -lNAME. - carg="-l`echo "$file" | sed 's/lib\(..*\)\.la$/\1/'`" - farg="$carg" + if test "$build_libtool_libs" = yes; then if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in @@ -351,68 +426,85 @@ if test -z "$show_help"; then esac fi - # Check to see that this really is a libtool archive. - if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : - else - echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 - exit 1 - fi - - libdir= - . $dir/$file - - if test -z "$libdir"; then - echo "$progname: \`$arg' contains no -rpath information" 1>&2 + if test -z "$linklib"; then + echo "$progname: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi - if test -n "$link_rpath_flag"; then - carg="`eval echo \"$link_rpath_flag\"` $carg" - farg="$carg" + if test -n "$hardcode_libdir_flag"; then + tmp=`eval echo \"$hardcode_libdir_flag\"` + compile_command="$compile_command $tmp" + finalize_command="$finalize_command $tmp" fi - if test "$hardcode_minus_L" != yes; then - # Just give the right -L directory flag. - carg="-L$dir/$objdir $carg" + case "$hardcode_action" in + rpath) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; - elif test "$hardcode_shlibpath_var" = yes; then - # Give an absolute path to the library. + relink) + # We need an absolute path. case "$dir" in - /*) absdir="$dir" ;; + /*) ;; *) - absdir=`cd $dir && pwd` + absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - echo "$progname: cannot determine absolute pathname of \`$dir'" 1>&2 + echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi - ;; - esac - carg="-L$absdir/$objdir $carg" - farg="-L$libdir $farg" - fi + dir="$absdir" + ;; + esac + + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; + esac + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = no; then + finalize_command="$finalize_command -L$libdir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + finalize_shlibpath="$finalize_shlibpath$libdir:" + finalize_command="$finalize_command -l$name" + fi else # Transform directly to old archives if we don't build new libraries. - carg="$dir/$objdir/`echo "$file" | sed 's/\.la$/.a/'`" - farg="$carg" + test -z "$old_library" && old_library="$linklib" + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" fi + continue ;; *) echo "$progname: unknown file suffix for \`$arg'" 1>&2 - echo "$help" + echo "$help" 1>&2 exit 1 ;; esac - args="$args $arg" - - compile_command="$compile_command $carg" - finalize_command="$finalize_command $farg" - prevarg="$arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" done if test -n "$prev"; then - echo "$progname: the \`$prevarg' option requires an argument" + echo "$progname: the \`$prevarg' option requires an argument" 1>&2 echo "$help" 1>&2 exit 1 fi @@ -521,11 +613,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 +621,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 +650,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 +680,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 +737,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,16 +784,24 @@ 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/ $//'` 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 %"` $show "$compile_command" $run $compile_command - exit $? + status=$? + + # If we failed to link statically, then try again. + if test $status -ne 0 && test -n "$link_static"; then + echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2 + compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"` + $show "$finalize_command" + $run $finalize_command + status=$? + fi + exit $status fi # Create the binary in the object directory, then wrap it. @@ -725,43 +818,36 @@ if test -z "$show_help"; then case "$dir" in /*) # Absolute path. - rpath="$rpath:$dir/$objdir" + rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. - rpath="$rpath:\$thisdir/$dir/$objdir" + rpath="$rpath\$thisdir/$dir:" ;; esac done - - # Strip the ugly leading colon. - rpath=`echo "$rpath" | sed 's/^://'` - - # Prettify the rpath for the link command. - linkrpath=`echo "$rpath" | sed 's%\$thisdir/%%g'` fi # Delete the old output file. $run $rm $output - if test "$hardcode_minus_L" != yes; then - # Things are fine, the world is a beautiful place. - $show "$compile_command" - - 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" + if test -n "$compile_shlibpath"; then + compile_command="$shlibpath_var=$compile_shlibpath\$$shlibpath_var $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=$finalize_shlibpath\$$shlibpath_var $finalize_command" + fi - else + case "$hardcode_action" in + relink) # AGH! Flame the AIX and HP-UX people for me, will ya? - echo "$progname: warning: using a buggy hardcoding system linker" 1>&2 + echo "$progname: warning: using a buggy system linker" 1>&2 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 + ;; + esac - $show "$compile_command" - fi - - $run $compile_command || exit $? + $show "$compile_command" + eval "$run $compile_command" || exit $? # Now create the wrapper script. echo "creating $output" @@ -797,36 +883,42 @@ else absdir=\`cd "\$thisdir" && pwd\` test -n "\$absdir" && thisdir="\$absdir" - program="\$thisdir/$objdir/$output" + progdir="\$thisdir/$objdir" + program="$output" + + if test -f "\$progdir/\$program"; then + # Run the actual program with our arguments. + args= + for arg + do + # Quote arguments (to preserve shell metacharacters). + args="\$args '\$arg'" + done + + # Export the path to the program. + PATH="\$progdir:\$PATH" + export PATH EOF # Export our shlibpath_var if we have one. if test -n "$shlibpath_var" && test -n "$rpath"; then cat >> $output <<EOF - # Add our own library path to $shlibpath_var - $shlibpath_var="$rpath:\$$shlibpath_var" - export $shlibpath_var + # Add our own library path to $shlibpath_var + $shlibpath_var="$rpath\$$shlibpath_var" + export $shlibpath_var EOF fi - cat >>$output <<EOF + cat >> $output <<EOF - if test -f "\$program"; then - # Run the actual program with our arguments. - args= - for arg - do - # Quote arguments (to preserve shell metacharacters). - args="\$args '\$arg'" - done eval "exec \$program \$args" echo "\$0: cannot exec \$program \$args" exit 1 else # The program doesn't exist. - echo "\$0: error: \$program does not exist" 1>&2 + echo "\$0: error: \$progdir/\$program does not exist" 1>&2 echo "This script is just a wrapper for \$program." 1>&2 echo "See the $PACKAGE documentation for more information." 1>&2 exit 1 @@ -842,8 +934,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. @@ -1112,7 +1204,7 @@ EOF # Check the variables that should have been set. if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then - echo "$progname: invalid libtool wrapper script \`$file'" + echo "$progname: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi @@ -1129,19 +1221,19 @@ EOF fi 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 : + echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2 + elif test -f "$libfile"; then : else echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done - if test "$hardcode_minus_L" = yes && test "$hardcode_shlibpath_var" = yes; then + if test "$hardcode_direct" != no && test "$hardcode_minus_L" != no && test "$hardcode_shlibpath_var" != no; then if test "$finalize" = no; then - echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" + echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 else - echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" + echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 $show "$finalize_command" if $run $finalize_command; then : else @@ -1166,7 +1258,7 @@ EOF ;; esac done - + # FIXME Install any profiled libraries, too. # newfiles= # for file in $staticlibs; do @@ -1207,7 +1299,7 @@ EOF done if test -n "$future_libdirs"; then - echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" + echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then @@ -1299,7 +1391,7 @@ EOF $show "$rm $file" $run $rm $file done - exit 0 + exit 0 ;; NONE) @@ -1322,6 +1414,7 @@ Usage: $progname [OPTION]... [MODE-ARG]... Provide generalized library-building support services. -n, --dry-run display commands without modifying any files + --features display configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] @@ -1409,8 +1502,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'. |