1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5
# Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
27
# Check that we have a working $echo.
28
if test "X$1" = X--no-reexec; then
29
# Discard the --no-reexec flag, and continue.
31
elif test "X$1" = X--fallback-echo; then
32
# Avoid inline document here, it may be left over
34
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35
# Yippee, $echo works!
38
# Restart under the correct shell, and then maybe $echo will work.
39
exec $SHELL "$0" --no-reexec ${1+"$@"}
42
if test "X$1" = X--fallback-echo; then
43
# used as fallback echo
51
# The name of this program.
52
progname=`$echo "$0" | sed 's%^.*/%%'`
59
TIMESTAMP=" (1.922.2.54 2001/09/11 03:33:37)"
62
help="Try \`$progname --help' for more information."
63
magic="%%%MAGIC variable%%%"
68
# Sed substitution that helps us do robust quoting. It backslashifies
69
# metacharacters that are still active within double-quoted strings.
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
73
NL2SP='tr \015\012 \040\040'
76
# Only set LANG and LC_ALL to C if already set.
77
# These must not be set unconditionally because not all systems understand
78
# e.g. LANG=C (notably SCO).
79
# We save the old values to restore during execute mode.
80
if test "${LC_ALL+set}" = set; then
81
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83
if test "${LANG+set}" = set; then
84
save_LANG="$LANG"; LANG=C; export LANG
87
# Make sure IFS has a sensible default
90
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91
echo "$modename: not configured to build any kind of library" 1>&2
92
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105
lo2o="s/\\.lo\$/.${objext}/"
106
o2lo="s/\\.${objext}\$/.lo/"
108
# Parse our command line options once, thoroughly.
115
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119
# If the previous option needs an argument, assign it.
120
if test -n "$prev"; then
123
execute_dlfiles="$execute_dlfiles $arg"
135
# Have we seen a non-optional argument yet?
142
echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
147
sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
152
echo "$progname: enabling shell trace mode"
162
if test "$build_libtool_libs" = yes; then
163
echo "enable shared libraries"
165
echo "disable shared libraries"
167
if test "$build_old_libs" = yes; then
168
echo "enable static libraries"
170
echo "disable static libraries"
175
--finish) mode="finish" ;;
177
--mode) prevopt="--mode" prev=mode ;;
178
--mode=*) mode="$optarg" ;;
190
$echo "$modename: unrecognized option \`$arg'" 1>&2
202
if test -n "$prevopt"; then
203
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
208
# If this variable is set in any of the actions, the command in it
209
# will be execed at the end. This prevents here-documents from being
210
# left over by shells.
213
if test -z "$show_help"; then
215
# Infer the operation mode.
216
if test -z "$mode"; then
218
*cc | *++ | gcc* | *-gcc*)
230
*db | *dbx | *strace | *truss)
240
# If we have no mode, but dlfiles were specified, then do execute mode.
241
test -n "$execute_dlfiles" && mode=execute
243
# Just use the default operation mode.
244
if test -z "$mode"; then
245
if test -n "$nonopt"; then
246
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
248
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
255
# Only execute mode is allowed to have -dlopen flags.
256
if test -n "$execute_dlfiles" && test "$mode" != execute; then
257
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
262
# Change the help message to a mode-specific one.
264
help="Try \`$modename --help --mode=$mode' for more information."
266
# These modes are in order of execution frequency so that they run quickly.
268
# libtool compile mode
270
modename="$modename: compile"
271
# Get the compilation command and the source file.
284
# Aesthetically quote the previous argument.
286
lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289
# Double-quote args containing other shell metacharacters.
290
# Many Bourne shells cannot handle close brackets correctly
291
# in scan sets, so we specify it separately.
292
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
297
# Add the previous argument to base_compile.
298
if test -z "$base_compile"; then
299
base_compile="$lastarg"
301
base_compile="$base_compile $lastarg"
307
# Accept any command-line options.
310
if test "$user_target" != "no"; then
311
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
338
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
340
save_ifs="$IFS"; IFS=','
344
# Double-quote args containing other shell metacharacters.
345
# Many Bourne shells cannot handle close brackets correctly
346
# in scan sets, so we specify it separately.
348
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
352
lastarg="$lastarg $arg"
355
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
357
# Add the arguments to base_compile.
358
if test -z "$base_compile"; then
359
base_compile="$lastarg"
361
base_compile="$base_compile $lastarg"
369
# The next one is the -o target name
374
# We got the output file
381
# Accept the current argument as the source file.
385
# Aesthetically quote the previous argument.
387
# Backslashify any backslashes, double quotes, and dollar signs.
388
# These are the only characters that are still specially
389
# interpreted inside of double-quoted scrings.
390
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
392
# Double-quote args containing other shell metacharacters.
393
# Many Bourne shells cannot handle close brackets correctly
394
# in scan sets, so we specify it separately.
396
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
397
lastarg="\"$lastarg\""
401
# Add the previous argument to base_compile.
402
if test -z "$base_compile"; then
403
base_compile="$lastarg"
405
base_compile="$base_compile $lastarg"
413
# Get the name of the library object.
414
libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417
$echo "$modename: you must specify a target with \`-o'" 1>&2
422
# Recognize several different file suffixes.
423
# If the user specifies -o file.o, it is replaced with file.lo
438
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
443
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
448
if test -z "$base_compile"; then
449
$echo "$modename: you must specify a compilation command" 1>&2
454
# Delete any leftover library objects.
455
if test "$build_old_libs" = yes; then
456
removelist="$obj $libobj"
462
trap "$run $rm $removelist; exit 1" 1 2 15
464
# On Cygwin there's no "real" PIC flag so we must build both object types
466
cygwin* | mingw* | pw32* | os2*)
470
if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
471
# non-PIC code in shared libraries is not supported
475
# Calculate the filename of the output object if compiler does
476
# not support -o with -c
477
if test "$compiler_c_o" = no; then
478
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
479
lockfile="$output_obj.lock"
480
removelist="$removelist $output_obj $lockfile"
481
trap "$run $rm $removelist; exit 1" 1 2 15
487
# Lock this critical section if it is needed
488
# We use this script file to make the link, it avoids creating a new file
489
if test "$need_locks" = yes; then
490
until $run ln "$0" "$lockfile" 2>/dev/null; do
491
$show "Waiting for $lockfile to be removed"
494
elif test "$need_locks" = warn; then
495
if test -f "$lockfile"; then
497
*** ERROR, $lockfile exists and contains:
498
`cat $lockfile 2>/dev/null`
500
This indicates that another process is trying to use the same
501
temporary object file, and libtool could not work around it because
502
your compiler does not support \`-c' and \`-o' together. If you
503
repeat this compilation, it may succeed, by chance, but you had better
504
avoid parallel builds (make -j) in this platform, or get a better
510
echo $srcfile > "$lockfile"
513
if test -n "$fix_srcfile_path"; then
514
eval srcfile=\"$fix_srcfile_path\"
517
# Only build a PIC object if we are building libtool libraries.
518
if test "$build_libtool_libs" = yes; then
519
# Without this assignment, base_compile gets emptied.
520
fbsd_hideous_sh_bug=$base_compile
522
if test "$pic_mode" != no; then
523
# All platforms use -DPIC, to notify preprocessed assembler code.
524
command="$base_compile $srcfile $pic_flag -DPIC"
526
# Don't build PIC code
527
command="$base_compile $srcfile"
529
if test "$build_old_libs" = yes; then
531
dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
532
if test "X$dir" = "X$libobj"; then
537
libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
539
if test -d "$dir"; then
546
if test $status -ne 0 && test ! -d $dir; then
551
if test "$compiler_o_lo" = yes; then
553
command="$command -o $output_obj"
554
elif test "$compiler_c_o" = yes; then
556
command="$command -o $output_obj"
559
$run $rm "$output_obj"
561
if $run eval "$command"; then :
563
test -n "$output_obj" && $run $rm $removelist
567
if test "$need_locks" = warn &&
568
test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
570
*** ERROR, $lockfile contains:
571
`cat $lockfile 2>/dev/null`
573
but it should contain:
576
This indicates that another process is trying to use the same
577
temporary object file, and libtool could not work around it because
578
your compiler does not support \`-c' and \`-o' together. If you
579
repeat this compilation, it may succeed, by chance, but you had better
580
avoid parallel builds (make -j) in this platform, or get a better
587
# Just move the object if needed, then go on to compile the next one
588
if test x"$output_obj" != x"$libobj"; then
589
$show "$mv $output_obj $libobj"
590
if $run $mv $output_obj $libobj; then :
598
# If we have no pic_flag, then copy the object into place and finish.
599
if (test -z "$pic_flag" || test "$pic_mode" != default) &&
600
test "$build_old_libs" = yes; then
601
# Rename the .lo from within objdir to obj
602
if test -f $obj; then
607
$show "$mv $libobj $obj"
608
if $run $mv $libobj $obj; then :
615
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
616
if test "X$xdir" = "X$obj"; then
621
baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
622
libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
623
# Now arrange that obj and lo_libobj become the same file
624
$show "(cd $xdir && $LN_S $baseobj $libobj)"
625
if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
626
# Unlock the critical section if it was locked
627
if test "$need_locks" != no; then
638
# Allow error messages only from the first compilation.
639
suppress_output=' >/dev/null 2>&1'
642
# Only build a position-dependent object if we build old libraries.
643
if test "$build_old_libs" = yes; then
644
if test "$pic_mode" != yes; then
645
# Don't build PIC code
646
command="$base_compile $srcfile"
648
# All platforms use -DPIC, to notify preprocessed assembler code.
649
command="$base_compile $srcfile $pic_flag -DPIC"
651
if test "$compiler_c_o" = yes; then
652
command="$command -o $obj"
656
# Suppress compiler output if we already did a PIC compilation.
657
command="$command$suppress_output"
658
$run $rm "$output_obj"
660
if $run eval "$command"; then :
666
if test "$need_locks" = warn &&
667
test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
669
*** ERROR, $lockfile contains:
670
`cat $lockfile 2>/dev/null`
672
but it should contain:
675
This indicates that another process is trying to use the same
676
temporary object file, and libtool could not work around it because
677
your compiler does not support \`-c' and \`-o' together. If you
678
repeat this compilation, it may succeed, by chance, but you had better
679
avoid parallel builds (make -j) in this platform, or get a better
686
# Just move the object if needed
687
if test x"$output_obj" != x"$obj"; then
688
$show "$mv $output_obj $obj"
689
if $run $mv $output_obj $obj; then :
697
# Create an invalid libtool object if no PIC, so that we do not
698
# accidentally link it into a program.
699
if test "$build_libtool_libs" != yes; then
700
$show "echo timestamp > $libobj"
701
$run eval "echo timestamp > \$libobj" || exit $?
703
# Move the .lo from within objdir
704
$show "$mv $libobj $lo_libobj"
705
if $run $mv $libobj $lo_libobj; then :
714
# Unlock the critical section if it was locked
715
if test "$need_locks" != no; then
724
modename="$modename: link"
726
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
727
# It is impossible to link a dll without this setting, and
728
# we shouldn't force the makefile maintainer to figure out
729
# which system we are compiling for in order to pass an extra
730
# flag for every libtool invokation.
733
# FIXME: Unfortunately, there are problems with the above when trying
734
# to make a dll which has undefined symbols, in which case not
735
# even a static library is built. For now, we need to specify
736
# -no-undefined on the libtool link line when we can be certain
737
# that all symbols are satisfied, otherwise we get a static library.
744
libtool_args="$nonopt"
745
compile_command="$nonopt"
746
finalize_command="$nonopt"
759
lib_search_path=`pwd`
767
export_symbols_regex=
774
prefer_static_libs=no
786
# We need to know -static, to get the right output filenames.
790
-all-static | -static)
791
if test "X$arg" = "X-all-static"; then
792
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
793
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
795
if test -n "$link_static_flag"; then
796
dlopen_self=$dlopen_self_static
799
if test -z "$pic_flag" && test -n "$link_static_flag"; then
800
dlopen_self=$dlopen_self_static
803
build_libtool_libs=no
805
prefer_static_libs=yes
811
# See if our shared archives depend on static archives.
812
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
814
# Go through the arguments, transforming them on the way.
815
while test $# -gt 0; do
819
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
820
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
824
libtool_args="$libtool_args $qarg"
826
# If the previous option needs an argument, assign it.
827
if test -n "$prev"; then
830
compile_command="$compile_command @OUTPUT@"
831
finalize_command="$finalize_command @OUTPUT@"
837
if test "$preload" = no; then
838
# Add the symbol object into the linking commands.
839
compile_command="$compile_command @SYMFILE@"
840
finalize_command="$finalize_command @SYMFILE@"
844
*.la | *.lo) ;; # We handle these cases below.
846
if test "$dlself" = no; then
854
if test "$prev" = dlprefiles; then
856
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
866
if test "$prev" = dlfiles; then
867
dlfiles="$dlfiles $arg"
869
dlprefiles="$dlprefiles $arg"
877
export_symbols="$arg"
878
if test ! -f "$arg"; then
879
$echo "$modename: symbol file \`$arg' does not exist"
886
export_symbols_regex="$arg"
896
# We need an absolute path.
898
[\\/]* | [A-Za-z]:[\\/]*) ;;
900
$echo "$modename: only absolute run-paths are allowed" 1>&2
904
if test "$prev" = rpath; then
907
*) rpath="$rpath $arg" ;;
912
*) xrpath="$xrpath $arg" ;;
919
compiler_flags="$compiler_flags $qarg"
921
compile_command="$compile_command $qarg"
922
finalize_command="$finalize_command $qarg"
926
linker_flags="$linker_flags $qarg"
927
compiler_flags="$compiler_flags $wl$qarg"
929
compile_command="$compile_command $wl$qarg"
930
finalize_command="$finalize_command $wl$qarg"
934
eval "$prev=\"\$arg\""
945
if test -n "$link_static_flag"; then
946
compile_command="$compile_command $link_static_flag"
947
finalize_command="$finalize_command $link_static_flag"
953
# FIXME: remove this flag sometime in the future.
954
$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
978
-export-symbols | -export-symbols-regex)
979
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
980
$echo "$modename: more than one -exported-symbols argument is not allowed"
983
if test "X$arg" = "X-export-symbols"; then
991
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
992
# so, if we see these flags be careful not to treat them like -L
994
case $with_gcc/$host in
996
compile_command="$compile_command $arg"
997
finalize_command="$finalize_command $arg"
1004
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1005
# We need an absolute path.
1007
[\\/]* | [A-Za-z]:[\\/]*) ;;
1009
absdir=`cd "$dir" && pwd`
1010
if test -z "$absdir"; then
1011
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1020
deplibs="$deplibs -L$dir"
1021
lib_search_path="$lib_search_path $dir"
1025
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1026
case :$dllsearchpath: in
1028
*) dllsearchpath="$dllsearchpath:$dir";;
1036
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1038
*-*-cygwin* | *-*-pw32* | *-*-beos*)
1039
# These systems don't actually have a C or math library (as such)
1042
*-*-mingw* | *-*-os2*)
1043
# These systems don't actually have a C library (as such)
1044
test "X$arg" = "X-lc" && continue
1047
# Do not include libc due to us having libc/libc_r.
1048
test "X$arg" = "X-lc" && continue
1051
elif test "X$arg" = "X-lc_r"; then
1054
# Do not include libc_r directly, use -pthread flag.
1059
deplibs="$deplibs $arg"
1075
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1076
# The PATH hackery in wrapper scripts is required on Windows
1077
# in order for the loader to find any dlls it needs.
1078
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1079
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1082
*) no_install=yes ;;
1110
dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1111
# We need an absolute path.
1113
[\\/]* | [A-Za-z]:[\\/]*) ;;
1115
$echo "$modename: only absolute run-paths are allowed" 1>&2
1121
*) xrpath="$xrpath $dir" ;;
1127
# The effects of -static are defined in a previous loop.
1128
# We used to do the same as -all-static on platforms that
1129
# didn't have a PIC flag, but the assumption that the effects
1130
# would be equivalent was wrong. It would break on at least
1131
# Digital Unix and AIX.
1146
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1148
save_ifs="$IFS"; IFS=','
1149
for flag in $args; do
1152
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1157
compiler_flags="$compiler_flags $flag"
1160
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1164
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1166
save_ifs="$IFS"; IFS=','
1167
for flag in $args; do
1170
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1175
compiler_flags="$compiler_flags $wl$flag"
1176
linker_flags="$linker_flags $flag"
1179
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1192
# Some other compiler flag.
1194
# Unknown arguments in both finalize_command and compile_command need
1195
# to be aesthetically quoted because they are evaled later.
1196
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1198
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1205
# A library or standard object.
1206
if test "$prev" = dlfiles; then
1207
# This file was specified with -dlopen.
1208
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1209
dlfiles="$dlfiles $arg"
1213
# If libtool objects are unsupported, then we need to preload.
1218
if test "$prev" = dlprefiles; then
1219
# Preload the old-style object.
1220
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1224
*.lo) libobjs="$libobjs $arg" ;;
1225
*) objs="$objs $arg" ;;
1232
deplibs="$deplibs $arg"
1233
old_deplibs="$old_deplibs $arg"
1238
# A libtool-controlled library.
1240
if test "$prev" = dlfiles; then
1241
# This library was specified with -dlopen.
1242
dlfiles="$dlfiles $arg"
1244
elif test "$prev" = dlprefiles; then
1245
# The library was specified with -dlpreopen.
1246
dlprefiles="$dlprefiles $arg"
1249
deplibs="$deplibs $arg"
1254
# Some other compiler argument.
1256
# Unknown arguments in both finalize_command and compile_command need
1257
# to be aesthetically quoted because they are evaled later.
1258
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1260
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1267
# Now actually substitute the argument into the commands.
1268
if test -n "$arg"; then
1269
compile_command="$compile_command $arg"
1270
finalize_command="$finalize_command $arg"
1272
done # argument parsing loop
1274
if test -n "$prev"; then
1275
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1280
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1281
eval arg=\"$export_dynamic_flag_spec\"
1282
compile_command="$compile_command $arg"
1283
finalize_command="$finalize_command $arg"
1286
# calculate the name of the file, without its directory
1287
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1288
libobjs_save="$libobjs"
1290
if test -n "$shlibpath_var"; then
1291
# get the directories listed in $shlibpath_var
1292
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1296
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1297
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1299
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1300
if test "X$output_objdir" = "X$output"; then
1301
output_objdir="$objdir"
1303
output_objdir="$output_objdir/$objdir"
1305
# Create the object directory.
1306
if test ! -d $output_objdir; then
1307
$show "$mkdir $output_objdir"
1308
$run $mkdir $output_objdir
1310
if test $status -ne 0 && test ! -d $output_objdir; then
1315
# Determine the type of output
1318
$echo "$modename: you must specify an output file" 1>&2
1322
*.$libext) linkmode=oldlib ;;
1323
*.lo | *.$objext) linkmode=obj ;;
1324
*.la) linkmode=lib ;;
1325
*) linkmode=prog ;; # Anything else should be a program.
1330
# Find all interdependent deplibs by searching for libraries
1331
# that are linked more than once (e.g. -la -lb -la)
1332
for deplib in $deplibs; do
1334
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1336
libs="$libs $deplib"
1341
need_relink=no # whether we're linking any uninstalled libtool libraries
1342
notinst_deplibs= # not-installed libtool libraries
1343
notinst_path= # paths that contain not-installed libtool libraries
1347
for file in $dlfiles $dlprefiles; do
1351
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1363
passes="conv scan dlopen dlpreopen link"
1368
for pass in $passes; do
1369
if test $linkmode = prog; then
1370
# Determine which files to process
1374
save_deplibs="$deplibs" # Collect dlpreopened libraries
1377
dlpreopen) libs="$dlprefiles" ;;
1378
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1381
for deplib in $libs; do
1386
if test $linkmode = oldlib && test $linkmode = obj; then
1387
$echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1390
if test $pass = conv; then
1391
deplibs="$deplib $deplibs"
1394
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1395
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1396
# Search the libtool library
1397
lib="$searchdir/lib${name}.la"
1398
if test -f "$lib"; then
1403
if test "$found" != yes; then
1404
# deplib doesn't seem to be a libtool library
1405
if test "$linkmode,$pass" = "prog,link"; then
1406
compile_deplibs="$deplib $compile_deplibs"
1407
finalize_deplibs="$deplib $finalize_deplibs"
1409
deplibs="$deplib $deplibs"
1410
test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1418
deplibs="$deplib $deplibs"
1419
test $pass = conv && continue
1420
newdependency_libs="$deplib $newdependency_libs"
1421
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1424
if test $pass = conv; then
1425
deplibs="$deplib $deplibs"
1428
if test $pass = scan; then
1429
deplibs="$deplib $deplibs"
1430
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1432
compile_deplibs="$deplib $compile_deplibs"
1433
finalize_deplibs="$deplib $finalize_deplibs"
1437
$echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1443
if test $pass = link; then
1444
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1445
# Make sure the xrpath contains only unique directories.
1448
*) xrpath="$xrpath $dir" ;;
1451
deplibs="$deplib $deplibs"
1454
*.la) lib="$deplib" ;;
1456
if test $pass = conv; then
1457
deplibs="$deplib $deplibs"
1462
if test "$deplibs_check_method" != pass_all; then
1464
echo "*** Warning: This library needs some functionality provided by $deplib."
1465
echo "*** I have the capability to make that library automatically link in when"
1466
echo "*** you link to this library. But I can only do this if you have a"
1467
echo "*** shared version of the library, which you do not appear to have."
1470
echo "*** Warning: Linking the shared library $output against the"
1471
echo "*** static library $deplib is not portable!"
1472
deplibs="$deplib $deplibs"
1477
if test $pass != link; then
1478
deplibs="$deplib $deplibs"
1480
compile_deplibs="$deplib $compile_deplibs"
1481
finalize_deplibs="$deplib $finalize_deplibs"
1488
if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1489
# If there is no dlopen support or we're linking statically,
1490
# we need to preload.
1491
newdlprefiles="$newdlprefiles $deplib"
1492
compile_deplibs="$deplib $compile_deplibs"
1493
finalize_deplibs="$deplib $finalize_deplibs"
1495
newdlfiles="$newdlfiles $deplib"
1504
if test $found = yes || test -f "$lib"; then :
1506
$echo "$modename: cannot find the library \`$lib'" 1>&2
1510
# Check to see that this really is a libtool archive.
1511
if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1513
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1517
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1518
test "X$ladir" = "X$lib" && ladir="."
1526
# If the library was installed with an old release of libtool,
1527
# it will not redefine variable installed.
1532
*/* | *\\*) . $lib ;;
1536
if test "$linkmode,$pass" = "lib,link" ||
1537
test "$linkmode,$pass" = "prog,scan" ||
1538
{ test $linkmode = oldlib && test $linkmode = obj; }; then
1539
# Add dl[pre]opened files of deplib
1540
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1541
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1544
if test $pass = conv; then
1545
# Only check for convenience libraries
1546
deplibs="$lib $deplibs"
1547
if test -z "$libdir"; then
1548
if test -z "$old_library"; then
1549
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1552
# It is a libtool convenience library, so add in its objects.
1553
convenience="$convenience $ladir/$objdir/$old_library"
1554
old_convenience="$old_convenience $ladir/$objdir/$old_library"
1556
for deplib in $dependency_libs; do
1557
deplibs="$deplib $deplibs"
1558
case "$tmp_libs " in
1559
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1561
tmp_libs="$tmp_libs $deplib"
1563
elif test $linkmode != prog && test $linkmode != lib; then
1564
$echo "$modename: \`$lib' is not a convenience library" 1>&2
1570
# Get the name of the library we link against.
1572
for l in $old_library $library_names; do
1575
if test -z "$linklib"; then
1576
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1580
# This library was specified with -dlopen.
1581
if test $pass = dlopen; then
1582
if test -z "$libdir"; then
1583
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1586
if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1587
# If there is no dlname, no dlopen support or we're linking
1588
# statically, we need to preload.
1589
dlprefiles="$dlprefiles $lib"
1591
newdlfiles="$newdlfiles $lib"
1596
# We need an absolute path.
1598
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1600
abs_ladir=`cd "$ladir" && pwd`
1601
if test -z "$abs_ladir"; then
1602
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1603
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1608
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1610
# Find the relevant object directory and library name.
1611
if test "X$installed" = Xyes; then
1612
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1613
$echo "$modename: warning: library \`$lib' was moved." 1>&2
1622
dir="$ladir/$objdir"
1623
absdir="$abs_ladir/$objdir"
1624
# Remove this search path later
1625
notinst_path="$notinst_path $abs_ladir"
1626
fi # $installed = yes
1627
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1629
# This library was specified with -dlpreopen.
1630
if test $pass = dlpreopen; then
1631
if test -z "$libdir"; then
1632
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1635
# Prefer using a static library (so that no silly _DYNAMIC symbols
1636
# are required to link).
1637
if test -n "$old_library"; then
1638
newdlprefiles="$newdlprefiles $dir/$old_library"
1639
# Otherwise, use the dlname, so that lt_dlopen finds it.
1640
elif test -n "$dlname"; then
1641
newdlprefiles="$newdlprefiles $dir/$dlname"
1643
newdlprefiles="$newdlprefiles $dir/$linklib"
1645
fi # $pass = dlpreopen
1647
if test -z "$libdir"; then
1648
# Link the convenience library
1649
if test $linkmode = lib; then
1650
deplibs="$dir/$old_library $deplibs"
1651
elif test "$linkmode,$pass" = "prog,link"; then
1652
compile_deplibs="$dir/$old_library $compile_deplibs"
1653
finalize_deplibs="$dir/$old_library $finalize_deplibs"
1655
deplibs="$lib $deplibs"
1660
if test $linkmode = prog && test $pass != link; then
1661
newlib_search_path="$newlib_search_path $ladir"
1662
deplibs="$lib $deplibs"
1665
if test "$link_all_deplibs" != no || test -z "$library_names" ||
1666
test "$build_libtool_libs" = no; then
1671
for deplib in $dependency_libs; do
1673
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1675
# Need to link against all dependency_libs?
1676
if test $linkalldeplibs = yes; then
1677
deplibs="$deplib $deplibs"
1679
# Need to hardcode shared library paths
1680
# or/and link against static libraries
1681
newdependency_libs="$deplib $newdependency_libs"
1683
case "$tmp_libs " in
1684
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1686
tmp_libs="$tmp_libs $deplib"
1689
fi # $linkmode = prog...
1691
link_static=no # Whether the deplib will be linked statically
1692
if test -n "$library_names" &&
1693
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1694
# Link against this shared library
1696
if test "$linkmode,$pass" = "prog,link" ||
1697
{ test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1698
# Hardcode the library path.
1699
# Skip directories that are in the system default run-time
1701
case " $sys_lib_dlsearch_path " in
1704
case "$compile_rpath " in
1706
*) compile_rpath="$compile_rpath $absdir"
1710
case " $sys_lib_dlsearch_path " in
1713
case "$finalize_rpath " in
1715
*) finalize_rpath="$finalize_rpath $libdir"
1719
if test $linkmode = prog; then
1720
# We need to hardcode the library path
1721
if test -n "$shlibpath_var"; then
1722
# Make sure the rpath contains only unique directories.
1723
case "$temp_rpath " in
1726
*) temp_rpath="$temp_rpath $dir" ;;
1730
fi # $linkmode,$pass = prog,link...
1732
if test "$alldeplibs" = yes &&
1733
{ test "$deplibs_check_method" = pass_all ||
1734
{ test "$build_libtool_libs" = yes &&
1735
test -n "$library_names"; }; }; then
1736
# We only need to search for static libraries
1740
if test "$installed" = no; then
1741
notinst_deplibs="$notinst_deplibs $lib"
1745
if test -n "$old_archive_from_expsyms_cmds"; then
1746
# figure out the soname
1747
set dummy $library_names
1750
libname=`eval \\$echo \"$libname_spec\"`
1751
# use dlname if we got it. it's perfectly good, no?
1752
if test -n "$dlname"; then
1754
elif test -n "$soname_spec"; then
1758
major=`expr $current - $age`
1762
eval soname=\"$soname_spec\"
1767
# Make a new name for the extract_expsyms_cmds to use
1769
soname=`echo $soroot | sed -e 's/^.*\///'`
1770
newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1772
# If the library has no export list, then create one now
1773
if test -f "$output_objdir/$soname-def"; then :
1775
$show "extracting exported symbol list from \`$soname'"
1776
save_ifs="$IFS"; IFS='~'
1777
eval cmds=\"$extract_expsyms_cmds\"
1778
for cmd in $cmds; do
1781
$run eval "$cmd" || exit $?
1787
if test -f "$output_objdir/$newlib"; then :; else
1788
$show "generating import library for \`$soname'"
1789
save_ifs="$IFS"; IFS='~'
1790
eval cmds=\"$old_archive_from_expsyms_cmds\"
1791
for cmd in $cmds; do
1794
$run eval "$cmd" || exit $?
1798
# make sure the library variables are pointing to the new library
1801
fi # test -n $old_archive_from_expsyms_cmds
1803
if test $linkmode = prog || test "$mode" != relink; then
1808
case $hardcode_action in
1809
immediate | unsupported)
1810
if test "$hardcode_direct" = no; then
1812
elif test "$hardcode_minus_L" = no; then
1814
*-*-sunos*) add_shlibpath="$dir" ;;
1818
elif test "$hardcode_shlibpath_var" = no; then
1819
add_shlibpath="$dir"
1826
if test "$hardcode_direct" = yes; then
1828
elif test "$hardcode_minus_L" = yes; then
1831
elif test "$hardcode_shlibpath_var" = yes; then
1832
add_shlibpath="$dir"
1841
if test "$lib_linked" != yes; then
1842
$echo "$modename: configuration error: unsupported hardcode properties"
1846
if test -n "$add_shlibpath"; then
1847
case :$compile_shlibpath: in
1848
*":$add_shlibpath:"*) ;;
1849
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1852
if test $linkmode = prog; then
1853
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1854
test -n "$add" && compile_deplibs="$add $compile_deplibs"
1856
test -n "$add_dir" && deplibs="$add_dir $deplibs"
1857
test -n "$add" && deplibs="$add $deplibs"
1858
if test "$hardcode_direct" != yes && \
1859
test "$hardcode_minus_L" != yes && \
1860
test "$hardcode_shlibpath_var" = yes; then
1861
case :$finalize_shlibpath: in
1863
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1869
if test $linkmode = prog || test "$mode" = relink; then
1873
# Finalize command for both is simple: just hardcode it.
1874
if test "$hardcode_direct" = yes; then
1875
add="$libdir/$linklib"
1876
elif test "$hardcode_minus_L" = yes; then
1879
elif test "$hardcode_shlibpath_var" = yes; then
1880
case :$finalize_shlibpath: in
1882
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1886
# We cannot seem to hardcode it, guess we'll fake it.
1891
if test $linkmode = prog; then
1892
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1893
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1895
test -n "$add_dir" && deplibs="$add_dir $deplibs"
1896
test -n "$add" && deplibs="$add $deplibs"
1899
elif test $linkmode = prog; then
1900
if test "$alldeplibs" = yes &&
1901
{ test "$deplibs_check_method" = pass_all ||
1902
{ test "$build_libtool_libs" = yes &&
1903
test -n "$library_names"; }; }; then
1904
# We only need to search for static libraries
1908
# Try to link the static library
1909
# Here we assume that one of hardcode_direct or hardcode_minus_L
1910
# is not unsupported. This is valid on all known static and
1912
if test "$hardcode_direct" != unsupported; then
1913
test -n "$old_library" && linklib="$old_library"
1914
compile_deplibs="$dir/$linklib $compile_deplibs"
1915
finalize_deplibs="$dir/$linklib $finalize_deplibs"
1917
compile_deplibs="-l$name -L$dir $compile_deplibs"
1918
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1920
elif test "$build_libtool_libs" = yes; then
1921
# Not a shared library
1922
if test "$deplibs_check_method" != pass_all; then
1923
# We're trying link a shared library against a static one
1924
# but the system doesn't support it.
1926
# Just print a warning and add the library to dependency_libs so
1927
# that the program can be linked against the static library.
1929
echo "*** Warning: This library needs some functionality provided by $lib."
1930
echo "*** I have the capability to make that library automatically link in when"
1931
echo "*** you link to this library. But I can only do this if you have a"
1932
echo "*** shared version of the library, which you do not appear to have."
1933
if test "$module" = yes; then
1934
echo "*** Therefore, libtool will create a static module, that should work "
1935
echo "*** as long as the dlopening application is linked with the -dlopen flag."
1936
if test -z "$global_symbol_pipe"; then
1938
echo "*** However, this would only work if libtool was able to extract symbol"
1939
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1940
echo "*** not find such a program. So, this module is probably useless."
1941
echo "*** \`nm' from GNU binutils and a full rebuild may help."
1943
if test "$build_old_libs" = no; then
1944
build_libtool_libs=module
1947
build_libtool_libs=no
1951
convenience="$convenience $dir/$old_library"
1952
old_convenience="$old_convenience $dir/$old_library"
1953
deplibs="$dir/$old_library $deplibs"
1956
fi # link shared/static library?
1958
if test $linkmode = lib; then
1959
if test -n "$dependency_libs" &&
1960
{ test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1961
test $link_static = yes; }; then
1962
# Extract -R from dependency_libs
1964
for libdir in $dependency_libs; do
1966
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1968
*" $temp_xrpath "*) ;;
1969
*) xrpath="$xrpath $temp_xrpath";;
1971
*) temp_deplibs="$temp_deplibs $libdir";;
1974
dependency_libs="$temp_deplibs"
1977
newlib_search_path="$newlib_search_path $absdir"
1978
# Link against this library
1979
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1980
# ... and its dependency_libs
1982
for deplib in $dependency_libs; do
1983
newdependency_libs="$deplib $newdependency_libs"
1984
case "$tmp_libs " in
1985
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1987
tmp_libs="$tmp_libs $deplib"
1990
if test $link_all_deplibs != no; then
1991
# Add the search paths of all dependency libraries
1992
for deplib in $dependency_libs; do
1994
-L*) path="$deplib" ;;
1996
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1997
test "X$dir" = "X$deplib" && dir="."
1998
# We need an absolute path.
2000
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2002
absdir=`cd "$dir" && pwd`
2003
if test -z "$absdir"; then
2004
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2009
if grep "^installed=no" $deplib > /dev/null; then
2010
path="-L$absdir/$objdir"
2012
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2013
if test -z "$libdir"; then
2014
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2017
if test "$absdir" != "$libdir"; then
2018
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2025
case " $deplibs " in
2027
*) deplibs="$deplibs $path" ;;
2030
fi # link_all_deplibs != no
2032
done # for deplib in $libs
2033
if test $pass = dlpreopen; then
2034
# Link the dlpreopened libraries before other libraries
2035
for deplib in $save_deplibs; do
2036
deplibs="$deplib $deplibs"
2039
if test $pass != dlopen; then
2040
test $pass != scan && dependency_libs="$newdependency_libs"
2041
if test $pass != conv; then
2042
# Make sure lib_search_path contains only unique directories.
2044
for dir in $newlib_search_path; do
2045
case "$lib_search_path " in
2047
*) lib_search_path="$lib_search_path $dir" ;;
2053
if test "$linkmode,$pass" != "prog,link"; then
2056
vars="compile_deplibs finalize_deplibs"
2058
for var in $vars dependency_libs; do
2059
# Add libraries to $var in reverse order
2060
eval tmp_libs=\"\$$var\"
2062
for deplib in $tmp_libs; do
2064
-L*) new_libs="$deplib $new_libs" ;;
2066
case " $specialdeplibs " in
2067
*" $deplib "*) new_libs="$deplib $new_libs" ;;
2069
case " $new_libs " in
2071
*) new_libs="$deplib $new_libs" ;;
2079
for deplib in $new_libs; do
2082
case " $tmp_libs " in
2084
*) tmp_libs="$tmp_libs $deplib" ;;
2087
*) tmp_libs="$tmp_libs $deplib" ;;
2090
eval $var=\"$tmp_libs\"
2093
if test "$pass" = "conv" &&
2094
{ test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2095
libs="$deplibs" # reset libs
2099
if test $linkmode = prog; then
2100
dlfiles="$newdlfiles"
2101
dlprefiles="$newdlprefiles"
2106
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2107
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2110
if test -n "$rpath"; then
2111
$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2114
if test -n "$xrpath"; then
2115
$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2118
if test -n "$vinfo"; then
2119
$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2122
if test -n "$release"; then
2123
$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2126
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2127
$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2130
# Now set the variables for building old libraries.
2131
build_libtool_libs=no
2133
objs="$objs$old_deplibs"
2137
# Make sure we only generate libraries of the form `libNAME.la'.
2140
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2141
eval libname=\"$libname_spec\"
2144
if test "$module" = no; then
2145
$echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2149
if test "$need_lib_prefix" != no; then
2150
# Add the "lib" prefix for modules if required
2151
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2152
eval libname=\"$libname_spec\"
2154
libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2159
if test -n "$objs"; then
2160
if test "$deplibs_check_method" != pass_all; then
2161
$echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2165
echo "*** Warning: Linking the shared library $output against the non-libtool"
2166
echo "*** objects $objs is not portable!"
2167
libobjs="$libobjs $objs"
2171
if test "$dlself" != no; then
2172
$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2176
if test $# -gt 2; then
2177
$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2182
if test -z "$rpath"; then
2183
if test "$build_libtool_libs" = yes; then
2184
# Building a libtool convenience library.
2186
oldlibs="$output_objdir/$libname.$libext $oldlibs"
2187
build_libtool_libs=convenience
2191
if test -n "$vinfo"; then
2192
$echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2195
if test -n "$release"; then
2196
$echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2200
# Parse the version information argument.
2201
save_ifs="$IFS"; IFS=':'
2202
set dummy $vinfo 0 0 0
2205
if test -n "$8"; then
2206
$echo "$modename: too many parameters to \`-version-info'" 1>&2
2215
# Check that each of the things are valid numbers.
2217
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2219
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2220
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2226
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2228
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2229
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2235
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2237
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2238
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243
if test $age -gt $current; then
2244
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2245
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2249
# Calculate the version variables.
2253
case $version_type in
2257
# Like Linux, but with the current version available in
2258
# verstring for coding it into the library header
2259
major=.`expr $current - $age`
2260
versuffix="$major.$age.$revision"
2261
# Darwin ld doesn't like 0 for these options...
2262
minor_current=`expr $current + 1`
2263
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2268
versuffix=".$current.$revision";
2273
versuffix=".$current";
2277
major=`expr $current - $age + 1`
2278
verstring="sgi$major.$revision"
2280
# Add in all the interfaces that we are compatible with.
2282
while test $loop != 0; do
2283
iface=`expr $revision - $loop`
2284
loop=`expr $loop - 1`
2285
verstring="sgi$major.$iface:$verstring"
2288
# Before this point, $major must not contain `.'.
2290
versuffix="$major.$revision"
2294
major=.`expr $current - $age`
2295
versuffix="$major.$age.$revision"
2299
major=`expr $current - $age`
2300
versuffix=".$current.$age.$revision"
2301
verstring="$current.$age.$revision"
2303
# Add in all the interfaces that we are compatible with.
2305
while test $loop != 0; do
2306
iface=`expr $current - $loop`
2307
loop=`expr $loop - 1`
2308
verstring="$verstring:${iface}.0"
2311
# Make executables depend on our current version.
2312
verstring="$verstring:${current}.0"
2317
versuffix=".$current.$revision"
2321
# Use '-' rather than '.', since we only want one
2322
# extension on DOS 8.3 filesystems.
2323
major=`expr $current - $age`
2328
$echo "$modename: unknown library version type \`$version_type'" 1>&2
2329
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2334
# Clear the version info if we defaulted, and they specified a release.
2335
if test -z "$vinfo" && test -n "$release"; then
2338
case $version_type in
2340
# we can't check for "0.0" in archive_cmds due to quoting
2341
# problems, so we reset it completely
2348
if test "$need_version" = no; then
2355
# Remove version info from name if versioning should be avoided
2356
if test "$avoid_version" = yes && test "$need_version" = no; then
2362
# Check to see if the archive will have undefined symbols.
2363
if test "$allow_undefined" = yes; then
2364
if test "$allow_undefined_flag" = unsupported; then
2365
$echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2366
build_libtool_libs=no
2370
# Don't allow undefined symbols.
2371
allow_undefined_flag="$no_undefined_flag"
2375
if test "$mode" != relink; then
2376
# Remove our outputs.
2377
$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2378
$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2381
# Now set the variables for building old libraries.
2382
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2383
oldlibs="$oldlibs $output_objdir/$libname.$libext"
2385
# Transform .lo files to .o files.
2386
oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2389
# Eliminate all temporary directories.
2390
for path in $notinst_path; do
2391
lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2392
deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2393
dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2396
if test -n "$xrpath"; then
2397
# If the user specified any rpath flags, then add them.
2399
for libdir in $xrpath; do
2400
temp_xrpath="$temp_xrpath -R$libdir"
2401
case "$finalize_rpath " in
2403
*) finalize_rpath="$finalize_rpath $libdir" ;;
2406
if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2407
dependency_libs="$temp_xrpath $dependency_libs"
2411
# Make sure dlfiles contains only unique files that won't be dlpreopened
2412
old_dlfiles="$dlfiles"
2414
for lib in $old_dlfiles; do
2415
case " $dlprefiles $dlfiles " in
2417
*) dlfiles="$dlfiles $lib" ;;
2421
# Make sure dlprefiles contains only unique files
2422
old_dlprefiles="$dlprefiles"
2424
for lib in $old_dlprefiles; do
2425
case "$dlprefiles " in
2427
*) dlprefiles="$dlprefiles $lib" ;;
2431
if test "$build_libtool_libs" = yes; then
2432
if test -n "$rpath"; then
2434
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2435
# these systems don't actually have a c library (as such)!
2437
*-*-rhapsody* | *-*-darwin1.[012])
2438
# Rhapsody C library is in the System framework
2439
deplibs="$deplibs -framework System"
2442
# Don't link with libc until the a.out ld.so is fixed.
2445
# Do not include libc due to us having libc/libc_r.
2448
# Add libc to deplibs on all other systems if necessary.
2449
if test $build_libtool_need_lc = "yes"; then
2450
deplibs="$deplibs -lc"
2456
# Transform deplibs into only deplibs that can be linked in shared.
2458
libname_save=$libname
2459
release_save=$release
2460
versuffix_save=$versuffix
2462
# I'm not sure if I'm treating the release correctly. I think
2463
# release should show up in the -l (ie -lgmp5) so we don't want to
2464
# add it in twice. Is that correct?
2470
case $deplibs_check_method in
2472
# Don't check for shared/static. Everything works.
2473
# This might be a little naive. We might want to check
2474
# whether the library exists or not. But this is on
2475
# osf3 & osf4 and I'm not really sure... Just
2476
# implementing what was already the behaviour.
2480
# This code stresses the "libraries are programs" paradigm to its
2481
# limits. Maybe even breaks it. We compile a program, linking it
2482
# against the deplibs as a proxy for the library. Then we can check
2483
# whether they linked in statically or dynamically with ldd.
2485
cat > conftest.c <<EOF
2486
int main() { return 0; }
2489
$CC -o conftest conftest.c $deplibs
2490
if test $? -eq 0 ; then
2491
ldd_output=`ldd conftest`
2492
for i in $deplibs; do
2493
name="`expr $i : '-l\(.*\)'`"
2494
# If $name is empty we are operating on a -L argument.
2495
if test -n "$name" && test "$name" != "0"; then
2496
libname=`eval \\$echo \"$libname_spec\"`
2497
deplib_matches=`eval \\$echo \"$library_names_spec\"`
2498
set dummy $deplib_matches
2500
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2501
newdeplibs="$newdeplibs $i"
2505
echo "*** Warning: This library needs some functionality provided by $i."
2506
echo "*** I have the capability to make that library automatically link in when"
2507
echo "*** you link to this library. But I can only do this if you have a"
2508
echo "*** shared version of the library, which you do not appear to have."
2511
newdeplibs="$newdeplibs $i"
2515
# Error occured in the first compile. Let's try to salvage the situation:
2516
# Compile a seperate program for each library.
2517
for i in $deplibs; do
2518
name="`expr $i : '-l\(.*\)'`"
2519
# If $name is empty we are operating on a -L argument.
2520
if test -n "$name" && test "$name" != "0"; then
2522
$CC -o conftest conftest.c $i
2524
if test $? -eq 0 ; then
2525
ldd_output=`ldd conftest`
2526
libname=`eval \\$echo \"$libname_spec\"`
2527
deplib_matches=`eval \\$echo \"$library_names_spec\"`
2528
set dummy $deplib_matches
2530
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2531
newdeplibs="$newdeplibs $i"
2535
echo "*** Warning: This library needs some functionality provided by $i."
2536
echo "*** I have the capability to make that library automatically link in when"
2537
echo "*** you link to this library. But I can only do this if you have a"
2538
echo "*** shared version of the library, which you do not appear to have."
2543
echo "*** Warning! Library $i is needed by this library but I was not able to"
2544
echo "*** make it link in! You will probably need to install it or some"
2545
echo "*** library that it depends on before this library will be fully"
2546
echo "*** functional. Installing it before continuing would be even better."
2549
newdeplibs="$newdeplibs $i"
2555
set dummy $deplibs_check_method
2556
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2557
for a_deplib in $deplibs; do
2558
name="`expr $a_deplib : '-l\(.*\)'`"
2559
# If $name is empty we are operating on a -L argument.
2560
if test -n "$name" && test "$name" != "0"; then
2561
libname=`eval \\$echo \"$libname_spec\"`
2562
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2563
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2564
for potent_lib in $potential_libs; do
2565
# Follow soft links.
2566
if ls -lLd "$potent_lib" 2>/dev/null \
2567
| grep " -> " >/dev/null; then
2570
# The statement above tries to avoid entering an
2571
# endless loop below, in case of cyclic links.
2572
# We might still enter an endless loop, since a link
2573
# loop can be closed while we follow links,
2575
potlib="$potent_lib"
2576
while test -h "$potlib" 2>/dev/null; do
2577
potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2579
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2580
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2583
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2585
| egrep "$file_magic_regex" > /dev/null; then
2586
newdeplibs="$newdeplibs $a_deplib"
2592
if test -n "$a_deplib" ; then
2595
echo "*** Warning: This library needs some functionality provided by $a_deplib."
2596
echo "*** I have the capability to make that library automatically link in when"
2597
echo "*** you link to this library. But I can only do this if you have a"
2598
echo "*** shared version of the library, which you do not appear to have."
2601
# Add a -L argument.
2602
newdeplibs="$newdeplibs $a_deplib"
2604
done # Gone through all deplibs.
2607
set dummy $deplibs_check_method
2608
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2609
for a_deplib in $deplibs; do
2610
name="`expr $a_deplib : '-l\(.*\)'`"
2611
# If $name is empty we are operating on a -L argument.
2612
if test -n "$name" && test "$name" != "0"; then
2613
libname=`eval \\$echo \"$libname_spec\"`
2614
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2615
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2616
for potent_lib in $potential_libs; do
2617
if eval echo \"$potent_lib\" 2>/dev/null \
2619
| egrep "$match_pattern_regex" > /dev/null; then
2620
newdeplibs="$newdeplibs $a_deplib"
2626
if test -n "$a_deplib" ; then
2629
echo "*** Warning: This library needs some functionality provided by $a_deplib."
2630
echo "*** I have the capability to make that library automatically link in when"
2631
echo "*** you link to this library. But I can only do this if you have a"
2632
echo "*** shared version of the library, which you do not appear to have."
2635
# Add a -L argument.
2636
newdeplibs="$newdeplibs $a_deplib"
2638
done # Gone through all deplibs.
2642
if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2643
-e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2644
grep . >/dev/null; then
2646
if test "X$deplibs_check_method" = "Xnone"; then
2647
echo "*** Warning: inter-library dependencies are not supported in this platform."
2649
echo "*** Warning: inter-library dependencies are not known to be supported."
2651
echo "*** All declared inter-library dependencies are being dropped."
2656
versuffix=$versuffix_save
2658
release=$release_save
2659
libname=$libname_save
2663
*-*-rhapsody* | *-*-darwin1.[012])
2664
# On Rhapsody replace the C library is the System framework
2665
newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2669
if test "$droppeddeps" = yes; then
2670
if test "$module" = yes; then
2672
echo "*** Warning: libtool could not satisfy all declared inter-library"
2673
echo "*** dependencies of module $libname. Therefore, libtool will create"
2674
echo "*** a static module, that should work as long as the dlopening"
2675
echo "*** application is linked with the -dlopen flag."
2676
if test -z "$global_symbol_pipe"; then
2678
echo "*** However, this would only work if libtool was able to extract symbol"
2679
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2680
echo "*** not find such a program. So, this module is probably useless."
2681
echo "*** \`nm' from GNU binutils and a full rebuild may help."
2683
if test "$build_old_libs" = no; then
2684
oldlibs="$output_objdir/$libname.$libext"
2685
build_libtool_libs=module
2688
build_libtool_libs=no
2691
echo "*** The inter-library dependencies that have been dropped here will be"
2692
echo "*** automatically added whenever a program is linked with this library"
2693
echo "*** or is declared to -dlopen it."
2695
if test $allow_undefined = no; then
2697
echo "*** Since this library must not contain undefined symbols,"
2698
echo "*** because either the platform does not support them or"
2699
echo "*** it was explicitly requested with -no-undefined,"
2700
echo "*** libtool will only create a static version of it."
2701
if test "$build_old_libs" = no; then
2702
oldlibs="$output_objdir/$libname.$libext"
2703
build_libtool_libs=module
2706
build_libtool_libs=no
2711
# Done checking deplibs!
2715
# All the library-specific variables (install_libdir is set above).
2720
# Test again, we may have decided not to build it any more
2721
if test "$build_libtool_libs" = yes; then
2722
if test $hardcode_into_libs = yes; then
2723
# Hardcode the library paths
2726
rpath="$finalize_rpath"
2727
test "$mode" != relink && rpath="$compile_rpath$rpath"
2728
for libdir in $rpath; do
2729
if test -n "$hardcode_libdir_flag_spec"; then
2730
if test -n "$hardcode_libdir_separator"; then
2731
if test -z "$hardcode_libdirs"; then
2732
hardcode_libdirs="$libdir"
2734
# Just accumulate the unique libdirs.
2735
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2736
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2739
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2744
eval flag=\"$hardcode_libdir_flag_spec\"
2745
dep_rpath="$dep_rpath $flag"
2747
elif test -n "$runpath_var"; then
2748
case "$perm_rpath " in
2750
*) perm_rpath="$perm_rpath $libdir" ;;
2754
# Substitute the hardcoded libdirs into the rpath.
2755
if test -n "$hardcode_libdir_separator" &&
2756
test -n "$hardcode_libdirs"; then
2757
libdir="$hardcode_libdirs"
2758
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2760
if test -n "$runpath_var" && test -n "$perm_rpath"; then
2761
# We should set the runpath_var.
2763
for dir in $perm_rpath; do
2766
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2768
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2771
shlibpath="$finalize_shlibpath"
2772
test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2773
if test -n "$shlibpath"; then
2774
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2777
# Get the real and link names of the library.
2778
eval library_names=\"$library_names_spec\"
2779
set dummy $library_names
2783
if test -n "$soname_spec"; then
2784
eval soname=\"$soname_spec\"
2788
test -z "$dlname" && dlname=$soname
2790
lib="$output_objdir/$realname"
2793
linknames="$linknames $link"
2796
# Ensure that we have .o objects for linkers which dislike .lo
2797
# (e.g. aix) in case we are running --disable-static
2798
for obj in $libobjs; do
2799
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2800
if test "X$xdir" = "X$obj"; then
2805
baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2806
oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2807
if test ! -f $xdir/$oldobj; then
2808
$show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2809
$run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2813
# Use standard objects if they are pic
2814
test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2816
# Prepare the list of exported symbols
2817
if test -z "$export_symbols"; then
2818
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2819
$show "generating symbol list for \`$libname.la'"
2820
export_symbols="$output_objdir/$libname.exp"
2821
$run $rm $export_symbols
2822
eval cmds=\"$export_symbols_cmds\"
2823
save_ifs="$IFS"; IFS='~'
2824
for cmd in $cmds; do
2827
$run eval "$cmd" || exit $?
2830
if test -n "$export_symbols_regex"; then
2831
$show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2832
$run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2833
$show "$mv \"${export_symbols}T\" \"$export_symbols\""
2834
$run eval '$mv "${export_symbols}T" "$export_symbols"'
2839
if test -n "$export_symbols" && test -n "$include_expsyms"; then
2840
$run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2843
if test -n "$convenience"; then
2844
if test -n "$whole_archive_flag_spec"; then
2845
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2847
gentop="$output_objdir/${outputname}x"
2848
$show "${rm}r $gentop"
2849
$run ${rm}r "$gentop"
2850
$show "mkdir $gentop"
2851
$run mkdir "$gentop"
2853
if test $status -ne 0 && test ! -d "$gentop"; then
2856
generated="$generated $gentop"
2858
for xlib in $convenience; do
2859
# Extract the objects.
2861
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2862
*) xabs=`pwd`"/$xlib" ;;
2864
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2865
xdir="$gentop/$xlib"
2867
$show "${rm}r $xdir"
2872
if test $status -ne 0 && test ! -d "$xdir"; then
2875
$show "(cd $xdir && $AR x $xabs)"
2876
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2878
libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2883
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2884
eval flag=\"$thread_safe_flag_spec\"
2885
linker_flags="$linker_flags $flag"
2888
# Make a backup of the uninstalled library when relinking
2889
if test "$mode" = relink; then
2890
$run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2893
# Do each of the archive commands.
2894
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2895
eval cmds=\"$archive_expsym_cmds\"
2897
eval cmds=\"$archive_cmds\"
2899
save_ifs="$IFS"; IFS='~'
2900
for cmd in $cmds; do
2903
$run eval "$cmd" || exit $?
2907
# Restore the uninstalled library and exit
2908
if test "$mode" = relink; then
2909
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2913
# Create links to the real library.
2914
for linkname in $linknames; do
2915
if test "$realname" != "$linkname"; then
2916
$show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2917
$run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2921
# If -module or -export-dynamic was specified, set the dlname.
2922
if test "$module" = yes || test "$export_dynamic" = yes; then
2923
# On all known operating systems, these are identical.
2930
if test -n "$deplibs"; then
2931
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2934
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2935
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2938
if test -n "$rpath"; then
2939
$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2942
if test -n "$xrpath"; then
2943
$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2946
if test -n "$vinfo"; then
2947
$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2950
if test -n "$release"; then
2951
$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2956
if test -n "$objs$old_deplibs"; then
2957
$echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2961
obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2969
# Delete the old objects.
2970
$run $rm $obj $libobj
2972
# Objects from convenience libraries. This assumes
2973
# single-version convenience libraries. Whenever we create
2974
# different ones for PIC/non-PIC, this we'll have to duplicate
2978
# reload_cmds runs $LD directly, so let us get rid of
2979
# -Wl from whole_archive_flag_spec
2982
if test -n "$convenience"; then
2983
if test -n "$whole_archive_flag_spec"; then
2984
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2986
gentop="$output_objdir/${obj}x"
2987
$show "${rm}r $gentop"
2988
$run ${rm}r "$gentop"
2989
$show "mkdir $gentop"
2990
$run mkdir "$gentop"
2992
if test $status -ne 0 && test ! -d "$gentop"; then
2995
generated="$generated $gentop"
2997
for xlib in $convenience; do
2998
# Extract the objects.
3000
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3001
*) xabs=`pwd`"/$xlib" ;;
3003
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3004
xdir="$gentop/$xlib"
3006
$show "${rm}r $xdir"
3011
if test $status -ne 0 && test ! -d "$xdir"; then
3014
$show "(cd $xdir && $AR x $xabs)"
3015
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3017
reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3022
# Create the old-style object.
3023
reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3026
eval cmds=\"$reload_cmds\"
3027
save_ifs="$IFS"; IFS='~'
3028
for cmd in $cmds; do
3031
$run eval "$cmd" || exit $?
3035
# Exit if we aren't doing a library object file.
3036
if test -z "$libobj"; then
3037
if test -n "$gentop"; then
3038
$show "${rm}r $gentop"
3045
if test "$build_libtool_libs" != yes; then
3046
if test -n "$gentop"; then
3047
$show "${rm}r $gentop"
3051
# Create an invalid libtool object if no PIC, so that we don't
3052
# accidentally link it into a program.
3053
$show "echo timestamp > $libobj"
3054
$run eval "echo timestamp > $libobj" || exit $?
3058
if test -n "$pic_flag" || test "$pic_mode" != default; then
3059
# Only do commands if we really have different PIC objects.
3060
reload_objs="$libobjs $reload_conv_objs"
3062
eval cmds=\"$reload_cmds\"
3063
save_ifs="$IFS"; IFS='~'
3064
for cmd in $cmds; do
3067
$run eval "$cmd" || exit $?
3071
# Just create a symlink.
3074
xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3075
if test "X$xdir" = "X$libobj"; then
3080
baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3081
oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3082
$show "(cd $xdir && $LN_S $oldobj $baseobj)"
3083
$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3086
if test -n "$gentop"; then
3087
$show "${rm}r $gentop"
3096
*cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3098
if test -n "$vinfo"; then
3099
$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3102
if test -n "$release"; then
3103
$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3106
if test "$preload" = yes; then
3107
if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3108
test "$dlopen_self_static" = unknown; then
3109
$echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3114
*-*-rhapsody* | *-*-darwin1.[012])
3115
# On Rhapsody replace the C library is the System framework
3116
compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3117
finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3121
compile_command="$compile_command $compile_deplibs"
3122
finalize_command="$finalize_command $finalize_deplibs"
3124
if test -n "$rpath$xrpath"; then
3125
# If the user specified any rpath flags, then add them.
3126
for libdir in $rpath $xrpath; do
3127
# This is the magic to use -rpath.
3128
case "$finalize_rpath " in
3130
*) finalize_rpath="$finalize_rpath $libdir" ;;
3135
# Now hardcode the library paths
3138
for libdir in $compile_rpath $finalize_rpath; do
3139
if test -n "$hardcode_libdir_flag_spec"; then
3140
if test -n "$hardcode_libdir_separator"; then
3141
if test -z "$hardcode_libdirs"; then
3142
hardcode_libdirs="$libdir"
3144
# Just accumulate the unique libdirs.
3145
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3146
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3149
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3154
eval flag=\"$hardcode_libdir_flag_spec\"
3155
rpath="$rpath $flag"
3157
elif test -n "$runpath_var"; then
3158
case "$perm_rpath " in
3160
*) perm_rpath="$perm_rpath $libdir" ;;
3164
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3165
case :$dllsearchpath: in
3167
*) dllsearchpath="$dllsearchpath:$libdir";;
3172
# Substitute the hardcoded libdirs into the rpath.
3173
if test -n "$hardcode_libdir_separator" &&
3174
test -n "$hardcode_libdirs"; then
3175
libdir="$hardcode_libdirs"
3176
eval rpath=\" $hardcode_libdir_flag_spec\"
3178
compile_rpath="$rpath"
3182
for libdir in $finalize_rpath; do
3183
if test -n "$hardcode_libdir_flag_spec"; then
3184
if test -n "$hardcode_libdir_separator"; then
3185
if test -z "$hardcode_libdirs"; then
3186
hardcode_libdirs="$libdir"
3188
# Just accumulate the unique libdirs.
3189
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3190
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3193
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3198
eval flag=\"$hardcode_libdir_flag_spec\"
3199
rpath="$rpath $flag"
3201
elif test -n "$runpath_var"; then
3202
case "$finalize_perm_rpath " in
3204
*) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3208
# Substitute the hardcoded libdirs into the rpath.
3209
if test -n "$hardcode_libdir_separator" &&
3210
test -n "$hardcode_libdirs"; then
3211
libdir="$hardcode_libdirs"
3212
eval rpath=\" $hardcode_libdir_flag_spec\"
3214
finalize_rpath="$rpath"
3216
if test -n "$libobjs" && test "$build_old_libs" = yes; then
3217
# Transform all the library objects into standard objects.
3218
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3219
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3223
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3224
if test -n "$NM" && test -n "$global_symbol_pipe"; then
3225
dlsyms="${outputname}S.c"
3227
$echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3231
if test -n "$dlsyms"; then
3235
# Discover the nlist of each of the dlfiles.
3236
nlist="$output_objdir/${outputname}.nm"
3238
$show "$rm $nlist ${nlist}S ${nlist}T"
3239
$run $rm "$nlist" "${nlist}S" "${nlist}T"
3241
# Parse the name list into a source file.
3242
$show "creating $output_objdir/$dlsyms"
3244
test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3245
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3246
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3252
/* Prevent the only kind of declaration conflicts we can make. */
3253
#define lt_preloaded_symbols some_other_symbol
3255
/* External symbol declarations for the compiler. */\
3258
if test "$dlself" = yes; then
3259
$show "generating symbol list for \`$output'"
3261
test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3263
# Add our own program objects to the symbol list.
3264
progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3265
for arg in $progfiles; do
3266
$show "extracting global C symbols from \`$arg'"
3267
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3270
if test -n "$exclude_expsyms"; then
3271
$run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3272
$run eval '$mv "$nlist"T "$nlist"'
3275
if test -n "$export_symbols_regex"; then
3276
$run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3277
$run eval '$mv "$nlist"T "$nlist"'
3280
# Prepare the list of exported symbols
3281
if test -z "$export_symbols"; then
3282
export_symbols="$output_objdir/$output.exp"
3283
$run $rm $export_symbols
3284
$run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3286
$run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3287
$run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3288
$run eval 'mv "$nlist"T "$nlist"'
3292
for arg in $dlprefiles; do
3293
$show "extracting global C symbols from \`$arg'"
3294
name=`echo "$arg" | sed -e 's%^.*/%%'`
3295
$run eval 'echo ": $name " >> "$nlist"'
3296
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3299
if test -z "$run"; then
3300
# Make sure we have at least an empty file.
3301
test -f "$nlist" || : > "$nlist"
3303
if test -n "$exclude_expsyms"; then
3304
egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3305
$mv "$nlist"T "$nlist"
3308
# Try sorting and uniquifying the output.
3309
if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3312
grep -v "^: " < "$nlist" > "$nlist"S
3315
if test -f "$nlist"S; then
3316
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3318
echo '/* NONE */' >> "$output_objdir/$dlsyms"
3321
$echo >> "$output_objdir/$dlsyms" "\
3323
#undef lt_preloaded_symbols
3325
#if defined (__STDC__) && __STDC__
3326
# define lt_ptr void *
3328
# define lt_ptr char *
3332
/* The mapping between symbol names and symbols. */
3337
lt_preloaded_symbols[] =
3341
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3343
$echo >> "$output_objdir/$dlsyms" "\
3347
/* This works around a problem in FreeBSD linker */
3348
#ifdef FREEBSD_WORKAROUND
3349
static const void *lt_preloaded_setup() {
3350
return lt_preloaded_symbols;
3360
pic_flag_for_symtable=
3362
# compiling the symbol table file with pic_flag works around
3363
# a FreeBSD bug that causes programs to crash when -lm is
3364
# linked before any other PIC object. But we must not use
3365
# pic_flag when linking with -static. The problem exists in
3366
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3367
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3368
case "$compile_command " in
3370
*) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3373
case "$compile_command " in
3375
*) pic_flag_for_symtable=" $pic_flag -DPIC";;
3379
# Now compile the dynamic symbol file.
3380
$show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3381
$run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3383
# Clean up the generated files.
3384
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3385
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3387
# Transform the symbol file into the correct name.
3388
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3389
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3392
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3397
# We keep going just in case the user didn't refer to
3398
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3399
# really was required.
3401
# Nullify the symbol file.
3402
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3403
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3406
if test $need_relink = no || test "$build_libtool_libs" != yes; then
3407
# Replace the output file specification.
3408
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3409
link_command="$compile_command$compile_rpath"
3411
# We have no uninstalled library dependencies, so finalize right now.
3412
$show "$link_command"
3413
$run eval "$link_command"
3416
# Delete the generated files.
3417
if test -n "$dlsyms"; then
3418
$show "$rm $output_objdir/${outputname}S.${objext}"
3419
$run $rm "$output_objdir/${outputname}S.${objext}"
3425
if test -n "$shlibpath_var"; then
3426
# We should set the shlibpath_var
3428
for dir in $temp_rpath; do
3430
[\\/]* | [A-Za-z]:[\\/]*)
3435
# Relative path: add a thisdir entry.
3436
rpath="$rpath\$thisdir/$dir:"
3443
if test -n "$compile_shlibpath$finalize_shlibpath"; then
3444
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3446
if test -n "$finalize_shlibpath"; then
3447
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3452
if test -n "$runpath_var"; then
3453
if test -n "$perm_rpath"; then
3454
# We should set the runpath_var.
3456
for dir in $perm_rpath; do
3459
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3461
if test -n "$finalize_perm_rpath"; then
3462
# We should set the runpath_var.
3464
for dir in $finalize_perm_rpath; do
3467
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3471
if test "$no_install" = yes; then
3472
# We don't need to create a wrapper script.
3473
link_command="$compile_var$compile_command$compile_rpath"
3474
# Replace the output file specification.
3475
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3476
# Delete the old output file.
3478
# Link the executable and exit
3479
$show "$link_command"
3480
$run eval "$link_command" || exit $?
3484
if test "$hardcode_action" = relink; then
3485
# Fast installation is not supported
3486
link_command="$compile_var$compile_command$compile_rpath"
3487
relink_command="$finalize_var$finalize_command$finalize_rpath"
3489
$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3490
$echo "$modename: \`$output' will be relinked during installation" 1>&2
3492
if test "$fast_install" != no; then
3493
link_command="$finalize_var$compile_command$finalize_rpath"
3494
if test "$fast_install" = yes; then
3495
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3497
# fast_install is set to needless
3501
link_command="$compile_var$compile_command$compile_rpath"
3502
relink_command="$finalize_var$finalize_command$finalize_rpath"
3506
# Replace the output file specification.
3507
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3509
# Delete the old output files.
3510
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3512
$show "$link_command"
3513
$run eval "$link_command" || exit $?
3515
# Now create the wrapper script.
3516
$show "creating $output"
3518
# Quote the relink command for shipping.
3519
if test -n "$relink_command"; then
3520
# Preserve any variables that may affect compiler behavior
3521
for var in $variables_saved_for_relink; do
3522
if eval test -z \"\${$var+set}\"; then
3523
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3524
elif eval var_value=\$$var; test -z "$var_value"; then
3525
relink_command="$var=; export $var; $relink_command"
3527
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3528
relink_command="$var=\"$var_value\"; export $var; $relink_command"
3531
relink_command="cd `pwd`; $relink_command"
3532
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3535
# Quote $echo for shipping.
3536
if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3538
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3539
*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3541
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3543
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3546
# Only actually do things if our run command is non-null.
3547
if test -z "$run"; then
3548
# win32 will think the script is a binary if it has
3549
# a .exe suffix, so we strip it off here.
3551
*.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3553
# test for cygwin because mv fails w/o .exe extensions
3555
*cygwin*) exeext=.exe ;;
3559
trap "$rm $output; exit 1" 1 2 15
3564
# $output - temporary wrapper script for $objdir/$outputname
3565
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3567
# The $output program cannot be directly executed until all the libtool
3568
# libraries that it depends on are installed.
3570
# This wrapper script should never be moved out of the build directory.
3571
# If it is, it will not operate correctly.
3573
# Sed substitution that helps us do robust quoting. It backslashifies
3574
# metacharacters that are still active within double-quoted strings.
3575
Xsed='sed -e 1s/^X//'
3576
sed_quote_subst='$sed_quote_subst'
3578
# The HP-UX ksh and POSIX shell print the target directory to stdout
3580
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3582
relink_command=\"$relink_command\"
3584
# This environment variable determines our operation mode.
3585
if test \"\$libtool_install_magic\" = \"$magic\"; then
3586
# install mode needs the following variable:
3587
notinst_deplibs='$notinst_deplibs'
3589
# When we are sourced in execute mode, \$file and \$echo are already set.
3590
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3593
# Make sure echo works.
3594
if test \"X\$1\" = X--no-reexec; then
3595
# Discard the --no-reexec flag, and continue.
3597
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3598
# Yippee, \$echo works!
3601
# Restart under the correct shell, and then maybe \$echo will work.
3602
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3608
# Find the directory that this script lives in.
3609
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3610
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3612
# Follow symbolic links until we get to the real thisdir.
3613
file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3614
while test -n \"\$file\"; do
3615
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3617
# If there was a directory component, then change thisdir.
3618
if test \"x\$destdir\" != \"x\$file\"; then
3619
case \"\$destdir\" in
3620
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3621
*) thisdir=\"\$thisdir/\$destdir\" ;;
3625
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3626
file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3629
# Try to get the absolute directory name.
3630
absdir=\`cd \"\$thisdir\" && pwd\`
3631
test -n \"\$absdir\" && thisdir=\"\$absdir\"
3634
if test "$fast_install" = yes; then
3636
program=lt-'$outputname'$exeext
3637
progdir=\"\$thisdir/$objdir\"
3639
if test ! -f \"\$progdir/\$program\" || \\
3640
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3641
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3643
file=\"\$\$-\$program\"
3645
if test ! -d \"\$progdir\"; then
3646
$mkdir \"\$progdir\"
3648
$rm \"\$progdir/\$file\"
3653
# relink executable if necessary
3654
if test -n \"\$relink_command\"; then
3655
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3657
$echo \"\$relink_command_output\" >&2
3658
$rm \"\$progdir/\$file\"
3663
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3664
{ $rm \"\$progdir/\$program\";
3665
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3666
$rm \"\$progdir/\$file\"
3670
program='$outputname'
3671
progdir=\"\$thisdir/$objdir\"
3677
if test -f \"\$progdir/\$program\"; then"
3679
# Export our shlibpath_var if we have one.
3680
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3682
# Add our own library path to $shlibpath_var
3683
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3685
# Some systems cannot cope with colon-terminated $shlibpath_var
3686
# The second colon is a workaround for a bug in BeOS R4 sed
3687
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3689
export $shlibpath_var
3693
# fixup the dll searchpath if we need to.
3694
if test -n "$dllsearchpath"; then
3696
# Add the dll search path components to the executable PATH
3697
PATH=$dllsearchpath:\$PATH
3702
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3703
# Run the actual program with our arguments.
3706
# win32 systems need to use the prog path for dll
3708
*-*-cygwin* | *-*-pw32*)
3710
exec \$progdir/\$program \${1+\"\$@\"}
3714
# Backslashes separate directories on plain windows
3715
*-*-mingw | *-*-os2*)
3717
exec \$progdir\\\\\$program \${1+\"\$@\"}
3723
# Export the path to the program.
3724
PATH=\"\$progdir:\$PATH\"
3727
exec \$program \${1+\"\$@\"}
3732
\$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3736
# The program doesn't exist.
3737
\$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3738
\$echo \"This script is just a wrapper for \$program.\" 1>&2
3739
echo \"See the $PACKAGE documentation for more information.\" 1>&2
3750
# See if we need to build an old-fashioned archive.
3751
for oldlib in $oldlibs; do
3753
if test "$build_libtool_libs" = convenience; then
3754
oldobjs="$libobjs_save"
3755
addlibs="$convenience"
3756
build_libtool_libs=no
3758
if test "$build_libtool_libs" = module; then
3759
oldobjs="$libobjs_save"
3760
build_libtool_libs=no
3762
oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3764
addlibs="$old_convenience"
3767
if test -n "$addlibs"; then
3768
gentop="$output_objdir/${outputname}x"
3769
$show "${rm}r $gentop"
3770
$run ${rm}r "$gentop"
3771
$show "mkdir $gentop"
3772
$run mkdir "$gentop"
3774
if test $status -ne 0 && test ! -d "$gentop"; then
3777
generated="$generated $gentop"
3779
# Add in members from convenience archives.
3780
for xlib in $addlibs; do
3781
# Extract the objects.
3783
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3784
*) xabs=`pwd`"/$xlib" ;;
3786
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3787
xdir="$gentop/$xlib"
3789
$show "${rm}r $xdir"
3794
if test $status -ne 0 && test ! -d "$xdir"; then
3797
$show "(cd $xdir && $AR x $xabs)"
3798
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3800
oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3804
# Do each command in the archive commands.
3805
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3806
eval cmds=\"$old_archive_from_new_cmds\"
3808
# Ensure that we have .o objects in place in case we decided
3809
# not to build a shared library, and have fallen back to building
3810
# static libs even though --disable-static was passed!
3811
for oldobj in $oldobjs; do
3812
if test ! -f $oldobj; then
3813
xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3814
if test "X$xdir" = "X$oldobj"; then
3819
baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3820
obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3821
$show "(cd $xdir && ${LN_S} $obj $baseobj)"
3822
$run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3826
eval cmds=\"$old_archive_cmds\"
3828
save_ifs="$IFS"; IFS='~'
3829
for cmd in $cmds; do
3832
$run eval "$cmd" || exit $?
3837
if test -n "$generated"; then
3838
$show "${rm}r$generated"
3839
$run ${rm}r$generated
3842
# Now create the libtool archive.
3846
test "$build_old_libs" = yes && old_library="$libname.$libext"
3847
$show "creating $output"
3849
# Preserve any variables that may affect compiler behavior
3850
for var in $variables_saved_for_relink; do
3851
if eval test -z \"\${$var+set}\"; then
3852
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3853
elif eval var_value=\$$var; test -z "$var_value"; then
3854
relink_command="$var=; export $var; $relink_command"
3856
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3857
relink_command="$var=\"$var_value\"; export $var; $relink_command"
3860
# Quote the link command for shipping.
3861
relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3862
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3864
# Only create the output if not a dry run.
3865
if test -z "$run"; then
3866
for installed in no yes; do
3867
if test "$installed" = yes; then
3868
if test -z "$install_libdir"; then
3871
output="$output_objdir/$outputname"i
3872
# Replace all uninstalled libtool libraries with the installed ones
3874
for deplib in $dependency_libs; do
3877
name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3878
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3879
if test -z "$libdir"; then
3880
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3883
newdependency_libs="$newdependency_libs $libdir/$name"
3885
*) newdependency_libs="$newdependency_libs $deplib" ;;
3888
dependency_libs="$newdependency_libs"
3890
for lib in $dlfiles; do
3891
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3892
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3893
if test -z "$libdir"; then
3894
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3897
newdlfiles="$newdlfiles $libdir/$name"
3899
dlfiles="$newdlfiles"
3901
for lib in $dlprefiles; do
3902
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3903
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3904
if test -z "$libdir"; then
3905
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3908
newdlprefiles="$newdlprefiles $libdir/$name"
3910
dlprefiles="$newdlprefiles"
3913
# place dlname in correct position for cygwin
3915
case $host,$output,$installed,$module,$dlname in
3916
*cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3919
# $outputname - a libtool library file
3920
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3922
# Please DO NOT delete this file!
3923
# It is necessary for linking the library.
3925
# The name that we can dlopen(3).
3928
# Names of this library.
3929
library_names='$library_names'
3931
# The name of the static archive.
3932
old_library='$old_library'
3934
# Libraries that this one depends upon.
3935
dependency_libs='$dependency_libs'
3937
# Version information for $libname.
3942
# Is this an already installed library?
3943
installed=$installed
3945
# Files to dlopen/dlpreopen
3947
dlpreopen='$dlprefiles'
3949
# Directory that this library needs to be installed in:
3950
libdir='$install_libdir'"
3951
if test "$installed" = no && test $need_relink = yes; then
3953
relink_command=\"$relink_command\""
3958
# Do a symbolic link so that the libtool archive can be found in
3959
# LD_LIBRARY_PATH before the program is installed.
3960
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3961
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3967
# libtool install mode
3969
modename="$modename: install"
3971
# There may be an optional sh(1) argument at the beginning of
3972
# install_prog (especially on Windows NT).
3973
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3974
# Allow the use of GNU shtool's install command.
3975
$echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3976
# Aesthetically quote it.
3977
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3979
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3983
install_prog="$arg "
3991
# The real first argument should be the name of the installation program.
3992
# Aesthetically quote it.
3993
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3995
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3999
install_prog="$install_prog$arg"
4001
# We need to accept at least all the BSD install flags.
4011
if test -n "$dest"; then
4012
files="$files $dest"
4030
# If the previous option needed an argument, then skip it.
4031
if test -n "$prev"; then
4040
# Aesthetically quote the argument.
4041
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4043
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4047
install_prog="$install_prog $arg"
4050
if test -z "$install_prog"; then
4051
$echo "$modename: you must specify an install program" 1>&2
4056
if test -n "$prev"; then
4057
$echo "$modename: the \`$prev' option requires an argument" 1>&2
4062
if test -z "$files"; then
4063
if test -z "$dest"; then
4064
$echo "$modename: no file or destination specified" 1>&2
4066
$echo "$modename: you must specify a destination" 1>&2
4072
# Strip any trailing slash from the destination.
4073
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4075
# Check to see that the destination is a directory.
4076
test -d "$dest" && isdir=yes
4077
if test "$isdir" = yes; then
4081
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4082
test "X$destdir" = "X$dest" && destdir=.
4083
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4085
# Not a directory, so check to see that there is only one file specified.
4087
if test $# -gt 2; then
4088
$echo "$modename: \`$dest' is not a directory" 1>&2
4094
[\\/]* | [A-Za-z]:[\\/]*) ;;
4096
for file in $files; do
4100
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4109
# This variable tells wrapper scripts just to set variables rather
4110
# than running their programs.
4111
libtool_install_magic="$magic"
4116
for file in $files; do
4118
# Do each installation.
4121
# Do the static libraries later.
4122
staticlibs="$staticlibs $file"
4126
# Check to see that this really is a libtool archive.
4127
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4129
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4137
# If there is no directory component, then add one.
4139
*/* | *\\*) . $file ;;
4143
# Add the libdir to current_libdirs if it is the destination.
4144
if test "X$destdir" = "X$libdir"; then
4145
case "$current_libdirs " in
4147
*) current_libdirs="$current_libdirs $libdir" ;;
4150
# Note the libdir as a future libdir.
4151
case "$future_libdirs " in
4153
*) future_libdirs="$future_libdirs $libdir" ;;
4157
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4158
test "X$dir" = "X$file/" && dir=
4161
if test -n "$relink_command"; then
4162
$echo "$modename: warning: relinking \`$file'" 1>&2
4163
$show "$relink_command"
4164
if $run eval "$relink_command"; then :
4166
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4171
# See the names of the shared library.
4172
set dummy $library_names
4173
if test -n "$2"; then
4179
test -n "$relink_command" && srcname="$realname"T
4181
# Install the shared library and build the symlinks.
4182
$show "$install_prog $dir/$srcname $destdir/$realname"
4183
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4184
if test -n "$stripme" && test -n "$striplib"; then
4185
$show "$striplib $destdir/$realname"
4186
$run eval "$striplib $destdir/$realname" || exit $?
4189
if test $# -gt 0; then
4190
# Delete the old symlinks, and create new ones.
4193
if test "$linkname" != "$realname"; then
4194
$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4195
$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4200
# Do each command in the postinstall commands.
4201
lib="$destdir/$realname"
4202
eval cmds=\"$postinstall_cmds\"
4203
save_ifs="$IFS"; IFS='~'
4204
for cmd in $cmds; do
4207
$run eval "$cmd" || exit $?
4212
# Install the pseudo-library for information purposes.
4213
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4214
instname="$dir/$name"i
4215
$show "$install_prog $instname $destdir/$name"
4216
$run eval "$install_prog $instname $destdir/$name" || exit $?
4218
# Maybe install the static library, too.
4219
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4223
# Install (i.e. copy) a libtool object.
4225
# Figure out destination file name, if it wasn't already specified.
4226
if test -n "$destname"; then
4227
destfile="$destdir/$destname"
4229
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4230
destfile="$destdir/$destfile"
4233
# Deduce the name of the destination old-style object file.
4236
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4239
staticdest="$destfile"
4243
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4249
# Install the libtool object if requested.
4250
if test -n "$destfile"; then
4251
$show "$install_prog $file $destfile"
4252
$run eval "$install_prog $file $destfile" || exit $?
4255
# Install the old object if enabled.
4256
if test "$build_old_libs" = yes; then
4257
# Deduce the name of the old-style object file.
4258
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4260
$show "$install_prog $staticobj $staticdest"
4261
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
4267
# Figure out destination file name, if it wasn't already specified.
4268
if test -n "$destname"; then
4269
destfile="$destdir/$destname"
4271
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4272
destfile="$destdir/$destfile"
4275
# Do a test to see if this is really a libtool program.
4276
#if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4279
wrapper=`echo $file | sed -e 's,.exe$,,'`
4285
if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4290
# If there is no directory component, then add one.
4292
#*/* | *\\*) . $file ;;
4294
*/* | *\\*) . $wrapper ;;
4298
# Check the variables that should have been set.
4299
if test -z "$notinst_deplibs"; then
4300
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4305
for lib in $notinst_deplibs; do
4306
# Check to see that each library is installed.
4308
if test -f "$lib"; then
4309
# If there is no directory component, then add one.
4311
*/* | *\\*) . $lib ;;
4315
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4316
if test -n "$libdir" && test ! -f "$libfile"; then
4317
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4323
# If there is no directory component, then add one.
4325
#*/* | *\\*) . $file ;;
4327
*/* | *\\*) . $wrapper ;;
4332
if test "$fast_install" = no && test -n "$relink_command"; then
4333
if test "$finalize" = yes && test -z "$run"; then
4335
test -n "$TMPDIR" && tmpdir="$TMPDIR"
4336
tmpdir="$tmpdir/libtool-$$"
4337
if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4339
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4342
file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4343
outputname="$tmpdir/$file"
4344
# Replace the output file specification.
4345
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4347
$show "$relink_command"
4348
if $run eval "$relink_command"; then :
4350
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4356
$echo "$modename: warning: cannot relink \`$file'" 1>&2
4359
# Install the binary that we compiled earlier.
4360
file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4364
# remove .exe since cygwin /usr/bin/install will append another
4366
case $install_prog,$host in
4367
/usr/bin/install*,*cygwin*)
4368
case $file:$destfile in
4373
destfile=$destfile.exe
4376
destfile=`echo $destfile | sed -e 's,.exe$,,'`
4381
$show "$install_prog$stripme $file $destfile"
4382
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4383
test -n "$outputname" && ${rm}r "$tmpdir"
4388
for file in $staticlibs; do
4389
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4391
# Set up the ranlib parameters.
4392
oldlib="$destdir/$name"
4394
$show "$install_prog $file $oldlib"
4395
$run eval "$install_prog \$file \$oldlib" || exit $?
4397
if test -n "$stripme" && test -n "$striplib"; then
4398
$show "$old_striplib $oldlib"
4399
$run eval "$old_striplib $oldlib" || exit $?
4402
# Do each command in the postinstall commands.
4403
eval cmds=\"$old_postinstall_cmds\"
4404
save_ifs="$IFS"; IFS='~'
4405
for cmd in $cmds; do
4408
$run eval "$cmd" || exit $?
4413
if test -n "$future_libdirs"; then
4414
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4417
if test -n "$current_libdirs"; then
4418
# Maybe just do a dry run.
4419
test -n "$run" && current_libdirs=" -n$current_libdirs"
4420
exec_cmd='$SHELL $0 --finish$current_libdirs'
4426
# libtool finish mode
4428
modename="$modename: finish"
4432
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4435
libdirs="$libdirs $dir"
4438
for libdir in $libdirs; do
4439
if test -n "$finish_cmds"; then
4440
# Do each command in the finish commands.
4441
eval cmds=\"$finish_cmds\"
4442
save_ifs="$IFS"; IFS='~'
4443
for cmd in $cmds; do
4446
$run eval "$cmd" || admincmds="$admincmds
4451
if test -n "$finish_eval"; then
4452
# Do the single finish_eval.
4453
eval cmds=\"$finish_eval\"
4454
$run eval "$cmds" || admincmds="$admincmds
4460
# Exit here if they wanted silent mode.
4461
test "$show" = ":" && exit 0
4463
echo "----------------------------------------------------------------------"
4464
echo "Libraries have been installed in:"
4465
for libdir in $libdirs; do
4469
echo "If you ever happen to want to link against installed libraries"
4470
echo "in a given directory, LIBDIR, you must either use libtool, and"
4471
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4472
echo "flag during linking and do at least one of the following:"
4473
if test -n "$shlibpath_var"; then
4474
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4475
echo " during execution"
4477
if test -n "$runpath_var"; then
4478
echo " - add LIBDIR to the \`$runpath_var' environment variable"
4479
echo " during linking"
4481
if test -n "$hardcode_libdir_flag_spec"; then
4483
eval flag=\"$hardcode_libdir_flag_spec\"
4485
echo " - use the \`$flag' linker flag"
4487
if test -n "$admincmds"; then
4488
echo " - have your system administrator run these commands:$admincmds"
4490
if test -f /etc/ld.so.conf; then
4491
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4494
echo "See any operating system documentation about shared libraries for"
4495
echo "more information, such as the ld(1) and ld.so(8) manual pages."
4496
echo "----------------------------------------------------------------------"
4500
# libtool execute mode
4502
modename="$modename: execute"
4504
# The first argument is the command name.
4506
if test -z "$cmd"; then
4507
$echo "$modename: you must specify a COMMAND" 1>&2
4512
# Handle -dlopen flags immediately.
4513
for file in $execute_dlfiles; do
4514
if test ! -f "$file"; then
4515
$echo "$modename: \`$file' is not a file" 1>&2
4523
# Check to see that this really is a libtool archive.
4524
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4526
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4531
# Read the libtool library.
4535
# If there is no directory component, then add one.
4537
*/* | *\\*) . $file ;;
4541
# Skip this library if it cannot be dlopened.
4542
if test -z "$dlname"; then
4543
# Warn if it was a shared library.
4544
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4548
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4549
test "X$dir" = "X$file" && dir=.
4551
if test -f "$dir/$objdir/$dlname"; then
4554
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4560
# Just add the directory containing the .lo file.
4561
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4562
test "X$dir" = "X$file" && dir=.
4566
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4571
# Get the absolute pathname.
4572
absdir=`cd "$dir" && pwd`
4573
test -n "$absdir" && dir="$absdir"
4575
# Now add the directory to shlibpath_var.
4576
if eval "test -z \"\$$shlibpath_var\""; then
4577
eval "$shlibpath_var=\"\$dir\""
4579
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4583
# This variable tells wrapper scripts just to set shlibpath_var
4584
# rather than running their programs.
4585
libtool_execute_magic="$magic"
4587
# Check if any of the arguments is a wrapper script.
4594
# Do a test to see if this is really a libtool program.
4595
if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4596
# If there is no directory component, then add one.
4598
*/* | *\\*) . $file ;;
4602
# Transform arg to wrapped name.
4603
file="$progdir/$program"
4607
# Quote arguments (to preserve shell metacharacters).
4608
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4609
args="$args \"$file\""
4612
if test -z "$run"; then
4613
if test -n "$shlibpath_var"; then
4614
# Export the shlibpath_var.
4615
eval "export $shlibpath_var"
4618
# Restore saved enviroment variables
4619
if test "${save_LC_ALL+set}" = set; then
4620
LC_ALL="$save_LC_ALL"; export LC_ALL
4622
if test "${save_LANG+set}" = set; then
4623
LANG="$save_LANG"; export LANG
4626
# Now prepare to actually exec the command.
4627
exec_cmd='"$cmd"$args'
4629
# Display what would be done.
4630
if test -n "$shlibpath_var"; then
4631
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4632
$echo "export $shlibpath_var"
4639
# libtool clean and uninstall mode
4641
modename="$modename: $mode"
4647
# This variable tells wrapper scripts just to set variables rather
4648
# than running their programs.
4649
libtool_install_magic="$magic"
4654
-f) rm="$rm $arg"; rmforce=yes ;;
4655
-*) rm="$rm $arg" ;;
4656
*) files="$files $arg" ;;
4660
if test -z "$rm"; then
4661
$echo "$modename: you must specify an RM program" 1>&2
4668
for file in $files; do
4669
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4670
if test "X$dir" = "X$file"; then
4674
objdir="$dir/$objdir"
4676
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4677
test $mode = uninstall && objdir="$dir"
4679
# Remember objdir for removal later, being careful to avoid duplicates
4680
if test $mode = clean; then
4683
*) rmdirs="$rmdirs $objdir" ;;
4687
# Don't error if the file doesn't exist and rm -f was used.
4688
if (test -L "$file") >/dev/null 2>&1 \
4689
|| (test -h "$file") >/dev/null 2>&1 \
4690
|| test -f "$file"; then
4692
elif test -d "$file"; then
4695
elif test "$rmforce" = yes; then
4703
# Possibly a libtool archive, so verify it.
4704
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4707
# Delete the libtool libraries and symlinks.
4708
for n in $library_names; do
4709
rmfiles="$rmfiles $objdir/$n"
4711
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4712
test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4714
if test $mode = uninstall; then
4715
if test -n "$library_names"; then
4716
# Do each command in the postuninstall commands.
4717
eval cmds=\"$postuninstall_cmds\"
4718
save_ifs="$IFS"; IFS='~'
4719
for cmd in $cmds; do
4723
if test $? != 0 && test "$rmforce" != yes; then
4730
if test -n "$old_library"; then
4731
# Do each command in the old_postuninstall commands.
4732
eval cmds=\"$old_postuninstall_cmds\"
4733
save_ifs="$IFS"; IFS='~'
4734
for cmd in $cmds; do
4738
if test $? != 0 && test "$rmforce" != yes; then
4744
# FIXME: should reinstall the best remaining shared library.
4750
if test "$build_old_libs" = yes; then
4751
oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4752
rmfiles="$rmfiles $dir/$oldobj"
4757
# Do a test to see if this is a libtool program.
4758
if test $mode = clean &&
4759
(sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4763
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4764
if test "$fast_install" = yes && test -n "$relink_command"; then
4765
rmfiles="$rmfiles $objdir/lt-$name"
4770
$show "$rm $rmfiles"
4771
$run $rm $rmfiles || exit_status=1
4774
# Try to remove the ${objdir}s in the directories where we deleted files
4775
for dir in $rmdirs; do
4776
if test -d "$dir"; then
4778
$run rmdir $dir >/dev/null 2>&1
4786
$echo "$modename: you must specify a MODE" 1>&2
4787
$echo "$generic_help" 1>&2
4792
if test -z "$exec_cmd"; then
4793
$echo "$modename: invalid operation mode \`$mode'" 1>&2
4794
$echo "$generic_help" 1>&2
4797
fi # test -z "$show_help"
4799
if test -n "$exec_cmd"; then
4804
# We need to display help for each of the modes.
4807
"Usage: $modename [OPTION]... [MODE-ARG]...
4809
Provide generalized library-building support services.
4811
--config show all configuration variables
4812
--debug enable verbose shell tracing
4813
-n, --dry-run display commands without modifying any files
4814
--features display basic configuration information and exit
4815
--finish same as \`--mode=finish'
4816
--help display this help message and exit
4817
--mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4818
--quiet same as \`--silent'
4819
--silent don't print informational messages
4820
--version print version information
4822
MODE must be one of the following:
4824
clean remove files from the build directory
4825
compile compile a source file into a libtool object
4826
execute automatically set library path, then run a program
4827
finish complete the installation of libtool libraries
4828
install install libraries or executables
4829
link create a library or an executable
4830
uninstall remove libraries from an installed directory
4832
MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4833
a more detailed description of MODE."
4839
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4841
Remove files from the build directory.
4843
RM is the name of the program to use to delete files associated with each FILE
4844
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4847
If FILE is a libtool library, object or program, all the files associated
4848
with it are deleted. Otherwise, only FILE itself is deleted using RM."
4853
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4855
Compile a source file into a libtool library object.
4857
This mode accepts the following additional options:
4859
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
4860
-prefer-pic try to building PIC objects only
4861
-prefer-non-pic try to building non-PIC objects only
4862
-static always build a \`.o' file suitable for static linking
4864
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4865
from the given SOURCEFILE.
4867
The output file name is determined by removing the directory component from
4868
SOURCEFILE, then substituting the C source code suffix \`.c' with the
4869
library object suffix, \`.lo'."
4874
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4876
Automatically set library path, then run a program.
4878
This mode accepts the following additional options:
4880
-dlopen FILE add the directory containing FILE to the library path
4882
This mode sets the library path environment variable according to \`-dlopen'
4885
If any of the ARGS are libtool executable wrappers, then they are translated
4886
into their corresponding uninstalled binary, and any of their required library
4887
directories are added to the library path.
4889
Then, COMMAND is executed, with ARGS as arguments."
4894
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4896
Complete the installation of libtool libraries.
4898
Each LIBDIR is a directory that contains libtool libraries.
4900
The commands that this mode executes may require superuser privileges. Use
4901
the \`--dry-run' option if you just want to see what would be executed."
4906
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4908
Install executables or libraries.
4910
INSTALL-COMMAND is the installation command. The first component should be
4911
either the \`install' or \`cp' program.
4913
The rest of the components are interpreted as arguments to that command (only
4914
BSD-compatible install options are recognized)."
4919
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4921
Link object files or libraries together to form another library, or to
4922
create an executable program.
4924
LINK-COMMAND is a command using the C compiler that you would use to create
4925
a program from several object files.
4927
The following components of LINK-COMMAND are treated specially:
4929
-all-static do not do any dynamic linking at all
4930
-avoid-version do not add a version suffix if possible
4931
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4932
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4933
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4934
-export-symbols SYMFILE
4935
try to export only the symbols listed in SYMFILE
4936
-export-symbols-regex REGEX
4937
try to export only the symbols matching REGEX
4938
-LLIBDIR search LIBDIR for required installed libraries
4939
-lNAME OUTPUT-FILE requires the installed library libNAME
4940
-module build a library that can dlopened
4941
-no-fast-install disable the fast-install mode
4942
-no-install link a not-installable executable
4943
-no-undefined declare that a library does not refer to external symbols
4944
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4945
-release RELEASE specify package release information
4946
-rpath LIBDIR the created library will eventually be installed in LIBDIR
4947
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4948
-static do not do any dynamic linking of libtool libraries
4949
-version-info CURRENT[:REVISION[:AGE]]
4950
specify library version info [each variable defaults to 0]
4952
All other options (arguments beginning with \`-') are ignored.
4954
Every other argument is treated as a filename. Files ending in \`.la' are
4955
treated as uninstalled libtool libraries, other files are standard or library
4958
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4959
only library objects (\`.lo' files) may be specified, and \`-rpath' is
4960
required, except when creating a convenience library.
4962
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4963
using \`ar' and \`ranlib', or on Windows using \`lib'.
4965
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4966
is created, otherwise an executable program is created."
4971
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4973
Remove libraries from an installation directory.
4975
RM is the name of the program to use to delete files associated with each FILE
4976
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4979
If FILE is a libtool library, all the files associated with it are deleted.
4980
Otherwise, only FILE itself is deleted using RM."
4984
$echo "$modename: invalid operation mode \`$mode'" 1>&2
4991
$echo "Try \`$modename --help' for more information about other modes."