From 393e4e4de704ba493484c49ec08028ef8e048cc5 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 12 Jun 1997 02:59:33 +0000 Subject: [PATCH] * ltconfig, ltmain.sh, config.guess: New files from libtool 0.9g. --- config.guess | 73 ++++++++++++++---- ltconfig | 172 +++++++++++++++++++++++++++-------------- ltmain.sh | 210 ++++++++++++++++++++++----------------------------- 3 files changed, 269 insertions(+), 186 deletions(-) diff --git a/config.guess b/config.guess index e9e44559f..bfd352355 100755 --- a/config.guess +++ b/config.guess @@ -1,6 +1,6 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -68,11 +68,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) - echo m68k-cbm-openbsd${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -115,19 +136,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) - echo m68k-atari-openbsd${UNAME_RELEASE} + echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) - echo m68k-sun-openbsd${UNAME_RELEASE} + echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) - echo m68k-apple-openbsd${UNAME_RELEASE} + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} @@ -141,6 +168,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >dummy.c int main (argc, argv) int argc; char **argv; { @@ -375,8 +405,8 @@ EOF hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; - hp3[0-9][05]:OpenBSD:*:*) - echo m68k-hp-openbsd${UNAME_RELEASE} + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | *:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -400,7 +430,7 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,-.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -422,6 +452,23 @@ EOF echo alpha-unknown-linux-gnu ; exit 0 elif test "${UNAME_MACHINE}" = "sparc" ; then echo sparc-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. @@ -529,6 +576,10 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -548,10 +599,6 @@ EOF echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/ltconfig b/ltconfig index 52a774e52..68429b6ae 100755 --- a/ltconfig +++ b/ltconfig @@ -33,7 +33,7 @@ progname=`echo "$0" | sed 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool -VERSION=0.9e +VERSION=0.9g ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' rm="rm -f" @@ -87,6 +87,7 @@ Usage: $progname [OPTION]... LTMAIN [HOST] Generate a system-specific libtool script. --disable-shared do not build shared libraries + --disable-static do not build static libraries --help display this help and exit --no-verify do not verify that HOST is a valid host type --quiet same as \`--silent' @@ -105,6 +106,8 @@ EOM --disable-shared) enable_shared=no ;; + --disable-static) enable_static=no ;; + --quiet | --silent) silent=yes ;; --srcdir) prev=srcdir ;; @@ -257,9 +260,9 @@ case "$host" in *-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac -host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' @@ -370,7 +373,7 @@ if test "$with_gcc" = no; then #endif EOF # 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 + if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c @@ -395,45 +398,45 @@ if test "$with_gcc" = yes; then link_static_flag='-static' else # PORTME Check for PIC flags for the system compiler. - case "$host" in - *-*-aix3* | *-*-aix4*) + case "$host_os" 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' ;; - *-*-hpux9* | *-*-hpux10*) + 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*) + irix5* | irix6*) wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. pic_flag= ;; - *-*-osf3* | *-*-osf4*) + osf3* | osf4*) # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf* wl='-Wl,' link_static_flag='-non_shared' ;; - *-*-sco3.2v5*) + sco3.2v5*) pic_flag='-Kpic' link_static_flag='-dn' special_shlib_compile_flags='-belf' ;; - *-*-solaris2*) + solaris2*) pic_flag='-KPIC' link_static_flag='-Bstatic' ;; - *-*-sunos4*) + sunos4*) pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' @@ -445,8 +448,8 @@ else esac fi -case "$host" in -rs6000-*-* | powerpc-*-* | powerpcle-*-*) +case "$host_cpu" in +rs6000 | powerpc | powerpcle) # Yippee! All RS/6000 and PowerPC code is position-independent. pic_flag= ;; @@ -469,6 +472,23 @@ if test -n "$special_shlib_compile_flags"; then fi fi +# See if we are using a broken GCC collect2 program. +if test "$with_gcc" = yes; then + echo $ac_n "checking for broken GCC collect2... $ac_c" 1>&6 + + # FIXME: Run a test here, instead of relying on the canonical system name. + case "$host_os" in + aix3*) + can_build_shared=no + echo $ac_t yes 1>&6 + echo "$progname: to build shared libraries, set the CC env variable to \`xlc' and reconfigure" 1>&2 + ;; + *) + echo $ac_t no 1>&6 + ;; + esac +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 @@ -483,6 +503,8 @@ with_gnu_ld=no set dummy $LD linker="$2" echo $ac_n "checking if $LD is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's don't accept +# it, but do accept -v. if $LD -v 2>&1 | egrep '(GNU ld|with BFD)' > /dev/null; then with_gnu_ld=yes linker="GNU ld" @@ -492,20 +514,23 @@ echo $ac_t "$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6 +allow_undefined_flag= archive_cmds= export_dynamic_flag= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no +hardcode_runpath_var=no hardcode_shlibpath_var=unsupported +runpath_var= ld_shlibs=yes if test "$with_gnu_ld" = yes; then # See if GNU ld supports shared libraries. - case "$host" in - *-*-sunos4*) + case "$host_os" in + sunos4*) ld_shlibs=yes hardcode_direct=yes hardcode_shlibpath_var=no @@ -513,6 +538,8 @@ if test "$with_gnu_ld" = yes; then *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes ld_shlibs=yes else ld_shlibs=no @@ -527,47 +554,69 @@ if test "$with_gnu_ld" = yes; then fi else # PORTME fill in a description of your system's linker (not GNU ld) - case "$host" in - *-*-aix3*) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes ;; - *-*-aix4*) + aix4*) + allow_undefined_flag=unsupported archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | 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_direct=yes hardcode_minus_L=yes ;; - *-*-freebsd*) + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # doesn't break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 don't have this feature. + freebsd2*) archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; - *-*-hpux9*) + # FreeBSD 3, at last, uses gcc -shared to do shared libraries. + freebsd3*) + archive_cmds='$CC -shared -o $lib$libobjs$deplibs' + hardcode_direct=yes + hardcode_minusL=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_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; - *-*-hpux10*) + hpux10*) archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; - *-*-irix5* | *-*-irix6*) + irix5* | irix6*) archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' ;; - *-*-netbsd*) + netbsd* | openbsd*) # Tested with NetBSD 1.2 ld archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='-R$libdir' @@ -575,24 +624,25 @@ else hardcode_shlibpath_var=no ;; - *-*-osf3* | *-*-osf4*) - archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' + osf3* | osf4*) + allow_undefined_flag=' -expect_unresolved' + archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; - *-*-sco3.2v5*) + sco3.2v5*) archive_cmds='$LD -G -o $lib$libobjs$deplibs' hardcode_direct=yes ;; - *-*-solaris2*) + solaris2*) archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no ;; - *-*-sunos4*) + sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes @@ -611,10 +661,12 @@ echo $ac_t "$ld_shlibs" 1>&6 # 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_spec"; then +if test -n "$hardcode_libdir_flag_spec" || \ + test "$hardcode_runpath_var" = yes; then + # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - test "$hardcode_minus_L" != no && + if test "$hardcode_direct" != no && \ + test "$hardcode_minus_L" != no && \ test "$hardcode_shlibpath_var" != no; then # Linking always hardcodes the temporary library directory. @@ -623,8 +675,8 @@ if test -n "$hardcode_libdir_flag_spec"; then # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi -elif test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && +elif test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" != yes; then # We can't hardcode anything. hardcode_action=unsupported @@ -654,8 +706,8 @@ version_type=none dynamic_linker="$host_os ld.so" echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 -case "$host" in -*-*-aix3* | *-*-aix4*) +case "$host_os" in +aix3* | aix4*) version_type=linux library_names_spec='$libname.so.$versuffix $libname.a' shlibpath_var=LIBPATH @@ -664,16 +716,20 @@ case "$host" in soname_spec='$libname.so.$major' ;; -*-*-freebsd*) +freebsd2* | freebsd3*) version_type=sunos library_names_spec='$libname.so.$versuffix $libname.so' finish_cmds='ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; -# *-*-gnu* needs to come after *-*-linux-gnu*. +gnu*) + version_type=sunos + library_names_spec='$libname.so.$versuffix' + shlibpath_var=LD_LIBRARY_PATH + ;; -*-*-hpux9* | *-*-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" @@ -685,7 +741,7 @@ case "$host" in postinstall_cmds='chmod 555 $lib' ;; -*-*-irix5* | *-*-irix6*) +irix5* | irix6*) version_type=osf soname_spec='$libname.so' library_names_spec='$libname.so.$versuffix $libname.so' @@ -693,13 +749,13 @@ case "$host" in ;; # No shared lib support for Linux oldld, aout, or coff. -*-*-linux-gnuoldld* | *-*-linux-gnuaout* | *-*-linux-gnucoff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no can_build_shared=no ;; # This must be Linux ELF. -*-*-linux-gnu*) +linux-gnu*) version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' @@ -707,41 +763,35 @@ case "$host" in shlibpath_var=LD_LIBRARY_PATH ;; -*-*-gnu*) - version_type=sunos - library_names_spec='$libname.so.$versuffix' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*-*-netbsd*) +netbsd* | openbsd*) version_type=sunos library_names_spec='$libname.so.$versuffix' finish_cmds='ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; -*-*-osf3* | *-*-osf4*) +osf3* | osf4*) version_type=osf soname_spec='$libname.so' library_names_spec='$libname.so.$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; -*-*-sco3.2v5*) +sco3.2v5*) version_type=osf soname_spec='$libname.so.$major' library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; -*-*-solaris2*) +solaris2*) version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH ;; -*-*-sunos4*) +sunos4*) version_type=sunos library_names_spec='$libname.so.$versuffix' finish_cmds='ldconfig $libdir' @@ -801,6 +851,8 @@ echo "$ac_t""$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes +echo "checking whether to build static libraries... $enable_static" 1>&6 + ofile=libtool trap "$rm $ofile; exit 1" 1 2 15 echo creating $ofile @@ -877,6 +929,9 @@ old_postinstall_cmds='$old_postinstall_cmds' archive_cmds='$archive_cmds' postinstall_cmds='$postinstall_cmds' +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag='$allow_undefined_flag' + # Commands used to finish a libtool library installation in a directory. finish_cmds='$finish_cmds' @@ -884,6 +939,9 @@ finish_cmds='$finish_cmds' striplib='$striplib' old_striplib='$old_striplib' +# This is the shared library runtime path variable. +runpath_var=$runpath_var + # This is the shared library path variable. shlibpath_var=$shlibpath_var @@ -905,7 +963,11 @@ hardcode_direct=$hardcode_direct # resulting binary. hardcode_minus_L=$hardcode_minus_L -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the +# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the +# resulting binary. +hardcode_runpath_var=$hardcode_runpath_var + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var diff --git a/ltmain.sh b/ltmain.sh index ab4a27f6c..15e30ef6c 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -28,7 +28,7 @@ progname=`echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=0.9e +VERSION=0.9g default_mode=NONE help="Try \`$progname --help' for more information." @@ -143,7 +143,7 @@ if test -z "$show_help"; then if test "$mode" = NONE; then case "$nonopt" in *cc) - if echo " $@ " | egrep "[ ]-c[ ]" > /dev/null 2>&1; then + if echo " $@ " | egrep -e "[ ]-c[ ]" > /dev/null 2>&1; then mode=compile else mode=link @@ -229,9 +229,14 @@ if test -z "$show_help"; then exit 1 fi - # Delete any old library objects. - $run $rm $obj $libobj - trap "$run $rm $obj $libobj; exit 1" 1 2 15 + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + $run $rm $obj $libobj + trap "$run $rm $obj $libobj; exit 1" 1 2 15 + else + $run $rm $libobj + trap "$run $rm $libobj; exit 1" 1 2 15 + fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then @@ -239,7 +244,7 @@ if test -z "$show_help"; then $show "$base_compile$pic_flag -DPIC $srcfile" if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then : else - $run $rm $obj + test -n "$obj" && $run $rm $obj exit 1 fi @@ -255,16 +260,18 @@ if test -z "$show_help"; then $run $mv $obj $libobj || exit 1 fi - # Compile the position-dependent object. - $show "$base_compile $srcfile" - if eval "$run $base_compile $srcfile"; then : - else - $run $rm $obj $libobj - exit 1 + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + $show "$base_compile $srcfile" + if eval "$run $base_compile $srcfile"; then : + else + $run $rm $obj $libobj + exit 1 + fi fi - # Create an invalid object file if no PIC, so that we don't accidentally - # link it. + # Create an invalid libtool object if no PIC, so that we don't accidentally + # link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" eval "$run echo timestamp > $libobj" || exit $? @@ -279,6 +286,7 @@ if test -z "$show_help"; then # Go through the arguments, transforming them on the way. cc="$nonopt" args="$cc" + allow_undefined=no compile_command="$cc" finalize_command="$cc" compile_shlibpath= @@ -292,12 +300,11 @@ if test -z "$show_help"; then link_static= ltlibs= objs= - output= prev= prevarg= + perm_rpath= temp_rpath= vinfo= - whole_archive=no # We need to know -static, to get the right output filenames. case " $@ " in @@ -326,6 +333,8 @@ if test -z "$show_help"; then prevarg="$arg" case "$arg" in + -allow-undefined) allow_undefined=yes ;; + -export-dynamic) export_dynamic=yes compile_command="$compile_command $export_dynamic_flag" @@ -348,8 +357,6 @@ if test -z "$show_help"; then -l*) deplibs="$deplibs $arg" ;; - -no-whole-archive) whole_archive=no ;; - -o) prev=output ;; -rpath) @@ -374,8 +381,6 @@ if test -z "$show_help"; then continue ;; - -whole-archive) whole_archive=yes ;; - -*) cc="$cc $arg" ;; # Some other compiler flag. *.o) @@ -389,36 +394,8 @@ if test -z "$show_help"; then dir=`echo "$arg" | sed 's%/[^/]*$%/%'` test "$dir" = "$arg" && dir= - # If -whole-archive was specified, we need to link all the members. - if test "$whole_archive" = yes; then - if test -f $arg; then : - else - echo "$progname: \`$arg' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 - fi - - # Get the names of the members of the archive. - members=`$AR t $arg 2>/dev/null` - for m in $members; do - case "$m" in - *.lo) libobjs="$libobjs $dir$m" ;; - *.o) - if test "$build_libtool_libs" = yes; then - objs="$objs $dir$m" - else - libobjs="$libobjs $dir$m" - fi - ;; - esac - done - elif test -f "$dir$objdir/$file"; then - # .libs/libfoo.a exists, so this is an archive of libobjects. - libobjs="$libobjs $arg" - else - # Standard archive. - objs="$objs $arg" - fi + # Standard archive. + objs="$objs $arg" ;; *.lo) @@ -499,8 +476,15 @@ if test -z "$show_help"; then compile_command="$compile_command $hardcode_libdir_flag" finalize_command="$finalize_command $hardcode_libdir_flag" fi + elif test "$hardcode_runpath_var" = yes; then + # Do the same for the permanent run path. + case "$perm_rpath " in + "* $libdir *") ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac fi + case "$hardcode_action" in immediate) if test "$hardcode_direct" = no; then @@ -557,7 +541,11 @@ if test -z "$show_help"; then fi else # Transform directly to old archives if we don't build new libraries. - test -z "$old_library" || linklib="$old_library" + if test -n "$pic_flag" && test -z "$old_library"; then + echo "$progname: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + test -n "$old_library" && linklib="$old_library" compile_command="$compile_command $dir/$linklib" finalize_command="$finalize_command $dir/$linklib" fi @@ -601,20 +589,6 @@ if test -z "$show_help"; then exit 1 ;; - *.a) - # Old archive. - libname=`echo "$output" | sed 's/\.a$//'` - build_old_libs=yes - - if test -n "$install_libdir"; then - echo "$progname: warning: \`-rpath' is ignored while linking old-style libraries" 1>&2 - fi - - if test -n "$vinfo"; then - echo "$progname: warning: \`-version-info' is ignored while linking old-style libraries" 1>&2 - fi - ;; - *.la) libname=`echo "$output" | sed 's/\.la$//'` @@ -742,6 +716,17 @@ if test -z "$show_help"; then $run $mkdir $objdir || exit $? fi + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if "$allow_undefined_flag" = unsupported; then + echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + fi + else + # Clear the flag. + allow_undefined_flag= + fi + if test "$build_libtool_libs" = yes; then # Get the real and link names of the library. library_names=`eval echo \"$library_names_spec\"` @@ -825,9 +810,7 @@ if test -z "$show_help"; then # Delete the old objects. $run $rm $obj $libobj - # Create the old-style object (skipping any convenience libraries). - # FIXME: skipping them is simplistic. We should determine which members - # are actually needed to resolve symbols. + # Create the old-style object. reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` output="$obj" @@ -876,6 +859,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/ $//'` + finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then @@ -925,16 +909,27 @@ if test -z "$show_help"; then ;; esac done + temp_rpath="$rpath" fi # Delete the old output file. $run $rm $output if test -n "$compile_shlibpath"; then - compile_command="$shlibpath_var=$compile_shlibpath\$$shlibpath_var $compile_command" + 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" + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" + finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" fi case "$hardcode_action" in @@ -971,8 +966,8 @@ if test -z "$show_help"; then # This environment variable determines our operation mode. if test "\$libtool_install_magic" = "$magic"; then # install mode needs the following variables: - link_against_libtool_libs="$link_against_libtool_libs" - finalize_command="$finalize_command" + link_against_libtool_libs='$link_against_libtool_libs' + finalize_command='$finalize_command' else # Find the directory that this script lives in. thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\` @@ -1000,11 +995,11 @@ else EOF # Export our shlibpath_var if we have one. - if test -n "$shlibpath_var" && test -n "$rpath"; then + if test -n "$shlibpath_var" && test -n "$temp_rpath"; then cat >> $output <&2 + echo "$help" 1>&2 + exit 1 + fi + # Now check to make sure each one is a valid libtool library. status=0 for lib in $ltlibs; do dlname= libdir= + library_names= # Check to see that this really is a libtool archive. if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : @@ -1482,6 +1455,9 @@ EOF status=1 elif test -n "$dlname"; then echo "$libdir/$dlname" + elif test -z "$library_names"; then + echo "$progname: \`$arg' is not a shared library" 1>&2 + status=1 else echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2 status=1 @@ -1631,7 +1607,7 @@ EOF dlname) cat <