# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
-VERSION=0.9
+VERSION=0.9d
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
rm="rm -f"
verify_host=yes
with_gcc=no
+old_AR="$AR"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS"
old_LD="$LD"
old_RANLIB="$RANLIB"
+test -z "$AR" && AR=ar
+
# Parse the command line options.
args=
prev=
host=`$ac_config_sub $host_alias`
echo "$ac_t""$host" 1>&6
+ # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
+ case "$host" in
+ *-*-linux-gnu*) ;;
+ *-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
elif test "$host" = NONE; then
echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
echo "$help" 1>&2
host_alias=$host
fi
+# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host" in
+*-*-linux-gnu*) ;;
+*-*-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/'`
# Determine commands to create old-style static archives.
-old_archive_cmds='ar cru $oldlib$oldobjs'
+old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
# If RANLIB is not set, then run the test.
pic_flag=
;;
- *-*-osf3*)
+ *-*-osf3* | *-*-osf4*)
# FIXME - pic_flag is probably required for hppa*-osf* and i860-osf*
wl='-Wl,'
link_static_flag='-non_shared'
set dummy $LD
linker="$2"
echo $ac_n "checking if $LD is GNU ld... $ac_c" 1>&6
-if $LD --version 2>&1 | egrep 'with BFD' > /dev/null; then
+if $LD --version 2>&1 | egrep '(GNU ld|with BFD)' > /dev/null; then
with_gnu_ld=yes
linker="GNU ld"
fi
echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6
archive_cmds=
-hardcode_libdir_flag=
+export_dynamic_flag=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
if test "$ld_shlibs" = yes; then
archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag='${wl}-rpath $wl$libdir'
+ hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
+ export_dynamic_flag='${wl}-export-dynamic'
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case "$host" in
*-*-aix3*)
- 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
+ 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*)
- 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
+ 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_minus_L=yes
;;
*-*-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_libdir_flag_spec='${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'
- hardcode_libdir_flag='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
*-*-irix5* | *-*-irix6*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
- hardcode_libdir_flag='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
;;
*-*-netbsd*)
# Tested with NetBSD 1.2 ld
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_libdir_flag='-R$libdir'
+ hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
- *-*-osf3*)
+ *-*-osf3* | *-*-osf4*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
- hardcode_libdir_flag='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
;;
*-*-sco3.2v5*)
*-*-solaris2*)
archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag='-R$libdir'
+ hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
;;
*-*-sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
- hardcode_libdir_flag='-L$libdir'
+ hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
# 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
+if test -n "$hardcode_libdir_flag_spec"; then
# We can hardcode non-existant directories.
if test "$hardcode_direct" != no &&
test "$hardcode_minus_L" != no &&
# Can't link without hardcoding.
hardcode_action=relink
else
- hardcode_action=rpath
+ hardcode_action=immediate
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
+ hardcode_action=immediate
else
# We can't hardcode anything.
hardcode_action=unsupported
test -n "$reload_flag" && reload_flag=" $reload_flag"
# PORTME Fill in your ld.so characteristics
-lib_names=
+library_names_spec=
soname_spec=
postinstall_cmds=
finish_cmds=
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
case "$host" in
*-*-aix3* | *-*-aix4*)
- # Shared libraries and static libraries currently use the same namespace.
- test "$enable_shared" = no || enable_static=no
-
version_type=linux
- lib_names='$libname.so.$versuffix $libname.a'
+ library_names_spec='$libname.so.$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name.
*-*-freebsd*)
version_type=sunos
- lib_names='$libname.so.$versuffix $libname.so'
+ library_names_spec='$libname.so.$versuffix $libname.so'
finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
-*-*-gnu*)
- version_type=sunos
- lib_names='$libname.so.$versuffix'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
+# *-*-gnu* needs to come after *-*-linux-gnu*.
*-*-hpux9* | *-*-hpux10*)
# Give a soname corresponding to the major version so that dld.sl refuses to
dynamic_linker="$host_os dld.sl"
version_type=sunos
shlibpath_var=SHLIB_PATH
- lib_names='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
+ library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
soname_spec='$libname.sl.$major'
# HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
*-*-irix5* | *-*-irix6*)
version_type=osf
soname_spec='$libname.so'
- lib_names='$libname.so.$versuffix $libname.so'
+ library_names_spec='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
-# No shared lib support for linuxoldld or linuxaout.
-*-*-linuxoldld* | *-*-linuxaout*)
+# No shared lib support for Linux oldld, aout, or coff.
+*-*-linux-gnuoldld* | *-*-linux-gnuaout* | *-*-linux-gnucoff*)
dynamic_linker=no
can_build_shared=no
;;
-*-*-linux*)
+# This must be Linux ELF.
+*-*-linux-gnu*)
version_type=linux
- lib_names='$libname.so.$versuffix $libname.so.$major $libname.so'
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
finish_cmds='ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
+*-*-gnu*)
+ version_type=sunos
+ library_names_spec='$libname.so.$versuffix'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
*-*-netbsd*)
version_type=sunos
- lib_names='$libname.so.$versuffix'
+ library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
-*-*-osf3*)
+*-*-osf3* | *-*-osf4*)
version_type=osf
soname_spec='$libname.so'
- lib_names='$libname.so.$versuffix $libname.so'
+ library_names_spec='$libname.so.$versuffix $libname.so'
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'
+ library_names_spec='$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'
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-sunos4*)
version_type=sunos
- lib_names='$libname.so.$versuffix'
+ library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
test "$can_build_shared" = "no" && enable_shared=no
-if test "$enable_shared" = yes; then
- # On AIX, we do not build both static and shared libraries.
- case "$host_os" in
- aix*)
- test "$enable_static" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds;\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
- esac
-fi
+# On AIX, shared libraries and static libraries use the same namespace.
+case "$host_os" in
+aix*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds;\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+esac
echo "$ac_t""$enable_shared" 1>&6
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
ofile=libtool
trap "$rm $ofile; exit 1" 1 2 15
host_alias="$host_alias"
host="$host"
+# The archiver.
+AR='$AR'
+
# The linker used to build libraries.
LD='$LD'
# Compiler flag to prevent dynamic linking.
link_static_flag='$link_static_flag'
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag='$export_dynamic_flag'
+
# Pattern to match compiler flags for creating libNAME_p libraries:
profile_flag_pattern='$profile_flag_pattern'
# 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'
+library_names_spec='$library_names_spec'
# The coded name of the library, if different from the real name.
soname_spec='$soname_spec'
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
-hardcode_libdir_flag='$hardcode_libdir_flag'
+hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec'
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator='$hardcode_libdir_separator'
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
# Constants.
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=0.9
+VERSION=0.9d
default_mode=NONE
help="Try \`$progname --help' for more information."
exit 1
fi
+#
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$progname: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
# Global variables.
mode=$default_mode
nonopt=
*rm)
mode=uninstall
;;
+ *.la)
+ mode=dlname
+ ;;
*)
# Just use the default operation mode.
if test "$mode" = NONE; then
if test -n "$nonopt"; then
- echo "$progname: warning: cannot infer operation mode from \`$nonopt $@'" 1>&2
+ echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
else
- echo "$progname: warning: cannot infer operation mode from no MODE-ARGS" 1>&2
+ echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
fi
fi
;;
case "$mode" in
# libtool compile mode
compile)
+ progname="$progname: compile"
# Get the compilation command and the source file.
base_compile="$nonopt"
lastarg=
# libtool link mode
link)
+ progname="$progname: link"
# Go through the arguments, transforming them on the way.
cc="$nonopt"
args="$cc"
compile_shlibpath=
finalize_shlibpath=
deplibs=
+ export_dynamic=no
+ hardcode_libdirs=
install_libdir=
libobjs=
link_against_libtool_libs=
prevarg=
temp_rpath=
vinfo=
-
-
-# FIXME Maybe set the library names to libNAME_p.a if we are doing profiling.
-# if echo " $@ " | egrep "[ ]$profile_flag_pattern[ ]" > /dev/null 2>&1; then
-# suffix=p
-# else
-# suffix=
-# fi
+ whole_archive=no
# We need to know -static, to get the right output filenames.
case " $@ " in
- *" -static "*) build_libtool_libs=no ;;
+ *" -static "*) build_libtool_libs=no build_old_libs=yes ;;
esac
for arg
if test -n "$prev"; then
case "$prev" in
output)
- 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
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
args="$args $arg"
;;
esac
prevarg="$arg"
case "$arg" in
+ -export-dynamic)
+ export_dynamic=yes
+ compile_command="$compile_command $export_dynamic_flag"
+ finalize_command="$finalize_command $export_dynamic_flag"
+ continue
+ ;;
+
-L*)
dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
case "$dir" in
-l*) deplibs="$deplibs $arg" ;;
+ -no-whole-archive) whole_archive=no ;;
+
-o) prev=output ;;
-rpath)
continue
;;
+ -whole-archive) whole_archive=yes ;;
+
-*) cc="$cc $arg" ;; # Some other compiler flag.
- *.o | *.a)
+ *.o)
# A standard object.
objs="$objs $arg"
;;
+ *.a)
+ # Find the relevant object directory and library name.
+ file=`echo "$arg" | sed 's%^.*/%%'`
+ 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
+ ;;
+
*.lo)
# A library object.
libobjs="$libobjs $arg"
exit 1
fi
- # Get the name of the link library.
+ # Get the name of the library we link against.
linklib=
- for linklib in $library_names; do
- :
+ for l in $old_library $library_names; do
+ linklib="$l"
done
+ if test -z "$linklib"; then
+ echo "$progname: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
# Find the relevant object directory and library name.
name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
dir=`echo "$arg" | sed 's%/[^/]*$%%'`
esac
fi
- if test -z "$linklib"; then
- echo "$progname: cannot find name of link library for \`$arg'" 1>&2
- exit 1
- fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ # Put the magic libdir with the hardcode flag.
+ hardcode_libdirs="$libdir"
+ libdir="@HARDCODE_LIBDIRS@"
+ else
+ # Just accumulate the libdirs.
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ libdir=
+ fi
+ fi
- if test -n "$hardcode_libdir_flag"; then
- tmp=`eval echo \"$hardcode_libdir_flag\"`
- compile_command="$compile_command $tmp"
- finalize_command="$finalize_command $tmp"
+ if test -n "$libdir"; then
+ hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
+ compile_command="$compile_command $hardcode_libdir_flag"
+ finalize_command="$finalize_command $hardcode_libdir_flag"
+ fi
fi
case "$hardcode_action" in
- rpath)
+ immediate)
if test "$hardcode_direct" = no; then
compile_command="$compile_command $dir/$linklib"
elif test "$hardcode_minus_L" = no; then
compile_command="$compile_command -l$name"
fi
;;
+
+ *)
+ echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
+ exit 1
+ ;;
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
+ elif test "$hardcode_minus_L" = yes; then
finalize_command="$finalize_command -L$libdir -l$name"
- elif test "$hardcode_shlibpath_var" = no; then
+ elif test "$hardcode_shlibpath_var" = yes; then
finalize_shlibpath="$finalize_shlibpath$libdir:"
finalize_command="$finalize_command -l$name"
+ else
+ # We can't seem to hardcode it, guess we'll fake it.
+ finalize_command="$finalize_command -L$libdir -l$name"
fi
else
# Transform directly to old archives if we don't build new libraries.
- test -z "$old_library" && old_library="$linklib"
- compile_command="$compile_command $dir/$old_library"
- finalize_command="$finalize_command $dir/$old_library"
+ test -z "$old_library" || linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
fi
continue
;;
exit 1
fi
+ # Substitute the hardcoded libdirs into the compile commands.
+ if test "$hardcode_libdir_colon_separated" = yes; then
+ compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
+ finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
+ fi
+
oldlib=
oldobjs=
case "$output" in
*.a)
# Old archive.
+ libname=`echo "$output" | sed 's/\.a$//'`
build_old_libs=yes
if test -n "$install_libdir"; then
*.la)
libname=`echo "$output" | sed 's/\.la$//'`
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+ current=0
+ revision=0
+ age=0
+
if test -n "$objs"; then
- echo "$progname: cannot build libtool library \`$output' from non-libtool objects"
+ echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
exit 1
fi
# How the heck are we supposed to write a wrapper for a shared library?
if test -n "$link_against_libtool_libs"; then
- echo "$progname: libtool libraries may not depend on uninstalled libraries" 1>&2
+ echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
exit 1
fi
exit 1
fi
- current=0
- revision=0
- age=0
-
# Parse the version information argument.
IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
set dummy $vinfo
if test "$build_libtool_libs" = yes; then
# Get the real and link names of the library.
- library_names=`eval echo \"$lib_names\"`
+ library_names=`eval echo \"$library_names_spec\"`
set dummy $library_names
realname="$2"
shift; shift
$show "$ln_s $realname $link"
$run $ln_s $realname $link || exit $?
done
+
+ # If -export-dynamic was specified, set the dlname.
+ if test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
fi
;;
# Delete the old objects.
$run $rm $obj $libobj
- # Create the old-style object.
- reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
+ # 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.
+ reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
output="$obj"
cmds=`eval echo \"$reload_cmds\"`
fi
if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
+ finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
+
# We have no uninstalled library dependencies, so finalize right now.
$show "$compile_command"
$run $compile_command
exit $status
fi
+ # Replace the output file specification.
+ compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
+ finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
+
# Create the binary in the object directory, then wrap it.
if test -d $objdir; then :
else
# See if we need to build an old-fashioned archive.
if test "$build_old_libs" = "yes"; then
- # 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.
- oldlib="$objdir/$libname.a"
- ;;
- *)
- oldlib="$output"
+ # Now set the variables for building old libraries.
+ oldlib="$objdir/$libname.a"
+
+ # Transform .lo files to .o (skipping convenience libraries).
+ # FIXME: skipping them is simplistic. We should determine which members
+ # are actually needed to resolve symbols.
+ oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
+
+ if test -d "$objdir"; then
$show "$rm $oldlib"
$run $rm $oldlib
- ;;
- esac
+ else
+ $show "$mkdir $objdir"
+ $run $mkdir $objdir
+ fi
# Do each command in the archive commands.
cmds=`eval echo \"$old_archive_cmds\"`
eval "$run $cmd" || exit $?
done
IFS="$save_ifs"
+
+ case "$output" in
+ *.a)
+ # Just move into place if there were any non-libtool objects.
+ if test -n "$objs"; then
+ $show "$mv $oldlib $output"
+ $run $mv $oldlib $output
+
+ elif test -z "$pic_flag" || test "$build_libtool_libs" != yes; then
+ # Just symlink if libtool objects are the same.
+ $show "$rm $output"
+ $run $rm $output
+ $show "$ln_s $oldlib $output"
+ $run $ln_s $oldlib $output
+
+ else
+ # Create an archive of libtool objects.
+ oldlib="$output"
+ oldobjs="$libobjs"
+
+ # 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"
+ $show "$cmd"
+ eval "$run $cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ ;;
+ esac
fi
# Now create the libtool archive.
# The name of the static archive.
old_library='$old_library'
+# The name that we can dlopen(3).
+dlname='$dlname'
+
# Version information for $libname.
current=$current
age=$age
# libtool install mode
install)
+ progname="$progname: install"
# The first argument is the name of the installation program.
install_prog="$nonopt"
# Install the shared library and build the symlinks.
$show "$install_prog $dir/$realname $destdir/$realname"
eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $?
+ test "X$dlname" = "X$realname" && dlname=
# Support stripping libraries.
if test -n "$stripme"; then
# ... and create new ones.
for linkname
do
+ test "X$dlname" = "X$linkname" && dlname=
$show "$ln_s $realname $destdir/$linkname"
$run $ln_s $realname $destdir/$linkname
done
fi
+ if test -n "$dlname"; then
+ # Install the dynamically-loadable library.
+ $show "$install_prog $dir/$dlname $destdir/$dlname"
+ eval "$run $install_prog $dir/$dlname $destdir/$dlname" || exit $?
+ fi
+
# Do each command in the postinstall commands.
lib="$destdir/$realname"
cmds=`eval echo \"$postinstall_cmds\"`
esac
done
-# FIXME Install any profiled libraries, too.
-# newfiles=
-# for file in $staticlibs; do
-# newfiles="$newfiles $file"
-# pfile=`echo "$file" | sed 's/\.a$/_p.a/'`
-# test -f "$pfile" && newfiles="$newfiles $pfile"
-# done
-# staticlibs="$newfiles"
-
for file in $staticlibs; do
name=`echo "$file" | sed 's%^.*/%%'`
exit 0
;;
+ # libtool dlname mode
+ dlname)
+ progname="$progname: dlname"
+ ltlibs="$nonopt"
+ for lib
+ do
+ ltlibs="$ltlibs $lib"
+ done
+
+ # Now check to make sure each one is a valid libtool library.
+ status=0
+ for lib in $ltlibs; do
+ dlname=
+ libdir=
+
+ # 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
+ status=1
+ continue
+ 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
+ status=1
+ elif test -n "$dlname"; then
+ echo "$libdir/$dlname"
+ else
+ echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
+ status=1
+ fi
+ done
+ exit $status
+ ;;
+
# libtool finish mode
finish)
+ progname="$progname: finish"
libdirs="$nonopt"
if test -n "$finish_cmds" && test -n "$libdirs"; then
# libtool uninstall mode
uninstall)
+ progname="$progname: uninstall"
rm="$nonopt"
files=
test "$dir" = "$file" && dir=.
name=`echo "$file" | sed -e 's%^.*/%%'`
+ rmfiles="$file"
+
case "$name" in
*.la)
# Possibly a libtool archive, so verify it.
# Delete the libtool libraries and symlinks.
for n in $library_names; do
- $show "$rm $dir/$n"
- $run $rm $dir/$n
+ rmfiles="$rmfiles $dir/$n"
+ test "X$n" = "X$dlname" && dlname=
done
+ test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
- # Delete the old-fashioned archive.
- if test -n "$old_library"; then
- $show "$rm $dir/$old_library"
- $run $rm $dir/$old_library
- fi
+ # FIXME: should reinstall the best remaining shared library.
fi
;;
esac
- $show "$rm $file"
- $run $rm $file
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
done
exit 0
;;
MODE must be one of the following:
compile compile a source file into a libtool object
+ dlname print filenames to use to \`dlopen' libtool libraries
finish complete the installation of libtool libraries
install install libraries or executables
link create a library or an executable
EOF
;;
+dlname)
+ cat <<EOF
+Usage: $progname [OPTION]... --mode=dlname LTLIBRARY [LTLIBRARY]...
+
+Print filenames to use to \`dlopen' libtool libraries.
+
+Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
+was linked using the \`-export-dynamic' option).
+
+The names to use are printed to standard output, one per line.
+EOF
+ ;;
+
finish)
cat <<EOF
Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
The following components of LINK-COMMAND are treated specially:
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -static do not do any dynamic linking or shared library creation
+ -export-dynamic allow the output file to be loaded with dlopen(3)
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -no-whole-archive turn off \`-whole-archive'
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -static do not do any dynamic linking or shared library creation
-version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
+ specify library version info [each variable defaults to 0]
+ -whole-archive use all members from subsequent \`.a' files
All other options (arguments beginning with \`-') are ignored.
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'.
+and \`ranlib'. If only libtool objects are specified, then the output file
+may be used in the creation of other libtool archives.
If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
created, otherwise an executable program is created.