1130803Smarcel# ltmain.sh - Provide generalized library-building support services. 2130803Smarcel# NOTE: Changing this file will not affect anything until you rerun ltconfig. 3130803Smarcel# 4130803Smarcel# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 5130803Smarcel# Free Software Foundation, Inc. 6130803Smarcel# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7130803Smarcel# 8130803Smarcel# This program is free software; you can redistribute it and/or modify 9130803Smarcel# it under the terms of the GNU General Public License as published by 10130803Smarcel# the Free Software Foundation; either version 2 of the License, or 11130803Smarcel# (at your option) any later version. 12130803Smarcel# 13130803Smarcel# This program is distributed in the hope that it will be useful, but 14130803Smarcel# WITHOUT ANY WARRANTY; without even the implied warranty of 15130803Smarcel# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16130803Smarcel# General Public License for more details. 17130803Smarcel# 18130803Smarcel# You should have received a copy of the GNU General Public License 19130803Smarcel# along with this program; if not, write to the Free Software 20130803Smarcel# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21130803Smarcel# 22130803Smarcel# As a special exception to the GNU General Public License, if you 23130803Smarcel# distribute this file as part of a program that contains a 24130803Smarcel# configuration script generated by Autoconf, you may include it under 25130803Smarcel# the same distribution terms that you use for the rest of that program. 26130803Smarcel 27130803Smarcel# Check that we have a working $echo. 28130803Smarcelif test "X$1" = X--no-reexec; then 29130803Smarcel # Discard the --no-reexec flag, and continue. 30130803Smarcel shift 31130803Smarcelelif test "X$1" = X--fallback-echo; then 32130803Smarcel # Avoid inline document here, it may be left over 33130803Smarcel : 34130803Smarcelelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 35130803Smarcel # Yippee, $echo works! 36130803Smarcel : 37130803Smarcelelse 38130803Smarcel # Restart under the correct shell, and then maybe $echo will work. 39130803Smarcel exec $SHELL "$0" --no-reexec ${1+"$@"} 40130803Smarcelfi 41130803Smarcel 42130803Smarcelif test "X$1" = X--fallback-echo; then 43130803Smarcel # used as fallback echo 44130803Smarcel shift 45130803Smarcel cat <<EOF 46130803Smarcel$* 47130803SmarcelEOF 48130803Smarcel exit 0 49130803Smarcelfi 50130803Smarcel 51130803Smarcel# The name of this program. 52130803Smarcelprogname=`$echo "$0" | sed 's%^.*/%%'` 53130803Smarcelmodename="$progname" 54130803Smarcel 55130803Smarcel# Constants. 56130803SmarcelPROGRAM=ltmain.sh 57130803SmarcelPACKAGE=libtool 58130803SmarcelVERSION=1.4a-GCC3.0 59130803SmarcelTIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)" 60130803Smarcel 61130803Smarceldefault_mode= 62130803Smarcelhelp="Try \`$progname --help' for more information." 63130803Smarcelmagic="%%%MAGIC variable%%%" 64130803Smarcelmkdir="mkdir" 65130803Smarcelmv="mv -f" 66130803Smarcelrm="rm -f" 67130803Smarcel 68130803Smarcel# Sed substitution that helps us do robust quoting. It backslashifies 69130803Smarcel# metacharacters that are still active within double-quoted strings. 70130803SmarcelXsed='sed -e 1s/^X//' 71130803Smarcelsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 72130803SmarcelSP2NL='tr \040 \012' 73130803SmarcelNL2SP='tr \015\012 \040\040' 74130803Smarcel 75130803Smarcel# NLS nuisances. 76130803Smarcel# Only set LANG and LC_ALL to C if already set. 77130803Smarcel# These must not be set unconditionally because not all systems understand 78130803Smarcel# e.g. LANG=C (notably SCO). 79130803Smarcel# We save the old values to restore during execute mode. 80130803Smarcelif test "${LC_ALL+set}" = set; then 81130803Smarcel save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 82130803Smarcelfi 83130803Smarcelif test "${LANG+set}" = set; then 84130803Smarcel save_LANG="$LANG"; LANG=C; export LANG 85130803Smarcelfi 86130803Smarcel 87130803Smarcelif test "$LTCONFIG_VERSION" != "$VERSION"; then 88130803Smarcel echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 89130803Smarcel echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 90130803Smarcel exit 1 91130803Smarcelfi 92130803Smarcel 93130803Smarcelif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 94130803Smarcel echo "$modename: not configured to build any kind of library" 1>&2 95130803Smarcel echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 96130803Smarcel exit 1 97130803Smarcelfi 98130803Smarcel 99130803Smarcel# Global variables. 100130803Smarcelmode=$default_mode 101130803Smarcelnonopt= 102130803Smarcelprev= 103130803Smarcelprevopt= 104130803Smarcelrun= 105130803Smarcelshow="$echo" 106130803Smarcelshow_help= 107130803Smarcelexecute_dlfiles= 108130803Smarcello2o="s/\\.lo\$/.${objext}/" 109130803Smarcelo2lo="s/\\.${objext}\$/.lo/" 110130803Smarceltaglist= 111130803Smarcel 112130803Smarcel# Parse our command line options once, thoroughly. 113130803Smarcelwhile test $# -gt 0 114130803Smarceldo 115130803Smarcel arg="$1" 116130803Smarcel shift 117130803Smarcel 118130803Smarcel case $arg in 119130803Smarcel -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 120130803Smarcel *) optarg= ;; 121130803Smarcel esac 122130803Smarcel 123130803Smarcel # If the previous option needs an argument, assign it. 124130803Smarcel if test -n "$prev"; then 125130803Smarcel case $prev in 126130803Smarcel execute_dlfiles) 127130803Smarcel execute_dlfiles="$execute_dlfiles $arg" 128130803Smarcel ;; 129130803Smarcel tag) 130130803Smarcel tagname="$arg" 131130803Smarcel 132130803Smarcel # Check whether tagname contains only valid characters 133130803Smarcel case $tagname in 134130803Smarcel *[!-_A-Za-z0-9,/]*) 135130803Smarcel echo "$progname: invalid tag name: $tagname" 1>&2 136130803Smarcel exit 1 137130803Smarcel ;; 138130803Smarcel esac 139130803Smarcel 140130803Smarcel case $tagname in 141130803Smarcel CC) 142130803Smarcel # Don't test for the "default" C tag, as we know, it's there, but 143130803Smarcel # not specially marked. 144130803Smarcel taglist="$taglist $tagname" 145130803Smarcel ;; 146130803Smarcel *) 147130803Smarcel if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then 148130803Smarcel taglist="$taglist $tagname" 149130803Smarcel # Evaluate the configuration. 150130803Smarcel eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" 151130803Smarcel else 152130803Smarcel echo "$progname: ignoring unknown tag $tagname" 1>&2 153130803Smarcel fi 154130803Smarcel ;; 155130803Smarcel esac 156130803Smarcel ;; 157130803Smarcel *) 158130803Smarcel eval "$prev=\$arg" 159130803Smarcel ;; 160130803Smarcel esac 161130803Smarcel 162130803Smarcel prev= 163130803Smarcel prevopt= 164130803Smarcel continue 165130803Smarcel fi 166130803Smarcel 167130803Smarcel # Have we seen a non-optional argument yet? 168130803Smarcel case $arg in 169130803Smarcel --help) 170130803Smarcel show_help=yes 171130803Smarcel ;; 172130803Smarcel 173130803Smarcel --version) 174130803Smarcel echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 175130803Smarcel exit 0 176130803Smarcel ;; 177130803Smarcel 178130803Smarcel --config) 179130803Smarcel sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0" 180130803Smarcel # Now print the configurations for the tags. 181130803Smarcel for tagname in $taglist; do 182130803Smarcel sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" 183130803Smarcel done 184130803Smarcel exit 0 185130803Smarcel ;; 186130803Smarcel 187130803Smarcel --debug) 188130803Smarcel echo "$progname: enabling shell trace mode" 189130803Smarcel set -x 190130803Smarcel ;; 191130803Smarcel 192130803Smarcel --dry-run | -n) 193130803Smarcel run=: 194130803Smarcel ;; 195130803Smarcel 196130803Smarcel --features) 197130803Smarcel echo "host: $host" 198130803Smarcel if test "$build_libtool_libs" = yes; then 199130803Smarcel echo "enable shared libraries" 200130803Smarcel else 201130803Smarcel echo "disable shared libraries" 202130803Smarcel fi 203130803Smarcel if test "$build_old_libs" = yes; then 204130803Smarcel echo "enable static libraries" 205130803Smarcel else 206130803Smarcel echo "disable static libraries" 207130803Smarcel fi 208130803Smarcel exit 0 209130803Smarcel ;; 210130803Smarcel 211130803Smarcel --finish) mode="finish" ;; 212130803Smarcel 213130803Smarcel --mode) prevopt="--mode" prev=mode ;; 214130803Smarcel --mode=*) mode="$optarg" ;; 215130803Smarcel 216130803Smarcel --quiet | --silent) 217130803Smarcel show=: 218130803Smarcel ;; 219130803Smarcel 220130803Smarcel --tag) prevopt="--tag" prev=tag ;; 221130803Smarcel --tag=*) 222130803Smarcel set tag "$optarg" ${1+"$@"} 223130803Smarcel shift 224130803Smarcel prev=tag 225130803Smarcel ;; 226130803Smarcel 227130803Smarcel -dlopen) 228130803Smarcel prevopt="-dlopen" 229130803Smarcel prev=execute_dlfiles 230130803Smarcel ;; 231130803Smarcel 232130803Smarcel -*) 233130803Smarcel $echo "$modename: unrecognized option \`$arg'" 1>&2 234130803Smarcel $echo "$help" 1>&2 235130803Smarcel exit 1 236130803Smarcel ;; 237130803Smarcel 238130803Smarcel *) 239130803Smarcel nonopt="$arg" 240130803Smarcel break 241130803Smarcel ;; 242130803Smarcel esac 243130803Smarceldone 244130803Smarcel 245130803Smarcelif test -n "$prevopt"; then 246130803Smarcel $echo "$modename: option \`$prevopt' requires an argument" 1>&2 247130803Smarcel $echo "$help" 1>&2 248130803Smarcel exit 1 249130803Smarcelfi 250130803Smarcel 251130803Smarcel# If this variable is set in any of the actions, the command in it 252130803Smarcel# will be execed at the end. This prevents here-documents from being 253130803Smarcel# left over by shells. 254130803Smarcelexec_cmd= 255130803Smarcel 256130803Smarcelif test -z "$show_help"; then 257130803Smarcel 258130803Smarcel # Infer the operation mode. 259130803Smarcel if test -z "$mode"; then 260130803Smarcel case $nonopt in 261130803Smarcel *cc | *++ | gcc* | *-gcc*) 262130803Smarcel mode=link 263130803Smarcel for arg 264130803Smarcel do 265130803Smarcel case $arg in 266130803Smarcel -c) 267130803Smarcel mode=compile 268130803Smarcel break 269130803Smarcel ;; 270130803Smarcel esac 271130803Smarcel done 272130803Smarcel ;; 273130803Smarcel *db | *dbx | *strace | *truss) 274130803Smarcel mode=execute 275130803Smarcel ;; 276130803Smarcel *install*|cp|mv) 277130803Smarcel mode=install 278130803Smarcel ;; 279130803Smarcel *rm) 280130803Smarcel mode=uninstall 281130803Smarcel ;; 282130803Smarcel *) 283130803Smarcel # If we have no mode, but dlfiles were specified, then do execute mode. 284130803Smarcel test -n "$execute_dlfiles" && mode=execute 285130803Smarcel 286130803Smarcel # Just use the default operation mode. 287130803Smarcel if test -z "$mode"; then 288130803Smarcel if test -n "$nonopt"; then 289130803Smarcel $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 290130803Smarcel else 291130803Smarcel $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 292130803Smarcel fi 293130803Smarcel fi 294130803Smarcel ;; 295130803Smarcel esac 296130803Smarcel fi 297130803Smarcel 298130803Smarcel # Only execute mode is allowed to have -dlopen flags. 299130803Smarcel if test -n "$execute_dlfiles" && test "$mode" != execute; then 300130803Smarcel $echo "$modename: unrecognized option \`-dlopen'" 1>&2 301130803Smarcel $echo "$help" 1>&2 302130803Smarcel exit 1 303130803Smarcel fi 304130803Smarcel 305130803Smarcel # Change the help message to a mode-specific one. 306130803Smarcel generic_help="$help" 307130803Smarcel help="Try \`$modename --help --mode=$mode' for more information." 308130803Smarcel 309130803Smarcel # These modes are in order of execution frequency so that they run quickly. 310130803Smarcel case $mode in 311130803Smarcel # libtool compile mode 312130803Smarcel compile) 313130803Smarcel modename="$modename: compile" 314130803Smarcel # Get the compilation command and the source file. 315130803Smarcel base_compile= 316130803Smarcel prev= 317130803Smarcel lastarg= 318130803Smarcel srcfile="$nonopt" 319130803Smarcel suppress_output= 320130803Smarcel 321130803Smarcel user_target=no 322130803Smarcel for arg 323130803Smarcel do 324130803Smarcel case $prev in 325130803Smarcel "") ;; 326130803Smarcel xcompiler) 327130803Smarcel # Aesthetically quote the previous argument. 328130803Smarcel prev= 329130803Smarcel lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 330130803Smarcel 331130803Smarcel case $arg in 332130803Smarcel # Double-quote args containing other shell metacharacters. 333130803Smarcel # Many Bourne shells cannot handle close brackets correctly 334130803Smarcel # in scan sets, so we specify it separately. 335130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 336130803Smarcel arg="\"$arg\"" 337130803Smarcel ;; 338130803Smarcel esac 339130803Smarcel 340130803Smarcel # Add the previous argument to base_compile. 341130803Smarcel if test -z "$base_compile"; then 342130803Smarcel base_compile="$lastarg" 343130803Smarcel else 344130803Smarcel base_compile="$base_compile $lastarg" 345130803Smarcel fi 346130803Smarcel continue 347130803Smarcel ;; 348130803Smarcel esac 349130803Smarcel 350130803Smarcel # Accept any command-line options. 351130803Smarcel case $arg in 352130803Smarcel -o) 353130803Smarcel if test "$user_target" != "no"; then 354130803Smarcel $echo "$modename: you cannot specify \`-o' more than once" 1>&2 355130803Smarcel exit 1 356130803Smarcel fi 357130803Smarcel user_target=next 358130803Smarcel ;; 359130803Smarcel 360130803Smarcel -static) 361130803Smarcel build_old_libs=yes 362130803Smarcel continue 363130803Smarcel ;; 364130803Smarcel 365130803Smarcel -prefer-pic) 366130803Smarcel pic_mode=yes 367130803Smarcel continue 368130803Smarcel ;; 369130803Smarcel 370130803Smarcel -prefer-non-pic) 371130803Smarcel pic_mode=no 372130803Smarcel continue 373130803Smarcel ;; 374130803Smarcel 375130803Smarcel -Xcompiler) 376130803Smarcel prev=xcompiler 377130803Smarcel continue 378130803Smarcel ;; 379130803Smarcel 380130803Smarcel -Wc,*) 381130803Smarcel args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 382130803Smarcel lastarg= 383130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 384130803Smarcel for arg in $args; do 385130803Smarcel IFS="$save_ifs" 386130803Smarcel 387130803Smarcel # Double-quote args containing other shell metacharacters. 388130803Smarcel # Many Bourne shells cannot handle close brackets correctly 389130803Smarcel # in scan sets, so we specify it separately. 390130803Smarcel case $arg in 391130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 392130803Smarcel arg="\"$arg\"" 393130803Smarcel ;; 394130803Smarcel esac 395130803Smarcel lastarg="$lastarg $arg" 396130803Smarcel done 397130803Smarcel IFS="$save_ifs" 398130803Smarcel lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 399130803Smarcel 400130803Smarcel # Add the arguments to base_compile. 401130803Smarcel if test -z "$base_compile"; then 402130803Smarcel base_compile="$lastarg" 403130803Smarcel else 404130803Smarcel base_compile="$base_compile $lastarg" 405130803Smarcel fi 406130803Smarcel continue 407130803Smarcel ;; 408130803Smarcel esac 409130803Smarcel 410130803Smarcel case $user_target in 411130803Smarcel next) 412130803Smarcel # The next one is the -o target name 413130803Smarcel user_target=yes 414130803Smarcel continue 415130803Smarcel ;; 416130803Smarcel yes) 417130803Smarcel # We got the output file 418130803Smarcel user_target=set 419130803Smarcel libobj="$arg" 420130803Smarcel continue 421130803Smarcel ;; 422130803Smarcel esac 423130803Smarcel 424130803Smarcel # Accept the current argument as the source file. 425130803Smarcel lastarg="$srcfile" 426130803Smarcel srcfile="$arg" 427130803Smarcel 428130803Smarcel # Aesthetically quote the previous argument. 429130803Smarcel 430130803Smarcel # Backslashify any backslashes, double quotes, and dollar signs. 431130803Smarcel # These are the only characters that are still specially 432130803Smarcel # interpreted inside of double-quoted scrings. 433130803Smarcel lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 434130803Smarcel 435130803Smarcel # Double-quote args containing other shell metacharacters. 436130803Smarcel # Many Bourne shells cannot handle close brackets correctly 437130803Smarcel # in scan sets, so we specify it separately. 438130803Smarcel case $lastarg in 439130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 440130803Smarcel lastarg="\"$lastarg\"" 441130803Smarcel ;; 442130803Smarcel esac 443130803Smarcel 444130803Smarcel # Add the previous argument to base_compile. 445130803Smarcel if test -z "$base_compile"; then 446130803Smarcel base_compile="$lastarg" 447130803Smarcel else 448130803Smarcel base_compile="$base_compile $lastarg" 449130803Smarcel fi 450130803Smarcel done 451130803Smarcel 452130803Smarcel case $user_target in 453130803Smarcel set) 454130803Smarcel ;; 455130803Smarcel no) 456130803Smarcel # Get the name of the library object. 457130803Smarcel libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 458130803Smarcel ;; 459130803Smarcel *) 460130803Smarcel $echo "$modename: you must specify a target with \`-o'" 1>&2 461130803Smarcel exit 1 462130803Smarcel ;; 463130803Smarcel esac 464130803Smarcel 465130803Smarcel # Recognize several different file suffixes. 466130803Smarcel # If the user specifies -o file.o, it is replaced with file.lo 467130803Smarcel xform='[cCFSfmso]' 468130803Smarcel case $libobj in 469130803Smarcel *.ada) xform=ada ;; 470130803Smarcel *.adb) xform=adb ;; 471130803Smarcel *.ads) xform=ads ;; 472130803Smarcel *.asm) xform=asm ;; 473130803Smarcel *.c++) xform=c++ ;; 474130803Smarcel *.cc) xform=cc ;; 475130803Smarcel *.class) xform=class ;; 476130803Smarcel *.cpp) xform=cpp ;; 477130803Smarcel *.cxx) xform=cxx ;; 478130803Smarcel *.f90) xform=f90 ;; 479130803Smarcel *.for) xform=for ;; 480130803Smarcel *.java) xform=java ;; 481130803Smarcel esac 482130803Smarcel 483130803Smarcel libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 484130803Smarcel 485130803Smarcel case $libobj in 486130803Smarcel *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 487130803Smarcel *) 488130803Smarcel $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 489130803Smarcel exit 1 490130803Smarcel ;; 491130803Smarcel esac 492130803Smarcel 493130803Smarcel # Infer tagged configuration to use if any are available and 494130803Smarcel # if one wasn't chosen via the "--tag" command line option. 495130803Smarcel # Only attempt this if the compiler in the base compile 496130803Smarcel # command doesn't match the default compiler. 497130803Smarcel if test -n "$available_tags" && test -z "$tagname"; then 498130803Smarcel case $base_compile in 499130803Smarcel "$CC "*) ;; 500130803Smarcel # Blanks in the command may have been stripped by the calling shell, 501130803Smarcel # but not from the CC environment variable when ltconfig was run. 502130803Smarcel "`$echo $CC` "*) ;; 503130803Smarcel *) 504130803Smarcel for z in $available_tags; do 505130803Smarcel if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then 506130803Smarcel # Evaluate the configuration. 507130803Smarcel eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" 508130803Smarcel case $base_compile in 509130803Smarcel "$CC "*) 510130803Smarcel # The compiler in the base compile command matches 511130803Smarcel # the one in the tagged configuration. 512130803Smarcel # Assume this is the tagged configuration we want. 513130803Smarcel tagname=$z 514130803Smarcel break 515130803Smarcel ;; 516130803Smarcel "`$echo $CC` "*) 517130803Smarcel tagname=$z 518130803Smarcel break 519130803Smarcel ;; 520130803Smarcel esac 521130803Smarcel fi 522130803Smarcel done 523130803Smarcel # If $tagname still isn't set, then no tagged configuration 524130803Smarcel # was found and let the user know that the "--tag" command 525130803Smarcel # line option must be used. 526130803Smarcel if test -z "$tagname"; then 527130803Smarcel echo "$modename: unable to infer tagged configuration" 528130803Smarcel echo "$modename: specify a tag with \`--tag'" 1>&2 529130803Smarcel exit 1 530130803Smarcel# else 531130803Smarcel# echo "$modename: using $tagname tagged configuration" 532130803Smarcel fi 533130803Smarcel ;; 534130803Smarcel esac 535130803Smarcel fi 536130803Smarcel 537130803Smarcel objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 538130803Smarcel xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 539130803Smarcel if test "X$xdir" = "X$obj"; then 540130803Smarcel xdir= 541130803Smarcel else 542130803Smarcel xdir=$xdir/ 543130803Smarcel fi 544130803Smarcel lobj=${xdir}$objdir/$objname 545130803Smarcel 546130803Smarcel if test -z "$base_compile"; then 547130803Smarcel $echo "$modename: you must specify a compilation command" 1>&2 548130803Smarcel $echo "$help" 1>&2 549130803Smarcel exit 1 550130803Smarcel fi 551130803Smarcel 552130803Smarcel # Delete any leftover library objects. 553130803Smarcel if test "$build_old_libs" = yes; then 554130803Smarcel removelist="$obj $lobj $libobj ${libobj}T" 555130803Smarcel else 556130803Smarcel removelist="$lobj $libobj ${libobj}T" 557130803Smarcel fi 558130803Smarcel 559130803Smarcel $run $rm $removelist 560130803Smarcel trap "$run $rm $removelist; exit 1" 1 2 15 561130803Smarcel 562130803Smarcel # On Cygwin there's no "real" PIC flag so we must build both object types 563130803Smarcel case $host_os in 564130803Smarcel cygwin* | mingw* | pw32* | os2*) 565130803Smarcel pic_mode=default 566130803Smarcel ;; 567130803Smarcel esac 568130803Smarcel if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then 569130803Smarcel # non-PIC code in shared libraries is not supported 570130803Smarcel pic_mode=default 571130803Smarcel fi 572130803Smarcel 573130803Smarcel # Calculate the filename of the output object if compiler does 574130803Smarcel # not support -o with -c 575130803Smarcel if test "$compiler_c_o" = no; then 576130803Smarcel output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 577130803Smarcel lockfile="$output_obj.lock" 578130803Smarcel removelist="$removelist $output_obj $lockfile" 579130803Smarcel trap "$run $rm $removelist; exit 1" 1 2 15 580130803Smarcel else 581130803Smarcel output_obj= 582130803Smarcel need_locks=no 583130803Smarcel lockfile= 584130803Smarcel fi 585130803Smarcel 586130803Smarcel # Lock this critical section if it is needed 587130803Smarcel # We use this script file to make the link, it avoids creating a new file 588130803Smarcel if test "$need_locks" = yes; then 589130803Smarcel until $run ln "$0" "$lockfile" 2>/dev/null; do 590130803Smarcel $show "Waiting for $lockfile to be removed" 591130803Smarcel sleep 2 592130803Smarcel done 593130803Smarcel elif test "$need_locks" = warn; then 594130803Smarcel if test -f "$lockfile"; then 595130803Smarcel echo "\ 596130803Smarcel*** ERROR, $lockfile exists and contains: 597130803Smarcel`cat $lockfile 2>/dev/null` 598130803Smarcel 599130803SmarcelThis indicates that another process is trying to use the same 600130803Smarceltemporary object file, and libtool could not work around it because 601130803Smarcelyour compiler does not support \`-c' and \`-o' together. If you 602130803Smarcelrepeat this compilation, it may succeed, by chance, but you had better 603130803Smarcelavoid parallel builds (make -j) in this platform, or get a better 604130803Smarcelcompiler." 605130803Smarcel 606130803Smarcel $run $rm $removelist 607130803Smarcel exit 1 608130803Smarcel fi 609130803Smarcel echo $srcfile > "$lockfile" 610130803Smarcel fi 611130803Smarcel 612130803Smarcel if test -n "$fix_srcfile_path"; then 613130803Smarcel eval srcfile=\"$fix_srcfile_path\" 614130803Smarcel fi 615130803Smarcel 616130803Smarcel $run $rm "$libobj" "${libobj}T" 617130803Smarcel 618130803Smarcel # Create a libtool object file (analogous to a ".la" file), 619130803Smarcel # but don't create it if we're doing a dry run. 620130803Smarcel test -z "$run" && cat > ${libobj}T <<EOF 621130803Smarcel# $libobj - a libtool object file 622130803Smarcel# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 623130803Smarcel# 624130803Smarcel# Please DO NOT delete this file! 625130803Smarcel# It is necessary for linking the library. 626130803Smarcel 627130803Smarcel# Name of the PIC object. 628130803SmarcelEOF 629130803Smarcel 630130803Smarcel # Only build a PIC object if we are building libtool libraries. 631130803Smarcel if test "$build_libtool_libs" = yes; then 632130803Smarcel # Without this assignment, base_compile gets emptied. 633130803Smarcel fbsd_hideous_sh_bug=$base_compile 634130803Smarcel 635130803Smarcel if test "$pic_mode" != no; then 636130803Smarcel command="$base_compile $srcfile $pic_flag" 637130803Smarcel else 638130803Smarcel # Don't build PIC code 639130803Smarcel command="$base_compile $srcfile" 640130803Smarcel fi 641130803Smarcel 642130803Smarcel if test ! -d ${xdir}$objdir; then 643130803Smarcel $show "$mkdir ${xdir}$objdir" 644130803Smarcel $run $mkdir ${xdir}$objdir 645130803Smarcel status=$? 646130803Smarcel if test $status -ne 0 && test ! -d ${xdir}$objdir; then 647130803Smarcel exit $status 648130803Smarcel fi 649130803Smarcel fi 650130803Smarcel 651130803Smarcel if test -z "$output_obj"; then 652130803Smarcel # Place PIC objects in $objdir 653130803Smarcel command="$command -o $lobj" 654130803Smarcel fi 655130803Smarcel 656130803Smarcel $run $rm "$lobj" "$output_obj" 657130803Smarcel 658130803Smarcel $show "$command" 659130803Smarcel if $run eval "$command"; then : 660130803Smarcel else 661130803Smarcel test -n "$output_obj" && $run $rm $removelist 662130803Smarcel exit 1 663130803Smarcel fi 664130803Smarcel 665130803Smarcel if test "$need_locks" = warn && 666130803Smarcel test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then 667130803Smarcel echo "\ 668130803Smarcel*** ERROR, $lockfile contains: 669130803Smarcel`cat $lockfile 2>/dev/null` 670130803Smarcel 671130803Smarcelbut it should contain: 672130803Smarcel$srcfile 673130803Smarcel 674130803SmarcelThis indicates that another process is trying to use the same 675130803Smarceltemporary object file, and libtool could not work around it because 676130803Smarcelyour compiler does not support \`-c' and \`-o' together. If you 677130803Smarcelrepeat this compilation, it may succeed, by chance, but you had better 678130803Smarcelavoid parallel builds (make -j) in this platform, or get a better 679130803Smarcelcompiler." 680130803Smarcel 681130803Smarcel $run $rm $removelist 682130803Smarcel exit 1 683130803Smarcel fi 684130803Smarcel 685130803Smarcel # Just move the object if needed, then go on to compile the next one 686130803Smarcel if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then 687130803Smarcel $show "$mv $output_obj $lobj" 688130803Smarcel if $run $mv $output_obj $lobj; then : 689130803Smarcel else 690130803Smarcel error=$? 691130803Smarcel $run $rm $removelist 692130803Smarcel exit $error 693130803Smarcel fi 694130803Smarcel fi 695130803Smarcel 696130803Smarcel # Append the name of the PIC object to the libtool object file. 697130803Smarcel test -z "$run" && cat >> ${libobj}T <<EOF 698130803Smarcelpic_object='$objdir/$objname' 699130803Smarcel 700130803SmarcelEOF 701130803Smarcel 702130803Smarcel # Allow error messages only from the first compilation. 703130803Smarcel suppress_output=' >/dev/null 2>&1' 704130803Smarcel else 705130803Smarcel # No PIC object so indicate it doesn't exist in the libtool 706130803Smarcel # object file. 707130803Smarcel test -z "$run" && cat >> ${libobj}T <<EOF 708130803Smarcelpic_object=none 709130803Smarcel 710130803SmarcelEOF 711130803Smarcel fi 712130803Smarcel 713130803Smarcel # Only build a position-dependent object if we build old libraries. 714130803Smarcel if test "$build_old_libs" = yes; then 715130803Smarcel if test "$pic_mode" != yes; then 716130803Smarcel # Don't build PIC code 717130803Smarcel command="$base_compile $srcfile" 718130803Smarcel else 719130803Smarcel command="$base_compile $srcfile $pic_flag" 720130803Smarcel fi 721130803Smarcel if test "$compiler_c_o" = yes; then 722130803Smarcel command="$command -o $obj" 723130803Smarcel fi 724130803Smarcel 725130803Smarcel # Suppress compiler output if we already did a PIC compilation. 726130803Smarcel command="$command$suppress_output" 727130803Smarcel $run $rm "$obj" "$output_obj" 728130803Smarcel $show "$command" 729130803Smarcel if $run eval "$command"; then : 730130803Smarcel else 731130803Smarcel $run $rm $removelist 732130803Smarcel exit 1 733130803Smarcel fi 734130803Smarcel 735130803Smarcel if test "$need_locks" = warn && 736130803Smarcel test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then 737130803Smarcel echo "\ 738130803Smarcel*** ERROR, $lockfile contains: 739130803Smarcel`cat $lockfile 2>/dev/null` 740130803Smarcel 741130803Smarcelbut it should contain: 742130803Smarcel$srcfile 743130803Smarcel 744130803SmarcelThis indicates that another process is trying to use the same 745130803Smarceltemporary object file, and libtool could not work around it because 746130803Smarcelyour compiler does not support \`-c' and \`-o' together. If you 747130803Smarcelrepeat this compilation, it may succeed, by chance, but you had better 748130803Smarcelavoid parallel builds (make -j) in this platform, or get a better 749130803Smarcelcompiler." 750130803Smarcel 751130803Smarcel $run $rm $removelist 752130803Smarcel exit 1 753130803Smarcel fi 754130803Smarcel 755130803Smarcel # Just move the object if needed 756130803Smarcel if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then 757130803Smarcel $show "$mv $output_obj $obj" 758130803Smarcel if $run $mv $output_obj $obj; then : 759130803Smarcel else 760130803Smarcel error=$? 761130803Smarcel $run $rm $removelist 762130803Smarcel exit $error 763130803Smarcel fi 764130803Smarcel fi 765130803Smarcel 766130803Smarcel # Append the name of the non-PIC object the libtool object file. 767130803Smarcel # Only append if the libtool object file exists. 768130803Smarcel test -z "$run" && cat >> ${libobj}T <<EOF 769130803Smarcel# Name of the non-PIC object. 770130803Smarcelnon_pic_object='$objname' 771130803Smarcel 772130803SmarcelEOF 773130803Smarcel else 774130803Smarcel # Append the name of the non-PIC object the libtool object file. 775130803Smarcel # Only append if the libtool object file exists. 776130803Smarcel test -z "$run" && cat >> ${libobj}T <<EOF 777130803Smarcel# Name of the non-PIC object. 778130803Smarcelnon_pic_object=none 779130803Smarcel 780130803SmarcelEOF 781130803Smarcel fi 782130803Smarcel 783130803Smarcel $run $mv "${libobj}T" "${libobj}" 784130803Smarcel 785130803Smarcel # Unlock the critical section if it was locked 786130803Smarcel if test "$need_locks" != no; then 787130803Smarcel $run $rm "$lockfile" 788130803Smarcel fi 789130803Smarcel 790130803Smarcel exit 0 791130803Smarcel ;; 792130803Smarcel 793130803Smarcel # libtool link mode 794130803Smarcel link | relink) 795130803Smarcel modename="$modename: link" 796130803Smarcel case $host in 797130803Smarcel *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 798130803Smarcel # It is impossible to link a dll without this setting, and 799130803Smarcel # we shouldn't force the makefile maintainer to figure out 800130803Smarcel # which system we are compiling for in order to pass an extra 801130803Smarcel # flag for every libtool invokation. 802130803Smarcel # allow_undefined=no 803130803Smarcel 804130803Smarcel # FIXME: Unfortunately, there are problems with the above when trying 805130803Smarcel # to make a dll which has undefined symbols, in which case not 806130803Smarcel # even a static library is built. For now, we need to specify 807130803Smarcel # -no-undefined on the libtool link line when we can be certain 808130803Smarcel # that all symbols are satisfied, otherwise we get a static library. 809130803Smarcel allow_undefined=yes 810130803Smarcel ;; 811130803Smarcel *) 812130803Smarcel allow_undefined=yes 813130803Smarcel ;; 814130803Smarcel esac 815130803Smarcel libtool_args="$nonopt" 816130803Smarcel base_compile="$nonopt" 817130803Smarcel compile_command="$nonopt" 818130803Smarcel finalize_command="$nonopt" 819130803Smarcel 820130803Smarcel compile_rpath= 821130803Smarcel finalize_rpath= 822130803Smarcel compile_shlibpath= 823130803Smarcel finalize_shlibpath= 824130803Smarcel convenience= 825130803Smarcel old_convenience= 826130803Smarcel deplibs= 827130803Smarcel old_deplibs= 828130803Smarcel compiler_flags= 829130803Smarcel linker_flags= 830130803Smarcel dllsearchpath= 831130803Smarcel lib_search_path=`pwd` 832130803Smarcel 833130803Smarcel avoid_version=no 834130803Smarcel dlfiles= 835130803Smarcel dlprefiles= 836130803Smarcel dlself=no 837130803Smarcel export_dynamic=no 838130803Smarcel export_symbols= 839130803Smarcel export_symbols_regex= 840130803Smarcel generated= 841130803Smarcel libobjs= 842130803Smarcel ltlibs= 843130803Smarcel module=no 844130803Smarcel no_install=no 845130803Smarcel objs= 846130803Smarcel non_pic_objects= 847130803Smarcel prefer_static_libs=no 848130803Smarcel preload=no 849130803Smarcel prev= 850130803Smarcel prevarg= 851130803Smarcel release= 852130803Smarcel rpath= 853130803Smarcel xrpath= 854130803Smarcel perm_rpath= 855130803Smarcel temp_rpath= 856130803Smarcel thread_safe=no 857130803Smarcel vinfo= 858130803Smarcel 859130803Smarcel # We need to know -static, to get the right output filenames. 860130803Smarcel for arg 861130803Smarcel do 862130803Smarcel case $arg in 863130803Smarcel -all-static | -static) 864130803Smarcel if test "X$arg" = "X-all-static"; then 865130803Smarcel if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 866130803Smarcel $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 867130803Smarcel fi 868130803Smarcel if test -n "$link_static_flag"; then 869130803Smarcel dlopen_self=$dlopen_self_static 870130803Smarcel fi 871130803Smarcel else 872130803Smarcel if test -z "$pic_flag" && test -n "$link_static_flag"; then 873130803Smarcel dlopen_self=$dlopen_self_static 874130803Smarcel fi 875130803Smarcel fi 876130803Smarcel build_libtool_libs=no 877130803Smarcel build_old_libs=yes 878130803Smarcel prefer_static_libs=yes 879130803Smarcel break 880130803Smarcel ;; 881130803Smarcel esac 882130803Smarcel done 883130803Smarcel 884130803Smarcel # See if our shared archives depend on static archives. 885130803Smarcel test -n "$old_archive_from_new_cmds" && build_old_libs=yes 886130803Smarcel 887130803Smarcel # Go through the arguments, transforming them on the way. 888130803Smarcel while test $# -gt 0; do 889130803Smarcel arg="$1" 890130803Smarcel base_compile="$base_compile $arg" 891130803Smarcel shift 892130803Smarcel case $arg in 893130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 894130803Smarcel qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 895130803Smarcel ;; 896130803Smarcel *) qarg=$arg ;; 897130803Smarcel esac 898130803Smarcel libtool_args="$libtool_args $qarg" 899130803Smarcel 900130803Smarcel # If the previous option needs an argument, assign it. 901130803Smarcel if test -n "$prev"; then 902130803Smarcel case $prev in 903130803Smarcel output) 904130803Smarcel compile_command="$compile_command @OUTPUT@" 905130803Smarcel finalize_command="$finalize_command @OUTPUT@" 906130803Smarcel ;; 907130803Smarcel esac 908130803Smarcel 909130803Smarcel case $prev in 910130803Smarcel dlfiles|dlprefiles) 911130803Smarcel if test "$preload" = no; then 912130803Smarcel # Add the symbol object into the linking commands. 913130803Smarcel compile_command="$compile_command @SYMFILE@" 914130803Smarcel finalize_command="$finalize_command @SYMFILE@" 915130803Smarcel preload=yes 916130803Smarcel fi 917130803Smarcel case $arg in 918130803Smarcel *.la | *.lo) ;; # We handle these cases below. 919130803Smarcel force) 920130803Smarcel if test "$dlself" = no; then 921130803Smarcel dlself=needless 922130803Smarcel export_dynamic=yes 923130803Smarcel fi 924130803Smarcel prev= 925130803Smarcel continue 926130803Smarcel ;; 927130803Smarcel self) 928130803Smarcel if test "$prev" = dlprefiles; then 929130803Smarcel dlself=yes 930130803Smarcel elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 931130803Smarcel dlself=yes 932130803Smarcel else 933130803Smarcel dlself=needless 934130803Smarcel export_dynamic=yes 935130803Smarcel fi 936130803Smarcel prev= 937130803Smarcel continue 938130803Smarcel ;; 939130803Smarcel *) 940130803Smarcel if test "$prev" = dlfiles; then 941130803Smarcel dlfiles="$dlfiles $arg" 942130803Smarcel else 943130803Smarcel dlprefiles="$dlprefiles $arg" 944130803Smarcel fi 945130803Smarcel prev= 946130803Smarcel continue 947130803Smarcel ;; 948130803Smarcel esac 949130803Smarcel ;; 950130803Smarcel expsyms) 951130803Smarcel export_symbols="$arg" 952130803Smarcel if test ! -f "$arg"; then 953130803Smarcel $echo "$modename: symbol file \`$arg' does not exist" 954130803Smarcel exit 1 955130803Smarcel fi 956130803Smarcel prev= 957130803Smarcel continue 958130803Smarcel ;; 959130803Smarcel expsyms_regex) 960130803Smarcel export_symbols_regex="$arg" 961130803Smarcel prev= 962130803Smarcel continue 963130803Smarcel ;; 964130803Smarcel release) 965130803Smarcel release="-$arg" 966130803Smarcel prev= 967130803Smarcel continue 968130803Smarcel ;; 969130803Smarcel objectlist) 970130803Smarcel if test -f "$arg"; then 971130803Smarcel save_arg=$arg 972130803Smarcel moreargs= 973130803Smarcel for fil in `cat $save_arg` 974130803Smarcel do 975130803Smarcel# moreargs="$moreargs $fil" 976130803Smarcel arg=$fil 977130803Smarcel # A libtool-controlled object. 978130803Smarcel 979130803Smarcel # Check to see that this really is a libtool object. 980130803Smarcel if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 981130803Smarcel pic_object= 982130803Smarcel non_pic_object= 983130803Smarcel 984130803Smarcel # Read the .lo file 985130803Smarcel # If there is no directory component, then add one. 986130803Smarcel case $arg in 987130803Smarcel */* | *\\*) . $arg ;; 988130803Smarcel *) . ./$arg ;; 989130803Smarcel esac 990130803Smarcel 991130803Smarcel if test -z "$pic_object" || \ 992130803Smarcel test -z "$non_pic_object" || 993130803Smarcel test "$pic_object" = none && \ 994130803Smarcel test "$non_pic_object" = none; then 995130803Smarcel $echo "$modename: cannot find name of object for \`$arg'" 1>&2 996130803Smarcel exit 1 997130803Smarcel fi 998130803Smarcel 999130803Smarcel # Extract subdirectory from the argument. 1000130803Smarcel xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1001130803Smarcel if test "X$xdir" = "X$arg"; then 1002130803Smarcel xdir= 1003130803Smarcel else 1004130803Smarcel xdir="$xdir/" 1005130803Smarcel fi 1006130803Smarcel 1007130803Smarcel if test "$pic_object" != none; then 1008130803Smarcel # Prepend the subdirectory the object is found in. 1009130803Smarcel pic_object="$xdir$pic_object" 1010130803Smarcel 1011130803Smarcel if test "$prev" = dlfiles; then 1012130803Smarcel if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1013130803Smarcel dlfiles="$dlfiles $pic_object" 1014130803Smarcel prev= 1015130803Smarcel continue 1016130803Smarcel else 1017130803Smarcel # If libtool objects are unsupported, then we need to preload. 1018130803Smarcel prev=dlprefiles 1019130803Smarcel fi 1020130803Smarcel fi 1021130803Smarcel 1022130803Smarcel # CHECK ME: I think I busted this. -Ossama 1023130803Smarcel if test "$prev" = dlprefiles; then 1024130803Smarcel # Preload the old-style object. 1025130803Smarcel dlprefiles="$dlprefiles $pic_object" 1026130803Smarcel prev= 1027130803Smarcel fi 1028130803Smarcel 1029130803Smarcel # A PIC object. 1030130803Smarcel libobjs="$libobjs $pic_object" 1031130803Smarcel arg="$pic_object" 1032130803Smarcel fi 1033130803Smarcel 1034130803Smarcel # Non-PIC object. 1035130803Smarcel if test "$non_pic_object" != none; then 1036130803Smarcel # Prepend the subdirectory the object is found in. 1037130803Smarcel non_pic_object="$xdir$non_pic_object" 1038130803Smarcel 1039130803Smarcel # A standard non-PIC object 1040130803Smarcel non_pic_objects="$non_pic_objects $non_pic_object" 1041130803Smarcel if test -z "$pic_object" || test "$pic_object" = none ; then 1042130803Smarcel arg="$non_pic_object" 1043130803Smarcel fi 1044130803Smarcel fi 1045130803Smarcel else 1046130803Smarcel # Only an error if not doing a dry-run. 1047130803Smarcel if test -z "$run"; then 1048130803Smarcel $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1049130803Smarcel exit 1 1050130803Smarcel else 1051130803Smarcel # Dry-run case. 1052130803Smarcel 1053130803Smarcel # Extract subdirectory from the argument. 1054130803Smarcel xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1055130803Smarcel if test "X$xdir" = "X$arg"; then 1056130803Smarcel xdir= 1057130803Smarcel else 1058130803Smarcel xdir="$xdir/" 1059130803Smarcel fi 1060130803Smarcel 1061130803Smarcel pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1062130803Smarcel non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1063130803Smarcel libobjs="$libobjs $pic_object" 1064130803Smarcel non_pic_objects="$non_pic_objects $non_pic_object" 1065130803Smarcel fi 1066130803Smarcel fi 1067130803Smarcel done 1068130803Smarcel else 1069130803Smarcel $echo "$modename: link input file \`$save_arg' does not exist" 1070130803Smarcel exit 1 1071130803Smarcel fi 1072130803Smarcel arg=$save_arg 1073130803Smarcel prev= 1074130803Smarcel continue 1075130803Smarcel ;; 1076130803Smarcel rpath | xrpath) 1077130803Smarcel # We need an absolute path. 1078130803Smarcel case $arg in 1079130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) ;; 1080130803Smarcel *) 1081130803Smarcel $echo "$modename: only absolute run-paths are allowed" 1>&2 1082130803Smarcel exit 1 1083130803Smarcel ;; 1084130803Smarcel esac 1085130803Smarcel if test "$prev" = rpath; then 1086130803Smarcel case "$rpath " in 1087130803Smarcel *" $arg "*) ;; 1088130803Smarcel *) rpath="$rpath $arg" ;; 1089130803Smarcel esac 1090130803Smarcel else 1091130803Smarcel case "$xrpath " in 1092130803Smarcel *" $arg "*) ;; 1093130803Smarcel *) xrpath="$xrpath $arg" ;; 1094130803Smarcel esac 1095130803Smarcel fi 1096130803Smarcel prev= 1097130803Smarcel continue 1098130803Smarcel ;; 1099130803Smarcel xcompiler) 1100130803Smarcel compiler_flags="$compiler_flags $qarg" 1101130803Smarcel prev= 1102130803Smarcel compile_command="$compile_command $qarg" 1103130803Smarcel finalize_command="$finalize_command $qarg" 1104130803Smarcel continue 1105130803Smarcel ;; 1106130803Smarcel xlinker) 1107130803Smarcel linker_flags="$linker_flags $qarg" 1108130803Smarcel compiler_flags="$compiler_flags $wl$qarg" 1109130803Smarcel prev= 1110130803Smarcel compile_command="$compile_command $wl$qarg" 1111130803Smarcel finalize_command="$finalize_command $wl$qarg" 1112130803Smarcel continue 1113130803Smarcel ;; 1114130803Smarcel *) 1115130803Smarcel eval "$prev=\"\$arg\"" 1116130803Smarcel prev= 1117130803Smarcel continue 1118130803Smarcel ;; 1119130803Smarcel esac 1120130803Smarcel fi # test -n $prev 1121130803Smarcel 1122130803Smarcel prevarg="$arg" 1123130803Smarcel 1124130803Smarcel case $arg in 1125130803Smarcel -all-static) 1126130803Smarcel if test -n "$link_static_flag"; then 1127130803Smarcel compile_command="$compile_command $link_static_flag" 1128130803Smarcel finalize_command="$finalize_command $link_static_flag" 1129130803Smarcel fi 1130130803Smarcel continue 1131130803Smarcel ;; 1132130803Smarcel 1133130803Smarcel -allow-undefined) 1134130803Smarcel # FIXME: remove this flag sometime in the future. 1135130803Smarcel $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1136130803Smarcel continue 1137130803Smarcel ;; 1138130803Smarcel 1139130803Smarcel -avoid-version) 1140130803Smarcel avoid_version=yes 1141130803Smarcel continue 1142130803Smarcel ;; 1143130803Smarcel 1144130803Smarcel -dlopen) 1145130803Smarcel prev=dlfiles 1146130803Smarcel continue 1147130803Smarcel ;; 1148130803Smarcel 1149130803Smarcel -dlpreopen) 1150130803Smarcel prev=dlprefiles 1151130803Smarcel continue 1152130803Smarcel ;; 1153130803Smarcel 1154130803Smarcel -export-dynamic) 1155130803Smarcel export_dynamic=yes 1156130803Smarcel continue 1157130803Smarcel ;; 1158130803Smarcel 1159130803Smarcel -export-symbols | -export-symbols-regex) 1160130803Smarcel if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1161130803Smarcel $echo "$modename: more than one -exported-symbols argument is not allowed" 1162130803Smarcel exit 1 1163130803Smarcel fi 1164130803Smarcel if test "X$arg" = "X-export-symbols"; then 1165130803Smarcel prev=expsyms 1166130803Smarcel else 1167130803Smarcel prev=expsyms_regex 1168130803Smarcel fi 1169130803Smarcel continue 1170130803Smarcel ;; 1171130803Smarcel 1172130803Smarcel # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1173130803Smarcel # so, if we see these flags be careful not to treat them like -L 1174130803Smarcel -L[A-Z][A-Z]*:*) 1175130803Smarcel case $with_gcc/$host in 1176130803Smarcel no/*-*-irix*) 1177130803Smarcel compile_command="$compile_command $arg" 1178130803Smarcel finalize_command="$finalize_command $arg" 1179130803Smarcel ;; 1180130803Smarcel esac 1181130803Smarcel continue 1182130803Smarcel ;; 1183130803Smarcel 1184130803Smarcel -L*) 1185130803Smarcel dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1186130803Smarcel # We need an absolute path. 1187130803Smarcel case $dir in 1188130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) ;; 1189130803Smarcel *) 1190130803Smarcel absdir=`cd "$dir" && pwd` 1191130803Smarcel if test -z "$absdir"; then 1192130803Smarcel $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1193130803Smarcel exit 1 1194130803Smarcel fi 1195130803Smarcel dir="$absdir" 1196130803Smarcel ;; 1197130803Smarcel esac 1198130803Smarcel case "$deplibs " in 1199130803Smarcel *" -L$dir "*) ;; 1200130803Smarcel *) 1201130803Smarcel deplibs="$deplibs -L$dir" 1202130803Smarcel lib_search_path="$lib_search_path $dir" 1203130803Smarcel ;; 1204130803Smarcel esac 1205130803Smarcel case $host in 1206130803Smarcel *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1207130803Smarcel case :$dllsearchpath: in 1208130803Smarcel *":$dir:"*) ;; 1209130803Smarcel *) dllsearchpath="$dllsearchpath:$dir";; 1210130803Smarcel esac 1211130803Smarcel ;; 1212130803Smarcel esac 1213130803Smarcel continue 1214130803Smarcel ;; 1215130803Smarcel 1216130803Smarcel -l*) 1217130803Smarcel if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1218130803Smarcel case $host in 1219130803Smarcel *-*-cygwin* | *-*-pw32* | *-*-beos*) 1220130803Smarcel # These systems don't actually have a C or math library (as such) 1221130803Smarcel continue 1222130803Smarcel ;; 1223130803Smarcel *-*-mingw* | *-*-os2*) 1224130803Smarcel # These systems don't actually have a C library (as such) 1225130803Smarcel test "X$arg" = "X-lc" && continue 1226130803Smarcel ;; 1227130803Smarcel esac 1228130803Smarcel fi 1229130803Smarcel deplibs="$deplibs $arg" 1230130803Smarcel continue 1231130803Smarcel ;; 1232130803Smarcel 1233130803Smarcel -module) 1234130803Smarcel module=yes 1235130803Smarcel continue 1236130803Smarcel ;; 1237130803Smarcel 1238130803Smarcel -no-fast-install) 1239130803Smarcel fast_install=no 1240130803Smarcel continue 1241130803Smarcel ;; 1242130803Smarcel 1243130803Smarcel -no-install) 1244130803Smarcel case $host in 1245130803Smarcel *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1246130803Smarcel # The PATH hackery in wrapper scripts is required on Windows 1247130803Smarcel # in order for the loader to find any dlls it needs. 1248130803Smarcel $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1249130803Smarcel $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1250130803Smarcel fast_install=no 1251130803Smarcel ;; 1252130803Smarcel *) no_install=yes ;; 1253130803Smarcel esac 1254130803Smarcel continue 1255130803Smarcel ;; 1256130803Smarcel 1257130803Smarcel -no-undefined) 1258130803Smarcel allow_undefined=no 1259130803Smarcel continue 1260130803Smarcel ;; 1261130803Smarcel 1262130803Smarcel -objectlist) 1263130803Smarcel prev=objectlist 1264130803Smarcel continue 1265130803Smarcel ;; 1266130803Smarcel 1267130803Smarcel -o) prev=output ;; 1268130803Smarcel 1269130803Smarcel -release) 1270130803Smarcel prev=release 1271130803Smarcel continue 1272130803Smarcel ;; 1273130803Smarcel 1274130803Smarcel -rpath) 1275130803Smarcel prev=rpath 1276130803Smarcel continue 1277130803Smarcel ;; 1278130803Smarcel 1279130803Smarcel -R) 1280130803Smarcel prev=xrpath 1281130803Smarcel continue 1282130803Smarcel ;; 1283130803Smarcel 1284130803Smarcel -R*) 1285130803Smarcel dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1286130803Smarcel # We need an absolute path. 1287130803Smarcel case $dir in 1288130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) ;; 1289130803Smarcel *) 1290130803Smarcel $echo "$modename: only absolute run-paths are allowed" 1>&2 1291130803Smarcel exit 1 1292130803Smarcel ;; 1293130803Smarcel esac 1294130803Smarcel case "$xrpath " in 1295130803Smarcel *" $dir "*) ;; 1296130803Smarcel *) xrpath="$xrpath $dir" ;; 1297130803Smarcel esac 1298130803Smarcel continue 1299130803Smarcel ;; 1300130803Smarcel 1301130803Smarcel -static) 1302130803Smarcel # The effects of -static are defined in a previous loop. 1303130803Smarcel # We used to do the same as -all-static on platforms that 1304130803Smarcel # didn't have a PIC flag, but the assumption that the effects 1305130803Smarcel # would be equivalent was wrong. It would break on at least 1306130803Smarcel # Digital Unix and AIX. 1307130803Smarcel continue 1308130803Smarcel ;; 1309130803Smarcel 1310130803Smarcel -thread-safe) 1311130803Smarcel thread_safe=yes 1312130803Smarcel continue 1313130803Smarcel ;; 1314130803Smarcel 1315130803Smarcel -version-info) 1316130803Smarcel prev=vinfo 1317130803Smarcel continue 1318130803Smarcel ;; 1319130803Smarcel 1320130803Smarcel -Wc,*) 1321130803Smarcel args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1322130803Smarcel arg= 1323130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 1324130803Smarcel for flag in $args; do 1325130803Smarcel IFS="$save_ifs" 1326130803Smarcel case $flag in 1327130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1328130803Smarcel flag="\"$flag\"" 1329130803Smarcel ;; 1330130803Smarcel esac 1331130803Smarcel arg="$arg $wl$flag" 1332130803Smarcel compiler_flags="$compiler_flags $flag" 1333130803Smarcel done 1334130803Smarcel IFS="$save_ifs" 1335130803Smarcel arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1336130803Smarcel ;; 1337130803Smarcel 1338130803Smarcel -Wl,*) 1339130803Smarcel args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1340130803Smarcel arg= 1341130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 1342130803Smarcel for flag in $args; do 1343130803Smarcel IFS="$save_ifs" 1344130803Smarcel case $flag in 1345130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1346130803Smarcel flag="\"$flag\"" 1347130803Smarcel ;; 1348130803Smarcel esac 1349130803Smarcel arg="$arg $wl$flag" 1350130803Smarcel compiler_flags="$compiler_flags $wl$flag" 1351130803Smarcel linker_flags="$linker_flags $flag" 1352130803Smarcel done 1353130803Smarcel IFS="$save_ifs" 1354130803Smarcel arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1355130803Smarcel ;; 1356130803Smarcel 1357130803Smarcel -Xcompiler) 1358130803Smarcel prev=xcompiler 1359130803Smarcel continue 1360130803Smarcel ;; 1361130803Smarcel 1362130803Smarcel -Xlinker) 1363130803Smarcel prev=xlinker 1364130803Smarcel continue 1365130803Smarcel ;; 1366130803Smarcel 1367130803Smarcel # Some other compiler flag. 1368130803Smarcel -* | +*) 1369130803Smarcel # Unknown arguments in both finalize_command and compile_command need 1370130803Smarcel # to be aesthetically quoted because they are evaled later. 1371130803Smarcel arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1372130803Smarcel case $arg in 1373130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1374130803Smarcel arg="\"$arg\"" 1375130803Smarcel ;; 1376130803Smarcel esac 1377130803Smarcel ;; 1378130803Smarcel 1379130803Smarcel *.$objext) 1380130803Smarcel # A standard object. 1381130803Smarcel objs="$objs $arg" 1382130803Smarcel ;; 1383130803Smarcel 1384130803Smarcel *.lo) 1385130803Smarcel # A libtool-controlled object. 1386130803Smarcel 1387130803Smarcel # Check to see that this really is a libtool object. 1388130803Smarcel if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1389130803Smarcel pic_object= 1390130803Smarcel non_pic_object= 1391130803Smarcel 1392130803Smarcel # Read the .lo file 1393130803Smarcel # If there is no directory component, then add one. 1394130803Smarcel case $arg in 1395130803Smarcel */* | *\\*) . $arg ;; 1396130803Smarcel *) . ./$arg ;; 1397130803Smarcel esac 1398130803Smarcel 1399130803Smarcel if test -z "$pic_object" || \ 1400130803Smarcel test -z "$non_pic_object" || 1401130803Smarcel test "$pic_object" = none && \ 1402130803Smarcel test "$non_pic_object" = none; then 1403130803Smarcel $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1404130803Smarcel exit 1 1405130803Smarcel fi 1406130803Smarcel 1407130803Smarcel # Extract subdirectory from the argument. 1408130803Smarcel xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1409130803Smarcel if test "X$xdir" = "X$arg"; then 1410130803Smarcel xdir= 1411130803Smarcel else 1412130803Smarcel xdir="$xdir/" 1413130803Smarcel fi 1414130803Smarcel 1415130803Smarcel if test "$pic_object" != none; then 1416130803Smarcel # Prepend the subdirectory the object is found in. 1417130803Smarcel pic_object="$xdir$pic_object" 1418130803Smarcel 1419130803Smarcel if test "$prev" = dlfiles; then 1420130803Smarcel if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1421130803Smarcel dlfiles="$dlfiles $pic_object" 1422130803Smarcel prev= 1423130803Smarcel continue 1424130803Smarcel else 1425130803Smarcel # If libtool objects are unsupported, then we need to preload. 1426130803Smarcel prev=dlprefiles 1427130803Smarcel fi 1428130803Smarcel fi 1429130803Smarcel 1430130803Smarcel # CHECK ME: I think I busted this. -Ossama 1431130803Smarcel if test "$prev" = dlprefiles; then 1432130803Smarcel # Preload the old-style object. 1433130803Smarcel dlprefiles="$dlprefiles $pic_object" 1434130803Smarcel prev= 1435130803Smarcel fi 1436130803Smarcel 1437130803Smarcel # A PIC object. 1438130803Smarcel libobjs="$libobjs $pic_object" 1439130803Smarcel arg="$pic_object" 1440130803Smarcel fi 1441130803Smarcel 1442130803Smarcel # Non-PIC object. 1443130803Smarcel if test "$non_pic_object" != none; then 1444130803Smarcel # Prepend the subdirectory the object is found in. 1445130803Smarcel non_pic_object="$xdir$non_pic_object" 1446130803Smarcel 1447130803Smarcel # A standard non-PIC object 1448130803Smarcel non_pic_objects="$non_pic_objects $non_pic_object" 1449130803Smarcel if test -z "$pic_object" || test "$pic_object" = none ; then 1450130803Smarcel arg="$non_pic_object" 1451130803Smarcel fi 1452130803Smarcel fi 1453130803Smarcel else 1454130803Smarcel # Only an error if not doing a dry-run. 1455130803Smarcel if test -z "$run"; then 1456130803Smarcel $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1457130803Smarcel exit 1 1458130803Smarcel else 1459130803Smarcel # Dry-run case. 1460130803Smarcel 1461130803Smarcel # Extract subdirectory from the argument. 1462130803Smarcel xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1463130803Smarcel if test "X$xdir" = "X$arg"; then 1464130803Smarcel xdir= 1465130803Smarcel else 1466130803Smarcel xdir="$xdir/" 1467130803Smarcel fi 1468130803Smarcel 1469130803Smarcel pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1470130803Smarcel non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1471130803Smarcel libobjs="$libobjs $pic_object" 1472130803Smarcel non_pic_objects="$non_pic_objects $non_pic_object" 1473130803Smarcel fi 1474130803Smarcel fi 1475130803Smarcel ;; 1476130803Smarcel 1477130803Smarcel *.$libext) 1478130803Smarcel # An archive. 1479130803Smarcel deplibs="$deplibs $arg" 1480130803Smarcel old_deplibs="$old_deplibs $arg" 1481130803Smarcel continue 1482130803Smarcel ;; 1483130803Smarcel 1484130803Smarcel *.la) 1485130803Smarcel # A libtool-controlled library. 1486130803Smarcel 1487130803Smarcel if test "$prev" = dlfiles; then 1488130803Smarcel # This library was specified with -dlopen. 1489130803Smarcel dlfiles="$dlfiles $arg" 1490130803Smarcel prev= 1491130803Smarcel elif test "$prev" = dlprefiles; then 1492130803Smarcel # The library was specified with -dlpreopen. 1493130803Smarcel dlprefiles="$dlprefiles $arg" 1494130803Smarcel prev= 1495130803Smarcel else 1496130803Smarcel deplibs="$deplibs $arg" 1497130803Smarcel fi 1498130803Smarcel continue 1499130803Smarcel ;; 1500130803Smarcel 1501130803Smarcel # Some other compiler argument. 1502130803Smarcel *) 1503130803Smarcel # Unknown arguments in both finalize_command and compile_command need 1504130803Smarcel # to be aesthetically quoted because they are evaled later. 1505130803Smarcel arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1506130803Smarcel case $arg in 1507130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1508130803Smarcel arg="\"$arg\"" 1509130803Smarcel ;; 1510130803Smarcel esac 1511130803Smarcel ;; 1512130803Smarcel esac # arg 1513130803Smarcel 1514130803Smarcel # Now actually substitute the argument into the commands. 1515130803Smarcel if test -n "$arg"; then 1516130803Smarcel compile_command="$compile_command $arg" 1517130803Smarcel finalize_command="$finalize_command $arg" 1518130803Smarcel fi 1519130803Smarcel done # argument parsing loop 1520130803Smarcel 1521130803Smarcel if test -n "$prev"; then 1522130803Smarcel $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1523130803Smarcel $echo "$help" 1>&2 1524130803Smarcel exit 1 1525130803Smarcel fi 1526130803Smarcel 1527130803Smarcel # Infer tagged configuration to use if any are available and 1528130803Smarcel # if one wasn't chosen via the "--tag" command line option. 1529130803Smarcel # Only attempt this if the compiler in the base link 1530130803Smarcel # command doesn't match the default compiler. 1531130803Smarcel if test -n "$available_tags" && test -z "$tagname"; then 1532130803Smarcel case $base_compile in 1533130803Smarcel "$CC "*) ;; 1534130803Smarcel # Blanks in the command may have been stripped by the calling shell, 1535130803Smarcel # but not from the CC environment variable when ltconfig was run. 1536130803Smarcel "`$echo $CC` "*) ;; 1537130803Smarcel *) 1538130803Smarcel for z in $available_tags; do 1539130803Smarcel if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then 1540130803Smarcel # Evaluate the configuration. 1541130803Smarcel eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" 1542130803Smarcel case $base_compile in 1543130803Smarcel "$CC "*) 1544130803Smarcel # The compiler in $compile_command matches 1545130803Smarcel # the one in the tagged configuration. 1546130803Smarcel # Assume this is the tagged configuration we want. 1547130803Smarcel tagname=$z 1548130803Smarcel break 1549130803Smarcel ;; 1550130803Smarcel "`$echo $CC` "*) 1551130803Smarcel tagname=$z 1552130803Smarcel break 1553130803Smarcel ;; 1554130803Smarcel esac 1555130803Smarcel fi 1556130803Smarcel done 1557130803Smarcel # If $tagname still isn't set, then no tagged configuration 1558130803Smarcel # was found and let the user know that the "--tag" command 1559130803Smarcel # line option must be used. 1560130803Smarcel if test -z "$tagname"; then 1561130803Smarcel echo "$modename: unable to infer tagged configuration" 1562130803Smarcel echo "$modename: specify a tag with \`--tag'" 1>&2 1563130803Smarcel exit 1 1564130803Smarcel# else 1565130803Smarcel# echo "$modename: using $tagname tagged configuration" 1566130803Smarcel fi 1567130803Smarcel ;; 1568130803Smarcel esac 1569130803Smarcel fi 1570130803Smarcel 1571130803Smarcel if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1572130803Smarcel eval arg=\"$export_dynamic_flag_spec\" 1573130803Smarcel compile_command="$compile_command $arg" 1574130803Smarcel finalize_command="$finalize_command $arg" 1575130803Smarcel fi 1576130803Smarcel 1577130803Smarcel # calculate the name of the file, without its directory 1578130803Smarcel outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1579130803Smarcel libobjs_save="$libobjs" 1580130803Smarcel 1581130803Smarcel if test -n "$shlibpath_var"; then 1582130803Smarcel # get the directories listed in $shlibpath_var 1583130803Smarcel eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1584130803Smarcel else 1585130803Smarcel shlib_search_path= 1586130803Smarcel fi 1587130803Smarcel eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1588130803Smarcel eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1589130803Smarcel 1590130803Smarcel output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1591130803Smarcel if test "X$output_objdir" = "X$output"; then 1592130803Smarcel output_objdir="$objdir" 1593130803Smarcel else 1594130803Smarcel output_objdir="$output_objdir/$objdir" 1595130803Smarcel fi 1596130803Smarcel # Create the object directory. 1597130803Smarcel if test ! -d $output_objdir; then 1598130803Smarcel $show "$mkdir $output_objdir" 1599130803Smarcel $run $mkdir $output_objdir 1600130803Smarcel status=$? 1601130803Smarcel if test $status -ne 0 && test ! -d $output_objdir; then 1602130803Smarcel exit $status 1603130803Smarcel fi 1604130803Smarcel fi 1605130803Smarcel 1606130803Smarcel # Determine the type of output 1607130803Smarcel case $output in 1608130803Smarcel "") 1609130803Smarcel $echo "$modename: you must specify an output file" 1>&2 1610130803Smarcel $echo "$help" 1>&2 1611130803Smarcel exit 1 1612130803Smarcel ;; 1613130803Smarcel *.$libext) linkmode=oldlib ;; 1614130803Smarcel *.lo | *.$objext) linkmode=obj ;; 1615130803Smarcel *.la) linkmode=lib ;; 1616130803Smarcel *) linkmode=prog ;; # Anything else should be a program. 1617130803Smarcel esac 1618130803Smarcel 1619130803Smarcel specialdeplibs= 1620130803Smarcel libs= 1621130803Smarcel # Find all interdependent deplibs by searching for libraries 1622130803Smarcel # that are linked more than once (e.g. -la -lb -la) 1623130803Smarcel for deplib in $deplibs; do 1624130803Smarcel case "$libs " in 1625130803Smarcel *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1626130803Smarcel esac 1627130803Smarcel libs="$libs $deplib" 1628130803Smarcel done 1629130803Smarcel 1630130803Smarcel if test $linkmode = lib; then 1631130803Smarcel libs="$predeps $libs $compiler_lib_search_path $postdeps" 1632130803Smarcel 1633130803Smarcel # Compute libraries that are listed more than once in $predeps 1634130803Smarcel # $postdeps and mark them as special (i.e., whose duplicates are 1635130803Smarcel # not to be eliminated). 1636130803Smarcel pre_post_deps= 1637130803Smarcel for pre_post_dep in $predeps $postdeps; do 1638130803Smarcel case "$pre_post_deps " in 1639130803Smarcel *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 1640130803Smarcel esac 1641130803Smarcel pre_post_deps="$pre_post_deps $pre_post_dep" 1642130803Smarcel done 1643130803Smarcel pre_post_deps= 1644130803Smarcel fi 1645130803Smarcel 1646130803Smarcel deplibs= 1647130803Smarcel newdependency_libs= 1648130803Smarcel newlib_search_path= 1649130803Smarcel need_relink=no # whether we're linking any uninstalled libtool libraries 1650130803Smarcel notinst_deplibs= # not-installed libtool libraries 1651130803Smarcel notinst_path= # paths that contain not-installed libtool libraries 1652130803Smarcel case $linkmode in 1653130803Smarcel lib) 1654130803Smarcel passes="conv link" 1655130803Smarcel for file in $dlfiles $dlprefiles; do 1656130803Smarcel case $file in 1657130803Smarcel *.la) ;; 1658130803Smarcel *) 1659130803Smarcel $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 1660130803Smarcel exit 1 1661130803Smarcel ;; 1662130803Smarcel esac 1663130803Smarcel done 1664130803Smarcel ;; 1665130803Smarcel prog) 1666130803Smarcel compile_deplibs= 1667130803Smarcel finalize_deplibs= 1668130803Smarcel alldeplibs=no 1669130803Smarcel newdlfiles= 1670130803Smarcel newdlprefiles= 1671130803Smarcel passes="conv scan dlopen dlpreopen link" 1672130803Smarcel ;; 1673130803Smarcel *) passes="conv" 1674130803Smarcel ;; 1675130803Smarcel esac 1676130803Smarcel for pass in $passes; do 1677130803Smarcel if test $linkmode = prog; then 1678130803Smarcel # Determine which files to process 1679130803Smarcel case $pass in 1680130803Smarcel dlopen) 1681130803Smarcel libs="$dlfiles" 1682130803Smarcel save_deplibs="$deplibs" # Collect dlpreopened libraries 1683130803Smarcel deplibs= 1684130803Smarcel ;; 1685130803Smarcel dlpreopen) libs="$dlprefiles" ;; 1686130803Smarcel link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 1687130803Smarcel esac 1688130803Smarcel fi 1689130803Smarcel for deplib in $libs; do 1690130803Smarcel lib= 1691130803Smarcel found=no 1692130803Smarcel case $deplib in 1693130803Smarcel -l*) 1694130803Smarcel if test $linkmode = oldlib && test $linkmode = obj; then 1695130803Smarcel $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 1696130803Smarcel continue 1697130803Smarcel fi 1698130803Smarcel if test $pass = conv; then 1699130803Smarcel deplibs="$deplib $deplibs" 1700130803Smarcel continue 1701130803Smarcel fi 1702130803Smarcel name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 1703130803Smarcel for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 1704130803Smarcel # Search the libtool library 1705130803Smarcel lib="$searchdir/lib${name}.la" 1706130803Smarcel if test -f "$lib"; then 1707130803Smarcel found=yes 1708130803Smarcel break 1709130803Smarcel fi 1710130803Smarcel done 1711130803Smarcel if test "$found" != yes; then 1712130803Smarcel # deplib doesn't seem to be a libtool library 1713130803Smarcel if test "$linkmode,$pass" = "prog,link"; then 1714130803Smarcel compile_deplibs="$deplib $compile_deplibs" 1715130803Smarcel finalize_deplibs="$deplib $finalize_deplibs" 1716130803Smarcel else 1717130803Smarcel deplibs="$deplib $deplibs" 1718130803Smarcel test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" 1719130803Smarcel fi 1720130803Smarcel continue 1721130803Smarcel fi 1722130803Smarcel ;; # -l 1723130803Smarcel -L*) 1724130803Smarcel case $linkmode in 1725130803Smarcel lib) 1726130803Smarcel deplibs="$deplib $deplibs" 1727130803Smarcel test $pass = conv && continue 1728130803Smarcel newdependency_libs="$deplib $newdependency_libs" 1729130803Smarcel newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1730130803Smarcel ;; 1731130803Smarcel prog) 1732130803Smarcel if test $pass = conv; then 1733130803Smarcel deplibs="$deplib $deplibs" 1734130803Smarcel continue 1735130803Smarcel fi 1736130803Smarcel if test $pass = scan; then 1737130803Smarcel deplibs="$deplib $deplibs" 1738130803Smarcel newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1739130803Smarcel else 1740130803Smarcel compile_deplibs="$deplib $compile_deplibs" 1741130803Smarcel finalize_deplibs="$deplib $finalize_deplibs" 1742130803Smarcel fi 1743130803Smarcel ;; 1744130803Smarcel *) 1745130803Smarcel $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 1746130803Smarcel ;; 1747130803Smarcel esac # linkmode 1748130803Smarcel continue 1749130803Smarcel ;; # -L 1750130803Smarcel -R*) 1751130803Smarcel if test $pass = link; then 1752130803Smarcel dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 1753130803Smarcel # Make sure the xrpath contains only unique directories. 1754130803Smarcel case "$xrpath " in 1755130803Smarcel *" $dir "*) ;; 1756130803Smarcel *) xrpath="$xrpath $dir" ;; 1757130803Smarcel esac 1758130803Smarcel fi 1759130803Smarcel deplibs="$deplib $deplibs" 1760130803Smarcel continue 1761130803Smarcel ;; 1762130803Smarcel *.la) lib="$deplib" ;; 1763130803Smarcel *.$libext) 1764130803Smarcel if test $pass = conv; then 1765130803Smarcel deplibs="$deplib $deplibs" 1766130803Smarcel continue 1767130803Smarcel fi 1768130803Smarcel case $linkmode in 1769130803Smarcel lib) 1770130803Smarcel if test "$deplibs_check_method" != pass_all; then 1771130803Smarcel echo 1772130803Smarcel echo "*** Warning: This library needs some functionality provided by $deplib." 1773130803Smarcel echo "*** I have the capability to make that library automatically link in when" 1774130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 1775130803Smarcel echo "*** shared version of the library, which you do not appear to have." 1776130803Smarcel else 1777130803Smarcel echo 1778130803Smarcel echo "*** Warning: Linking the shared library $output against the" 1779130803Smarcel echo "*** static library $deplib is not portable!" 1780130803Smarcel deplibs="$deplib $deplibs" 1781130803Smarcel fi 1782130803Smarcel continue 1783130803Smarcel ;; 1784130803Smarcel prog) 1785130803Smarcel if test $pass != link; then 1786130803Smarcel deplibs="$deplib $deplibs" 1787130803Smarcel else 1788130803Smarcel compile_deplibs="$deplib $compile_deplibs" 1789130803Smarcel finalize_deplibs="$deplib $finalize_deplibs" 1790130803Smarcel fi 1791130803Smarcel continue 1792130803Smarcel ;; 1793130803Smarcel esac # linkmode 1794130803Smarcel ;; # *.$libext 1795130803Smarcel *.lo | *.$objext) 1796130803Smarcel if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 1797130803Smarcel # If there is no dlopen support or we're linking statically, 1798130803Smarcel # we need to preload. 1799130803Smarcel newdlprefiles="$newdlprefiles $deplib" 1800130803Smarcel compile_deplibs="$deplib $compile_deplibs" 1801130803Smarcel finalize_deplibs="$deplib $finalize_deplibs" 1802130803Smarcel else 1803130803Smarcel newdlfiles="$newdlfiles $deplib" 1804130803Smarcel fi 1805130803Smarcel continue 1806130803Smarcel ;; 1807130803Smarcel %DEPLIBS%) 1808130803Smarcel alldeplibs=yes 1809130803Smarcel continue 1810130803Smarcel ;; 1811130803Smarcel esac # case $deplib 1812130803Smarcel if test $found = yes || test -f "$lib"; then : 1813130803Smarcel else 1814130803Smarcel $echo "$modename: cannot find the library \`$lib'" 1>&2 1815130803Smarcel exit 1 1816130803Smarcel fi 1817130803Smarcel 1818130803Smarcel # Check to see that this really is a libtool archive. 1819130803Smarcel if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 1820130803Smarcel else 1821130803Smarcel $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 1822130803Smarcel exit 1 1823130803Smarcel fi 1824130803Smarcel 1825130803Smarcel ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 1826130803Smarcel test "X$ladir" = "X$lib" && ladir="." 1827130803Smarcel 1828130803Smarcel dlname= 1829130803Smarcel dlopen= 1830130803Smarcel dlpreopen= 1831130803Smarcel libdir= 1832130803Smarcel library_names= 1833130803Smarcel old_library= 1834130803Smarcel # If the library was installed with an old release of libtool, 1835130803Smarcel # it will not redefine variable installed. 1836130803Smarcel installed=yes 1837130803Smarcel 1838130803Smarcel # Read the .la file 1839130803Smarcel case $lib in 1840130803Smarcel */* | *\\*) . $lib ;; 1841130803Smarcel *) . ./$lib ;; 1842130803Smarcel esac 1843130803Smarcel 1844130803Smarcel if test "$linkmode,$pass" = "lib,link" || 1845130803Smarcel test "$linkmode,$pass" = "prog,scan" || 1846130803Smarcel { test $linkmode = oldlib && test $linkmode = obj; }; then 1847130803Smarcel # Add dl[pre]opened files of deplib 1848130803Smarcel test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 1849130803Smarcel test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 1850130803Smarcel fi 1851130803Smarcel 1852130803Smarcel if test $pass = conv; then 1853130803Smarcel # Only check for convenience libraries 1854130803Smarcel deplibs="$lib $deplibs" 1855130803Smarcel if test -z "$libdir"; then 1856130803Smarcel if test -z "$old_library"; then 1857130803Smarcel $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 1858130803Smarcel exit 1 1859130803Smarcel fi 1860130803Smarcel # It is a libtool convenience library, so add in its objects. 1861130803Smarcel convenience="$convenience $ladir/$objdir/$old_library" 1862130803Smarcel old_convenience="$old_convenience $ladir/$objdir/$old_library" 1863130803Smarcel tmp_libs= 1864130803Smarcel for deplib in $dependency_libs; do 1865130803Smarcel deplibs="$deplib $deplibs" 1866130803Smarcel case "$tmp_libs " in 1867130803Smarcel *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1868130803Smarcel esac 1869130803Smarcel tmp_libs="$tmp_libs $deplib" 1870130803Smarcel done 1871130803Smarcel elif test $linkmode != prog && test $linkmode != lib; then 1872130803Smarcel $echo "$modename: \`$lib' is not a convenience library" 1>&2 1873130803Smarcel exit 1 1874130803Smarcel fi 1875130803Smarcel continue 1876130803Smarcel fi # $pass = conv 1877130803Smarcel 1878130803Smarcel # Get the name of the library we link against. 1879130803Smarcel linklib= 1880130803Smarcel for l in $old_library $library_names; do 1881130803Smarcel linklib="$l" 1882130803Smarcel done 1883130803Smarcel if test -z "$linklib"; then 1884130803Smarcel $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 1885130803Smarcel exit 1 1886130803Smarcel fi 1887130803Smarcel 1888130803Smarcel # This library was specified with -dlopen. 1889130803Smarcel if test $pass = dlopen; then 1890130803Smarcel if test -z "$libdir"; then 1891130803Smarcel $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 1892130803Smarcel exit 1 1893130803Smarcel fi 1894130803Smarcel if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 1895130803Smarcel # If there is no dlname, no dlopen support or we're linking 1896130803Smarcel # statically, we need to preload. 1897130803Smarcel dlprefiles="$dlprefiles $lib" 1898130803Smarcel else 1899130803Smarcel newdlfiles="$newdlfiles $lib" 1900130803Smarcel fi 1901130803Smarcel continue 1902130803Smarcel fi # $pass = dlopen 1903130803Smarcel 1904130803Smarcel # We need an absolute path. 1905130803Smarcel case $ladir in 1906130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 1907130803Smarcel *) 1908130803Smarcel abs_ladir=`cd "$ladir" && pwd` 1909130803Smarcel if test -z "$abs_ladir"; then 1910130803Smarcel $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 1911130803Smarcel $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 1912130803Smarcel abs_ladir="$ladir" 1913130803Smarcel fi 1914130803Smarcel ;; 1915130803Smarcel esac 1916130803Smarcel laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 1917130803Smarcel 1918130803Smarcel # Find the relevant object directory and library name. 1919130803Smarcel if test "X$installed" = Xyes; then 1920130803Smarcel if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 1921130803Smarcel $echo "$modename: warning: library \`$lib' was moved." 1>&2 1922130803Smarcel dir="$ladir" 1923130803Smarcel absdir="$abs_ladir" 1924130803Smarcel libdir="$abs_ladir" 1925130803Smarcel else 1926130803Smarcel dir="$libdir" 1927130803Smarcel absdir="$libdir" 1928130803Smarcel fi 1929130803Smarcel else 1930130803Smarcel dir="$ladir/$objdir" 1931130803Smarcel absdir="$abs_ladir/$objdir" 1932130803Smarcel # Remove this search path later 1933130803Smarcel notinst_path="$notinst_path $abs_ladir" 1934130803Smarcel fi # $installed = yes 1935130803Smarcel name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 1936130803Smarcel 1937130803Smarcel # This library was specified with -dlpreopen. 1938130803Smarcel if test $pass = dlpreopen; then 1939130803Smarcel if test -z "$libdir"; then 1940130803Smarcel $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 1941130803Smarcel exit 1 1942130803Smarcel fi 1943130803Smarcel # Prefer using a static library (so that no silly _DYNAMIC symbols 1944130803Smarcel # are required to link). 1945130803Smarcel if test -n "$old_library"; then 1946130803Smarcel newdlprefiles="$newdlprefiles $dir/$old_library" 1947130803Smarcel # Otherwise, use the dlname, so that lt_dlopen finds it. 1948130803Smarcel elif test -n "$dlname"; then 1949130803Smarcel newdlprefiles="$newdlprefiles $dir/$dlname" 1950130803Smarcel else 1951130803Smarcel newdlprefiles="$newdlprefiles $dir/$linklib" 1952130803Smarcel fi 1953130803Smarcel fi # $pass = dlpreopen 1954130803Smarcel 1955130803Smarcel if test -z "$libdir"; then 1956130803Smarcel # Link the convenience library 1957130803Smarcel if test $linkmode = lib; then 1958130803Smarcel deplibs="$dir/$old_library $deplibs" 1959130803Smarcel elif test "$linkmode,$pass" = "prog,link"; then 1960130803Smarcel compile_deplibs="$dir/$old_library $compile_deplibs" 1961130803Smarcel finalize_deplibs="$dir/$old_library $finalize_deplibs" 1962130803Smarcel else 1963130803Smarcel deplibs="$lib $deplibs" 1964130803Smarcel fi 1965130803Smarcel continue 1966130803Smarcel fi 1967130803Smarcel 1968130803Smarcel if test $linkmode = prog && test $pass != link; then 1969130803Smarcel newlib_search_path="$newlib_search_path $ladir" 1970130803Smarcel deplibs="$lib $deplibs" 1971130803Smarcel 1972130803Smarcel linkalldeplibs=no 1973130803Smarcel if test "$link_all_deplibs" != no || test -z "$library_names" || 1974130803Smarcel test "$build_libtool_libs" = no; then 1975130803Smarcel linkalldeplibs=yes 1976130803Smarcel fi 1977130803Smarcel 1978130803Smarcel tmp_libs= 1979130803Smarcel for deplib in $dependency_libs; do 1980130803Smarcel case $deplib in 1981130803Smarcel -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 1982130803Smarcel esac 1983130803Smarcel # Need to link against all dependency_libs? 1984130803Smarcel if test $linkalldeplibs = yes; then 1985130803Smarcel deplibs="$deplib $deplibs" 1986130803Smarcel else 1987130803Smarcel # Need to hardcode shared library paths 1988130803Smarcel # or/and link against static libraries 1989130803Smarcel newdependency_libs="$deplib $newdependency_libs" 1990130803Smarcel fi 1991130803Smarcel case "$tmp_libs " in 1992130803Smarcel *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1993130803Smarcel esac 1994130803Smarcel tmp_libs="$tmp_libs $deplib" 1995130803Smarcel done # for deplib 1996130803Smarcel continue 1997130803Smarcel fi # $linkmode = prog... 1998130803Smarcel 1999130803Smarcel link_static=no # Whether the deplib will be linked statically 2000130803Smarcel if test -n "$library_names" && 2001130803Smarcel { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2002130803Smarcel # Link against this shared library 2003130803Smarcel 2004130803Smarcel if test "$linkmode,$pass" = "prog,link" || 2005130803Smarcel { test $linkmode = lib && test $hardcode_into_libs = yes; }; then 2006130803Smarcel # Hardcode the library path. 2007130803Smarcel # Skip directories that are in the system default run-time 2008130803Smarcel # search path. 2009130803Smarcel case " $sys_lib_dlsearch_path " in 2010130803Smarcel *" $absdir "*) ;; 2011130803Smarcel *) 2012130803Smarcel case "$compile_rpath " in 2013130803Smarcel *" $absdir "*) ;; 2014130803Smarcel *) compile_rpath="$compile_rpath $absdir" 2015130803Smarcel esac 2016130803Smarcel ;; 2017130803Smarcel esac 2018130803Smarcel case " $sys_lib_dlsearch_path " in 2019130803Smarcel *" $libdir "*) ;; 2020130803Smarcel *) 2021130803Smarcel case "$finalize_rpath " in 2022130803Smarcel *" $libdir "*) ;; 2023130803Smarcel *) finalize_rpath="$finalize_rpath $libdir" 2024130803Smarcel esac 2025130803Smarcel ;; 2026130803Smarcel esac 2027130803Smarcel if test $linkmode = prog; then 2028130803Smarcel # We need to hardcode the library path 2029130803Smarcel if test -n "$shlibpath_var"; then 2030130803Smarcel # Make sure the rpath contains only unique directories. 2031130803Smarcel case "$temp_rpath " in 2032130803Smarcel *" $dir "*) ;; 2033130803Smarcel *" $absdir "*) ;; 2034130803Smarcel *) temp_rpath="$temp_rpath $dir" ;; 2035130803Smarcel esac 2036130803Smarcel fi 2037130803Smarcel fi 2038130803Smarcel fi # $linkmode,$pass = prog,link... 2039130803Smarcel 2040130803Smarcel if test "$alldeplibs" = yes && 2041130803Smarcel { test "$deplibs_check_method" = pass_all || 2042130803Smarcel { test "$build_libtool_libs" = yes && 2043130803Smarcel test -n "$library_names"; }; }; then 2044130803Smarcel # We only need to search for static libraries 2045130803Smarcel continue 2046130803Smarcel fi 2047130803Smarcel 2048130803Smarcel if test "$installed" = no; then 2049130803Smarcel notinst_deplibs="$notinst_deplibs $lib" 2050130803Smarcel need_relink=yes 2051130803Smarcel fi 2052130803Smarcel 2053130803Smarcel if test -n "$old_archive_from_expsyms_cmds"; then 2054130803Smarcel # figure out the soname 2055130803Smarcel set dummy $library_names 2056130803Smarcel realname="$2" 2057130803Smarcel shift; shift 2058130803Smarcel libname=`eval \\$echo \"$libname_spec\"` 2059130803Smarcel # use dlname if we got it. it's perfectly good, no? 2060130803Smarcel if test -n "$dlname"; then 2061130803Smarcel soname="$dlname" 2062130803Smarcel elif test -n "$soname_spec"; then 2063130803Smarcel # bleh windows 2064130803Smarcel case $host in 2065130803Smarcel *cygwin*) 2066130803Smarcel major=`expr $current - $age` 2067130803Smarcel versuffix="-$major" 2068130803Smarcel ;; 2069130803Smarcel esac 2070130803Smarcel eval soname=\"$soname_spec\" 2071130803Smarcel else 2072130803Smarcel soname="$realname" 2073130803Smarcel fi 2074130803Smarcel 2075130803Smarcel # Make a new name for the extract_expsyms_cmds to use 2076130803Smarcel soroot="$soname" 2077130803Smarcel soname=`echo $soroot | sed -e 's/^.*\///'` 2078130803Smarcel newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" 2079130803Smarcel 2080130803Smarcel # If the library has no export list, then create one now 2081130803Smarcel if test -f "$output_objdir/$soname-def"; then : 2082130803Smarcel else 2083130803Smarcel $show "extracting exported symbol list from \`$soname'" 2084130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 2085130803Smarcel eval cmds=\"$extract_expsyms_cmds\" 2086130803Smarcel for cmd in $cmds; do 2087130803Smarcel IFS="$save_ifs" 2088130803Smarcel $show "$cmd" 2089130803Smarcel $run eval "$cmd" || exit $? 2090130803Smarcel done 2091130803Smarcel IFS="$save_ifs" 2092130803Smarcel fi 2093130803Smarcel 2094130803Smarcel # Create $newlib 2095130803Smarcel if test -f "$output_objdir/$newlib"; then :; else 2096130803Smarcel $show "generating import library for \`$soname'" 2097130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 2098130803Smarcel eval cmds=\"$old_archive_from_expsyms_cmds\" 2099130803Smarcel for cmd in $cmds; do 2100130803Smarcel IFS="$save_ifs" 2101130803Smarcel $show "$cmd" 2102130803Smarcel $run eval "$cmd" || exit $? 2103130803Smarcel done 2104130803Smarcel IFS="$save_ifs" 2105130803Smarcel fi 2106130803Smarcel # make sure the library variables are pointing to the new library 2107130803Smarcel dir=$output_objdir 2108130803Smarcel linklib=$newlib 2109130803Smarcel fi # test -n $old_archive_from_expsyms_cmds 2110130803Smarcel 2111130803Smarcel if test $linkmode = prog || test "$mode" != relink; then 2112130803Smarcel add_shlibpath= 2113130803Smarcel add_dir= 2114130803Smarcel add= 2115130803Smarcel lib_linked=yes 2116130803Smarcel case $hardcode_action in 2117130803Smarcel immediate | unsupported) 2118130803Smarcel if test "$hardcode_direct" = no; then 2119130803Smarcel add="$dir/$linklib" 2120130803Smarcel elif test "$hardcode_minus_L" = no; then 2121130803Smarcel case $host in 2122130803Smarcel *-*-sunos*) add_shlibpath="$dir" ;; 2123130803Smarcel esac 2124130803Smarcel add_dir="-L$dir" 2125130803Smarcel add="-l$name" 2126130803Smarcel elif test "$hardcode_shlibpath_var" = no; then 2127130803Smarcel add_shlibpath="$dir" 2128130803Smarcel add="-l$name" 2129130803Smarcel else 2130130803Smarcel lib_linked=no 2131130803Smarcel fi 2132130803Smarcel ;; 2133130803Smarcel relink) 2134130803Smarcel if test "$hardcode_direct" = yes; then 2135130803Smarcel add="$dir/$linklib" 2136130803Smarcel elif test "$hardcode_minus_L" = yes; then 2137130803Smarcel add_dir="-L$dir" 2138130803Smarcel add="-l$name" 2139130803Smarcel elif test "$hardcode_shlibpath_var" = yes; then 2140130803Smarcel add_shlibpath="$dir" 2141130803Smarcel add="-l$name" 2142130803Smarcel else 2143130803Smarcel lib_linked=no 2144130803Smarcel fi 2145130803Smarcel ;; 2146130803Smarcel *) lib_linked=no ;; 2147130803Smarcel esac 2148130803Smarcel 2149130803Smarcel if test "$lib_linked" != yes; then 2150130803Smarcel $echo "$modename: configuration error: unsupported hardcode properties" 2151130803Smarcel exit 1 2152130803Smarcel fi 2153130803Smarcel 2154130803Smarcel if test -n "$add_shlibpath"; then 2155130803Smarcel case :$compile_shlibpath: in 2156130803Smarcel *":$add_shlibpath:"*) ;; 2157130803Smarcel *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2158130803Smarcel esac 2159130803Smarcel fi 2160130803Smarcel if test $linkmode = prog; then 2161130803Smarcel test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2162130803Smarcel test -n "$add" && compile_deplibs="$add $compile_deplibs" 2163130803Smarcel else 2164130803Smarcel test -n "$add_dir" && deplibs="$add_dir $deplibs" 2165130803Smarcel test -n "$add" && deplibs="$add $deplibs" 2166130803Smarcel if test "$hardcode_direct" != yes && \ 2167130803Smarcel test "$hardcode_minus_L" != yes && \ 2168130803Smarcel test "$hardcode_shlibpath_var" = yes; then 2169130803Smarcel case :$finalize_shlibpath: in 2170130803Smarcel *":$libdir:"*) ;; 2171130803Smarcel *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2172130803Smarcel esac 2173130803Smarcel fi 2174130803Smarcel fi 2175130803Smarcel fi 2176130803Smarcel 2177130803Smarcel if test $linkmode = prog || test "$mode" = relink; then 2178130803Smarcel add_shlibpath= 2179130803Smarcel add_dir= 2180130803Smarcel add= 2181130803Smarcel # Finalize command for both is simple: just hardcode it. 2182130803Smarcel if test "$hardcode_direct" = yes; then 2183130803Smarcel add="$libdir/$linklib" 2184130803Smarcel elif test "$hardcode_minus_L" = yes; then 2185130803Smarcel add_dir="-L$libdir" 2186130803Smarcel add="-l$name" 2187130803Smarcel elif test "$hardcode_shlibpath_var" = yes; then 2188130803Smarcel case :$finalize_shlibpath: in 2189130803Smarcel *":$libdir:"*) ;; 2190130803Smarcel *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2191130803Smarcel esac 2192130803Smarcel add="-l$name" 2193130803Smarcel else 2194130803Smarcel # We cannot seem to hardcode it, guess we'll fake it. 2195130803Smarcel add_dir="-L$libdir" 2196130803Smarcel add="-l$name" 2197130803Smarcel fi 2198130803Smarcel 2199130803Smarcel if test $linkmode = prog; then 2200130803Smarcel test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2201130803Smarcel test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2202130803Smarcel else 2203130803Smarcel test -n "$add_dir" && deplibs="$add_dir $deplibs" 2204130803Smarcel test -n "$add" && deplibs="$add $deplibs" 2205130803Smarcel fi 2206130803Smarcel fi 2207130803Smarcel elif test $linkmode = prog; then 2208130803Smarcel if test "$alldeplibs" = yes && 2209130803Smarcel { test "$deplibs_check_method" = pass_all || 2210130803Smarcel { test "$build_libtool_libs" = yes && 2211130803Smarcel test -n "$library_names"; }; }; then 2212130803Smarcel # We only need to search for static libraries 2213130803Smarcel continue 2214130803Smarcel fi 2215130803Smarcel 2216130803Smarcel # Try to link the static library 2217130803Smarcel # Here we assume that one of hardcode_direct or hardcode_minus_L 2218130803Smarcel # is not unsupported. This is valid on all known static and 2219130803Smarcel # shared platforms. 2220130803Smarcel if test "$hardcode_direct" != unsupported; then 2221130803Smarcel test -n "$old_library" && linklib="$old_library" 2222130803Smarcel compile_deplibs="$dir/$linklib $compile_deplibs" 2223130803Smarcel finalize_deplibs="$dir/$linklib $finalize_deplibs" 2224130803Smarcel else 2225130803Smarcel compile_deplibs="-l$name -L$dir $compile_deplibs" 2226130803Smarcel finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2227130803Smarcel fi 2228130803Smarcel elif test "$build_libtool_libs" = yes; then 2229130803Smarcel # Not a shared library 2230130803Smarcel if test "$deplibs_check_method" != pass_all; then 2231130803Smarcel # We're trying link a shared library against a static one 2232130803Smarcel # but the system doesn't support it. 2233130803Smarcel 2234130803Smarcel # Just print a warning and add the library to dependency_libs so 2235130803Smarcel # that the program can be linked against the static library. 2236130803Smarcel echo 2237130803Smarcel echo "*** Warning: This library needs some functionality provided by $lib." 2238130803Smarcel echo "*** I have the capability to make that library automatically link in when" 2239130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 2240130803Smarcel echo "*** shared version of the library, which you do not appear to have." 2241130803Smarcel if test "$module" = yes; then 2242130803Smarcel echo "*** Therefore, libtool will create a static module, that should work " 2243130803Smarcel echo "*** as long as the dlopening application is linked with the -dlopen flag." 2244130803Smarcel if test -z "$global_symbol_pipe"; then 2245130803Smarcel echo 2246130803Smarcel echo "*** However, this would only work if libtool was able to extract symbol" 2247130803Smarcel echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2248130803Smarcel echo "*** not find such a program. So, this module is probably useless." 2249130803Smarcel echo "*** \`nm' from GNU binutils and a full rebuild may help." 2250130803Smarcel fi 2251130803Smarcel if test "$build_old_libs" = no; then 2252130803Smarcel build_libtool_libs=module 2253130803Smarcel build_old_libs=yes 2254130803Smarcel else 2255130803Smarcel build_libtool_libs=no 2256130803Smarcel fi 2257130803Smarcel fi 2258130803Smarcel else 2259130803Smarcel convenience="$convenience $dir/$old_library" 2260130803Smarcel old_convenience="$old_convenience $dir/$old_library" 2261130803Smarcel deplibs="$dir/$old_library $deplibs" 2262130803Smarcel link_static=yes 2263130803Smarcel fi 2264130803Smarcel fi # link shared/static library? 2265130803Smarcel 2266130803Smarcel if test $linkmode = lib; then 2267130803Smarcel if test -n "$dependency_libs" && 2268130803Smarcel { test $hardcode_into_libs != yes || test $build_old_libs = yes || 2269130803Smarcel test $link_static = yes; }; then 2270130803Smarcel # Extract -R from dependency_libs 2271130803Smarcel temp_deplibs= 2272130803Smarcel for libdir in $dependency_libs; do 2273130803Smarcel case $libdir in 2274130803Smarcel -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2275130803Smarcel case " $xrpath " in 2276130803Smarcel *" $temp_xrpath "*) ;; 2277130803Smarcel *) xrpath="$xrpath $temp_xrpath";; 2278130803Smarcel esac;; 2279130803Smarcel *) temp_deplibs="$temp_deplibs $libdir";; 2280130803Smarcel esac 2281130803Smarcel done 2282130803Smarcel dependency_libs="$temp_deplibs" 2283130803Smarcel fi 2284130803Smarcel 2285130803Smarcel newlib_search_path="$newlib_search_path $absdir" 2286130803Smarcel # Link against this library 2287130803Smarcel test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2288130803Smarcel # ... and its dependency_libs 2289130803Smarcel tmp_libs= 2290130803Smarcel for deplib in $dependency_libs; do 2291130803Smarcel newdependency_libs="$deplib $newdependency_libs" 2292130803Smarcel case "$tmp_libs " in 2293130803Smarcel *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2294130803Smarcel esac 2295130803Smarcel tmp_libs="$tmp_libs $deplib" 2296130803Smarcel done 2297130803Smarcel 2298130803Smarcel if test $link_all_deplibs != no; then 2299130803Smarcel # Add the search paths of all dependency libraries 2300130803Smarcel for deplib in $dependency_libs; do 2301130803Smarcel case $deplib in 2302130803Smarcel -L*) path="$deplib" ;; 2303130803Smarcel *.la) 2304130803Smarcel dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2305130803Smarcel test "X$dir" = "X$deplib" && dir="." 2306130803Smarcel # We need an absolute path. 2307130803Smarcel case $dir in 2308130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2309130803Smarcel *) 2310130803Smarcel absdir=`cd "$dir" && pwd` 2311130803Smarcel if test -z "$absdir"; then 2312130803Smarcel $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2313130803Smarcel absdir="$dir" 2314130803Smarcel fi 2315130803Smarcel ;; 2316130803Smarcel esac 2317130803Smarcel if grep "^installed=no" $deplib > /dev/null; then 2318130803Smarcel path="-L$absdir/$objdir" 2319130803Smarcel else 2320130803Smarcel eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2321130803Smarcel if test -z "$libdir"; then 2322130803Smarcel $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2323130803Smarcel exit 1 2324130803Smarcel fi 2325130803Smarcel if test "$absdir" != "$libdir"; then 2326130803Smarcel $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2327130803Smarcel fi 2328130803Smarcel path="-L$absdir" 2329130803Smarcel fi 2330130803Smarcel ;; 2331130803Smarcel *) continue ;; 2332130803Smarcel esac 2333130803Smarcel case " $deplibs " in 2334130803Smarcel *" $path "*) ;; 2335130803Smarcel *) deplibs="$path $deplibs" ;; 2336130803Smarcel esac 2337130803Smarcel done 2338130803Smarcel fi # link_all_deplibs != no 2339130803Smarcel fi # linkmode = lib 2340130803Smarcel done # for deplib in $libs 2341130803Smarcel if test $pass = dlpreopen; then 2342130803Smarcel # Link the dlpreopened libraries before other libraries 2343130803Smarcel for deplib in $save_deplibs; do 2344130803Smarcel deplibs="$deplib $deplibs" 2345130803Smarcel done 2346130803Smarcel fi 2347130803Smarcel if test $pass != dlopen; then 2348130803Smarcel test $pass != scan && dependency_libs="$newdependency_libs" 2349130803Smarcel if test $pass != conv; then 2350130803Smarcel # Make sure lib_search_path contains only unique directories. 2351130803Smarcel lib_search_path= 2352130803Smarcel for dir in $newlib_search_path; do 2353130803Smarcel case "$lib_search_path " in 2354130803Smarcel *" $dir "*) ;; 2355130803Smarcel *) lib_search_path="$lib_search_path $dir" ;; 2356130803Smarcel esac 2357130803Smarcel done 2358130803Smarcel newlib_search_path= 2359130803Smarcel fi 2360130803Smarcel 2361130803Smarcel if test "$linkmode,$pass" != "prog,link"; then 2362130803Smarcel vars="deplibs" 2363130803Smarcel else 2364130803Smarcel vars="compile_deplibs finalize_deplibs" 2365130803Smarcel fi 2366130803Smarcel for var in $vars dependency_libs; do 2367130803Smarcel # Add libraries to $var in reverse order 2368130803Smarcel eval tmp_libs=\"\$$var\" 2369130803Smarcel new_libs= 2370130803Smarcel for deplib in $tmp_libs; do 2371130803Smarcel case $deplib in 2372130803Smarcel -L*) new_libs="$deplib $new_libs" ;; 2373130803Smarcel *) 2374130803Smarcel case " $specialdeplibs " in 2375130803Smarcel *" $deplib "*) new_libs="$deplib $new_libs" ;; 2376130803Smarcel *) 2377130803Smarcel case " $new_libs " in 2378130803Smarcel *" $deplib "*) ;; 2379130803Smarcel *) new_libs="$deplib $new_libs" ;; 2380130803Smarcel esac 2381130803Smarcel ;; 2382130803Smarcel esac 2383130803Smarcel ;; 2384130803Smarcel esac 2385130803Smarcel done 2386130803Smarcel tmp_libs= 2387130803Smarcel for deplib in $new_libs; do 2388130803Smarcel case $deplib in 2389130803Smarcel -L*) 2390130803Smarcel case " $tmp_libs " in 2391130803Smarcel *" $deplib "*) ;; 2392130803Smarcel *) tmp_libs="$tmp_libs $deplib" ;; 2393130803Smarcel esac 2394130803Smarcel ;; 2395130803Smarcel *) tmp_libs="$tmp_libs $deplib" ;; 2396130803Smarcel esac 2397130803Smarcel done 2398130803Smarcel eval $var=\"$tmp_libs\" 2399130803Smarcel done # for var 2400130803Smarcel fi 2401130803Smarcel if test "$pass" = "conv" && 2402130803Smarcel { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then 2403130803Smarcel libs="$deplibs" # reset libs 2404130803Smarcel deplibs= 2405130803Smarcel fi 2406130803Smarcel done # for pass 2407130803Smarcel if test $linkmode = prog; then 2408130803Smarcel dlfiles="$newdlfiles" 2409130803Smarcel dlprefiles="$newdlprefiles" 2410130803Smarcel fi 2411130803Smarcel 2412130803Smarcel case $linkmode in 2413130803Smarcel oldlib) 2414130803Smarcel if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2415130803Smarcel $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 2416130803Smarcel fi 2417130803Smarcel 2418130803Smarcel if test -n "$rpath"; then 2419130803Smarcel $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 2420130803Smarcel fi 2421130803Smarcel 2422130803Smarcel if test -n "$xrpath"; then 2423130803Smarcel $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 2424130803Smarcel fi 2425130803Smarcel 2426130803Smarcel if test -n "$vinfo"; then 2427130803Smarcel $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 2428130803Smarcel fi 2429130803Smarcel 2430130803Smarcel if test -n "$release"; then 2431130803Smarcel $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 2432130803Smarcel fi 2433130803Smarcel 2434130803Smarcel if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 2435130803Smarcel $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 2436130803Smarcel fi 2437130803Smarcel 2438130803Smarcel # Now set the variables for building old libraries. 2439130803Smarcel build_libtool_libs=no 2440130803Smarcel oldlibs="$output" 2441130803Smarcel objs="$objs$old_deplibs" 2442130803Smarcel ;; 2443130803Smarcel 2444130803Smarcel lib) 2445130803Smarcel # Make sure we only generate libraries of the form `libNAME.la'. 2446130803Smarcel case $outputname in 2447130803Smarcel lib*) 2448130803Smarcel name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2449130803Smarcel eval libname=\"$libname_spec\" 2450130803Smarcel ;; 2451130803Smarcel *) 2452130803Smarcel if test "$module" = no; then 2453130803Smarcel $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 2454130803Smarcel $echo "$help" 1>&2 2455130803Smarcel exit 1 2456130803Smarcel fi 2457130803Smarcel if test "$need_lib_prefix" != no; then 2458130803Smarcel # Add the "lib" prefix for modules if required 2459130803Smarcel name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 2460130803Smarcel eval libname=\"$libname_spec\" 2461130803Smarcel else 2462130803Smarcel libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 2463130803Smarcel fi 2464130803Smarcel ;; 2465130803Smarcel esac 2466130803Smarcel 2467130803Smarcel if test -n "$objs"; then 2468130803Smarcel if test "$deplibs_check_method" != pass_all; then 2469130803Smarcel $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 2470130803Smarcel exit 1 2471130803Smarcel else 2472130803Smarcel echo 2473130803Smarcel echo "*** Warning: Linking the shared library $output against the non-libtool" 2474130803Smarcel echo "*** objects $objs is not portable!" 2475130803Smarcel libobjs="$libobjs $objs" 2476130803Smarcel fi 2477130803Smarcel fi 2478130803Smarcel 2479130803Smarcel if test "$dlself" != no; then 2480130803Smarcel $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 2481130803Smarcel fi 2482130803Smarcel 2483130803Smarcel set dummy $rpath 2484130803Smarcel if test $# -gt 2; then 2485130803Smarcel $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 2486130803Smarcel fi 2487130803Smarcel install_libdir="$2" 2488130803Smarcel 2489130803Smarcel oldlibs= 2490130803Smarcel if test -z "$rpath"; then 2491130803Smarcel if test "$build_libtool_libs" = yes; then 2492130803Smarcel # Building a libtool convenience library. 2493130803Smarcel # Some compilers have problems with a `.al' extension so 2494130803Smarcel # convenience libraries should have the same extension an 2495130803Smarcel # archive normally would. 2496130803Smarcel oldlibs="$output_objdir/$libname.$libext $oldlibs" 2497130803Smarcel build_libtool_libs=convenience 2498130803Smarcel build_old_libs=yes 2499130803Smarcel fi 2500130803Smarcel 2501130803Smarcel if test -n "$vinfo"; then 2502130803Smarcel $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 2503130803Smarcel fi 2504130803Smarcel 2505130803Smarcel if test -n "$release"; then 2506130803Smarcel $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 2507130803Smarcel fi 2508130803Smarcel else 2509130803Smarcel 2510130803Smarcel # Parse the version information argument. 2511130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' 2512130803Smarcel set dummy $vinfo 0 0 0 2513130803Smarcel IFS="$save_ifs" 2514130803Smarcel 2515130803Smarcel if test -n "$8"; then 2516130803Smarcel $echo "$modename: too many parameters to \`-version-info'" 1>&2 2517130803Smarcel $echo "$help" 1>&2 2518130803Smarcel exit 1 2519130803Smarcel fi 2520130803Smarcel 2521130803Smarcel current="$2" 2522130803Smarcel revision="$3" 2523130803Smarcel age="$4" 2524130803Smarcel 2525130803Smarcel # Check that each of the things are valid numbers. 2526130803Smarcel case $current in 2527130803Smarcel 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2528130803Smarcel *) 2529130803Smarcel $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 2530130803Smarcel $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2531130803Smarcel exit 1 2532130803Smarcel ;; 2533130803Smarcel esac 2534130803Smarcel 2535130803Smarcel case $revision in 2536130803Smarcel 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2537130803Smarcel *) 2538130803Smarcel $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 2539130803Smarcel $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2540130803Smarcel exit 1 2541130803Smarcel ;; 2542130803Smarcel esac 2543130803Smarcel 2544130803Smarcel case $age in 2545130803Smarcel 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2546130803Smarcel *) 2547130803Smarcel $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 2548130803Smarcel $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2549130803Smarcel exit 1 2550130803Smarcel ;; 2551130803Smarcel esac 2552130803Smarcel 2553130803Smarcel if test $age -gt $current; then 2554130803Smarcel $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 2555130803Smarcel $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2556130803Smarcel exit 1 2557130803Smarcel fi 2558130803Smarcel 2559130803Smarcel # Calculate the version variables. 2560130803Smarcel major= 2561130803Smarcel versuffix= 2562130803Smarcel verstring= 2563130803Smarcel case $version_type in 2564130803Smarcel none) ;; 2565130803Smarcel 2566130803Smarcel darwin) 2567130803Smarcel # Like Linux, but with the current version available in 2568130803Smarcel # verstring for coding it into the library header 2569130803Smarcel major=.`expr $current - $age` 2570130803Smarcel versuffix="$major.$age.$revision" 2571130803Smarcel # Darwin ld doesn't like 0 for these options... 2572130803Smarcel minor_current=`expr $current + 1` 2573130803Smarcel verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 2574130803Smarcel ;; 2575130803Smarcel 2576130803Smarcel freebsd-aout) 2577130803Smarcel major=".$current" 2578130803Smarcel versuffix=".$current.$revision"; 2579130803Smarcel ;; 2580130803Smarcel 2581130803Smarcel freebsd-elf) 2582130803Smarcel major=".$current" 2583130803Smarcel versuffix=".$current"; 2584130803Smarcel ;; 2585130803Smarcel 2586130803Smarcel irix) 2587130803Smarcel major=`expr $current - $age + 1` 2588130803Smarcel verstring="sgi$major.$revision" 2589130803Smarcel 2590130803Smarcel # Add in all the interfaces that we are compatible with. 2591130803Smarcel loop=$revision 2592130803Smarcel while test $loop != 0; do 2593130803Smarcel iface=`expr $revision - $loop` 2594130803Smarcel loop=`expr $loop - 1` 2595130803Smarcel verstring="sgi$major.$iface:$verstring" 2596130803Smarcel done 2597130803Smarcel 2598130803Smarcel # Before this point, $major must not contain `.'. 2599130803Smarcel major=.$major 2600130803Smarcel versuffix="$major.$revision" 2601130803Smarcel ;; 2602130803Smarcel 2603130803Smarcel linux) 2604130803Smarcel major=.`expr $current - $age` 2605130803Smarcel versuffix="$major.$age.$revision" 2606130803Smarcel ;; 2607130803Smarcel 2608130803Smarcel osf) 2609130803Smarcel major=`expr $current - $age` 2610130803Smarcel versuffix=".$current.$age.$revision" 2611130803Smarcel verstring="$current.$age.$revision" 2612130803Smarcel 2613130803Smarcel # Add in all the interfaces that we are compatible with. 2614130803Smarcel loop=$age 2615130803Smarcel while test $loop != 0; do 2616130803Smarcel iface=`expr $current - $loop` 2617130803Smarcel loop=`expr $loop - 1` 2618130803Smarcel verstring="$verstring:${iface}.0" 2619130803Smarcel done 2620130803Smarcel 2621130803Smarcel # Make executables depend on our current version. 2622130803Smarcel verstring="$verstring:${current}.0" 2623130803Smarcel ;; 2624130803Smarcel 2625130803Smarcel sunos) 2626130803Smarcel major=".$current" 2627130803Smarcel versuffix=".$current.$revision" 2628130803Smarcel ;; 2629130803Smarcel 2630130803Smarcel windows) 2631130803Smarcel # Use '-' rather than '.', since we only want one 2632130803Smarcel # extension on DOS 8.3 filesystems. 2633130803Smarcel major=`expr $current - $age` 2634130803Smarcel versuffix="-$major" 2635130803Smarcel ;; 2636130803Smarcel 2637130803Smarcel *) 2638130803Smarcel $echo "$modename: unknown library version type \`$version_type'" 1>&2 2639130803Smarcel echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 2640130803Smarcel exit 1 2641130803Smarcel ;; 2642130803Smarcel esac 2643130803Smarcel 2644130803Smarcel # Clear the version info if we defaulted, and they specified a release. 2645130803Smarcel if test -z "$vinfo" && test -n "$release"; then 2646130803Smarcel major= 2647130803Smarcel verstring="0.0" 2648130803Smarcel if test "$need_version" = no; then 2649130803Smarcel versuffix= 2650130803Smarcel else 2651130803Smarcel versuffix=".0.0" 2652130803Smarcel fi 2653130803Smarcel fi 2654130803Smarcel 2655130803Smarcel # Remove version info from name if versioning should be avoided 2656130803Smarcel if test "$avoid_version" = yes && test "$need_version" = no; then 2657130803Smarcel major= 2658130803Smarcel versuffix= 2659130803Smarcel verstring="" 2660130803Smarcel fi 2661130803Smarcel 2662130803Smarcel # Check to see if the archive will have undefined symbols. 2663130803Smarcel if test "$allow_undefined" = yes; then 2664130803Smarcel if test "$allow_undefined_flag" = unsupported; then 2665130803Smarcel $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 2666130803Smarcel build_libtool_libs=no 2667130803Smarcel build_old_libs=yes 2668130803Smarcel fi 2669130803Smarcel else 2670130803Smarcel # Don't allow undefined symbols. 2671130803Smarcel allow_undefined_flag="$no_undefined_flag" 2672130803Smarcel fi 2673130803Smarcel fi 2674130803Smarcel 2675130803Smarcel if test "$mode" != relink; then 2676130803Smarcel # Remove our outputs, but don't remove object files since they 2677130803Smarcel # may have been created when compiling PIC objects. 2678130803Smarcel removelist= 2679130803Smarcel tempremovelist=`echo "$output_objdir/*"` 2680130803Smarcel for p in $tempremovelist; do 2681130803Smarcel case $p in 2682130803Smarcel *.$objext) 2683130803Smarcel ;; 2684130803Smarcel $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 2685130803Smarcel removelist="$removelist $p" 2686130803Smarcel ;; 2687130803Smarcel *) ;; 2688130803Smarcel esac 2689130803Smarcel done 2690130803Smarcel if test -n "$removelist"; then 2691130803Smarcel $show "${rm}r $removelist" 2692130803Smarcel $run ${rm}r $removelist 2693130803Smarcel fi 2694130803Smarcel fi 2695130803Smarcel 2696130803Smarcel # Now set the variables for building old libraries. 2697130803Smarcel if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 2698130803Smarcel oldlibs="$oldlibs $output_objdir/$libname.$libext" 2699130803Smarcel 2700130803Smarcel # Transform .lo files to .o files. 2701130803Smarcel oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 2702130803Smarcel fi 2703130803Smarcel 2704130803Smarcel # Eliminate all temporary directories. 2705130803Smarcel for path in $notinst_path; do 2706130803Smarcel lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` 2707130803Smarcel deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` 2708130803Smarcel dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` 2709130803Smarcel done 2710130803Smarcel 2711130803Smarcel if test -n "$xrpath"; then 2712130803Smarcel # If the user specified any rpath flags, then add them. 2713130803Smarcel temp_xrpath= 2714130803Smarcel for libdir in $xrpath; do 2715130803Smarcel temp_xrpath="$temp_xrpath -R$libdir" 2716130803Smarcel case "$finalize_rpath " in 2717130803Smarcel *" $libdir "*) ;; 2718130803Smarcel *) finalize_rpath="$finalize_rpath $libdir" ;; 2719130803Smarcel esac 2720130803Smarcel done 2721130803Smarcel if test $hardcode_into_libs != yes || test $build_old_libs = yes; then 2722130803Smarcel dependency_libs="$temp_xrpath $dependency_libs" 2723130803Smarcel fi 2724130803Smarcel fi 2725130803Smarcel 2726130803Smarcel # Make sure dlfiles contains only unique files that won't be dlpreopened 2727130803Smarcel old_dlfiles="$dlfiles" 2728130803Smarcel dlfiles= 2729130803Smarcel for lib in $old_dlfiles; do 2730130803Smarcel case " $dlprefiles $dlfiles " in 2731130803Smarcel *" $lib "*) ;; 2732130803Smarcel *) dlfiles="$dlfiles $lib" ;; 2733130803Smarcel esac 2734130803Smarcel done 2735130803Smarcel 2736130803Smarcel # Make sure dlprefiles contains only unique files 2737130803Smarcel old_dlprefiles="$dlprefiles" 2738130803Smarcel dlprefiles= 2739130803Smarcel for lib in $old_dlprefiles; do 2740130803Smarcel case "$dlprefiles " in 2741130803Smarcel *" $lib "*) ;; 2742130803Smarcel *) dlprefiles="$dlprefiles $lib" ;; 2743130803Smarcel esac 2744130803Smarcel done 2745130803Smarcel 2746130803Smarcel if test "$build_libtool_libs" = yes; then 2747130803Smarcel if test -n "$rpath"; then 2748130803Smarcel case $host in 2749130803Smarcel *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 2750130803Smarcel # these systems don't actually have a c library (as such)! 2751130803Smarcel ;; 2752130803Smarcel *-*-rhapsody* | *-*-darwin1.[012]) 2753130803Smarcel # Rhapsody C library is in the System framework 2754130803Smarcel deplibs="$deplibs -framework System" 2755130803Smarcel ;; 2756130803Smarcel *-*-netbsd*) 2757130803Smarcel # Don't link with libc until the a.out ld.so is fixed. 2758130803Smarcel ;; 2759130803Smarcel *) 2760130803Smarcel # Add libc to deplibs on all other systems if necessary. 2761130803Smarcel if test $build_libtool_need_lc = "yes"; then 2762130803Smarcel deplibs="$deplibs -lc" 2763130803Smarcel fi 2764130803Smarcel ;; 2765130803Smarcel esac 2766130803Smarcel fi 2767130803Smarcel 2768130803Smarcel # Transform deplibs into only deplibs that can be linked in shared. 2769130803Smarcel name_save=$name 2770130803Smarcel libname_save=$libname 2771130803Smarcel release_save=$release 2772130803Smarcel versuffix_save=$versuffix 2773130803Smarcel major_save=$major 2774130803Smarcel # I'm not sure if I'm treating the release correctly. I think 2775130803Smarcel # release should show up in the -l (ie -lgmp5) so we don't want to 2776130803Smarcel # add it in twice. Is that correct? 2777130803Smarcel release="" 2778130803Smarcel versuffix="" 2779130803Smarcel major="" 2780130803Smarcel newdeplibs= 2781130803Smarcel droppeddeps=no 2782130803Smarcel case $deplibs_check_method in 2783130803Smarcel pass_all) 2784130803Smarcel # Don't check for shared/static. Everything works. 2785130803Smarcel # This might be a little naive. We might want to check 2786130803Smarcel # whether the library exists or not. But this is on 2787130803Smarcel # osf3 & osf4 and I'm not really sure... Just 2788130803Smarcel # implementing what was already the behaviour. 2789130803Smarcel newdeplibs=$deplibs 2790130803Smarcel ;; 2791130803Smarcel test_compile) 2792130803Smarcel # This code stresses the "libraries are programs" paradigm to its 2793130803Smarcel # limits. Maybe even breaks it. We compile a program, linking it 2794130803Smarcel # against the deplibs as a proxy for the library. Then we can check 2795130803Smarcel # whether they linked in statically or dynamically with ldd. 2796130803Smarcel $rm conftest.c 2797130803Smarcel cat > conftest.c <<EOF 2798130803Smarcel int main() { return 0; } 2799130803SmarcelEOF 2800130803Smarcel $rm conftest 2801130803Smarcel $LTCC -o conftest conftest.c $deplibs 2802130803Smarcel if test $? -eq 0 ; then 2803130803Smarcel ldd_output=`ldd conftest` 2804130803Smarcel for i in $deplibs; do 2805130803Smarcel name="`expr $i : '-l\(.*\)'`" 2806130803Smarcel # If $name is empty we are operating on a -L argument. 2807130803Smarcel if test -n "$name" && test "$name" != "0"; then 2808130803Smarcel libname=`eval \\$echo \"$libname_spec\"` 2809130803Smarcel deplib_matches=`eval \\$echo \"$library_names_spec\"` 2810130803Smarcel set dummy $deplib_matches 2811130803Smarcel deplib_match=$2 2812130803Smarcel if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 2813130803Smarcel newdeplibs="$newdeplibs $i" 2814130803Smarcel else 2815130803Smarcel droppeddeps=yes 2816130803Smarcel echo 2817130803Smarcel echo "*** Warning: This library needs some functionality provided by $i." 2818130803Smarcel echo "*** I have the capability to make that library automatically link in when" 2819130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 2820130803Smarcel echo "*** shared version of the library, which you do not appear to have." 2821130803Smarcel fi 2822130803Smarcel else 2823130803Smarcel newdeplibs="$newdeplibs $i" 2824130803Smarcel fi 2825130803Smarcel done 2826130803Smarcel else 2827130803Smarcel # Error occured in the first compile. Let's try to salvage the situation: 2828130803Smarcel # Compile a seperate program for each library. 2829130803Smarcel for i in $deplibs; do 2830130803Smarcel name="`expr $i : '-l\(.*\)'`" 2831130803Smarcel # If $name is empty we are operating on a -L argument. 2832130803Smarcel if test -n "$name" && test "$name" != "0"; then 2833130803Smarcel $rm conftest 2834130803Smarcel $LTCC -o conftest conftest.c $i 2835130803Smarcel # Did it work? 2836130803Smarcel if test $? -eq 0 ; then 2837130803Smarcel ldd_output=`ldd conftest` 2838130803Smarcel libname=`eval \\$echo \"$libname_spec\"` 2839130803Smarcel deplib_matches=`eval \\$echo \"$library_names_spec\"` 2840130803Smarcel set dummy $deplib_matches 2841130803Smarcel deplib_match=$2 2842130803Smarcel if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 2843130803Smarcel newdeplibs="$newdeplibs $i" 2844130803Smarcel else 2845130803Smarcel droppeddeps=yes 2846130803Smarcel echo 2847130803Smarcel echo "*** Warning: This library needs some functionality provided by $i." 2848130803Smarcel echo "*** I have the capability to make that library automatically link in when" 2849130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 2850130803Smarcel echo "*** shared version of the library, which you do not appear to have." 2851130803Smarcel fi 2852130803Smarcel else 2853130803Smarcel droppeddeps=yes 2854130803Smarcel echo 2855130803Smarcel echo "*** Warning! Library $i is needed by this library but I was not able to" 2856130803Smarcel echo "*** make it link in! You will probably need to install it or some" 2857130803Smarcel echo "*** library that it depends on before this library will be fully" 2858130803Smarcel echo "*** functional. Installing it before continuing would be even better." 2859130803Smarcel fi 2860130803Smarcel else 2861130803Smarcel newdeplibs="$newdeplibs $i" 2862130803Smarcel fi 2863130803Smarcel done 2864130803Smarcel fi 2865130803Smarcel ;; 2866130803Smarcel file_magic*) 2867130803Smarcel set dummy $deplibs_check_method 2868130803Smarcel file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2869130803Smarcel for a_deplib in $deplibs; do 2870130803Smarcel name="`expr $a_deplib : '-l\(.*\)'`" 2871130803Smarcel # If $name is empty we are operating on a -L argument. 2872130803Smarcel if test -n "$name" && test "$name" != "0"; then 2873130803Smarcel libname=`eval \\$echo \"$libname_spec\"` 2874130803Smarcel for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 2875130803Smarcel potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 2876130803Smarcel for potent_lib in $potential_libs; do 2877130803Smarcel # Follow soft links. 2878130803Smarcel if ls -lLd "$potent_lib" 2>/dev/null \ 2879130803Smarcel | grep " -> " >/dev/null; then 2880130803Smarcel continue 2881130803Smarcel fi 2882130803Smarcel # The statement above tries to avoid entering an 2883130803Smarcel # endless loop below, in case of cyclic links. 2884130803Smarcel # We might still enter an endless loop, since a link 2885130803Smarcel # loop can be closed while we follow links, 2886130803Smarcel # but so what? 2887130803Smarcel potlib="$potent_lib" 2888130803Smarcel while test -h "$potlib" 2>/dev/null; do 2889130803Smarcel potliblink=`ls -ld $potlib | sed 's/.* -> //'` 2890130803Smarcel case $potliblink in 2891130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 2892130803Smarcel *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 2893130803Smarcel esac 2894130803Smarcel done 2895130803Smarcel if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 2896130803Smarcel | sed 10q \ 2897130803Smarcel | egrep "$file_magic_regex" > /dev/null; then 2898130803Smarcel newdeplibs="$newdeplibs $a_deplib" 2899130803Smarcel a_deplib="" 2900130803Smarcel break 2 2901130803Smarcel fi 2902130803Smarcel done 2903130803Smarcel done 2904130803Smarcel if test -n "$a_deplib" ; then 2905130803Smarcel droppeddeps=yes 2906130803Smarcel echo 2907130803Smarcel echo "*** Warning: This library needs some functionality provided by $a_deplib." 2908130803Smarcel echo "*** I have the capability to make that library automatically link in when" 2909130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 2910130803Smarcel echo "*** shared version of the library, which you do not appear to have." 2911130803Smarcel fi 2912130803Smarcel else 2913130803Smarcel # Add a -L argument. 2914130803Smarcel newdeplibs="$newdeplibs $a_deplib" 2915130803Smarcel fi 2916130803Smarcel done # Gone through all deplibs. 2917130803Smarcel ;; 2918130803Smarcel match_pattern*) 2919130803Smarcel set dummy $deplibs_check_method 2920130803Smarcel match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2921130803Smarcel for a_deplib in $deplibs; do 2922130803Smarcel name="`expr $a_deplib : '-l\(.*\)'`" 2923130803Smarcel # If $name is empty we are operating on a -L argument. 2924130803Smarcel if test -n "$name" && test "$name" != "0"; then 2925130803Smarcel libname=`eval \\$echo \"$libname_spec\"` 2926130803Smarcel for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 2927130803Smarcel potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 2928130803Smarcel for potent_lib in $potential_libs; do 2929130803Smarcel if eval echo \"$potent_lib\" 2>/dev/null \ 2930130803Smarcel | sed 10q \ 2931130803Smarcel | egrep "$match_pattern_regex" > /dev/null; then 2932130803Smarcel newdeplibs="$newdeplibs $a_deplib" 2933130803Smarcel a_deplib="" 2934130803Smarcel break 2 2935130803Smarcel fi 2936130803Smarcel done 2937130803Smarcel done 2938130803Smarcel if test -n "$a_deplib" ; then 2939130803Smarcel droppeddeps=yes 2940130803Smarcel echo 2941130803Smarcel echo "*** Warning: This library needs some functionality provided by $a_deplib." 2942130803Smarcel echo "*** I have the capability to make that library automatically link in when" 2943130803Smarcel echo "*** you link to this library. But I can only do this if you have a" 2944130803Smarcel echo "*** shared version of the library, which you do not appear to have." 2945130803Smarcel fi 2946130803Smarcel else 2947130803Smarcel # Add a -L argument. 2948130803Smarcel newdeplibs="$newdeplibs $a_deplib" 2949130803Smarcel fi 2950130803Smarcel done # Gone through all deplibs. 2951130803Smarcel ;; 2952130803Smarcel none | unknown | *) 2953130803Smarcel newdeplibs="" 2954130803Smarcel if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 2955130803Smarcel -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | 2956130803Smarcel grep . >/dev/null; then 2957130803Smarcel echo 2958130803Smarcel if test "X$deplibs_check_method" = "Xnone"; then 2959130803Smarcel echo "*** Warning: inter-library dependencies are not supported in this platform." 2960130803Smarcel else 2961130803Smarcel echo "*** Warning: inter-library dependencies are not known to be supported." 2962130803Smarcel fi 2963130803Smarcel echo "*** All declared inter-library dependencies are being dropped." 2964130803Smarcel droppeddeps=yes 2965130803Smarcel fi 2966130803Smarcel ;; 2967130803Smarcel esac 2968130803Smarcel versuffix=$versuffix_save 2969130803Smarcel major=$major_save 2970130803Smarcel release=$release_save 2971130803Smarcel libname=$libname_save 2972130803Smarcel name=$name_save 2973130803Smarcel 2974130803Smarcel case $host in 2975130803Smarcel *-*-rhapsody* | *-*-darwin1.[012]) 2976130803Smarcel # On Rhapsody replace the C library is the System framework 2977130803Smarcel newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 2978130803Smarcel ;; 2979130803Smarcel esac 2980130803Smarcel 2981130803Smarcel if test "$droppeddeps" = yes; then 2982130803Smarcel if test "$module" = yes; then 2983130803Smarcel echo 2984130803Smarcel echo "*** Warning: libtool could not satisfy all declared inter-library" 2985130803Smarcel echo "*** dependencies of module $libname. Therefore, libtool will create" 2986130803Smarcel echo "*** a static module, that should work as long as the dlopening" 2987130803Smarcel echo "*** application is linked with the -dlopen flag." 2988130803Smarcel if test -z "$global_symbol_pipe"; then 2989130803Smarcel echo 2990130803Smarcel echo "*** However, this would only work if libtool was able to extract symbol" 2991130803Smarcel echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2992130803Smarcel echo "*** not find such a program. So, this module is probably useless." 2993130803Smarcel echo "*** \`nm' from GNU binutils and a full rebuild may help." 2994130803Smarcel fi 2995130803Smarcel if test "$build_old_libs" = no; then 2996130803Smarcel oldlibs="$output_objdir/$libname.$libext" 2997130803Smarcel build_libtool_libs=module 2998130803Smarcel build_old_libs=yes 2999130803Smarcel else 3000130803Smarcel build_libtool_libs=no 3001130803Smarcel fi 3002130803Smarcel else 3003130803Smarcel echo "*** The inter-library dependencies that have been dropped here will be" 3004130803Smarcel echo "*** automatically added whenever a program is linked with this library" 3005130803Smarcel echo "*** or is declared to -dlopen it." 3006130803Smarcel 3007130803Smarcel if test $allow_undefined = no; then 3008130803Smarcel echo 3009130803Smarcel echo "*** Since this library must not contain undefined symbols," 3010130803Smarcel echo "*** because either the platform does not support them or" 3011130803Smarcel echo "*** it was explicitly requested with -no-undefined," 3012130803Smarcel echo "*** libtool will only create a static version of it." 3013130803Smarcel if test "$build_old_libs" = no; then 3014130803Smarcel oldlibs="$output_objdir/$libname.$libext" 3015130803Smarcel build_libtool_libs=module 3016130803Smarcel build_old_libs=yes 3017130803Smarcel else 3018130803Smarcel build_libtool_libs=no 3019130803Smarcel fi 3020130803Smarcel fi 3021130803Smarcel fi 3022130803Smarcel fi 3023130803Smarcel # Done checking deplibs! 3024130803Smarcel deplibs=$newdeplibs 3025130803Smarcel fi 3026130803Smarcel 3027130803Smarcel # All the library-specific variables (install_libdir is set above). 3028130803Smarcel library_names= 3029130803Smarcel old_library= 3030130803Smarcel dlname= 3031130803Smarcel 3032130803Smarcel # Test again, we may have decided not to build it any more 3033130803Smarcel if test "$build_libtool_libs" = yes; then 3034130803Smarcel if test $hardcode_into_libs = yes; then 3035130803Smarcel # Hardcode the library paths 3036130803Smarcel hardcode_libdirs= 3037130803Smarcel dep_rpath= 3038130803Smarcel rpath="$finalize_rpath" 3039130803Smarcel test "$mode" != relink && rpath="$compile_rpath$rpath" 3040130803Smarcel for libdir in $rpath; do 3041130803Smarcel if test -n "$hardcode_libdir_flag_spec"; then 3042130803Smarcel if test -n "$hardcode_libdir_separator"; then 3043130803Smarcel if test -z "$hardcode_libdirs"; then 3044130803Smarcel hardcode_libdirs="$libdir" 3045130803Smarcel else 3046130803Smarcel # Just accumulate the unique libdirs. 3047130803Smarcel case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3048130803Smarcel *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3049130803Smarcel ;; 3050130803Smarcel *) 3051130803Smarcel hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3052130803Smarcel ;; 3053130803Smarcel esac 3054130803Smarcel fi 3055130803Smarcel else 3056130803Smarcel eval flag=\"$hardcode_libdir_flag_spec\" 3057130803Smarcel dep_rpath="$dep_rpath $flag" 3058130803Smarcel fi 3059130803Smarcel elif test -n "$runpath_var"; then 3060130803Smarcel case "$perm_rpath " in 3061130803Smarcel *" $libdir "*) ;; 3062130803Smarcel *) perm_rpath="$perm_rpath $libdir" ;; 3063130803Smarcel esac 3064130803Smarcel fi 3065130803Smarcel done 3066130803Smarcel # Substitute the hardcoded libdirs into the rpath. 3067130803Smarcel if test -n "$hardcode_libdir_separator" && 3068130803Smarcel test -n "$hardcode_libdirs"; then 3069130803Smarcel libdir="$hardcode_libdirs" 3070130803Smarcel eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3071130803Smarcel fi 3072130803Smarcel if test -n "$runpath_var" && test -n "$perm_rpath"; then 3073130803Smarcel # We should set the runpath_var. 3074130803Smarcel rpath= 3075130803Smarcel for dir in $perm_rpath; do 3076130803Smarcel rpath="$rpath$dir:" 3077130803Smarcel done 3078130803Smarcel eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3079130803Smarcel fi 3080130803Smarcel test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3081130803Smarcel fi 3082130803Smarcel 3083130803Smarcel shlibpath="$finalize_shlibpath" 3084130803Smarcel test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3085130803Smarcel if test -n "$shlibpath"; then 3086130803Smarcel eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3087130803Smarcel fi 3088130803Smarcel 3089130803Smarcel # Get the real and link names of the library. 3090130803Smarcel eval library_names=\"$library_names_spec\" 3091130803Smarcel set dummy $library_names 3092130803Smarcel realname="$2" 3093130803Smarcel shift; shift 3094130803Smarcel 3095130803Smarcel if test -n "$soname_spec"; then 3096130803Smarcel eval soname=\"$soname_spec\" 3097130803Smarcel else 3098130803Smarcel soname="$realname" 3099130803Smarcel fi 3100130803Smarcel test -z "$dlname" && dlname=$soname 3101130803Smarcel 3102130803Smarcel lib="$output_objdir/$realname" 3103130803Smarcel for link 3104130803Smarcel do 3105130803Smarcel linknames="$linknames $link" 3106130803Smarcel done 3107130803Smarcel 3108130803Smarcel# # Ensure that we have .o objects for linkers which dislike .lo 3109130803Smarcel# # (e.g. aix) in case we are running --disable-static 3110130803Smarcel# for obj in $libobjs; do 3111130803Smarcel# xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 3112130803Smarcel# if test "X$xdir" = "X$obj"; then 3113130803Smarcel# xdir="." 3114130803Smarcel# else 3115130803Smarcel# xdir="$xdir" 3116130803Smarcel# fi 3117130803Smarcel# baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 3118130803Smarcel# oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` 3119130803Smarcel# if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then 3120130803Smarcel# $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" 3121130803Smarcel# $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? 3122130803Smarcel# fi 3123130803Smarcel# done 3124130803Smarcel 3125130803Smarcel # Use standard objects if they are pic 3126130803Smarcel test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3127130803Smarcel 3128130803Smarcel # Prepare the list of exported symbols 3129130803Smarcel if test -z "$export_symbols"; then 3130130803Smarcel if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 3131130803Smarcel $show "generating symbol list for \`$libname.la'" 3132130803Smarcel export_symbols="$output_objdir/$libname.exp" 3133130803Smarcel $run $rm $export_symbols 3134130803Smarcel eval cmds=\"$export_symbols_cmds\" 3135130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3136130803Smarcel for cmd in $cmds; do 3137130803Smarcel IFS="$save_ifs" 3138130803Smarcel $show "$cmd" 3139130803Smarcel $run eval "$cmd" || exit $? 3140130803Smarcel done 3141130803Smarcel IFS="$save_ifs" 3142130803Smarcel if test -n "$export_symbols_regex"; then 3143130803Smarcel $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3144130803Smarcel $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 3145130803Smarcel $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 3146130803Smarcel $run eval '$mv "${export_symbols}T" "$export_symbols"' 3147130803Smarcel fi 3148130803Smarcel fi 3149130803Smarcel fi 3150130803Smarcel 3151130803Smarcel if test -n "$export_symbols" && test -n "$include_expsyms"; then 3152130803Smarcel $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 3153130803Smarcel fi 3154130803Smarcel 3155130803Smarcel if test -n "$convenience"; then 3156130803Smarcel if test -n "$whole_archive_flag_spec"; then 3157130803Smarcel save_libobjs=$libobjs 3158130803Smarcel eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3159130803Smarcel else 3160130803Smarcel gentop="$output_objdir/${outputname}x" 3161130803Smarcel $show "${rm}r $gentop" 3162130803Smarcel $run ${rm}r "$gentop" 3163130803Smarcel $show "$mkdir $gentop" 3164130803Smarcel $run $mkdir "$gentop" 3165130803Smarcel status=$? 3166130803Smarcel if test $status -ne 0 && test ! -d "$gentop"; then 3167130803Smarcel exit $status 3168130803Smarcel fi 3169130803Smarcel generated="$generated $gentop" 3170130803Smarcel 3171130803Smarcel for xlib in $convenience; do 3172130803Smarcel # Extract the objects. 3173130803Smarcel case $xlib in 3174130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 3175130803Smarcel *) xabs=`pwd`"/$xlib" ;; 3176130803Smarcel esac 3177130803Smarcel xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 3178130803Smarcel xdir="$gentop/$xlib" 3179130803Smarcel 3180130803Smarcel $show "${rm}r $xdir" 3181130803Smarcel $run ${rm}r "$xdir" 3182130803Smarcel $show "$mkdir $xdir" 3183130803Smarcel $run $mkdir "$xdir" 3184130803Smarcel status=$? 3185130803Smarcel if test $status -ne 0 && test ! -d "$xdir"; then 3186130803Smarcel exit $status 3187130803Smarcel fi 3188130803Smarcel $show "(cd $xdir && $AR x $xabs)" 3189130803Smarcel $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 3190130803Smarcel 3191130803Smarcel libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 3192130803Smarcel done 3193130803Smarcel fi 3194130803Smarcel fi 3195130803Smarcel 3196130803Smarcel if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 3197130803Smarcel eval flag=\"$thread_safe_flag_spec\" 3198130803Smarcel linker_flags="$linker_flags $flag" 3199130803Smarcel fi 3200130803Smarcel 3201130803Smarcel # Make a backup of the uninstalled library when relinking 3202130803Smarcel if test "$mode" = relink; then 3203130803Smarcel $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 3204130803Smarcel fi 3205130803Smarcel 3206130803Smarcel # Do each of the archive commands. 3207130803Smarcel if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 3208130803Smarcel eval cmds=\"$archive_expsym_cmds\" 3209130803Smarcel else 3210130803Smarcel eval cmds=\"$archive_cmds\" 3211130803Smarcel fi 3212130803Smarcel if len=`expr "X$cmds" : ".*"` && 3213130803Smarcel test $len -le $max_cmd_len; then 3214130803Smarcel : 3215130803Smarcel else 3216130803Smarcel # The command line is too long to link in one step, link piecewise. 3217130803Smarcel $echo "creating reloadable object files..." 3218130803Smarcel 3219130803Smarcel # Save the value of $output and $libobjs because we want to 3220130803Smarcel # use them later. If we have whole_archive_flag_spec, we 3221130803Smarcel # want to use save_libobjs as it was before 3222130803Smarcel # whole_archive_flag_spec was expanded, because we can't 3223130803Smarcel # assume the linker understands whole_archive_flag_spec. 3224130803Smarcel # This may have to be revisited, in case too many 3225130803Smarcel # convenience libraries get linked in and end up exceeding 3226130803Smarcel # the spec. 3227130803Smarcel if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 3228130803Smarcel save_libobjs=$libobjs 3229130803Smarcel fi 3230130803Smarcel save_output=$output 3231130803Smarcel 3232130803Smarcel # Clear the reloadable object creation command queue and 3233130803Smarcel # initialize k to one. 3234130803Smarcel test_cmds= 3235130803Smarcel concat_cmds= 3236130803Smarcel objlist= 3237130803Smarcel delfiles= 3238130803Smarcel last_robj= 3239130803Smarcel k=1 3240130803Smarcel output=$output_objdir/$save_output-${k}.$objext 3241130803Smarcel # Loop over the list of objects to be linked. 3242130803Smarcel for obj in $save_libobjs 3243130803Smarcel do 3244130803Smarcel eval test_cmds=\"$reload_cmds $objlist $last_robj\" 3245130803Smarcel if test "X$objlist" = X || 3246130803Smarcel { len=`expr "X$test_cmds" : ".*"` && 3247130803Smarcel test $len -le $max_cmd_len; }; then 3248130803Smarcel objlist="$objlist $obj" 3249130803Smarcel else 3250130803Smarcel # The command $test_cmds is almost too long, add a 3251130803Smarcel # command to the queue. 3252130803Smarcel if test $k -eq 1 ; then 3253130803Smarcel # The first file doesn't have a previous command to add. 3254130803Smarcel eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 3255130803Smarcel else 3256130803Smarcel # All subsequent reloadable object files will link in 3257130803Smarcel # the last one created. 3258130803Smarcel eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 3259130803Smarcel fi 3260130803Smarcel last_robj=$output_objdir/$save_output-${k}.$objext 3261130803Smarcel k=`expr $k + 1` 3262130803Smarcel output=$output_objdir/$save_output-${k}.$objext 3263130803Smarcel objlist=$obj 3264130803Smarcel len=1 3265130803Smarcel fi 3266130803Smarcel done 3267130803Smarcel # Handle the remaining objects by creating one last 3268130803Smarcel # reloadable object file. All subsequent reloadable object 3269130803Smarcel # files will link in the last one created. 3270130803Smarcel test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 3271130803Smarcel eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 3272130803Smarcel 3273130803Smarcel # Set up a command to remove the reloadale object files 3274130803Smarcel # after they are used. 3275130803Smarcel i=0 3276130803Smarcel while test $i -lt $k 3277130803Smarcel do 3278130803Smarcel i=`expr $i + 1` 3279130803Smarcel delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 3280130803Smarcel done 3281130803Smarcel 3282130803Smarcel $echo "creating a temporary reloadable object file: $output" 3283130803Smarcel 3284130803Smarcel # Loop through the commands generated above and execute them. 3285130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3286130803Smarcel for cmd in $concat_cmds; do 3287130803Smarcel IFS="$save_ifs" 3288130803Smarcel $show "$cmd" 3289130803Smarcel $run eval "$cmd" || exit $? 3290130803Smarcel done 3291130803Smarcel IFS="$save_ifs" 3292130803Smarcel 3293130803Smarcel libobjs=$output 3294130803Smarcel # Restore the value of output. 3295130803Smarcel output=$save_output 3296130803Smarcel 3297130803Smarcel if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 3298130803Smarcel eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3299130803Smarcel fi 3300130803Smarcel # Expand the library linking commands again to reset the 3301130803Smarcel # value of $libobjs for piecewise linking. 3302130803Smarcel 3303130803Smarcel # Do each of the archive commands. 3304130803Smarcel if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 3305130803Smarcel eval cmds=\"$archive_expsym_cmds\" 3306130803Smarcel else 3307130803Smarcel eval cmds=\"$archive_cmds\" 3308130803Smarcel fi 3309130803Smarcel 3310130803Smarcel # Append the command to remove the reloadable object files 3311130803Smarcel # to the just-reset $cmds. 3312130803Smarcel eval cmds=\"\$cmds~$rm $delfiles\" 3313130803Smarcel fi 3314130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3315130803Smarcel for cmd in $cmds; do 3316130803Smarcel IFS="$save_ifs" 3317130803Smarcel $show "$cmd" 3318130803Smarcel $run eval "$cmd" || exit $? 3319130803Smarcel done 3320130803Smarcel IFS="$save_ifs" 3321130803Smarcel 3322130803Smarcel # Restore the uninstalled library and exit 3323130803Smarcel if test "$mode" = relink; then 3324130803Smarcel $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 3325130803Smarcel exit 0 3326130803Smarcel fi 3327130803Smarcel 3328130803Smarcel # Create links to the real library. 3329130803Smarcel for linkname in $linknames; do 3330130803Smarcel if test "$realname" != "$linkname"; then 3331130803Smarcel $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 3332130803Smarcel $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 3333130803Smarcel fi 3334130803Smarcel done 3335130803Smarcel 3336130803Smarcel # If -module or -export-dynamic was specified, set the dlname. 3337130803Smarcel if test "$module" = yes || test "$export_dynamic" = yes; then 3338130803Smarcel # On all known operating systems, these are identical. 3339130803Smarcel dlname="$soname" 3340130803Smarcel fi 3341130803Smarcel fi 3342130803Smarcel ;; 3343130803Smarcel 3344130803Smarcel obj) 3345130803Smarcel if test -n "$deplibs"; then 3346130803Smarcel $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 3347130803Smarcel fi 3348130803Smarcel 3349130803Smarcel if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3350130803Smarcel $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 3351130803Smarcel fi 3352130803Smarcel 3353130803Smarcel if test -n "$rpath"; then 3354130803Smarcel $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 3355130803Smarcel fi 3356130803Smarcel 3357130803Smarcel if test -n "$xrpath"; then 3358130803Smarcel $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 3359130803Smarcel fi 3360130803Smarcel 3361130803Smarcel if test -n "$vinfo"; then 3362130803Smarcel $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 3363130803Smarcel fi 3364130803Smarcel 3365130803Smarcel if test -n "$release"; then 3366130803Smarcel $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 3367130803Smarcel fi 3368130803Smarcel 3369130803Smarcel case $output in 3370130803Smarcel *.lo) 3371130803Smarcel if test -n "$objs$old_deplibs"; then 3372130803Smarcel $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 3373130803Smarcel exit 1 3374130803Smarcel fi 3375130803Smarcel libobj="$output" 3376130803Smarcel obj=`$echo "X$output" | $Xsed -e "$lo2o"` 3377130803Smarcel ;; 3378130803Smarcel *) 3379130803Smarcel libobj= 3380130803Smarcel obj="$output" 3381130803Smarcel ;; 3382130803Smarcel esac 3383130803Smarcel 3384130803Smarcel # Delete the old objects. 3385130803Smarcel $run $rm $obj $libobj 3386130803Smarcel 3387130803Smarcel # Objects from convenience libraries. This assumes 3388130803Smarcel # single-version convenience libraries. Whenever we create 3389130803Smarcel # different ones for PIC/non-PIC, this we'll have to duplicate 3390130803Smarcel # the extraction. 3391130803Smarcel reload_conv_objs= 3392130803Smarcel gentop= 3393130803Smarcel # reload_cmds runs $LD directly, so let us get rid of 3394130803Smarcel # -Wl from whole_archive_flag_spec 3395130803Smarcel wl= 3396130803Smarcel 3397130803Smarcel if test -n "$convenience"; then 3398130803Smarcel if test -n "$whole_archive_flag_spec"; then 3399130803Smarcel eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 3400130803Smarcel else 3401130803Smarcel gentop="$output_objdir/${obj}x" 3402130803Smarcel $show "${rm}r $gentop" 3403130803Smarcel $run ${rm}r "$gentop" 3404130803Smarcel $show "$mkdir $gentop" 3405130803Smarcel $run $mkdir "$gentop" 3406130803Smarcel status=$? 3407130803Smarcel if test $status -ne 0 && test ! -d "$gentop"; then 3408130803Smarcel exit $status 3409130803Smarcel fi 3410130803Smarcel generated="$generated $gentop" 3411130803Smarcel 3412130803Smarcel for xlib in $convenience; do 3413130803Smarcel # Extract the objects. 3414130803Smarcel case $xlib in 3415130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 3416130803Smarcel *) xabs=`pwd`"/$xlib" ;; 3417130803Smarcel esac 3418130803Smarcel xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 3419130803Smarcel xdir="$gentop/$xlib" 3420130803Smarcel 3421130803Smarcel $show "${rm}r $xdir" 3422130803Smarcel $run ${rm}r "$xdir" 3423130803Smarcel $show "$mkdir $xdir" 3424130803Smarcel $run $mkdir "$xdir" 3425130803Smarcel status=$? 3426130803Smarcel if test $status -ne 0 && test ! -d "$xdir"; then 3427130803Smarcel exit $status 3428130803Smarcel fi 3429130803Smarcel $show "(cd $xdir && $AR x $xabs)" 3430130803Smarcel $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 3431130803Smarcel 3432130803Smarcel reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 3433130803Smarcel done 3434130803Smarcel fi 3435130803Smarcel fi 3436130803Smarcel 3437130803Smarcel # Create the old-style object. 3438130803Smarcel 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 3439130803Smarcel 3440130803Smarcel output="$obj" 3441130803Smarcel eval cmds=\"$reload_cmds\" 3442130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3443130803Smarcel for cmd in $cmds; do 3444130803Smarcel IFS="$save_ifs" 3445130803Smarcel $show "$cmd" 3446130803Smarcel $run eval "$cmd" || exit $? 3447130803Smarcel done 3448130803Smarcel IFS="$save_ifs" 3449130803Smarcel 3450130803Smarcel # Exit if we aren't doing a library object file. 3451130803Smarcel if test -z "$libobj"; then 3452130803Smarcel if test -n "$gentop"; then 3453130803Smarcel $show "${rm}r $gentop" 3454130803Smarcel $run ${rm}r $gentop 3455130803Smarcel fi 3456130803Smarcel 3457130803Smarcel exit 0 3458130803Smarcel fi 3459130803Smarcel 3460130803Smarcel if test "$build_libtool_libs" != yes; then 3461130803Smarcel if test -n "$gentop"; then 3462130803Smarcel $show "${rm}r $gentop" 3463130803Smarcel $run ${rm}r $gentop 3464130803Smarcel fi 3465130803Smarcel 3466130803Smarcel # Create an invalid libtool object if no PIC, so that we don't 3467130803Smarcel # accidentally link it into a program. 3468130803Smarcel # $show "echo timestamp > $libobj" 3469130803Smarcel # $run eval "echo timestamp > $libobj" || exit $? 3470130803Smarcel exit 0 3471130803Smarcel fi 3472130803Smarcel 3473130803Smarcel if test -n "$pic_flag" || test "$pic_mode" != default; then 3474130803Smarcel # Only do commands if we really have different PIC objects. 3475130803Smarcel reload_objs="$libobjs $reload_conv_objs" 3476130803Smarcel output="$libobj" 3477130803Smarcel eval cmds=\"$reload_cmds\" 3478130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3479130803Smarcel for cmd in $cmds; do 3480130803Smarcel IFS="$save_ifs" 3481130803Smarcel $show "$cmd" 3482130803Smarcel $run eval "$cmd" || exit $? 3483130803Smarcel done 3484130803Smarcel IFS="$save_ifs" 3485130803Smarcel# else 3486130803Smarcel# # Just create a symlink. 3487130803Smarcel# $show $rm $libobj 3488130803Smarcel# $run $rm $libobj 3489130803Smarcel# xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` 3490130803Smarcel# if test "X$xdir" = "X$libobj"; then 3491130803Smarcel# xdir="." 3492130803Smarcel# else 3493130803Smarcel# xdir="$xdir" 3494130803Smarcel# fi 3495130803Smarcel# baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` 3496130803Smarcel# oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` 3497130803Smarcel# $show "(cd $xdir && $LN_S $oldobj $baseobj)" 3498130803Smarcel# $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? 3499130803Smarcel fi 3500130803Smarcel 3501130803Smarcel if test -n "$gentop"; then 3502130803Smarcel $show "${rm}r $gentop" 3503130803Smarcel $run ${rm}r $gentop 3504130803Smarcel fi 3505130803Smarcel 3506130803Smarcel exit 0 3507130803Smarcel ;; 3508130803Smarcel 3509130803Smarcel prog) 3510130803Smarcel case $host in 3511130803Smarcel *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; 3512130803Smarcel esac 3513130803Smarcel if test -n "$vinfo"; then 3514130803Smarcel $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 3515130803Smarcel fi 3516130803Smarcel 3517130803Smarcel if test -n "$release"; then 3518130803Smarcel $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 3519130803Smarcel fi 3520130803Smarcel 3521130803Smarcel if test "$preload" = yes; then 3522130803Smarcel if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 3523130803Smarcel test "$dlopen_self_static" = unknown; then 3524130803Smarcel $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 3525130803Smarcel fi 3526130803Smarcel fi 3527130803Smarcel 3528130803Smarcel case $host in 3529130803Smarcel *-*-rhapsody* | *-*-darwin1.[012]) 3530130803Smarcel # On Rhapsody replace the C library is the System framework 3531130803Smarcel compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 3532130803Smarcel finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 3533130803Smarcel ;; 3534130803Smarcel esac 3535130803Smarcel 3536130803Smarcel compile_command="$compile_command $compile_deplibs" 3537130803Smarcel finalize_command="$finalize_command $finalize_deplibs" 3538130803Smarcel 3539130803Smarcel if test -n "$rpath$xrpath"; then 3540130803Smarcel # If the user specified any rpath flags, then add them. 3541130803Smarcel for libdir in $rpath $xrpath; do 3542130803Smarcel # This is the magic to use -rpath. 3543130803Smarcel case "$finalize_rpath " in 3544130803Smarcel *" $libdir "*) ;; 3545130803Smarcel *) finalize_rpath="$finalize_rpath $libdir" ;; 3546130803Smarcel esac 3547130803Smarcel done 3548130803Smarcel fi 3549130803Smarcel 3550130803Smarcel # Now hardcode the library paths 3551130803Smarcel rpath= 3552130803Smarcel hardcode_libdirs= 3553130803Smarcel for libdir in $compile_rpath $finalize_rpath; do 3554130803Smarcel if test -n "$hardcode_libdir_flag_spec"; then 3555130803Smarcel if test -n "$hardcode_libdir_separator"; then 3556130803Smarcel if test -z "$hardcode_libdirs"; then 3557130803Smarcel hardcode_libdirs="$libdir" 3558130803Smarcel else 3559130803Smarcel # Just accumulate the unique libdirs. 3560130803Smarcel case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3561130803Smarcel *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3562130803Smarcel ;; 3563130803Smarcel *) 3564130803Smarcel hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3565130803Smarcel ;; 3566130803Smarcel esac 3567130803Smarcel fi 3568130803Smarcel else 3569130803Smarcel eval flag=\"$hardcode_libdir_flag_spec\" 3570130803Smarcel rpath="$rpath $flag" 3571130803Smarcel fi 3572130803Smarcel elif test -n "$runpath_var"; then 3573130803Smarcel case "$perm_rpath " in 3574130803Smarcel *" $libdir "*) ;; 3575130803Smarcel *) perm_rpath="$perm_rpath $libdir" ;; 3576130803Smarcel esac 3577130803Smarcel fi 3578130803Smarcel case $host in 3579130803Smarcel *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 3580130803Smarcel case :$dllsearchpath: in 3581130803Smarcel *":$libdir:"*) ;; 3582130803Smarcel *) dllsearchpath="$dllsearchpath:$libdir";; 3583130803Smarcel esac 3584130803Smarcel ;; 3585130803Smarcel esac 3586130803Smarcel done 3587130803Smarcel # Substitute the hardcoded libdirs into the rpath. 3588130803Smarcel if test -n "$hardcode_libdir_separator" && 3589130803Smarcel test -n "$hardcode_libdirs"; then 3590130803Smarcel libdir="$hardcode_libdirs" 3591130803Smarcel eval rpath=\" $hardcode_libdir_flag_spec\" 3592130803Smarcel fi 3593130803Smarcel compile_rpath="$rpath" 3594130803Smarcel 3595130803Smarcel rpath= 3596130803Smarcel hardcode_libdirs= 3597130803Smarcel for libdir in $finalize_rpath; do 3598130803Smarcel if test -n "$hardcode_libdir_flag_spec"; then 3599130803Smarcel if test -n "$hardcode_libdir_separator"; then 3600130803Smarcel if test -z "$hardcode_libdirs"; then 3601130803Smarcel hardcode_libdirs="$libdir" 3602130803Smarcel else 3603130803Smarcel # Just accumulate the unique libdirs. 3604130803Smarcel case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3605130803Smarcel *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3606130803Smarcel ;; 3607130803Smarcel *) 3608130803Smarcel hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3609130803Smarcel ;; 3610130803Smarcel esac 3611130803Smarcel fi 3612130803Smarcel else 3613130803Smarcel eval flag=\"$hardcode_libdir_flag_spec\" 3614130803Smarcel rpath="$rpath $flag" 3615130803Smarcel fi 3616130803Smarcel elif test -n "$runpath_var"; then 3617130803Smarcel case "$finalize_perm_rpath " in 3618130803Smarcel *" $libdir "*) ;; 3619130803Smarcel *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 3620130803Smarcel esac 3621130803Smarcel fi 3622130803Smarcel done 3623130803Smarcel # Substitute the hardcoded libdirs into the rpath. 3624130803Smarcel if test -n "$hardcode_libdir_separator" && 3625130803Smarcel test -n "$hardcode_libdirs"; then 3626130803Smarcel libdir="$hardcode_libdirs" 3627130803Smarcel eval rpath=\" $hardcode_libdir_flag_spec\" 3628130803Smarcel fi 3629130803Smarcel finalize_rpath="$rpath" 3630130803Smarcel 3631130803Smarcel dlsyms= 3632130803Smarcel if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3633130803Smarcel if test -n "$NM" && test -n "$global_symbol_pipe"; then 3634130803Smarcel dlsyms="${outputname}S.c" 3635130803Smarcel else 3636130803Smarcel $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 3637130803Smarcel fi 3638130803Smarcel fi 3639130803Smarcel 3640130803Smarcel if test -n "$dlsyms"; then 3641130803Smarcel case $dlsyms in 3642130803Smarcel "") ;; 3643130803Smarcel *.c) 3644130803Smarcel # Discover the nlist of each of the dlfiles. 3645130803Smarcel nlist="$output_objdir/${outputname}.nm" 3646130803Smarcel 3647130803Smarcel $show "$rm $nlist ${nlist}S ${nlist}T" 3648130803Smarcel $run $rm "$nlist" "${nlist}S" "${nlist}T" 3649130803Smarcel 3650130803Smarcel # Parse the name list into a source file. 3651130803Smarcel $show "creating $output_objdir/$dlsyms" 3652130803Smarcel 3653130803Smarcel test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 3654130803Smarcel/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 3655130803Smarcel/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 3656130803Smarcel 3657130803Smarcel#ifdef __cplusplus 3658130803Smarcelextern \"C\" { 3659130803Smarcel#endif 3660130803Smarcel 3661130803Smarcel/* Prevent the only kind of declaration conflicts we can make. */ 3662130803Smarcel#define lt_preloaded_symbols some_other_symbol 3663130803Smarcel 3664130803Smarcel/* External symbol declarations for the compiler. */\ 3665130803Smarcel" 3666130803Smarcel 3667130803Smarcel if test "$dlself" = yes; then 3668130803Smarcel $show "generating symbol list for \`$output'" 3669130803Smarcel 3670130803Smarcel test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 3671130803Smarcel 3672130803Smarcel # Add our own program objects to the symbol list. 3673130803Smarcel progfiles="$objs$old_deplibs" 3674130803Smarcel for arg in $progfiles; do 3675130803Smarcel $show "extracting global C symbols from \`$arg'" 3676130803Smarcel $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 3677130803Smarcel done 3678130803Smarcel 3679130803Smarcel if test -n "$exclude_expsyms"; then 3680130803Smarcel $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3681130803Smarcel $run eval '$mv "$nlist"T "$nlist"' 3682130803Smarcel fi 3683130803Smarcel 3684130803Smarcel if test -n "$export_symbols_regex"; then 3685130803Smarcel $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3686130803Smarcel $run eval '$mv "$nlist"T "$nlist"' 3687130803Smarcel fi 3688130803Smarcel 3689130803Smarcel # Prepare the list of exported symbols 3690130803Smarcel if test -z "$export_symbols"; then 3691130803Smarcel export_symbols="$output_objdir/$output.exp" 3692130803Smarcel $run $rm $export_symbols 3693130803Smarcel $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3694130803Smarcel else 3695130803Smarcel $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' 3696130803Smarcel $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' 3697130803Smarcel $run eval 'mv "$nlist"T "$nlist"' 3698130803Smarcel fi 3699130803Smarcel fi 3700130803Smarcel 3701130803Smarcel for arg in $dlprefiles; do 3702130803Smarcel $show "extracting global C symbols from \`$arg'" 3703130803Smarcel name=`echo "$arg" | sed -e 's%^.*/%%'` 3704130803Smarcel $run eval 'echo ": $name " >> "$nlist"' 3705130803Smarcel $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 3706130803Smarcel done 3707130803Smarcel 3708130803Smarcel if test -z "$run"; then 3709130803Smarcel # Make sure we have at least an empty file. 3710130803Smarcel test -f "$nlist" || : > "$nlist" 3711130803Smarcel 3712130803Smarcel if test -n "$exclude_expsyms"; then 3713130803Smarcel egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3714130803Smarcel $mv "$nlist"T "$nlist" 3715130803Smarcel fi 3716130803Smarcel 3717130803Smarcel # Try sorting and uniquifying the output. 3718130803Smarcel if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then 3719130803Smarcel : 3720130803Smarcel else 3721130803Smarcel grep -v "^: " < "$nlist" > "$nlist"S 3722130803Smarcel fi 3723130803Smarcel 3724130803Smarcel if test -f "$nlist"S; then 3725130803Smarcel eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 3726130803Smarcel else 3727130803Smarcel echo '/* NONE */' >> "$output_objdir/$dlsyms" 3728130803Smarcel fi 3729130803Smarcel 3730130803Smarcel $echo >> "$output_objdir/$dlsyms" "\ 3731130803Smarcel 3732130803Smarcel#undef lt_preloaded_symbols 3733130803Smarcel 3734130803Smarcel#if defined (__STDC__) && __STDC__ 3735130803Smarcel# define lt_ptr_t void * 3736130803Smarcel#else 3737130803Smarcel# define lt_ptr_t char * 3738130803Smarcel# define const 3739130803Smarcel#endif 3740130803Smarcel 3741130803Smarcel/* The mapping between symbol names and symbols. */ 3742130803Smarcelconst struct { 3743130803Smarcel const char *name; 3744130803Smarcel lt_ptr_t address; 3745130803Smarcel} 3746130803Smarcellt_preloaded_symbols[] = 3747130803Smarcel{\ 3748130803Smarcel" 3749130803Smarcel 3750130803Smarcel sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ 3751130803Smarcel -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ 3752130803Smarcel < "$nlist" >> "$output_objdir/$dlsyms" 3753130803Smarcel 3754130803Smarcel $echo >> "$output_objdir/$dlsyms" "\ 3755130803Smarcel {0, (lt_ptr_t) 0} 3756130803Smarcel}; 3757130803Smarcel 3758130803Smarcel/* This works around a problem in FreeBSD linker */ 3759130803Smarcel#ifdef FREEBSD_WORKAROUND 3760130803Smarcelstatic const void *lt_preloaded_setup() { 3761130803Smarcel return lt_preloaded_symbols; 3762130803Smarcel} 3763130803Smarcel#endif 3764130803Smarcel 3765130803Smarcel#ifdef __cplusplus 3766130803Smarcel} 3767130803Smarcel#endif\ 3768130803Smarcel" 3769130803Smarcel fi 3770130803Smarcel 3771130803Smarcel pic_flag_for_symtable= 3772130803Smarcel case $host in 3773130803Smarcel # compiling the symbol table file with pic_flag works around 3774130803Smarcel # a FreeBSD bug that causes programs to crash when -lm is 3775130803Smarcel # linked before any other PIC object. But we must not use 3776130803Smarcel # pic_flag when linking with -static. The problem exists in 3777130803Smarcel # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3778130803Smarcel *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3779130803Smarcel case "$compile_command " in 3780130803Smarcel *" -static "*) ;; 3781130803Smarcel *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 3782130803Smarcel esac;; 3783130803Smarcel *-*-hpux*) 3784130803Smarcel case "$compile_command " in 3785130803Smarcel *" -static "*) ;; 3786130803Smarcel *) pic_flag_for_symtable=" $pic_flag";; 3787130803Smarcel esac 3788130803Smarcel esac 3789130803Smarcel 3790130803Smarcel # Now compile the dynamic symbol file. 3791130803Smarcel $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 3792130803Smarcel $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 3793130803Smarcel 3794130803Smarcel # Clean up the generated files. 3795130803Smarcel $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 3796130803Smarcel $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 3797130803Smarcel 3798130803Smarcel # Transform the symbol file into the correct name. 3799130803Smarcel compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 3800130803Smarcel finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 3801130803Smarcel ;; 3802130803Smarcel *) 3803130803Smarcel $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 3804130803Smarcel exit 1 3805130803Smarcel ;; 3806130803Smarcel esac 3807130803Smarcel else 3808130803Smarcel # We keep going just in case the user didn't refer to 3809130803Smarcel # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3810130803Smarcel # really was required. 3811130803Smarcel 3812130803Smarcel # Nullify the symbol file. 3813130803Smarcel compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 3814130803Smarcel finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 3815130803Smarcel fi 3816130803Smarcel 3817130803Smarcel if test $need_relink = no || test "$build_libtool_libs" != yes; then 3818130803Smarcel # Replace the output file specification. 3819130803Smarcel compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 3820130803Smarcel link_command="$compile_command$compile_rpath" 3821130803Smarcel 3822130803Smarcel # We have no uninstalled library dependencies, so finalize right now. 3823130803Smarcel $show "$link_command" 3824130803Smarcel $run eval "$link_command" 3825130803Smarcel status=$? 3826130803Smarcel 3827130803Smarcel # Delete the generated files. 3828130803Smarcel if test -n "$dlsyms"; then 3829130803Smarcel $show "$rm $output_objdir/${outputname}S.${objext}" 3830130803Smarcel $run $rm "$output_objdir/${outputname}S.${objext}" 3831130803Smarcel fi 3832130803Smarcel 3833130803Smarcel exit $status 3834130803Smarcel fi 3835130803Smarcel 3836130803Smarcel if test -n "$shlibpath_var"; then 3837130803Smarcel # We should set the shlibpath_var 3838130803Smarcel rpath= 3839130803Smarcel for dir in $temp_rpath; do 3840130803Smarcel case $dir in 3841130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) 3842130803Smarcel # Absolute path. 3843130803Smarcel rpath="$rpath$dir:" 3844130803Smarcel ;; 3845130803Smarcel *) 3846130803Smarcel # Relative path: add a thisdir entry. 3847130803Smarcel rpath="$rpath\$thisdir/$dir:" 3848130803Smarcel ;; 3849130803Smarcel esac 3850130803Smarcel done 3851130803Smarcel temp_rpath="$rpath" 3852130803Smarcel fi 3853130803Smarcel 3854130803Smarcel if test -n "$compile_shlibpath$finalize_shlibpath"; then 3855130803Smarcel compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 3856130803Smarcel fi 3857130803Smarcel if test -n "$finalize_shlibpath"; then 3858130803Smarcel finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 3859130803Smarcel fi 3860130803Smarcel 3861130803Smarcel compile_var= 3862130803Smarcel finalize_var= 3863130803Smarcel if test -n "$runpath_var"; then 3864130803Smarcel if test -n "$perm_rpath"; then 3865130803Smarcel # We should set the runpath_var. 3866130803Smarcel rpath= 3867130803Smarcel for dir in $perm_rpath; do 3868130803Smarcel rpath="$rpath$dir:" 3869130803Smarcel done 3870130803Smarcel compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 3871130803Smarcel fi 3872130803Smarcel if test -n "$finalize_perm_rpath"; then 3873130803Smarcel # We should set the runpath_var. 3874130803Smarcel rpath= 3875130803Smarcel for dir in $finalize_perm_rpath; do 3876130803Smarcel rpath="$rpath$dir:" 3877130803Smarcel done 3878130803Smarcel finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 3879130803Smarcel fi 3880130803Smarcel fi 3881130803Smarcel 3882130803Smarcel if test "$no_install" = yes; then 3883130803Smarcel # We don't need to create a wrapper script. 3884130803Smarcel link_command="$compile_var$compile_command$compile_rpath" 3885130803Smarcel # Replace the output file specification. 3886130803Smarcel link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 3887130803Smarcel # Delete the old output file. 3888130803Smarcel $run $rm $output 3889130803Smarcel # Link the executable and exit 3890130803Smarcel $show "$link_command" 3891130803Smarcel $run eval "$link_command" || exit $? 3892130803Smarcel exit 0 3893130803Smarcel fi 3894130803Smarcel 3895130803Smarcel if test "$hardcode_action" = relink; then 3896130803Smarcel # Fast installation is not supported 3897130803Smarcel link_command="$compile_var$compile_command$compile_rpath" 3898130803Smarcel relink_command="$finalize_var$finalize_command$finalize_rpath" 3899130803Smarcel 3900130803Smarcel $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 3901130803Smarcel $echo "$modename: \`$output' will be relinked during installation" 1>&2 3902130803Smarcel else 3903130803Smarcel if test "$fast_install" != no; then 3904130803Smarcel link_command="$finalize_var$compile_command$finalize_rpath" 3905130803Smarcel if test "$fast_install" = yes; then 3906130803Smarcel relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 3907130803Smarcel else 3908130803Smarcel # fast_install is set to needless 3909130803Smarcel relink_command= 3910130803Smarcel fi 3911130803Smarcel else 3912130803Smarcel link_command="$compile_var$compile_command$compile_rpath" 3913130803Smarcel relink_command="$finalize_var$finalize_command$finalize_rpath" 3914130803Smarcel fi 3915130803Smarcel fi 3916130803Smarcel 3917130803Smarcel # Replace the output file specification. 3918130803Smarcel link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 3919130803Smarcel 3920130803Smarcel # Delete the old output files. 3921130803Smarcel $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 3922130803Smarcel 3923130803Smarcel $show "$link_command" 3924130803Smarcel $run eval "$link_command" || exit $? 3925130803Smarcel 3926130803Smarcel # Now create the wrapper script. 3927130803Smarcel $show "creating $output" 3928130803Smarcel 3929130803Smarcel # Quote the relink command for shipping. 3930130803Smarcel if test -n "$relink_command"; then 3931130803Smarcel # Preserve any variables that may affect compiler behavior 3932130803Smarcel for var in $variables_saved_for_relink; do 3933130803Smarcel if eval test -z \"\${$var+set}\"; then 3934130803Smarcel relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 3935130803Smarcel elif eval var_value=\$$var; test -z "$var_value"; then 3936130803Smarcel relink_command="$var=; export $var; $relink_command" 3937130803Smarcel else 3938130803Smarcel var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 3939130803Smarcel relink_command="$var=\"$var_value\"; export $var; $relink_command" 3940130803Smarcel fi 3941130803Smarcel done 3942130803Smarcel relink_command="cd `pwd`; $relink_command" 3943130803Smarcel relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 3944130803Smarcel fi 3945130803Smarcel 3946130803Smarcel # Quote $echo for shipping. 3947130803Smarcel if test "X$echo" = "X$SHELL $0 --fallback-echo"; then 3948130803Smarcel case $0 in 3949130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; 3950130803Smarcel *) qecho="$SHELL `pwd`/$0 --fallback-echo";; 3951130803Smarcel esac 3952130803Smarcel qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 3953130803Smarcel else 3954130803Smarcel qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 3955130803Smarcel fi 3956130803Smarcel 3957130803Smarcel # Only actually do things if our run command is non-null. 3958130803Smarcel if test -z "$run"; then 3959130803Smarcel # win32 will think the script is a binary if it has 3960130803Smarcel # a .exe suffix, so we strip it off here. 3961130803Smarcel case $output in 3962130803Smarcel *.exe) output=`echo $output|sed 's,.exe$,,'` ;; 3963130803Smarcel esac 3964130803Smarcel # test for cygwin because mv fails w/o .exe extensions 3965130803Smarcel case $host in 3966130803Smarcel *cygwin*) exeext=.exe ;; 3967130803Smarcel *) exeext= ;; 3968130803Smarcel esac 3969130803Smarcel $rm $output 3970130803Smarcel trap "$rm $output; exit 1" 1 2 15 3971130803Smarcel 3972130803Smarcel $echo > $output "\ 3973130803Smarcel#! $SHELL 3974130803Smarcel 3975130803Smarcel# $output - temporary wrapper script for $objdir/$outputname 3976130803Smarcel# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 3977130803Smarcel# 3978130803Smarcel# The $output program cannot be directly executed until all the libtool 3979130803Smarcel# libraries that it depends on are installed. 3980130803Smarcel# 3981130803Smarcel# This wrapper script should never be moved out of the build directory. 3982130803Smarcel# If it is, it will not operate correctly. 3983130803Smarcel 3984130803Smarcel# Sed substitution that helps us do robust quoting. It backslashifies 3985130803Smarcel# metacharacters that are still active within double-quoted strings. 3986130803SmarcelXsed='sed -e 1s/^X//' 3987130803Smarcelsed_quote_subst='$sed_quote_subst' 3988130803Smarcel 3989130803Smarcel# The HP-UX ksh and POSIX shell print the target directory to stdout 3990130803Smarcel# if CDPATH is set. 3991130803Smarcelif test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi 3992130803Smarcel 3993130803Smarcelrelink_command=\"$relink_command\" 3994130803Smarcel 3995130803Smarcel# This environment variable determines our operation mode. 3996130803Smarcelif test \"\$libtool_install_magic\" = \"$magic\"; then 3997130803Smarcel # install mode needs the following variable: 3998130803Smarcel notinst_deplibs='$notinst_deplibs' 3999130803Smarcelelse 4000130803Smarcel # When we are sourced in execute mode, \$file and \$echo are already set. 4001130803Smarcel if test \"\$libtool_execute_magic\" != \"$magic\"; then 4002130803Smarcel echo=\"$qecho\" 4003130803Smarcel file=\"\$0\" 4004130803Smarcel # Make sure echo works. 4005130803Smarcel if test \"X\$1\" = X--no-reexec; then 4006130803Smarcel # Discard the --no-reexec flag, and continue. 4007130803Smarcel shift 4008130803Smarcel elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 4009130803Smarcel # Yippee, \$echo works! 4010130803Smarcel : 4011130803Smarcel else 4012130803Smarcel # Restart under the correct shell, and then maybe \$echo will work. 4013130803Smarcel exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 4014130803Smarcel fi 4015130803Smarcel fi\ 4016130803Smarcel" 4017130803Smarcel $echo >> $output "\ 4018130803Smarcel 4019130803Smarcel # Find the directory that this script lives in. 4020130803Smarcel thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 4021130803Smarcel test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4022130803Smarcel 4023130803Smarcel # Follow symbolic links until we get to the real thisdir. 4024130803Smarcel file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` 4025130803Smarcel while test -n \"\$file\"; do 4026130803Smarcel destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 4027130803Smarcel 4028130803Smarcel # If there was a directory component, then change thisdir. 4029130803Smarcel if test \"x\$destdir\" != \"x\$file\"; then 4030130803Smarcel case \"\$destdir\" in 4031130803Smarcel [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4032130803Smarcel *) thisdir=\"\$thisdir/\$destdir\" ;; 4033130803Smarcel esac 4034130803Smarcel fi 4035130803Smarcel 4036130803Smarcel file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 4037130803Smarcel file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` 4038130803Smarcel done 4039130803Smarcel 4040130803Smarcel # Try to get the absolute directory name. 4041130803Smarcel absdir=\`cd \"\$thisdir\" && pwd\` 4042130803Smarcel test -n \"\$absdir\" && thisdir=\"\$absdir\" 4043130803Smarcel" 4044130803Smarcel 4045130803Smarcel if test "$fast_install" = yes; then 4046130803Smarcel echo >> $output "\ 4047130803Smarcel program=lt-'$outputname'$exeext 4048130803Smarcel progdir=\"\$thisdir/$objdir\" 4049130803Smarcel 4050130803Smarcel if test ! -f \"\$progdir/\$program\" || \\ 4051130803Smarcel { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ 4052130803Smarcel test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4053130803Smarcel 4054130803Smarcel file=\"\$\$-\$program\" 4055130803Smarcel 4056130803Smarcel if test ! -d \"\$progdir\"; then 4057130803Smarcel $mkdir \"\$progdir\" 4058130803Smarcel else 4059130803Smarcel $rm \"\$progdir/\$file\" 4060130803Smarcel fi" 4061130803Smarcel 4062130803Smarcel echo >> $output "\ 4063130803Smarcel 4064130803Smarcel # relink executable if necessary 4065130803Smarcel if test -n \"\$relink_command\"; then 4066130803Smarcel if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4067130803Smarcel else 4068130803Smarcel $echo \"\$relink_command_output\" >&2 4069130803Smarcel $rm \"\$progdir/\$file\" 4070130803Smarcel exit 1 4071130803Smarcel fi 4072130803Smarcel fi 4073130803Smarcel 4074130803Smarcel $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4075130803Smarcel { $rm \"\$progdir/\$program\"; 4076130803Smarcel $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4077130803Smarcel $rm \"\$progdir/\$file\" 4078130803Smarcel fi" 4079130803Smarcel else 4080130803Smarcel echo >> $output "\ 4081130803Smarcel program='$outputname' 4082130803Smarcel progdir=\"\$thisdir/$objdir\" 4083130803Smarcel" 4084130803Smarcel fi 4085130803Smarcel 4086130803Smarcel echo >> $output "\ 4087130803Smarcel 4088130803Smarcel if test -f \"\$progdir/\$program\"; then" 4089130803Smarcel 4090130803Smarcel # Export our shlibpath_var if we have one. 4091130803Smarcel if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4092130803Smarcel $echo >> $output "\ 4093130803Smarcel # Add our own library path to $shlibpath_var 4094130803Smarcel $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4095130803Smarcel 4096130803Smarcel # Some systems cannot cope with colon-terminated $shlibpath_var 4097130803Smarcel # The second colon is a workaround for a bug in BeOS R4 sed 4098130803Smarcel $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 4099130803Smarcel 4100130803Smarcel export $shlibpath_var 4101130803Smarcel" 4102130803Smarcel fi 4103130803Smarcel 4104130803Smarcel # fixup the dll searchpath if we need to. 4105130803Smarcel if test -n "$dllsearchpath"; then 4106130803Smarcel $echo >> $output "\ 4107130803Smarcel # Add the dll search path components to the executable PATH 4108130803Smarcel PATH=$dllsearchpath:\$PATH 4109130803Smarcel" 4110130803Smarcel fi 4111130803Smarcel 4112130803Smarcel $echo >> $output "\ 4113130803Smarcel if test \"\$libtool_execute_magic\" != \"$magic\"; then 4114130803Smarcel # Run the actual program with our arguments. 4115130803Smarcel" 4116130803Smarcel case $host in 4117130803Smarcel # win32 systems need to use the prog path for dll 4118130803Smarcel # lookup to work 4119130803Smarcel *-*-cygwin* | *-*-pw32*) 4120130803Smarcel $echo >> $output "\ 4121130803Smarcel exec \$progdir/\$program \${1+\"\$@\"} 4122130803Smarcel" 4123130803Smarcel ;; 4124130803Smarcel 4125130803Smarcel # Backslashes separate directories on plain windows 4126130803Smarcel *-*-mingw | *-*-os2*) 4127130803Smarcel $echo >> $output "\ 4128130803Smarcel exec \$progdir\\\\\$program \${1+\"\$@\"} 4129130803Smarcel" 4130130803Smarcel ;; 4131130803Smarcel 4132130803Smarcel *) 4133130803Smarcel $echo >> $output "\ 4134130803Smarcel # Export the path to the program. 4135130803Smarcel PATH=\"\$progdir:\$PATH\" 4136130803Smarcel export PATH 4137130803Smarcel 4138130803Smarcel exec \$program \${1+\"\$@\"} 4139130803Smarcel" 4140130803Smarcel ;; 4141130803Smarcel esac 4142130803Smarcel $echo >> $output "\ 4143130803Smarcel \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 4144130803Smarcel exit 1 4145130803Smarcel fi 4146130803Smarcel else 4147130803Smarcel # The program doesn't exist. 4148130803Smarcel \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 4149130803Smarcel \$echo \"This script is just a wrapper for \$program.\" 1>&2 4150130803Smarcel echo \"See the $PACKAGE documentation for more information.\" 1>&2 4151130803Smarcel exit 1 4152130803Smarcel fi 4153130803Smarcelfi\ 4154130803Smarcel" 4155130803Smarcel chmod +x $output 4156130803Smarcel fi 4157130803Smarcel exit 0 4158130803Smarcel ;; 4159130803Smarcel esac 4160130803Smarcel 4161130803Smarcel # See if we need to build an old-fashioned archive. 4162130803Smarcel for oldlib in $oldlibs; do 4163130803Smarcel 4164130803Smarcel if test "$build_libtool_libs" = convenience; then 4165130803Smarcel oldobjs="$libobjs_save" 4166130803Smarcel addlibs="$convenience" 4167130803Smarcel build_libtool_libs=no 4168130803Smarcel else 4169130803Smarcel if test "$build_libtool_libs" = module; then 4170130803Smarcel oldobjs="$libobjs_save" 4171130803Smarcel build_libtool_libs=no 4172130803Smarcel else 4173130803Smarcel oldobjs="$objs$old_deplibs $non_pic_objects" 4174130803Smarcel fi 4175130803Smarcel addlibs="$old_convenience" 4176130803Smarcel fi 4177130803Smarcel 4178130803Smarcel if test -n "$addlibs"; then 4179130803Smarcel gentop="$output_objdir/${outputname}x" 4180130803Smarcel $show "${rm}r $gentop" 4181130803Smarcel $run ${rm}r "$gentop" 4182130803Smarcel $show "$mkdir $gentop" 4183130803Smarcel $run $mkdir "$gentop" 4184130803Smarcel status=$? 4185130803Smarcel if test $status -ne 0 && test ! -d "$gentop"; then 4186130803Smarcel exit $status 4187130803Smarcel fi 4188130803Smarcel generated="$generated $gentop" 4189130803Smarcel 4190130803Smarcel # Add in members from convenience archives. 4191130803Smarcel for xlib in $addlibs; do 4192130803Smarcel # Extract the objects. 4193130803Smarcel case $xlib in 4194130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 4195130803Smarcel *) xabs=`pwd`"/$xlib" ;; 4196130803Smarcel esac 4197130803Smarcel xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 4198130803Smarcel xdir="$gentop/$xlib" 4199130803Smarcel 4200130803Smarcel $show "${rm}r $xdir" 4201130803Smarcel $run ${rm}r "$xdir" 4202130803Smarcel $show "$mkdir $xdir" 4203130803Smarcel $run $mkdir "$xdir" 4204130803Smarcel status=$? 4205130803Smarcel if test $status -ne 0 && test ! -d "$xdir"; then 4206130803Smarcel exit $status 4207130803Smarcel fi 4208130803Smarcel $show "(cd $xdir && $AR x $xabs)" 4209130803Smarcel $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 4210130803Smarcel 4211130803Smarcel oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP` 4212130803Smarcel done 4213130803Smarcel fi 4214130803Smarcel 4215130803Smarcel # Do each command in the archive commands. 4216130803Smarcel if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 4217130803Smarcel eval cmds=\"$old_archive_from_new_cmds\" 4218130803Smarcel else 4219130803Smarcel# # Ensure that we have .o objects in place in case we decided 4220130803Smarcel# # not to build a shared library, and have fallen back to building 4221130803Smarcel# # static libs even though --disable-static was passed! 4222130803Smarcel# for oldobj in $oldobjs; do 4223130803Smarcel# if test ! -f $oldobj; then 4224130803Smarcel# xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` 4225130803Smarcel# if test "X$xdir" = "X$oldobj"; then 4226130803Smarcel# xdir="." 4227130803Smarcel# else 4228130803Smarcel# xdir="$xdir" 4229130803Smarcel# fi 4230130803Smarcel# baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` 4231130803Smarcel# obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` 4232130803Smarcel# $show "(cd $xdir && ${LN_S} $obj $baseobj)" 4233130803Smarcel# $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? 4234130803Smarcel# fi 4235130803Smarcel# done 4236130803Smarcel 4237130803Smarcel eval cmds=\"$old_archive_cmds\" 4238130803Smarcel 4239130803Smarcel if len=`expr "X$cmds" : ".*"` && 4240130803Smarcel test $len -le $max_cmd_len; then 4241130803Smarcel : 4242130803Smarcel else 4243130803Smarcel # the command line is too long to link in one step, link in parts 4244130803Smarcel $echo "using piecewise archive linking..." 4245130803Smarcel save_RANLIB=$RANLIB 4246130803Smarcel RANLIB=: 4247130803Smarcel objlist= 4248130803Smarcel concat_cmds= 4249130803Smarcel save_oldobjs=$oldobjs 4250130803Smarcel for obj in $save_oldobjs 4251130803Smarcel do 4252130803Smarcel oldobjs="$objlist $obj" 4253130803Smarcel objlist="$objlist $obj" 4254130803Smarcel eval test_cmds=\"$old_archive_cmds\" 4255130803Smarcel if len=`expr "X$test_cmds" : ".*"` && 4256130803Smarcel test $len -le $max_cmd_len; then 4257130803Smarcel : 4258130803Smarcel else 4259130803Smarcel # the above command should be used before it gets too long 4260130803Smarcel oldobjs=$objlist 4261130803Smarcel test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4262130803Smarcel eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 4263130803Smarcel objlist= 4264130803Smarcel fi 4265130803Smarcel done 4266130803Smarcel RANLIB=$save_RANLIB 4267130803Smarcel oldobjs=$objlist 4268130803Smarcel eval cmds=\"\$concat_cmds~$old_archive_cmds\" 4269130803Smarcel fi 4270130803Smarcel fi 4271130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4272130803Smarcel for cmd in $cmds; do 4273130803Smarcel IFS="$save_ifs" 4274130803Smarcel $show "$cmd" 4275130803Smarcel $run eval "$cmd" || exit $? 4276130803Smarcel done 4277130803Smarcel IFS="$save_ifs" 4278130803Smarcel done 4279130803Smarcel 4280130803Smarcel if test -n "$generated"; then 4281130803Smarcel $show "${rm}r$generated" 4282130803Smarcel $run ${rm}r$generated 4283130803Smarcel fi 4284130803Smarcel 4285130803Smarcel # Now create the libtool archive. 4286130803Smarcel case $output in 4287130803Smarcel *.la) 4288130803Smarcel old_library= 4289130803Smarcel test "$build_old_libs" = yes && old_library="$libname.$libext" 4290130803Smarcel $show "creating $output" 4291130803Smarcel 4292130803Smarcel # Preserve any variables that may affect compiler behavior 4293130803Smarcel for var in $variables_saved_for_relink; do 4294130803Smarcel if eval test -z \"\${$var+set}\"; then 4295130803Smarcel relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4296130803Smarcel elif eval var_value=\$$var; test -z "$var_value"; then 4297130803Smarcel relink_command="$var=; export $var; $relink_command" 4298130803Smarcel else 4299130803Smarcel var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4300130803Smarcel relink_command="$var=\"$var_value\"; export $var; $relink_command" 4301130803Smarcel fi 4302130803Smarcel done 4303130803Smarcel # Quote the link command for shipping. 4304130803Smarcel tagopts= 4305130803Smarcel for tag in $taglist; do 4306130803Smarcel tagopts="$tagopts --tag $tag" 4307130803Smarcel done 4308130803Smarcel relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" 4309130803Smarcel relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 4310130803Smarcel 4311130803Smarcel # Only create the output if not a dry run. 4312130803Smarcel if test -z "$run"; then 4313130803Smarcel for installed in no yes; do 4314130803Smarcel if test "$installed" = yes; then 4315130803Smarcel if test -z "$install_libdir"; then 4316130803Smarcel break 4317130803Smarcel fi 4318130803Smarcel output="$output_objdir/$outputname"i 4319130803Smarcel # Replace all uninstalled libtool libraries with the installed ones 4320130803Smarcel newdependency_libs= 4321130803Smarcel for deplib in $dependency_libs; do 4322130803Smarcel case $deplib in 4323130803Smarcel *.la) 4324130803Smarcel name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 4325130803Smarcel eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 4326130803Smarcel if test -z "$libdir"; then 4327130803Smarcel $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 4328130803Smarcel exit 1 4329130803Smarcel fi 4330130803Smarcel newdependency_libs="$newdependency_libs $libdir/$name" 4331130803Smarcel ;; 4332130803Smarcel *) newdependency_libs="$newdependency_libs $deplib" ;; 4333130803Smarcel esac 4334130803Smarcel done 4335130803Smarcel dependency_libs="$newdependency_libs" 4336130803Smarcel newdlfiles= 4337130803Smarcel for lib in $dlfiles; do 4338130803Smarcel name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 4339130803Smarcel eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 4340130803Smarcel if test -z "$libdir"; then 4341130803Smarcel $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4342130803Smarcel exit 1 4343130803Smarcel fi 4344130803Smarcel newdlfiles="$newdlfiles $libdir/$name" 4345130803Smarcel done 4346130803Smarcel dlfiles="$newdlfiles" 4347130803Smarcel newdlprefiles= 4348130803Smarcel for lib in $dlprefiles; do 4349130803Smarcel name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 4350130803Smarcel eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 4351130803Smarcel if test -z "$libdir"; then 4352130803Smarcel $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4353130803Smarcel exit 1 4354130803Smarcel fi 4355130803Smarcel newdlprefiles="$newdlprefiles $libdir/$name" 4356130803Smarcel done 4357130803Smarcel dlprefiles="$newdlprefiles" 4358130803Smarcel fi 4359130803Smarcel $rm $output 4360130803Smarcel # place dlname in correct position for cygwin 4361130803Smarcel tdlname=$dlname 4362130803Smarcel case $host,$output,$installed,$module,$dlname in 4363130803Smarcel *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 4364130803Smarcel esac 4365130803Smarcel $echo > $output "\ 4366130803Smarcel# $outputname - a libtool library file 4367130803Smarcel# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4368130803Smarcel# 4369130803Smarcel# Please DO NOT delete this file! 4370130803Smarcel# It is necessary for linking the library. 4371130803Smarcel 4372130803Smarcel# The name that we can dlopen(3). 4373130803Smarceldlname='$tdlname' 4374130803Smarcel 4375130803Smarcel# Names of this library. 4376130803Smarcellibrary_names='$library_names' 4377130803Smarcel 4378130803Smarcel# The name of the static archive. 4379130803Smarcelold_library='$old_library' 4380130803Smarcel 4381130803Smarcel# Libraries that this one depends upon. 4382130803Smarceldependency_libs='$dependency_libs' 4383130803Smarcel 4384130803Smarcel# Version information for $libname. 4385130803Smarcelcurrent=$current 4386130803Smarcelage=$age 4387130803Smarcelrevision=$revision 4388130803Smarcel 4389130803Smarcel# Is this an already installed library? 4390130803Smarcelinstalled=$installed 4391130803Smarcel 4392130803Smarcel# Files to dlopen/dlpreopen 4393130803Smarceldlopen='$dlfiles' 4394130803Smarceldlpreopen='$dlprefiles' 4395130803Smarcel 4396130803Smarcel# Directory that this library needs to be installed in: 4397130803Smarcellibdir='$install_libdir'" 4398130803Smarcel if test "$installed" = no && test $need_relink = yes; then 4399130803Smarcel $echo >> $output "\ 4400130803Smarcelrelink_command=\"$relink_command\"" 4401130803Smarcel fi 4402130803Smarcel done 4403130803Smarcel fi 4404130803Smarcel 4405130803Smarcel # Do a symbolic link so that the libtool archive can be found in 4406130803Smarcel # LD_LIBRARY_PATH before the program is installed. 4407130803Smarcel $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 4408130803Smarcel $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 4409130803Smarcel ;; 4410130803Smarcel esac 4411130803Smarcel exit 0 4412130803Smarcel ;; 4413130803Smarcel 4414130803Smarcel # libtool install mode 4415130803Smarcel install) 4416130803Smarcel modename="$modename: install" 4417130803Smarcel 4418130803Smarcel # There may be an optional sh(1) argument at the beginning of 4419130803Smarcel # install_prog (especially on Windows NT). 4420130803Smarcel if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 4421130803Smarcel # Allow the use of GNU shtool's install command. 4422130803Smarcel $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 4423130803Smarcel # Aesthetically quote it. 4424130803Smarcel arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 4425130803Smarcel case $arg in 4426130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4427130803Smarcel arg="\"$arg\"" 4428130803Smarcel ;; 4429130803Smarcel esac 4430130803Smarcel install_prog="$arg " 4431130803Smarcel arg="$1" 4432130803Smarcel shift 4433130803Smarcel else 4434130803Smarcel install_prog= 4435130803Smarcel arg="$nonopt" 4436130803Smarcel fi 4437130803Smarcel 4438130803Smarcel # The real first argument should be the name of the installation program. 4439130803Smarcel # Aesthetically quote it. 4440130803Smarcel arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 4441130803Smarcel case $arg in 4442130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4443130803Smarcel arg="\"$arg\"" 4444130803Smarcel ;; 4445130803Smarcel esac 4446130803Smarcel install_prog="$install_prog$arg" 4447130803Smarcel 4448130803Smarcel # We need to accept at least all the BSD install flags. 4449130803Smarcel dest= 4450130803Smarcel files= 4451130803Smarcel opts= 4452130803Smarcel prev= 4453130803Smarcel install_type= 4454130803Smarcel isdir=no 4455130803Smarcel stripme= 4456130803Smarcel for arg 4457130803Smarcel do 4458130803Smarcel if test -n "$dest"; then 4459130803Smarcel files="$files $dest" 4460130803Smarcel dest="$arg" 4461130803Smarcel continue 4462130803Smarcel fi 4463130803Smarcel 4464130803Smarcel case $arg in 4465130803Smarcel -d) isdir=yes ;; 4466130803Smarcel -f) prev="-f" ;; 4467130803Smarcel -g) prev="-g" ;; 4468130803Smarcel -m) prev="-m" ;; 4469130803Smarcel -o) prev="-o" ;; 4470130803Smarcel -s) 4471130803Smarcel stripme=" -s" 4472130803Smarcel continue 4473130803Smarcel ;; 4474130803Smarcel -*) ;; 4475130803Smarcel 4476130803Smarcel *) 4477130803Smarcel # If the previous option needed an argument, then skip it. 4478130803Smarcel if test -n "$prev"; then 4479130803Smarcel prev= 4480130803Smarcel else 4481130803Smarcel dest="$arg" 4482130803Smarcel continue 4483130803Smarcel fi 4484130803Smarcel ;; 4485130803Smarcel esac 4486130803Smarcel 4487130803Smarcel # Aesthetically quote the argument. 4488130803Smarcel arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 4489130803Smarcel case $arg in 4490130803Smarcel *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4491130803Smarcel arg="\"$arg\"" 4492130803Smarcel ;; 4493130803Smarcel esac 4494130803Smarcel install_prog="$install_prog $arg" 4495130803Smarcel done 4496130803Smarcel 4497130803Smarcel if test -z "$install_prog"; then 4498130803Smarcel $echo "$modename: you must specify an install program" 1>&2 4499130803Smarcel $echo "$help" 1>&2 4500130803Smarcel exit 1 4501130803Smarcel fi 4502130803Smarcel 4503130803Smarcel if test -n "$prev"; then 4504130803Smarcel $echo "$modename: the \`$prev' option requires an argument" 1>&2 4505130803Smarcel $echo "$help" 1>&2 4506130803Smarcel exit 1 4507130803Smarcel fi 4508130803Smarcel 4509130803Smarcel if test -z "$files"; then 4510130803Smarcel if test -z "$dest"; then 4511130803Smarcel $echo "$modename: no file or destination specified" 1>&2 4512130803Smarcel else 4513130803Smarcel $echo "$modename: you must specify a destination" 1>&2 4514130803Smarcel fi 4515130803Smarcel $echo "$help" 1>&2 4516130803Smarcel exit 1 4517130803Smarcel fi 4518130803Smarcel 4519130803Smarcel # Strip any trailing slash from the destination. 4520130803Smarcel dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 4521130803Smarcel 4522130803Smarcel # Check to see that the destination is a directory. 4523130803Smarcel test -d "$dest" && isdir=yes 4524130803Smarcel if test "$isdir" = yes; then 4525130803Smarcel destdir="$dest" 4526130803Smarcel destname= 4527130803Smarcel else 4528130803Smarcel destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 4529130803Smarcel test "X$destdir" = "X$dest" && destdir=. 4530130803Smarcel destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 4531130803Smarcel 4532130803Smarcel # Not a directory, so check to see that there is only one file specified. 4533130803Smarcel set dummy $files 4534130803Smarcel if test $# -gt 2; then 4535130803Smarcel $echo "$modename: \`$dest' is not a directory" 1>&2 4536130803Smarcel $echo "$help" 1>&2 4537130803Smarcel exit 1 4538130803Smarcel fi 4539130803Smarcel fi 4540130803Smarcel case $destdir in 4541130803Smarcel [\\/]* | [A-Za-z]:[\\/]*) ;; 4542130803Smarcel *) 4543130803Smarcel for file in $files; do 4544130803Smarcel case $file in 4545130803Smarcel *.lo) ;; 4546130803Smarcel *) 4547130803Smarcel $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 4548130803Smarcel $echo "$help" 1>&2 4549130803Smarcel exit 1 4550130803Smarcel ;; 4551130803Smarcel esac 4552130803Smarcel done 4553130803Smarcel ;; 4554130803Smarcel esac 4555130803Smarcel 4556130803Smarcel # This variable tells wrapper scripts just to set variables rather 4557130803Smarcel # than running their programs. 4558130803Smarcel libtool_install_magic="$magic" 4559130803Smarcel 4560130803Smarcel staticlibs= 4561130803Smarcel future_libdirs= 4562130803Smarcel current_libdirs= 4563130803Smarcel for file in $files; do 4564130803Smarcel 4565130803Smarcel # Do each installation. 4566130803Smarcel case $file in 4567130803Smarcel *.$libext) 4568130803Smarcel # Do the static libraries later. 4569130803Smarcel staticlibs="$staticlibs $file" 4570130803Smarcel ;; 4571130803Smarcel 4572130803Smarcel *.la) 4573130803Smarcel # Check to see that this really is a libtool archive. 4574130803Smarcel if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 4575130803Smarcel else 4576130803Smarcel $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 4577130803Smarcel $echo "$help" 1>&2 4578130803Smarcel exit 1 4579130803Smarcel fi 4580130803Smarcel 4581130803Smarcel library_names= 4582130803Smarcel old_library= 4583130803Smarcel relink_command= 4584130803Smarcel # If there is no directory component, then add one. 4585130803Smarcel case $file in 4586130803Smarcel */* | *\\*) . $file ;; 4587130803Smarcel *) . ./$file ;; 4588130803Smarcel esac 4589130803Smarcel 4590130803Smarcel # Add the libdir to current_libdirs if it is the destination. 4591130803Smarcel if test "X$destdir" = "X$libdir"; then 4592130803Smarcel case "$current_libdirs " in 4593130803Smarcel *" $libdir "*) ;; 4594130803Smarcel *) current_libdirs="$current_libdirs $libdir" ;; 4595130803Smarcel esac 4596130803Smarcel else 4597130803Smarcel # Note the libdir as a future libdir. 4598130803Smarcel case "$future_libdirs " in 4599130803Smarcel *" $libdir "*) ;; 4600130803Smarcel *) future_libdirs="$future_libdirs $libdir" ;; 4601130803Smarcel esac 4602130803Smarcel fi 4603130803Smarcel 4604130803Smarcel dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 4605130803Smarcel test "X$dir" = "X$file/" && dir= 4606130803Smarcel dir="$dir$objdir" 4607130803Smarcel 4608130803Smarcel if test -n "$relink_command"; then 4609130803Smarcel $echo "$modename: warning: relinking \`$file'" 1>&2 4610130803Smarcel $show "$relink_command" 4611130803Smarcel if $run eval "$relink_command"; then : 4612130803Smarcel else 4613130803Smarcel $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 4614130803Smarcel exit 1 4615130803Smarcel fi 4616130803Smarcel fi 4617130803Smarcel 4618130803Smarcel # See the names of the shared library. 4619130803Smarcel set dummy $library_names 4620130803Smarcel if test -n "$2"; then 4621130803Smarcel realname="$2" 4622130803Smarcel shift 4623130803Smarcel shift 4624130803Smarcel 4625130803Smarcel srcname="$realname" 4626130803Smarcel test -n "$relink_command" && srcname="$realname"T 4627130803Smarcel 4628130803Smarcel # Install the shared library and build the symlinks. 4629130803Smarcel $show "$install_prog $dir/$srcname $destdir/$realname" 4630130803Smarcel $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 4631130803Smarcel if test -n "$stripme" && test -n "$striplib"; then 4632130803Smarcel $show "$striplib $destdir/$realname" 4633130803Smarcel $run eval "$striplib $destdir/$realname" || exit $? 4634130803Smarcel fi 4635130803Smarcel 4636130803Smarcel if test $# -gt 0; then 4637130803Smarcel # Delete the old symlinks, and create new ones. 4638130803Smarcel for linkname 4639130803Smarcel do 4640130803Smarcel if test "$linkname" != "$realname"; then 4641130803Smarcel $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 4642130803Smarcel $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 4643130803Smarcel fi 4644130803Smarcel done 4645130803Smarcel fi 4646130803Smarcel 4647130803Smarcel # Do each command in the postinstall commands. 4648130803Smarcel lib="$destdir/$realname" 4649130803Smarcel eval cmds=\"$postinstall_cmds\" 4650130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4651130803Smarcel for cmd in $cmds; do 4652130803Smarcel IFS="$save_ifs" 4653130803Smarcel $show "$cmd" 4654130803Smarcel $run eval "$cmd" || exit $? 4655130803Smarcel done 4656130803Smarcel IFS="$save_ifs" 4657130803Smarcel fi 4658130803Smarcel 4659130803Smarcel # Install the pseudo-library for information purposes. 4660130803Smarcel name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4661130803Smarcel instname="$dir/$name"i 4662130803Smarcel $show "$install_prog $instname $destdir/$name" 4663130803Smarcel $run eval "$install_prog $instname $destdir/$name" || exit $? 4664130803Smarcel 4665130803Smarcel # Maybe install the static library, too. 4666130803Smarcel test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 4667130803Smarcel ;; 4668130803Smarcel 4669130803Smarcel *.lo) 4670130803Smarcel # Install (i.e. copy) a libtool object. 4671130803Smarcel 4672130803Smarcel # Figure out destination file name, if it wasn't already specified. 4673130803Smarcel if test -n "$destname"; then 4674130803Smarcel destfile="$destdir/$destname" 4675130803Smarcel else 4676130803Smarcel destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4677130803Smarcel destfile="$destdir/$destfile" 4678130803Smarcel fi 4679130803Smarcel 4680130803Smarcel # Deduce the name of the destination old-style object file. 4681130803Smarcel case $destfile in 4682130803Smarcel *.lo) 4683130803Smarcel staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 4684130803Smarcel ;; 4685130803Smarcel *.$objext) 4686130803Smarcel staticdest="$destfile" 4687130803Smarcel destfile= 4688130803Smarcel ;; 4689130803Smarcel *) 4690130803Smarcel $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 4691130803Smarcel $echo "$help" 1>&2 4692130803Smarcel exit 1 4693130803Smarcel ;; 4694130803Smarcel esac 4695130803Smarcel 4696130803Smarcel # Install the libtool object if requested. 4697130803Smarcel if test -n "$destfile"; then 4698130803Smarcel $show "$install_prog $file $destfile" 4699130803Smarcel $run eval "$install_prog $file $destfile" || exit $? 4700130803Smarcel fi 4701130803Smarcel 4702130803Smarcel # Install the old object if enabled. 4703130803Smarcel if test "$build_old_libs" = yes; then 4704130803Smarcel # Deduce the name of the old-style object file. 4705130803Smarcel staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 4706130803Smarcel 4707130803Smarcel $show "$install_prog $staticobj $staticdest" 4708130803Smarcel $run eval "$install_prog \$staticobj \$staticdest" || exit $? 4709130803Smarcel fi 4710130803Smarcel exit 0 4711130803Smarcel ;; 4712130803Smarcel 4713130803Smarcel *) 4714130803Smarcel # Figure out destination file name, if it wasn't already specified. 4715130803Smarcel if test -n "$destname"; then 4716130803Smarcel destfile="$destdir/$destname" 4717130803Smarcel else 4718130803Smarcel destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4719130803Smarcel destfile="$destdir/$destfile" 4720130803Smarcel fi 4721130803Smarcel 4722130803Smarcel # Do a test to see if this is really a libtool program. 4723130803Smarcel if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 4724130803Smarcel notinst_deplibs= 4725130803Smarcel relink_command= 4726130803Smarcel 4727130803Smarcel # If there is no directory component, then add one. 4728130803Smarcel case $file in 4729130803Smarcel */* | *\\*) . $file ;; 4730130803Smarcel *) . ./$file ;; 4731130803Smarcel esac 4732130803Smarcel 4733130803Smarcel # Check the variables that should have been set. 4734130803Smarcel if test -z "$notinst_deplibs"; then 4735130803Smarcel $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 4736130803Smarcel exit 1 4737130803Smarcel fi 4738130803Smarcel 4739130803Smarcel finalize=yes 4740130803Smarcel for lib in $notinst_deplibs; do 4741130803Smarcel # Check to see that each library is installed. 4742130803Smarcel libdir= 4743130803Smarcel if test -f "$lib"; then 4744130803Smarcel # If there is no directory component, then add one. 4745130803Smarcel case $lib in 4746130803Smarcel */* | *\\*) . $lib ;; 4747130803Smarcel *) . ./$lib ;; 4748130803Smarcel esac 4749130803Smarcel fi 4750130803Smarcel libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 4751130803Smarcel if test -n "$libdir" && test ! -f "$libfile"; then 4752130803Smarcel $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 4753130803Smarcel finalize=no 4754130803Smarcel fi 4755130803Smarcel done 4756130803Smarcel 4757130803Smarcel relink_command= 4758130803Smarcel # If there is no directory component, then add one. 4759130803Smarcel case $file in 4760130803Smarcel */* | *\\*) . $file ;; 4761130803Smarcel *) . ./$file ;; 4762130803Smarcel esac 4763130803Smarcel 4764130803Smarcel outputname= 4765130803Smarcel if test "$fast_install" = no && test -n "$relink_command"; then 4766130803Smarcel if test "$finalize" = yes && test -z "$run"; then 4767130803Smarcel tmpdir="/tmp" 4768130803Smarcel test -n "$TMPDIR" && tmpdir="$TMPDIR" 4769130803Smarcel tmpdir="$tmpdir/libtool-$$" 4770130803Smarcel if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 4771130803Smarcel else 4772130803Smarcel $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 4773130803Smarcel continue 4774130803Smarcel fi 4775130803Smarcel file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4776130803Smarcel outputname="$tmpdir/$file" 4777130803Smarcel # Replace the output file specification. 4778130803Smarcel relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 4779130803Smarcel 4780130803Smarcel $show "$relink_command" 4781130803Smarcel if $run eval "$relink_command"; then : 4782130803Smarcel else 4783130803Smarcel $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 4784130803Smarcel ${rm}r "$tmpdir" 4785130803Smarcel continue 4786130803Smarcel fi 4787130803Smarcel file="$outputname" 4788130803Smarcel else 4789130803Smarcel $echo "$modename: warning: cannot relink \`$file'" 1>&2 4790130803Smarcel fi 4791130803Smarcel else 4792130803Smarcel # Install the binary that we compiled earlier. 4793130803Smarcel file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 4794130803Smarcel fi 4795130803Smarcel fi 4796130803Smarcel 4797130803Smarcel 4798130803Smarcel # remove .exe since cygwin /usr/bin/install will append another 4799130803Smarcel # one anyways 4800130803Smarcel case $install_prog,$host in 4801130803Smarcel */usr/bin/install*,*cygwin*) 4802130803Smarcel case $file:$destfile in 4803130803Smarcel *.exe:*.exe) 4804130803Smarcel # this is ok 4805130803Smarcel ;; 4806130803Smarcel *.exe:*) 4807130803Smarcel destfile=$destfile.exe 4808130803Smarcel ;; 4809130803Smarcel *:*.exe) 4810130803Smarcel destfile=`echo $destfile | sed -e 's,.exe$,,'` 4811130803Smarcel ;; 4812130803Smarcel esac 4813130803Smarcel ;; 4814130803Smarcel esac 4815130803Smarcel 4816130803Smarcel $show "$install_prog$stripme $file $destfile" 4817130803Smarcel $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 4818130803Smarcel test -n "$outputname" && ${rm}r "$tmpdir" 4819130803Smarcel ;; 4820130803Smarcel esac 4821130803Smarcel done 4822130803Smarcel 4823130803Smarcel for file in $staticlibs; do 4824130803Smarcel name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4825130803Smarcel 4826130803Smarcel # Set up the ranlib parameters. 4827130803Smarcel oldlib="$destdir/$name" 4828130803Smarcel 4829130803Smarcel $show "$install_prog $file $oldlib" 4830130803Smarcel $run eval "$install_prog \$file \$oldlib" || exit $? 4831130803Smarcel 4832130803Smarcel if test -n "$stripme" && test -n "$striplib"; then 4833130803Smarcel $show "$old_striplib $oldlib" 4834130803Smarcel $run eval "$old_striplib $oldlib" || exit $? 4835130803Smarcel fi 4836130803Smarcel 4837130803Smarcel # Do each command in the postinstall commands. 4838130803Smarcel eval cmds=\"$old_postinstall_cmds\" 4839130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4840130803Smarcel for cmd in $cmds; do 4841130803Smarcel IFS="$save_ifs" 4842130803Smarcel $show "$cmd" 4843130803Smarcel $run eval "$cmd" || exit $? 4844130803Smarcel done 4845130803Smarcel IFS="$save_ifs" 4846130803Smarcel done 4847130803Smarcel 4848130803Smarcel if test -n "$future_libdirs"; then 4849130803Smarcel $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 4850130803Smarcel fi 4851130803Smarcel 4852130803Smarcel if test -n "$current_libdirs"; then 4853130803Smarcel # Maybe just do a dry run. 4854130803Smarcel test -n "$run" && current_libdirs=" -n$current_libdirs" 4855130803Smarcel exec_cmd='$SHELL $0 --finish$current_libdirs' 4856130803Smarcel else 4857130803Smarcel exit 0 4858130803Smarcel fi 4859130803Smarcel ;; 4860130803Smarcel 4861130803Smarcel # libtool finish mode 4862130803Smarcel finish) 4863130803Smarcel modename="$modename: finish" 4864130803Smarcel libdirs="$nonopt" 4865130803Smarcel admincmds= 4866130803Smarcel 4867130803Smarcel if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4868130803Smarcel for dir 4869130803Smarcel do 4870130803Smarcel libdirs="$libdirs $dir" 4871130803Smarcel done 4872130803Smarcel 4873130803Smarcel for libdir in $libdirs; do 4874130803Smarcel if test -n "$finish_cmds"; then 4875130803Smarcel # Do each command in the finish commands. 4876130803Smarcel eval cmds=\"$finish_cmds\" 4877130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4878130803Smarcel for cmd in $cmds; do 4879130803Smarcel IFS="$save_ifs" 4880130803Smarcel $show "$cmd" 4881130803Smarcel $run eval "$cmd" || admincmds="$admincmds 4882130803Smarcel $cmd" 4883130803Smarcel done 4884130803Smarcel IFS="$save_ifs" 4885130803Smarcel fi 4886130803Smarcel if test -n "$finish_eval"; then 4887130803Smarcel # Do the single finish_eval. 4888130803Smarcel eval cmds=\"$finish_eval\" 4889130803Smarcel $run eval "$cmds" || admincmds="$admincmds 4890130803Smarcel $cmds" 4891130803Smarcel fi 4892130803Smarcel done 4893130803Smarcel fi 4894130803Smarcel 4895130803Smarcel # Exit here if they wanted silent mode. 4896130803Smarcel test "$show" = ":" && exit 0 4897130803Smarcel 4898130803Smarcel echo "----------------------------------------------------------------------" 4899130803Smarcel echo "Libraries have been installed in:" 4900130803Smarcel for libdir in $libdirs; do 4901130803Smarcel echo " $libdir" 4902130803Smarcel done 4903130803Smarcel echo 4904130803Smarcel echo "If you ever happen to want to link against installed libraries" 4905130803Smarcel echo "in a given directory, LIBDIR, you must either use libtool, and" 4906130803Smarcel echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 4907130803Smarcel echo "flag during linking and do at least one of the following:" 4908130803Smarcel if test -n "$shlibpath_var"; then 4909130803Smarcel echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 4910130803Smarcel echo " during execution" 4911130803Smarcel fi 4912130803Smarcel if test -n "$runpath_var"; then 4913130803Smarcel echo " - add LIBDIR to the \`$runpath_var' environment variable" 4914130803Smarcel echo " during linking" 4915130803Smarcel fi 4916130803Smarcel if test -n "$hardcode_libdir_flag_spec"; then 4917130803Smarcel libdir=LIBDIR 4918130803Smarcel eval flag=\"$hardcode_libdir_flag_spec\" 4919130803Smarcel 4920130803Smarcel echo " - use the \`$flag' linker flag" 4921130803Smarcel fi 4922130803Smarcel if test -n "$admincmds"; then 4923130803Smarcel echo " - have your system administrator run these commands:$admincmds" 4924130803Smarcel fi 4925130803Smarcel if test -f /etc/ld.so.conf; then 4926130803Smarcel echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 4927130803Smarcel fi 4928130803Smarcel echo 4929130803Smarcel echo "See any operating system documentation about shared libraries for" 4930130803Smarcel echo "more information, such as the ld(1) and ld.so(8) manual pages." 4931130803Smarcel echo "----------------------------------------------------------------------" 4932130803Smarcel exit 0 4933130803Smarcel ;; 4934130803Smarcel 4935130803Smarcel # libtool execute mode 4936130803Smarcel execute) 4937130803Smarcel modename="$modename: execute" 4938130803Smarcel 4939130803Smarcel # The first argument is the command name. 4940130803Smarcel cmd="$nonopt" 4941130803Smarcel if test -z "$cmd"; then 4942130803Smarcel $echo "$modename: you must specify a COMMAND" 1>&2 4943130803Smarcel $echo "$help" 4944130803Smarcel exit 1 4945130803Smarcel fi 4946130803Smarcel 4947130803Smarcel # Handle -dlopen flags immediately. 4948130803Smarcel for file in $execute_dlfiles; do 4949130803Smarcel if test ! -f "$file"; then 4950130803Smarcel $echo "$modename: \`$file' is not a file" 1>&2 4951130803Smarcel $echo "$help" 1>&2 4952130803Smarcel exit 1 4953130803Smarcel fi 4954130803Smarcel 4955130803Smarcel dir= 4956130803Smarcel case $file in 4957130803Smarcel *.la) 4958130803Smarcel # Check to see that this really is a libtool archive. 4959130803Smarcel if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 4960130803Smarcel else 4961130803Smarcel $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4962130803Smarcel $echo "$help" 1>&2 4963130803Smarcel exit 1 4964130803Smarcel fi 4965130803Smarcel 4966130803Smarcel # Read the libtool library. 4967130803Smarcel dlname= 4968130803Smarcel library_names= 4969130803Smarcel 4970130803Smarcel # If there is no directory component, then add one. 4971130803Smarcel case $file in 4972130803Smarcel */* | *\\*) . $file ;; 4973130803Smarcel *) . ./$file ;; 4974130803Smarcel esac 4975130803Smarcel 4976130803Smarcel # Skip this library if it cannot be dlopened. 4977130803Smarcel if test -z "$dlname"; then 4978130803Smarcel # Warn if it was a shared library. 4979130803Smarcel test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 4980130803Smarcel continue 4981130803Smarcel fi 4982130803Smarcel 4983130803Smarcel dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 4984130803Smarcel test "X$dir" = "X$file" && dir=. 4985130803Smarcel 4986130803Smarcel if test -f "$dir/$objdir/$dlname"; then 4987130803Smarcel dir="$dir/$objdir" 4988130803Smarcel else 4989130803Smarcel $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 4990130803Smarcel exit 1 4991130803Smarcel fi 4992130803Smarcel ;; 4993130803Smarcel 4994130803Smarcel *.lo) 4995130803Smarcel # Just add the directory containing the .lo file. 4996130803Smarcel dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 4997130803Smarcel test "X$dir" = "X$file" && dir=. 4998130803Smarcel ;; 4999130803Smarcel 5000130803Smarcel *) 5001130803Smarcel $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 5002130803Smarcel continue 5003130803Smarcel ;; 5004130803Smarcel esac 5005130803Smarcel 5006130803Smarcel # Get the absolute pathname. 5007130803Smarcel absdir=`cd "$dir" && pwd` 5008130803Smarcel test -n "$absdir" && dir="$absdir" 5009130803Smarcel 5010130803Smarcel # Now add the directory to shlibpath_var. 5011130803Smarcel if eval "test -z \"\$$shlibpath_var\""; then 5012130803Smarcel eval "$shlibpath_var=\"\$dir\"" 5013130803Smarcel else 5014130803Smarcel eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 5015130803Smarcel fi 5016130803Smarcel done 5017130803Smarcel 5018130803Smarcel # This variable tells wrapper scripts just to set shlibpath_var 5019130803Smarcel # rather than running their programs. 5020130803Smarcel libtool_execute_magic="$magic" 5021130803Smarcel 5022130803Smarcel # Check if any of the arguments is a wrapper script. 5023130803Smarcel args= 5024130803Smarcel for file 5025130803Smarcel do 5026130803Smarcel case $file in 5027130803Smarcel -*) ;; 5028130803Smarcel *) 5029130803Smarcel # Do a test to see if this is really a libtool program. 5030130803Smarcel if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5031130803Smarcel # If there is no directory component, then add one. 5032130803Smarcel case $file in 5033130803Smarcel */* | *\\*) . $file ;; 5034130803Smarcel *) . ./$file ;; 5035130803Smarcel esac 5036130803Smarcel 5037130803Smarcel # Transform arg to wrapped name. 5038130803Smarcel file="$progdir/$program" 5039130803Smarcel fi 5040130803Smarcel ;; 5041130803Smarcel esac 5042130803Smarcel # Quote arguments (to preserve shell metacharacters). 5043130803Smarcel file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 5044130803Smarcel args="$args \"$file\"" 5045130803Smarcel done 5046130803Smarcel 5047130803Smarcel if test -z "$run"; then 5048130803Smarcel if test -n "$shlibpath_var"; then 5049130803Smarcel # Export the shlibpath_var. 5050130803Smarcel eval "export $shlibpath_var" 5051130803Smarcel fi 5052130803Smarcel 5053130803Smarcel # Restore saved enviroment variables 5054130803Smarcel if test "${save_LC_ALL+set}" = set; then 5055130803Smarcel LC_ALL="$save_LC_ALL"; export LC_ALL 5056130803Smarcel fi 5057130803Smarcel if test "${save_LANG+set}" = set; then 5058130803Smarcel LANG="$save_LANG"; export LANG 5059130803Smarcel fi 5060130803Smarcel 5061130803Smarcel # Now prepare to actually exec the command. 5062130803Smarcel exec_cmd='"$cmd"$args' 5063130803Smarcel else 5064130803Smarcel # Display what would be done. 5065130803Smarcel if test -n "$shlibpath_var"; then 5066130803Smarcel eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 5067130803Smarcel $echo "export $shlibpath_var" 5068130803Smarcel fi 5069130803Smarcel $echo "$cmd$args" 5070130803Smarcel exit 0 5071130803Smarcel fi 5072130803Smarcel ;; 5073130803Smarcel 5074130803Smarcel # libtool clean and uninstall mode 5075130803Smarcel clean | uninstall) 5076130803Smarcel modename="$modename: $mode" 5077130803Smarcel rm="$nonopt" 5078130803Smarcel files= 5079130803Smarcel rmforce= 5080130803Smarcel exit_status=0 5081130803Smarcel 5082130803Smarcel # This variable tells wrapper scripts just to set variables rather 5083130803Smarcel # than running their programs. 5084130803Smarcel libtool_install_magic="$magic" 5085130803Smarcel 5086130803Smarcel for arg 5087130803Smarcel do 5088130803Smarcel case $arg in 5089130803Smarcel -f) rm="$rm $arg"; rmforce=yes ;; 5090130803Smarcel -*) rm="$rm $arg" ;; 5091130803Smarcel *) files="$files $arg" ;; 5092130803Smarcel esac 5093130803Smarcel done 5094130803Smarcel 5095130803Smarcel if test -z "$rm"; then 5096130803Smarcel $echo "$modename: you must specify an RM program" 1>&2 5097130803Smarcel $echo "$help" 1>&2 5098130803Smarcel exit 1 5099130803Smarcel fi 5100130803Smarcel 5101130803Smarcel rmdirs= 5102130803Smarcel 5103130803Smarcel for file in $files; do 5104130803Smarcel dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 5105130803Smarcel if test "X$dir" = "X$file"; then 5106130803Smarcel dir=. 5107130803Smarcel objdir="$objdir" 5108130803Smarcel else 5109130803Smarcel objdir="$dir/$objdir" 5110130803Smarcel fi 5111130803Smarcel name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 5112130803Smarcel test $mode = uninstall && objdir="$dir" 5113130803Smarcel 5114130803Smarcel # Remember objdir for removal later, being careful to avoid duplicates 5115130803Smarcel if test $mode = clean; then 5116130803Smarcel case " $rmdirs " in 5117130803Smarcel *" $objdir "*) ;; 5118130803Smarcel *) rmdirs="$rmdirs $objdir" ;; 5119130803Smarcel esac 5120130803Smarcel fi 5121130803Smarcel 5122130803Smarcel # Don't error if the file doesn't exist and rm -f was used. 5123130803Smarcel if (test -L "$file") >/dev/null 2>&1 \ 5124130803Smarcel || (test -h "$file") >/dev/null 2>&1 \ 5125130803Smarcel || test -f "$file"; then 5126130803Smarcel : 5127130803Smarcel elif test -d "$file"; then 5128130803Smarcel exit_status=1 5129130803Smarcel continue 5130130803Smarcel elif test "$rmforce" = yes; then 5131130803Smarcel continue 5132130803Smarcel fi 5133130803Smarcel 5134130803Smarcel rmfiles="$file" 5135130803Smarcel 5136130803Smarcel case $name in 5137130803Smarcel *.la) 5138130803Smarcel # Possibly a libtool archive, so verify it. 5139130803Smarcel if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5140130803Smarcel . $dir/$name 5141130803Smarcel 5142130803Smarcel # Delete the libtool libraries and symlinks. 5143130803Smarcel for n in $library_names; do 5144130803Smarcel rmfiles="$rmfiles $objdir/$n" 5145130803Smarcel done 5146130803Smarcel test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 5147130803Smarcel test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 5148130803Smarcel 5149130803Smarcel if test $mode = uninstall; then 5150130803Smarcel if test -n "$library_names"; then 5151130803Smarcel # Do each command in the postuninstall commands. 5152130803Smarcel eval cmds=\"$postuninstall_cmds\" 5153130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 5154130803Smarcel for cmd in $cmds; do 5155130803Smarcel IFS="$save_ifs" 5156130803Smarcel $show "$cmd" 5157130803Smarcel $run eval "$cmd" 5158130803Smarcel if test $? != 0 && test "$rmforce" != yes; then 5159130803Smarcel exit_status=1 5160130803Smarcel fi 5161130803Smarcel done 5162130803Smarcel IFS="$save_ifs" 5163130803Smarcel fi 5164130803Smarcel 5165130803Smarcel if test -n "$old_library"; then 5166130803Smarcel # Do each command in the old_postuninstall commands. 5167130803Smarcel eval cmds=\"$old_postuninstall_cmds\" 5168130803Smarcel IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 5169130803Smarcel for cmd in $cmds; do 5170130803Smarcel IFS="$save_ifs" 5171130803Smarcel $show "$cmd" 5172130803Smarcel $run eval "$cmd" 5173130803Smarcel if test $? != 0 && test "$rmforce" != yes; then 5174130803Smarcel exit_status=1 5175130803Smarcel fi 5176130803Smarcel done 5177130803Smarcel IFS="$save_ifs" 5178130803Smarcel fi 5179130803Smarcel # FIXME: should reinstall the best remaining shared library. 5180130803Smarcel fi 5181130803Smarcel fi 5182130803Smarcel ;; 5183130803Smarcel 5184130803Smarcel *.lo) 5185130803Smarcel # Possibly a libtool object, so verify it. 5186130803Smarcel if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5187130803Smarcel 5188130803Smarcel # Read the .lo file 5189130803Smarcel . $dir/$name 5190130803Smarcel 5191130803Smarcel # Add PIC object to the list of files to remove. 5192130803Smarcel if test -n "$pic_object" \ 5193130803Smarcel && test "$pic_object" != none; then 5194130803Smarcel rmfiles="$rmfiles $dir/$pic_object" 5195130803Smarcel fi 5196130803Smarcel 5197130803Smarcel # Add non-PIC object to the list of files to remove. 5198130803Smarcel if test -n "$non_pic_object" \ 5199130803Smarcel && test "$non_pic_object" != none; then 5200130803Smarcel rmfiles="$rmfiles $dir/$non_pic_object" 5201130803Smarcel fi 5202130803Smarcel fi 5203130803Smarcel ;; 5204130803Smarcel 5205130803Smarcel *) 5206130803Smarcel # Do a test to see if this is a libtool program. 5207130803Smarcel if test $mode = clean && 5208130803Smarcel (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5209130803Smarcel relink_command= 5210130803Smarcel . $dir/$file 5211130803Smarcel 5212130803Smarcel rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 5213130803Smarcel if test "$fast_install" = yes && test -n "$relink_command"; then 5214130803Smarcel rmfiles="$rmfiles $objdir/lt-$name" 5215130803Smarcel fi 5216130803Smarcel fi 5217130803Smarcel ;; 5218130803Smarcel esac 5219130803Smarcel $show "$rm $rmfiles" 5220130803Smarcel $run $rm $rmfiles || exit_status=1 5221130803Smarcel done 5222130803Smarcel 5223130803Smarcel # Try to remove the ${objdir}s in the directories where we deleted files 5224130803Smarcel for dir in $rmdirs; do 5225130803Smarcel if test -d "$dir"; then 5226130803Smarcel $show "rmdir $dir" 5227130803Smarcel $run rmdir $dir >/dev/null 2>&1 5228130803Smarcel fi 5229130803Smarcel done 5230130803Smarcel 5231130803Smarcel exit $exit_status 5232130803Smarcel ;; 5233130803Smarcel 5234130803Smarcel "") 5235130803Smarcel $echo "$modename: you must specify a MODE" 1>&2 5236130803Smarcel $echo "$generic_help" 1>&2 5237130803Smarcel exit 1 5238130803Smarcel ;; 5239130803Smarcel esac 5240130803Smarcel 5241130803Smarcel if test -z "$exec_cmd"; then 5242130803Smarcel $echo "$modename: invalid operation mode \`$mode'" 1>&2 5243130803Smarcel $echo "$generic_help" 1>&2 5244130803Smarcel exit 1 5245130803Smarcel fi 5246130803Smarcelfi # test -z "$show_help" 5247130803Smarcel 5248130803Smarcelif test -n "$exec_cmd"; then 5249130803Smarcel eval exec $exec_cmd 5250130803Smarcel exit 1 5251130803Smarcelfi 5252130803Smarcel 5253130803Smarcel# We need to display help for each of the modes. 5254130803Smarcelcase $mode in 5255130803Smarcel"") $echo \ 5256130803Smarcel"Usage: $modename [OPTION]... [MODE-ARG]... 5257130803Smarcel 5258130803SmarcelProvide generalized library-building support services. 5259130803Smarcel 5260130803Smarcel --config show all configuration variables 5261130803Smarcel --debug enable verbose shell tracing 5262130803Smarcel-n, --dry-run display commands without modifying any files 5263130803Smarcel --features display basic configuration information and exit 5264130803Smarcel --finish same as \`--mode=finish' 5265130803Smarcel --help display this help message and exit 5266130803Smarcel --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 5267130803Smarcel --quiet same as \`--silent' 5268130803Smarcel --silent don't print informational messages 5269130803Smarcel --tag=TAG use configuration variables from tag TAG 5270130803Smarcel --version print version information 5271130803Smarcel 5272130803SmarcelMODE must be one of the following: 5273130803Smarcel 5274130803Smarcel clean remove files from the build directory 5275130803Smarcel compile compile a source file into a libtool object 5276130803Smarcel execute automatically set library path, then run a program 5277130803Smarcel finish complete the installation of libtool libraries 5278130803Smarcel install install libraries or executables 5279130803Smarcel link create a library or an executable 5280130803Smarcel uninstall remove libraries from an installed directory 5281130803Smarcel 5282130803SmarcelMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 5283130803Smarcela more detailed description of MODE." 5284130803Smarcel exit 0 5285130803Smarcel ;; 5286130803Smarcel 5287130803Smarcelclean) 5288130803Smarcel $echo \ 5289130803Smarcel"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 5290130803Smarcel 5291130803SmarcelRemove files from the build directory. 5292130803Smarcel 5293130803SmarcelRM is the name of the program to use to delete files associated with each FILE 5294130803Smarcel(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 5295130803Smarcelto RM. 5296130803Smarcel 5297130803SmarcelIf FILE is a libtool library, object or program, all the files associated 5298130803Smarcelwith it are deleted. Otherwise, only FILE itself is deleted using RM." 5299130803Smarcel ;; 5300130803Smarcel 5301130803Smarcelcompile) 5302130803Smarcel $echo \ 5303130803Smarcel"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 5304130803Smarcel 5305130803SmarcelCompile a source file into a libtool library object. 5306130803Smarcel 5307130803SmarcelThis mode accepts the following additional options: 5308130803Smarcel 5309130803Smarcel -o OUTPUT-FILE set the output file name to OUTPUT-FILE 5310130803Smarcel -prefer-pic try to building PIC objects only 5311130803Smarcel -prefer-non-pic try to building non-PIC objects only 5312130803Smarcel -static always build a \`.o' file suitable for static linking 5313130803Smarcel 5314130803SmarcelCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 5315130803Smarcelfrom the given SOURCEFILE. 5316130803Smarcel 5317130803SmarcelThe output file name is determined by removing the directory component from 5318130803SmarcelSOURCEFILE, then substituting the C source code suffix \`.c' with the 5319130803Smarcellibrary object suffix, \`.lo'." 5320130803Smarcel ;; 5321130803Smarcel 5322130803Smarcelexecute) 5323130803Smarcel $echo \ 5324130803Smarcel"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 5325130803Smarcel 5326130803SmarcelAutomatically set library path, then run a program. 5327130803Smarcel 5328130803SmarcelThis mode accepts the following additional options: 5329130803Smarcel 5330130803Smarcel -dlopen FILE add the directory containing FILE to the library path 5331130803Smarcel 5332130803SmarcelThis mode sets the library path environment variable according to \`-dlopen' 5333130803Smarcelflags. 5334130803Smarcel 5335130803SmarcelIf any of the ARGS are libtool executable wrappers, then they are translated 5336130803Smarcelinto their corresponding uninstalled binary, and any of their required library 5337130803Smarceldirectories are added to the library path. 5338130803Smarcel 5339130803SmarcelThen, COMMAND is executed, with ARGS as arguments." 5340130803Smarcel ;; 5341130803Smarcel 5342130803Smarcelfinish) 5343130803Smarcel $echo \ 5344130803Smarcel"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 5345130803Smarcel 5346130803SmarcelComplete the installation of libtool libraries. 5347130803Smarcel 5348130803SmarcelEach LIBDIR is a directory that contains libtool libraries. 5349130803Smarcel 5350130803SmarcelThe commands that this mode executes may require superuser privileges. Use 5351130803Smarcelthe \`--dry-run' option if you just want to see what would be executed." 5352130803Smarcel ;; 5353130803Smarcel 5354130803Smarcelinstall) 5355130803Smarcel $echo \ 5356130803Smarcel"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 5357130803Smarcel 5358130803SmarcelInstall executables or libraries. 5359130803Smarcel 5360130803SmarcelINSTALL-COMMAND is the installation command. The first component should be 5361130803Smarceleither the \`install' or \`cp' program. 5362130803Smarcel 5363130803SmarcelThe rest of the components are interpreted as arguments to that command (only 5364130803SmarcelBSD-compatible install options are recognized)." 5365130803Smarcel ;; 5366130803Smarcel 5367130803Smarcellink) 5368130803Smarcel $echo \ 5369130803Smarcel"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 5370130803Smarcel 5371130803SmarcelLink object files or libraries together to form another library, or to 5372130803Smarcelcreate an executable program. 5373130803Smarcel 5374130803SmarcelLINK-COMMAND is a command using the C compiler that you would use to create 5375130803Smarcela program from several object files. 5376130803Smarcel 5377130803SmarcelThe following components of LINK-COMMAND are treated specially: 5378130803Smarcel 5379130803Smarcel -all-static do not do any dynamic linking at all 5380130803Smarcel -avoid-version do not add a version suffix if possible 5381130803Smarcel -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 5382130803Smarcel -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 5383130803Smarcel -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 5384130803Smarcel -export-symbols SYMFILE 5385130803Smarcel try to export only the symbols listed in SYMFILE 5386130803Smarcel -export-symbols-regex REGEX 5387130803Smarcel try to export only the symbols matching REGEX 5388130803Smarcel -LLIBDIR search LIBDIR for required installed libraries 5389130803Smarcel -lNAME OUTPUT-FILE requires the installed library libNAME 5390130803Smarcel -module build a library that can dlopened 5391130803Smarcel -no-fast-install disable the fast-install mode 5392130803Smarcel -no-install link a not-installable executable 5393130803Smarcel -no-undefined declare that a library does not refer to external symbols 5394130803Smarcel -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 5395130803Smarcel -objectlist FILE Use a list of object files found in FILE to specify objects 5396130803Smarcel -release RELEASE specify package release information 5397130803Smarcel -rpath LIBDIR the created library will eventually be installed in LIBDIR 5398130803Smarcel -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 5399130803Smarcel -static do not do any dynamic linking of libtool libraries 5400130803Smarcel -version-info CURRENT[:REVISION[:AGE]] 5401130803Smarcel specify library version info [each variable defaults to 0] 5402130803Smarcel 5403130803SmarcelAll other options (arguments beginning with \`-') are ignored. 5404130803Smarcel 5405130803SmarcelEvery other argument is treated as a filename. Files ending in \`.la' are 5406130803Smarceltreated as uninstalled libtool libraries, other files are standard or library 5407130803Smarcelobject files. 5408130803Smarcel 5409130803SmarcelIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 5410130803Smarcelonly library objects (\`.lo' files) may be specified, and \`-rpath' is 5411130803Smarcelrequired, except when creating a convenience library. 5412130803Smarcel 5413130803SmarcelIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 5414130803Smarcelusing \`ar' and \`ranlib', or on Windows using \`lib'. 5415130803Smarcel 5416130803SmarcelIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 5417130803Smarcelis created, otherwise an executable program is created." 5418130803Smarcel ;; 5419130803Smarcel 5420130803Smarceluninstall) 5421130803Smarcel $echo \ 5422130803Smarcel"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 5423130803Smarcel 5424130803SmarcelRemove libraries from an installation directory. 5425130803Smarcel 5426130803SmarcelRM is the name of the program to use to delete files associated with each FILE 5427130803Smarcel(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 5428130803Smarcelto RM. 5429130803Smarcel 5430130803SmarcelIf FILE is a libtool library, all the files associated with it are deleted. 5431130803SmarcelOtherwise, only FILE itself is deleted using RM." 5432130803Smarcel ;; 5433130803Smarcel 5434130803Smarcel*) 5435130803Smarcel $echo "$modename: invalid operation mode \`$mode'" 1>&2 5436130803Smarcel $echo "$help" 1>&2 5437130803Smarcel exit 1 5438130803Smarcel ;; 5439130803Smarcelesac 5440130803Smarcel 5441130803Smarcelecho 5442130803Smarcel$echo "Try \`$modename --help' for more information about other modes." 5443130803Smarcel 5444130803Smarcelexit 0 5445130803Smarcel 5446130803Smarcel# The TAGs below are defined such that we never get into a situation 5447130803Smarcel# in which we disable both kinds of libraries. Given conflicting 5448130803Smarcel# choices, we go for a static library, that is the most portable, 5449130803Smarcel# since we can't tell whether shared libraries were disabled because 5450130803Smarcel# the user asked for that or because the platform doesn't support 5451130803Smarcel# them. This is particularly important on AIX, because we don't 5452130803Smarcel# support having both static and shared libraries enabled at the same 5453130803Smarcel# time on that platform, so we default to a shared-only configuration. 5454130803Smarcel# If a disable-shared tag is given, we'll fallback to a static-only 5455130803Smarcel# configuration. But we'll never go from static-only to shared-only. 5456130803Smarcel 5457130803Smarcel### BEGIN LIBTOOL TAG CONFIG: disable-shared 5458130803Smarcelbuild_libtool_libs=no 5459130803Smarcelbuild_old_libs=yes 5460130803Smarcel### END LIBTOOL TAG CONFIG: disable-shared 5461130803Smarcel 5462130803Smarcel### BEGIN LIBTOOL TAG CONFIG: disable-static 5463130803Smarcelbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5464130803Smarcel### END LIBTOOL TAG CONFIG: disable-static 5465130803Smarcel 5466130803Smarcel# Local Variables: 5467130803Smarcel# mode:shell-script 5468130803Smarcel# sh-indentation:2 5469130803Smarcel# End: 5470