1*03a78d15Sespie# ltmain.sh - Provide generalized library-building support services. 2*03a78d15Sespie# NOTE: Changing this file will not affect anything until you rerun ltconfig. 3*03a78d15Sespie# 4*03a78d15Sespie# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 5*03a78d15Sespie# Free Software Foundation, Inc. 6*03a78d15Sespie# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7*03a78d15Sespie# 8*03a78d15Sespie# This program is free software; you can redistribute it and/or modify 9*03a78d15Sespie# it under the terms of the GNU General Public License as published by 10*03a78d15Sespie# the Free Software Foundation; either version 2 of the License, or 11*03a78d15Sespie# (at your option) any later version. 12*03a78d15Sespie# 13*03a78d15Sespie# This program is distributed in the hope that it will be useful, but 14*03a78d15Sespie# WITHOUT ANY WARRANTY; without even the implied warranty of 15*03a78d15Sespie# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16*03a78d15Sespie# General Public License for more details. 17*03a78d15Sespie# 18*03a78d15Sespie# You should have received a copy of the GNU General Public License 19*03a78d15Sespie# along with this program; if not, write to the Free Software 20*03a78d15Sespie# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21*03a78d15Sespie# 22*03a78d15Sespie# As a special exception to the GNU General Public License, if you 23*03a78d15Sespie# distribute this file as part of a program that contains a 24*03a78d15Sespie# configuration script generated by Autoconf, you may include it under 25*03a78d15Sespie# the same distribution terms that you use for the rest of that program. 26*03a78d15Sespie 27*03a78d15Sespie# Check that we have a working $echo. 28*03a78d15Sespieif test "X$1" = X--no-reexec; then 29*03a78d15Sespie # Discard the --no-reexec flag, and continue. 30*03a78d15Sespie shift 31*03a78d15Sespieelif test "X$1" = X--fallback-echo; then 32*03a78d15Sespie # Avoid inline document here, it may be left over 33*03a78d15Sespie : 34*03a78d15Sespieelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 35*03a78d15Sespie # Yippee, $echo works! 36*03a78d15Sespie : 37*03a78d15Sespieelse 38*03a78d15Sespie # Restart under the correct shell, and then maybe $echo will work. 39*03a78d15Sespie exec $SHELL "$0" --no-reexec ${1+"$@"} 40*03a78d15Sespiefi 41*03a78d15Sespie 42*03a78d15Sespieif test "X$1" = X--fallback-echo; then 43*03a78d15Sespie # used as fallback echo 44*03a78d15Sespie shift 45*03a78d15Sespie cat <<EOF 46*03a78d15Sespie$* 47*03a78d15SespieEOF 48*03a78d15Sespie exit 0 49*03a78d15Sespiefi 50*03a78d15Sespie 51*03a78d15Sespie# The name of this program. 52*03a78d15Sespieprogname=`$echo "$0" | sed 's%^.*/%%'` 53*03a78d15Sespiemodename="$progname" 54*03a78d15Sespie 55*03a78d15Sespie# Constants. 56*03a78d15SespiePROGRAM=ltmain.sh 57*03a78d15SespiePACKAGE=libtool 58*03a78d15SespieVERSION=1.4a-GCC3.0 59*03a78d15SespieTIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)" 60*03a78d15Sespie 61*03a78d15Sespiedefault_mode= 62*03a78d15Sespiehelp="Try \`$progname --help' for more information." 63*03a78d15Sespiemagic="%%%MAGIC variable%%%" 64*03a78d15Sespiemkdir="mkdir" 65*03a78d15Sespiemv="mv -f" 66*03a78d15Sespierm="rm -f" 67*03a78d15Sespie 68*03a78d15Sespie# Sed substitution that helps us do robust quoting. It backslashifies 69*03a78d15Sespie# metacharacters that are still active within double-quoted strings. 70*03a78d15SespieXsed='sed -e 1s/^X//' 71*03a78d15Sespiesed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 72*03a78d15SespieSP2NL='tr \040 \012' 73*03a78d15SespieNL2SP='tr \015\012 \040\040' 74*03a78d15Sespie 75*03a78d15Sespie# NLS nuisances. 76*03a78d15Sespie# Only set LANG and LC_ALL to C if already set. 77*03a78d15Sespie# These must not be set unconditionally because not all systems understand 78*03a78d15Sespie# e.g. LANG=C (notably SCO). 79*03a78d15Sespie# We save the old values to restore during execute mode. 80*03a78d15Sespieif test "${LC_ALL+set}" = set; then 81*03a78d15Sespie save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 82*03a78d15Sespiefi 83*03a78d15Sespieif test "${LANG+set}" = set; then 84*03a78d15Sespie save_LANG="$LANG"; LANG=C; export LANG 85*03a78d15Sespiefi 86*03a78d15Sespie 87*03a78d15Sespieif test "$LTCONFIG_VERSION" != "$VERSION"; then 88*03a78d15Sespie echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 89*03a78d15Sespie echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 90*03a78d15Sespie exit 1 91*03a78d15Sespiefi 92*03a78d15Sespie 93*03a78d15Sespieif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 94*03a78d15Sespie echo "$modename: not configured to build any kind of library" 1>&2 95*03a78d15Sespie echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 96*03a78d15Sespie exit 1 97*03a78d15Sespiefi 98*03a78d15Sespie 99*03a78d15Sespie# Global variables. 100*03a78d15Sespiemode=$default_mode 101*03a78d15Sespienonopt= 102*03a78d15Sespieprev= 103*03a78d15Sespieprevopt= 104*03a78d15Sespierun= 105*03a78d15Sespieshow="$echo" 106*03a78d15Sespieshow_help= 107*03a78d15Sespieexecute_dlfiles= 108*03a78d15Sespielo2o="s/\\.lo\$/.${objext}/" 109*03a78d15Sespieo2lo="s/\\.${objext}\$/.lo/" 110*03a78d15Sespietaglist= 111*03a78d15Sespie 112*03a78d15Sespie# Parse our command line options once, thoroughly. 113*03a78d15Sespiewhile test $# -gt 0 114*03a78d15Sespiedo 115*03a78d15Sespie arg="$1" 116*03a78d15Sespie shift 117*03a78d15Sespie 118*03a78d15Sespie case $arg in 119*03a78d15Sespie -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 120*03a78d15Sespie *) optarg= ;; 121*03a78d15Sespie esac 122*03a78d15Sespie 123*03a78d15Sespie # If the previous option needs an argument, assign it. 124*03a78d15Sespie if test -n "$prev"; then 125*03a78d15Sespie case $prev in 126*03a78d15Sespie execute_dlfiles) 127*03a78d15Sespie execute_dlfiles="$execute_dlfiles $arg" 128*03a78d15Sespie ;; 129*03a78d15Sespie tag) 130*03a78d15Sespie tagname="$arg" 131*03a78d15Sespie 132*03a78d15Sespie # Check whether tagname contains only valid characters 133*03a78d15Sespie case $tagname in 134*03a78d15Sespie *[!-_A-Za-z0-9,/]*) 135*03a78d15Sespie echo "$progname: invalid tag name: $tagname" 1>&2 136*03a78d15Sespie exit 1 137*03a78d15Sespie ;; 138*03a78d15Sespie esac 139*03a78d15Sespie 140*03a78d15Sespie case $tagname in 141*03a78d15Sespie CC) 142*03a78d15Sespie # Don't test for the "default" C tag, as we know, it's there, but 143*03a78d15Sespie # not specially marked. 144*03a78d15Sespie taglist="$taglist $tagname" 145*03a78d15Sespie ;; 146*03a78d15Sespie *) 147*03a78d15Sespie if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then 148*03a78d15Sespie taglist="$taglist $tagname" 149*03a78d15Sespie # Evaluate the configuration. 150*03a78d15Sespie eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" 151*03a78d15Sespie else 152*03a78d15Sespie echo "$progname: ignoring unknown tag $tagname" 1>&2 153*03a78d15Sespie fi 154*03a78d15Sespie ;; 155*03a78d15Sespie esac 156*03a78d15Sespie ;; 157*03a78d15Sespie *) 158*03a78d15Sespie eval "$prev=\$arg" 159*03a78d15Sespie ;; 160*03a78d15Sespie esac 161*03a78d15Sespie 162*03a78d15Sespie prev= 163*03a78d15Sespie prevopt= 164*03a78d15Sespie continue 165*03a78d15Sespie fi 166*03a78d15Sespie 167*03a78d15Sespie # Have we seen a non-optional argument yet? 168*03a78d15Sespie case $arg in 169*03a78d15Sespie --help) 170*03a78d15Sespie show_help=yes 171*03a78d15Sespie ;; 172*03a78d15Sespie 173*03a78d15Sespie --version) 174*03a78d15Sespie echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 175*03a78d15Sespie exit 0 176*03a78d15Sespie ;; 177*03a78d15Sespie 178*03a78d15Sespie --config) 179*03a78d15Sespie sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0" 180*03a78d15Sespie # Now print the configurations for the tags. 181*03a78d15Sespie for tagname in $taglist; do 182*03a78d15Sespie sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" 183*03a78d15Sespie done 184*03a78d15Sespie exit 0 185*03a78d15Sespie ;; 186*03a78d15Sespie 187*03a78d15Sespie --debug) 188*03a78d15Sespie echo "$progname: enabling shell trace mode" 189*03a78d15Sespie set -x 190*03a78d15Sespie ;; 191*03a78d15Sespie 192*03a78d15Sespie --dry-run | -n) 193*03a78d15Sespie run=: 194*03a78d15Sespie ;; 195*03a78d15Sespie 196*03a78d15Sespie --features) 197*03a78d15Sespie echo "host: $host" 198*03a78d15Sespie if test "$build_libtool_libs" = yes; then 199*03a78d15Sespie echo "enable shared libraries" 200*03a78d15Sespie else 201*03a78d15Sespie echo "disable shared libraries" 202*03a78d15Sespie fi 203*03a78d15Sespie if test "$build_old_libs" = yes; then 204*03a78d15Sespie echo "enable static libraries" 205*03a78d15Sespie else 206*03a78d15Sespie echo "disable static libraries" 207*03a78d15Sespie fi 208*03a78d15Sespie exit 0 209*03a78d15Sespie ;; 210*03a78d15Sespie 211*03a78d15Sespie --finish) mode="finish" ;; 212*03a78d15Sespie 213*03a78d15Sespie --mode) prevopt="--mode" prev=mode ;; 214*03a78d15Sespie --mode=*) mode="$optarg" ;; 215*03a78d15Sespie 216*03a78d15Sespie --quiet | --silent) 217*03a78d15Sespie show=: 218*03a78d15Sespie ;; 219*03a78d15Sespie 220*03a78d15Sespie --tag) prevopt="--tag" prev=tag ;; 221*03a78d15Sespie --tag=*) 222*03a78d15Sespie set tag "$optarg" ${1+"$@"} 223*03a78d15Sespie shift 224*03a78d15Sespie prev=tag 225*03a78d15Sespie ;; 226*03a78d15Sespie 227*03a78d15Sespie -dlopen) 228*03a78d15Sespie prevopt="-dlopen" 229*03a78d15Sespie prev=execute_dlfiles 230*03a78d15Sespie ;; 231*03a78d15Sespie 232*03a78d15Sespie -*) 233*03a78d15Sespie $echo "$modename: unrecognized option \`$arg'" 1>&2 234*03a78d15Sespie $echo "$help" 1>&2 235*03a78d15Sespie exit 1 236*03a78d15Sespie ;; 237*03a78d15Sespie 238*03a78d15Sespie *) 239*03a78d15Sespie nonopt="$arg" 240*03a78d15Sespie break 241*03a78d15Sespie ;; 242*03a78d15Sespie esac 243*03a78d15Sespiedone 244*03a78d15Sespie 245*03a78d15Sespieif test -n "$prevopt"; then 246*03a78d15Sespie $echo "$modename: option \`$prevopt' requires an argument" 1>&2 247*03a78d15Sespie $echo "$help" 1>&2 248*03a78d15Sespie exit 1 249*03a78d15Sespiefi 250*03a78d15Sespie 251*03a78d15Sespie# If this variable is set in any of the actions, the command in it 252*03a78d15Sespie# will be execed at the end. This prevents here-documents from being 253*03a78d15Sespie# left over by shells. 254*03a78d15Sespieexec_cmd= 255*03a78d15Sespie 256*03a78d15Sespieif test -z "$show_help"; then 257*03a78d15Sespie 258*03a78d15Sespie # Infer the operation mode. 259*03a78d15Sespie if test -z "$mode"; then 260*03a78d15Sespie case $nonopt in 261*03a78d15Sespie *cc | *++ | gcc* | *-gcc*) 262*03a78d15Sespie mode=link 263*03a78d15Sespie for arg 264*03a78d15Sespie do 265*03a78d15Sespie case $arg in 266*03a78d15Sespie -c) 267*03a78d15Sespie mode=compile 268*03a78d15Sespie break 269*03a78d15Sespie ;; 270*03a78d15Sespie esac 271*03a78d15Sespie done 272*03a78d15Sespie ;; 273*03a78d15Sespie *db | *dbx | *strace | *truss) 274*03a78d15Sespie mode=execute 275*03a78d15Sespie ;; 276*03a78d15Sespie *install*|cp|mv) 277*03a78d15Sespie mode=install 278*03a78d15Sespie ;; 279*03a78d15Sespie *rm) 280*03a78d15Sespie mode=uninstall 281*03a78d15Sespie ;; 282*03a78d15Sespie *) 283*03a78d15Sespie # If we have no mode, but dlfiles were specified, then do execute mode. 284*03a78d15Sespie test -n "$execute_dlfiles" && mode=execute 285*03a78d15Sespie 286*03a78d15Sespie # Just use the default operation mode. 287*03a78d15Sespie if test -z "$mode"; then 288*03a78d15Sespie if test -n "$nonopt"; then 289*03a78d15Sespie $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 290*03a78d15Sespie else 291*03a78d15Sespie $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 292*03a78d15Sespie fi 293*03a78d15Sespie fi 294*03a78d15Sespie ;; 295*03a78d15Sespie esac 296*03a78d15Sespie fi 297*03a78d15Sespie 298*03a78d15Sespie # Only execute mode is allowed to have -dlopen flags. 299*03a78d15Sespie if test -n "$execute_dlfiles" && test "$mode" != execute; then 300*03a78d15Sespie $echo "$modename: unrecognized option \`-dlopen'" 1>&2 301*03a78d15Sespie $echo "$help" 1>&2 302*03a78d15Sespie exit 1 303*03a78d15Sespie fi 304*03a78d15Sespie 305*03a78d15Sespie # Change the help message to a mode-specific one. 306*03a78d15Sespie generic_help="$help" 307*03a78d15Sespie help="Try \`$modename --help --mode=$mode' for more information." 308*03a78d15Sespie 309*03a78d15Sespie # These modes are in order of execution frequency so that they run quickly. 310*03a78d15Sespie case $mode in 311*03a78d15Sespie # libtool compile mode 312*03a78d15Sespie compile) 313*03a78d15Sespie modename="$modename: compile" 314*03a78d15Sespie # Get the compilation command and the source file. 315*03a78d15Sespie base_compile= 316*03a78d15Sespie prev= 317*03a78d15Sespie lastarg= 318*03a78d15Sespie srcfile="$nonopt" 319*03a78d15Sespie suppress_output= 320*03a78d15Sespie 321*03a78d15Sespie user_target=no 322*03a78d15Sespie for arg 323*03a78d15Sespie do 324*03a78d15Sespie case $prev in 325*03a78d15Sespie "") ;; 326*03a78d15Sespie xcompiler) 327*03a78d15Sespie # Aesthetically quote the previous argument. 328*03a78d15Sespie prev= 329*03a78d15Sespie lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 330*03a78d15Sespie 331*03a78d15Sespie case $arg in 332*03a78d15Sespie # Double-quote args containing other shell metacharacters. 333*03a78d15Sespie # Many Bourne shells cannot handle close brackets correctly 334*03a78d15Sespie # in scan sets, so we specify it separately. 335*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 336*03a78d15Sespie arg="\"$arg\"" 337*03a78d15Sespie ;; 338*03a78d15Sespie esac 339*03a78d15Sespie 340*03a78d15Sespie # Add the previous argument to base_compile. 341*03a78d15Sespie if test -z "$base_compile"; then 342*03a78d15Sespie base_compile="$lastarg" 343*03a78d15Sespie else 344*03a78d15Sespie base_compile="$base_compile $lastarg" 345*03a78d15Sespie fi 346*03a78d15Sespie continue 347*03a78d15Sespie ;; 348*03a78d15Sespie esac 349*03a78d15Sespie 350*03a78d15Sespie # Accept any command-line options. 351*03a78d15Sespie case $arg in 352*03a78d15Sespie -o) 353*03a78d15Sespie if test "$user_target" != "no"; then 354*03a78d15Sespie $echo "$modename: you cannot specify \`-o' more than once" 1>&2 355*03a78d15Sespie exit 1 356*03a78d15Sespie fi 357*03a78d15Sespie user_target=next 358*03a78d15Sespie ;; 359*03a78d15Sespie 360*03a78d15Sespie -static) 361*03a78d15Sespie build_old_libs=yes 362*03a78d15Sespie continue 363*03a78d15Sespie ;; 364*03a78d15Sespie 365*03a78d15Sespie -prefer-pic) 366*03a78d15Sespie pic_mode=yes 367*03a78d15Sespie continue 368*03a78d15Sespie ;; 369*03a78d15Sespie 370*03a78d15Sespie -prefer-non-pic) 371*03a78d15Sespie pic_mode=no 372*03a78d15Sespie continue 373*03a78d15Sespie ;; 374*03a78d15Sespie 375*03a78d15Sespie -Xcompiler) 376*03a78d15Sespie prev=xcompiler 377*03a78d15Sespie continue 378*03a78d15Sespie ;; 379*03a78d15Sespie 380*03a78d15Sespie -Wc,*) 381*03a78d15Sespie args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 382*03a78d15Sespie lastarg= 383*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 384*03a78d15Sespie for arg in $args; do 385*03a78d15Sespie IFS="$save_ifs" 386*03a78d15Sespie 387*03a78d15Sespie # Double-quote args containing other shell metacharacters. 388*03a78d15Sespie # Many Bourne shells cannot handle close brackets correctly 389*03a78d15Sespie # in scan sets, so we specify it separately. 390*03a78d15Sespie case $arg in 391*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 392*03a78d15Sespie arg="\"$arg\"" 393*03a78d15Sespie ;; 394*03a78d15Sespie esac 395*03a78d15Sespie lastarg="$lastarg $arg" 396*03a78d15Sespie done 397*03a78d15Sespie IFS="$save_ifs" 398*03a78d15Sespie lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 399*03a78d15Sespie 400*03a78d15Sespie # Add the arguments to base_compile. 401*03a78d15Sespie if test -z "$base_compile"; then 402*03a78d15Sespie base_compile="$lastarg" 403*03a78d15Sespie else 404*03a78d15Sespie base_compile="$base_compile $lastarg" 405*03a78d15Sespie fi 406*03a78d15Sespie continue 407*03a78d15Sespie ;; 408*03a78d15Sespie esac 409*03a78d15Sespie 410*03a78d15Sespie case $user_target in 411*03a78d15Sespie next) 412*03a78d15Sespie # The next one is the -o target name 413*03a78d15Sespie user_target=yes 414*03a78d15Sespie continue 415*03a78d15Sespie ;; 416*03a78d15Sespie yes) 417*03a78d15Sespie # We got the output file 418*03a78d15Sespie user_target=set 419*03a78d15Sespie libobj="$arg" 420*03a78d15Sespie continue 421*03a78d15Sespie ;; 422*03a78d15Sespie esac 423*03a78d15Sespie 424*03a78d15Sespie # Accept the current argument as the source file. 425*03a78d15Sespie lastarg="$srcfile" 426*03a78d15Sespie srcfile="$arg" 427*03a78d15Sespie 428*03a78d15Sespie # Aesthetically quote the previous argument. 429*03a78d15Sespie 430*03a78d15Sespie # Backslashify any backslashes, double quotes, and dollar signs. 431*03a78d15Sespie # These are the only characters that are still specially 432*03a78d15Sespie # interpreted inside of double-quoted scrings. 433*03a78d15Sespie lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 434*03a78d15Sespie 435*03a78d15Sespie # Double-quote args containing other shell metacharacters. 436*03a78d15Sespie # Many Bourne shells cannot handle close brackets correctly 437*03a78d15Sespie # in scan sets, so we specify it separately. 438*03a78d15Sespie case $lastarg in 439*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 440*03a78d15Sespie lastarg="\"$lastarg\"" 441*03a78d15Sespie ;; 442*03a78d15Sespie esac 443*03a78d15Sespie 444*03a78d15Sespie # Add the previous argument to base_compile. 445*03a78d15Sespie if test -z "$base_compile"; then 446*03a78d15Sespie base_compile="$lastarg" 447*03a78d15Sespie else 448*03a78d15Sespie base_compile="$base_compile $lastarg" 449*03a78d15Sespie fi 450*03a78d15Sespie done 451*03a78d15Sespie 452*03a78d15Sespie case $user_target in 453*03a78d15Sespie set) 454*03a78d15Sespie ;; 455*03a78d15Sespie no) 456*03a78d15Sespie # Get the name of the library object. 457*03a78d15Sespie libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 458*03a78d15Sespie ;; 459*03a78d15Sespie *) 460*03a78d15Sespie $echo "$modename: you must specify a target with \`-o'" 1>&2 461*03a78d15Sespie exit 1 462*03a78d15Sespie ;; 463*03a78d15Sespie esac 464*03a78d15Sespie 465*03a78d15Sespie # Recognize several different file suffixes. 466*03a78d15Sespie # If the user specifies -o file.o, it is replaced with file.lo 467*03a78d15Sespie xform='[cCFSfmso]' 468*03a78d15Sespie case $libobj in 469*03a78d15Sespie *.ada) xform=ada ;; 470*03a78d15Sespie *.adb) xform=adb ;; 471*03a78d15Sespie *.ads) xform=ads ;; 472*03a78d15Sespie *.asm) xform=asm ;; 473*03a78d15Sespie *.c++) xform=c++ ;; 474*03a78d15Sespie *.cc) xform=cc ;; 475*03a78d15Sespie *.class) xform=class ;; 476*03a78d15Sespie *.cpp) xform=cpp ;; 477*03a78d15Sespie *.cxx) xform=cxx ;; 478*03a78d15Sespie *.f90) xform=f90 ;; 479*03a78d15Sespie *.for) xform=for ;; 480*03a78d15Sespie *.java) xform=java ;; 481*03a78d15Sespie esac 482*03a78d15Sespie 483*03a78d15Sespie libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 484*03a78d15Sespie 485*03a78d15Sespie case $libobj in 486*03a78d15Sespie *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 487*03a78d15Sespie *) 488*03a78d15Sespie $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 489*03a78d15Sespie exit 1 490*03a78d15Sespie ;; 491*03a78d15Sespie esac 492*03a78d15Sespie 493*03a78d15Sespie # Infer tagged configuration to use if any are available and 494*03a78d15Sespie # if one wasn't chosen via the "--tag" command line option. 495*03a78d15Sespie # Only attempt this if the compiler in the base compile 496*03a78d15Sespie # command doesn't match the default compiler. 497*03a78d15Sespie if test -n "$available_tags" && test -z "$tagname"; then 498*03a78d15Sespie case $base_compile in 499*03a78d15Sespie "$CC "*) ;; 500*03a78d15Sespie # Blanks in the command may have been stripped by the calling shell, 501*03a78d15Sespie # but not from the CC environment variable when ltconfig was run. 502*03a78d15Sespie "`$echo $CC` "*) ;; 503*03a78d15Sespie *) 504*03a78d15Sespie for z in $available_tags; do 505*03a78d15Sespie if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then 506*03a78d15Sespie # Evaluate the configuration. 507*03a78d15Sespie eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" 508*03a78d15Sespie case $base_compile in 509*03a78d15Sespie "$CC "*) 510*03a78d15Sespie # The compiler in the base compile command matches 511*03a78d15Sespie # the one in the tagged configuration. 512*03a78d15Sespie # Assume this is the tagged configuration we want. 513*03a78d15Sespie tagname=$z 514*03a78d15Sespie break 515*03a78d15Sespie ;; 516*03a78d15Sespie "`$echo $CC` "*) 517*03a78d15Sespie tagname=$z 518*03a78d15Sespie break 519*03a78d15Sespie ;; 520*03a78d15Sespie esac 521*03a78d15Sespie fi 522*03a78d15Sespie done 523*03a78d15Sespie # If $tagname still isn't set, then no tagged configuration 524*03a78d15Sespie # was found and let the user know that the "--tag" command 525*03a78d15Sespie # line option must be used. 526*03a78d15Sespie if test -z "$tagname"; then 527*03a78d15Sespie echo "$modename: unable to infer tagged configuration" 528*03a78d15Sespie echo "$modename: specify a tag with \`--tag'" 1>&2 529*03a78d15Sespie exit 1 530*03a78d15Sespie# else 531*03a78d15Sespie# echo "$modename: using $tagname tagged configuration" 532*03a78d15Sespie fi 533*03a78d15Sespie ;; 534*03a78d15Sespie esac 535*03a78d15Sespie fi 536*03a78d15Sespie 537*03a78d15Sespie objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 538*03a78d15Sespie xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 539*03a78d15Sespie if test "X$xdir" = "X$obj"; then 540*03a78d15Sespie xdir= 541*03a78d15Sespie else 542*03a78d15Sespie xdir=$xdir/ 543*03a78d15Sespie fi 544*03a78d15Sespie lobj=${xdir}$objdir/$objname 545*03a78d15Sespie 546*03a78d15Sespie if test -z "$base_compile"; then 547*03a78d15Sespie $echo "$modename: you must specify a compilation command" 1>&2 548*03a78d15Sespie $echo "$help" 1>&2 549*03a78d15Sespie exit 1 550*03a78d15Sespie fi 551*03a78d15Sespie 552*03a78d15Sespie # Delete any leftover library objects. 553*03a78d15Sespie if test "$build_old_libs" = yes; then 554*03a78d15Sespie removelist="$obj $lobj $libobj ${libobj}T" 555*03a78d15Sespie else 556*03a78d15Sespie removelist="$lobj $libobj ${libobj}T" 557*03a78d15Sespie fi 558*03a78d15Sespie 559*03a78d15Sespie $run $rm $removelist 560*03a78d15Sespie trap "$run $rm $removelist; exit 1" 1 2 15 561*03a78d15Sespie 562*03a78d15Sespie # On Cygwin there's no "real" PIC flag so we must build both object types 563*03a78d15Sespie case $host_os in 564*03a78d15Sespie cygwin* | mingw* | pw32* | os2*) 565*03a78d15Sespie pic_mode=default 566*03a78d15Sespie ;; 567*03a78d15Sespie esac 568*03a78d15Sespie if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then 569*03a78d15Sespie # non-PIC code in shared libraries is not supported 570*03a78d15Sespie pic_mode=default 571*03a78d15Sespie fi 572*03a78d15Sespie 573*03a78d15Sespie # Calculate the filename of the output object if compiler does 574*03a78d15Sespie # not support -o with -c 575*03a78d15Sespie if test "$compiler_c_o" = no; then 576*03a78d15Sespie output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 577*03a78d15Sespie lockfile="$output_obj.lock" 578*03a78d15Sespie removelist="$removelist $output_obj $lockfile" 579*03a78d15Sespie trap "$run $rm $removelist; exit 1" 1 2 15 580*03a78d15Sespie else 581*03a78d15Sespie output_obj= 582*03a78d15Sespie need_locks=no 583*03a78d15Sespie lockfile= 584*03a78d15Sespie fi 585*03a78d15Sespie 586*03a78d15Sespie # Lock this critical section if it is needed 587*03a78d15Sespie # We use this script file to make the link, it avoids creating a new file 588*03a78d15Sespie if test "$need_locks" = yes; then 589*03a78d15Sespie until $run ln "$0" "$lockfile" 2>/dev/null; do 590*03a78d15Sespie $show "Waiting for $lockfile to be removed" 591*03a78d15Sespie sleep 2 592*03a78d15Sespie done 593*03a78d15Sespie elif test "$need_locks" = warn; then 594*03a78d15Sespie if test -f "$lockfile"; then 595*03a78d15Sespie echo "\ 596*03a78d15Sespie*** ERROR, $lockfile exists and contains: 597*03a78d15Sespie`cat $lockfile 2>/dev/null` 598*03a78d15Sespie 599*03a78d15SespieThis indicates that another process is trying to use the same 600*03a78d15Sespietemporary object file, and libtool could not work around it because 601*03a78d15Sespieyour compiler does not support \`-c' and \`-o' together. If you 602*03a78d15Sespierepeat this compilation, it may succeed, by chance, but you had better 603*03a78d15Sespieavoid parallel builds (make -j) in this platform, or get a better 604*03a78d15Sespiecompiler." 605*03a78d15Sespie 606*03a78d15Sespie $run $rm $removelist 607*03a78d15Sespie exit 1 608*03a78d15Sespie fi 609*03a78d15Sespie echo $srcfile > "$lockfile" 610*03a78d15Sespie fi 611*03a78d15Sespie 612*03a78d15Sespie if test -n "$fix_srcfile_path"; then 613*03a78d15Sespie eval srcfile=\"$fix_srcfile_path\" 614*03a78d15Sespie fi 615*03a78d15Sespie 616*03a78d15Sespie $run $rm "$libobj" "${libobj}T" 617*03a78d15Sespie 618*03a78d15Sespie # Create a libtool object file (analogous to a ".la" file), 619*03a78d15Sespie # but don't create it if we're doing a dry run. 620*03a78d15Sespie test -z "$run" && cat > ${libobj}T <<EOF 621*03a78d15Sespie# $libobj - a libtool object file 622*03a78d15Sespie# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 623*03a78d15Sespie# 624*03a78d15Sespie# Please DO NOT delete this file! 625*03a78d15Sespie# It is necessary for linking the library. 626*03a78d15Sespie 627*03a78d15Sespie# Name of the PIC object. 628*03a78d15SespieEOF 629*03a78d15Sespie 630*03a78d15Sespie # Only build a PIC object if we are building libtool libraries. 631*03a78d15Sespie if test "$build_libtool_libs" = yes; then 632*03a78d15Sespie # Without this assignment, base_compile gets emptied. 633*03a78d15Sespie fbsd_hideous_sh_bug=$base_compile 634*03a78d15Sespie 635*03a78d15Sespie if test "$pic_mode" != no; then 636*03a78d15Sespie command="$base_compile $srcfile $pic_flag" 637*03a78d15Sespie else 638*03a78d15Sespie # Don't build PIC code 639*03a78d15Sespie command="$base_compile $srcfile" 640*03a78d15Sespie fi 641*03a78d15Sespie 642*03a78d15Sespie if test ! -d ${xdir}$objdir; then 643*03a78d15Sespie $show "$mkdir ${xdir}$objdir" 644*03a78d15Sespie $run $mkdir ${xdir}$objdir 645*03a78d15Sespie status=$? 646*03a78d15Sespie if test $status -ne 0 && test ! -d ${xdir}$objdir; then 647*03a78d15Sespie exit $status 648*03a78d15Sespie fi 649*03a78d15Sespie fi 650*03a78d15Sespie 651*03a78d15Sespie if test -z "$output_obj"; then 652*03a78d15Sespie # Place PIC objects in $objdir 653*03a78d15Sespie command="$command -o $lobj" 654*03a78d15Sespie fi 655*03a78d15Sespie 656*03a78d15Sespie $run $rm "$lobj" "$output_obj" 657*03a78d15Sespie 658*03a78d15Sespie $show "$command" 659*03a78d15Sespie if $run eval "$command"; then : 660*03a78d15Sespie else 661*03a78d15Sespie test -n "$output_obj" && $run $rm $removelist 662*03a78d15Sespie exit 1 663*03a78d15Sespie fi 664*03a78d15Sespie 665*03a78d15Sespie if test "$need_locks" = warn && 666*03a78d15Sespie test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then 667*03a78d15Sespie echo "\ 668*03a78d15Sespie*** ERROR, $lockfile contains: 669*03a78d15Sespie`cat $lockfile 2>/dev/null` 670*03a78d15Sespie 671*03a78d15Sespiebut it should contain: 672*03a78d15Sespie$srcfile 673*03a78d15Sespie 674*03a78d15SespieThis indicates that another process is trying to use the same 675*03a78d15Sespietemporary object file, and libtool could not work around it because 676*03a78d15Sespieyour compiler does not support \`-c' and \`-o' together. If you 677*03a78d15Sespierepeat this compilation, it may succeed, by chance, but you had better 678*03a78d15Sespieavoid parallel builds (make -j) in this platform, or get a better 679*03a78d15Sespiecompiler." 680*03a78d15Sespie 681*03a78d15Sespie $run $rm $removelist 682*03a78d15Sespie exit 1 683*03a78d15Sespie fi 684*03a78d15Sespie 685*03a78d15Sespie # Just move the object if needed, then go on to compile the next one 686*03a78d15Sespie if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then 687*03a78d15Sespie $show "$mv $output_obj $lobj" 688*03a78d15Sespie if $run $mv $output_obj $lobj; then : 689*03a78d15Sespie else 690*03a78d15Sespie error=$? 691*03a78d15Sespie $run $rm $removelist 692*03a78d15Sespie exit $error 693*03a78d15Sespie fi 694*03a78d15Sespie fi 695*03a78d15Sespie 696*03a78d15Sespie # Append the name of the PIC object to the libtool object file. 697*03a78d15Sespie test -z "$run" && cat >> ${libobj}T <<EOF 698*03a78d15Sespiepic_object='$objdir/$objname' 699*03a78d15Sespie 700*03a78d15SespieEOF 701*03a78d15Sespie 702*03a78d15Sespie # Allow error messages only from the first compilation. 703*03a78d15Sespie suppress_output=' >/dev/null 2>&1' 704*03a78d15Sespie else 705*03a78d15Sespie # No PIC object so indicate it doesn't exist in the libtool 706*03a78d15Sespie # object file. 707*03a78d15Sespie test -z "$run" && cat >> ${libobj}T <<EOF 708*03a78d15Sespiepic_object=none 709*03a78d15Sespie 710*03a78d15SespieEOF 711*03a78d15Sespie fi 712*03a78d15Sespie 713*03a78d15Sespie # Only build a position-dependent object if we build old libraries. 714*03a78d15Sespie if test "$build_old_libs" = yes; then 715*03a78d15Sespie if test "$pic_mode" != yes; then 716*03a78d15Sespie # Don't build PIC code 717*03a78d15Sespie command="$base_compile $srcfile" 718*03a78d15Sespie else 719*03a78d15Sespie command="$base_compile $srcfile $pic_flag" 720*03a78d15Sespie fi 721*03a78d15Sespie if test "$compiler_c_o" = yes; then 722*03a78d15Sespie command="$command -o $obj" 723*03a78d15Sespie fi 724*03a78d15Sespie 725*03a78d15Sespie # Suppress compiler output if we already did a PIC compilation. 726*03a78d15Sespie command="$command$suppress_output" 727*03a78d15Sespie $run $rm "$obj" "$output_obj" 728*03a78d15Sespie $show "$command" 729*03a78d15Sespie if $run eval "$command"; then : 730*03a78d15Sespie else 731*03a78d15Sespie $run $rm $removelist 732*03a78d15Sespie exit 1 733*03a78d15Sespie fi 734*03a78d15Sespie 735*03a78d15Sespie if test "$need_locks" = warn && 736*03a78d15Sespie test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then 737*03a78d15Sespie echo "\ 738*03a78d15Sespie*** ERROR, $lockfile contains: 739*03a78d15Sespie`cat $lockfile 2>/dev/null` 740*03a78d15Sespie 741*03a78d15Sespiebut it should contain: 742*03a78d15Sespie$srcfile 743*03a78d15Sespie 744*03a78d15SespieThis indicates that another process is trying to use the same 745*03a78d15Sespietemporary object file, and libtool could not work around it because 746*03a78d15Sespieyour compiler does not support \`-c' and \`-o' together. If you 747*03a78d15Sespierepeat this compilation, it may succeed, by chance, but you had better 748*03a78d15Sespieavoid parallel builds (make -j) in this platform, or get a better 749*03a78d15Sespiecompiler." 750*03a78d15Sespie 751*03a78d15Sespie $run $rm $removelist 752*03a78d15Sespie exit 1 753*03a78d15Sespie fi 754*03a78d15Sespie 755*03a78d15Sespie # Just move the object if needed 756*03a78d15Sespie if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then 757*03a78d15Sespie $show "$mv $output_obj $obj" 758*03a78d15Sespie if $run $mv $output_obj $obj; then : 759*03a78d15Sespie else 760*03a78d15Sespie error=$? 761*03a78d15Sespie $run $rm $removelist 762*03a78d15Sespie exit $error 763*03a78d15Sespie fi 764*03a78d15Sespie fi 765*03a78d15Sespie 766*03a78d15Sespie # Append the name of the non-PIC object the libtool object file. 767*03a78d15Sespie # Only append if the libtool object file exists. 768*03a78d15Sespie test -z "$run" && cat >> ${libobj}T <<EOF 769*03a78d15Sespie# Name of the non-PIC object. 770*03a78d15Sespienon_pic_object='$objname' 771*03a78d15Sespie 772*03a78d15SespieEOF 773*03a78d15Sespie else 774*03a78d15Sespie # Append the name of the non-PIC object the libtool object file. 775*03a78d15Sespie # Only append if the libtool object file exists. 776*03a78d15Sespie test -z "$run" && cat >> ${libobj}T <<EOF 777*03a78d15Sespie# Name of the non-PIC object. 778*03a78d15Sespienon_pic_object=none 779*03a78d15Sespie 780*03a78d15SespieEOF 781*03a78d15Sespie fi 782*03a78d15Sespie 783*03a78d15Sespie $run $mv "${libobj}T" "${libobj}" 784*03a78d15Sespie 785*03a78d15Sespie # Unlock the critical section if it was locked 786*03a78d15Sespie if test "$need_locks" != no; then 787*03a78d15Sespie $run $rm "$lockfile" 788*03a78d15Sespie fi 789*03a78d15Sespie 790*03a78d15Sespie exit 0 791*03a78d15Sespie ;; 792*03a78d15Sespie 793*03a78d15Sespie # libtool link mode 794*03a78d15Sespie link | relink) 795*03a78d15Sespie modename="$modename: link" 796*03a78d15Sespie case $host in 797*03a78d15Sespie *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 798*03a78d15Sespie # It is impossible to link a dll without this setting, and 799*03a78d15Sespie # we shouldn't force the makefile maintainer to figure out 800*03a78d15Sespie # which system we are compiling for in order to pass an extra 801*03a78d15Sespie # flag for every libtool invokation. 802*03a78d15Sespie # allow_undefined=no 803*03a78d15Sespie 804*03a78d15Sespie # FIXME: Unfortunately, there are problems with the above when trying 805*03a78d15Sespie # to make a dll which has undefined symbols, in which case not 806*03a78d15Sespie # even a static library is built. For now, we need to specify 807*03a78d15Sespie # -no-undefined on the libtool link line when we can be certain 808*03a78d15Sespie # that all symbols are satisfied, otherwise we get a static library. 809*03a78d15Sespie allow_undefined=yes 810*03a78d15Sespie ;; 811*03a78d15Sespie *) 812*03a78d15Sespie allow_undefined=yes 813*03a78d15Sespie ;; 814*03a78d15Sespie esac 815*03a78d15Sespie libtool_args="$nonopt" 816*03a78d15Sespie base_compile="$nonopt" 817*03a78d15Sespie compile_command="$nonopt" 818*03a78d15Sespie finalize_command="$nonopt" 819*03a78d15Sespie 820*03a78d15Sespie compile_rpath= 821*03a78d15Sespie finalize_rpath= 822*03a78d15Sespie compile_shlibpath= 823*03a78d15Sespie finalize_shlibpath= 824*03a78d15Sespie convenience= 825*03a78d15Sespie old_convenience= 826*03a78d15Sespie deplibs= 827*03a78d15Sespie old_deplibs= 828*03a78d15Sespie compiler_flags= 829*03a78d15Sespie linker_flags= 830*03a78d15Sespie dllsearchpath= 831*03a78d15Sespie lib_search_path=`pwd` 832*03a78d15Sespie 833*03a78d15Sespie avoid_version=no 834*03a78d15Sespie dlfiles= 835*03a78d15Sespie dlprefiles= 836*03a78d15Sespie dlself=no 837*03a78d15Sespie export_dynamic=no 838*03a78d15Sespie export_symbols= 839*03a78d15Sespie export_symbols_regex= 840*03a78d15Sespie generated= 841*03a78d15Sespie libobjs= 842*03a78d15Sespie ltlibs= 843*03a78d15Sespie module=no 844*03a78d15Sespie no_install=no 845*03a78d15Sespie objs= 846*03a78d15Sespie non_pic_objects= 847*03a78d15Sespie prefer_static_libs=no 848*03a78d15Sespie preload=no 849*03a78d15Sespie prev= 850*03a78d15Sespie prevarg= 851*03a78d15Sespie release= 852*03a78d15Sespie rpath= 853*03a78d15Sespie xrpath= 854*03a78d15Sespie perm_rpath= 855*03a78d15Sespie temp_rpath= 856*03a78d15Sespie thread_safe=no 857*03a78d15Sespie vinfo= 858*03a78d15Sespie 859*03a78d15Sespie # We need to know -static, to get the right output filenames. 860*03a78d15Sespie for arg 861*03a78d15Sespie do 862*03a78d15Sespie case $arg in 863*03a78d15Sespie -all-static | -static) 864*03a78d15Sespie if test "X$arg" = "X-all-static"; then 865*03a78d15Sespie if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 866*03a78d15Sespie $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 867*03a78d15Sespie fi 868*03a78d15Sespie if test -n "$link_static_flag"; then 869*03a78d15Sespie dlopen_self=$dlopen_self_static 870*03a78d15Sespie fi 871*03a78d15Sespie else 872*03a78d15Sespie if test -z "$pic_flag" && test -n "$link_static_flag"; then 873*03a78d15Sespie dlopen_self=$dlopen_self_static 874*03a78d15Sespie fi 875*03a78d15Sespie fi 876*03a78d15Sespie build_libtool_libs=no 877*03a78d15Sespie build_old_libs=yes 878*03a78d15Sespie prefer_static_libs=yes 879*03a78d15Sespie break 880*03a78d15Sespie ;; 881*03a78d15Sespie esac 882*03a78d15Sespie done 883*03a78d15Sespie 884*03a78d15Sespie # See if our shared archives depend on static archives. 885*03a78d15Sespie test -n "$old_archive_from_new_cmds" && build_old_libs=yes 886*03a78d15Sespie 887*03a78d15Sespie # Go through the arguments, transforming them on the way. 888*03a78d15Sespie while test $# -gt 0; do 889*03a78d15Sespie arg="$1" 890*03a78d15Sespie base_compile="$base_compile $arg" 891*03a78d15Sespie shift 892*03a78d15Sespie case $arg in 893*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 894*03a78d15Sespie qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 895*03a78d15Sespie ;; 896*03a78d15Sespie *) qarg=$arg ;; 897*03a78d15Sespie esac 898*03a78d15Sespie libtool_args="$libtool_args $qarg" 899*03a78d15Sespie 900*03a78d15Sespie # If the previous option needs an argument, assign it. 901*03a78d15Sespie if test -n "$prev"; then 902*03a78d15Sespie case $prev in 903*03a78d15Sespie output) 904*03a78d15Sespie compile_command="$compile_command @OUTPUT@" 905*03a78d15Sespie finalize_command="$finalize_command @OUTPUT@" 906*03a78d15Sespie ;; 907*03a78d15Sespie esac 908*03a78d15Sespie 909*03a78d15Sespie case $prev in 910*03a78d15Sespie dlfiles|dlprefiles) 911*03a78d15Sespie if test "$preload" = no; then 912*03a78d15Sespie # Add the symbol object into the linking commands. 913*03a78d15Sespie compile_command="$compile_command @SYMFILE@" 914*03a78d15Sespie finalize_command="$finalize_command @SYMFILE@" 915*03a78d15Sespie preload=yes 916*03a78d15Sespie fi 917*03a78d15Sespie case $arg in 918*03a78d15Sespie *.la | *.lo) ;; # We handle these cases below. 919*03a78d15Sespie force) 920*03a78d15Sespie if test "$dlself" = no; then 921*03a78d15Sespie dlself=needless 922*03a78d15Sespie export_dynamic=yes 923*03a78d15Sespie fi 924*03a78d15Sespie prev= 925*03a78d15Sespie continue 926*03a78d15Sespie ;; 927*03a78d15Sespie self) 928*03a78d15Sespie if test "$prev" = dlprefiles; then 929*03a78d15Sespie dlself=yes 930*03a78d15Sespie elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 931*03a78d15Sespie dlself=yes 932*03a78d15Sespie else 933*03a78d15Sespie dlself=needless 934*03a78d15Sespie export_dynamic=yes 935*03a78d15Sespie fi 936*03a78d15Sespie prev= 937*03a78d15Sespie continue 938*03a78d15Sespie ;; 939*03a78d15Sespie *) 940*03a78d15Sespie if test "$prev" = dlfiles; then 941*03a78d15Sespie dlfiles="$dlfiles $arg" 942*03a78d15Sespie else 943*03a78d15Sespie dlprefiles="$dlprefiles $arg" 944*03a78d15Sespie fi 945*03a78d15Sespie prev= 946*03a78d15Sespie continue 947*03a78d15Sespie ;; 948*03a78d15Sespie esac 949*03a78d15Sespie ;; 950*03a78d15Sespie expsyms) 951*03a78d15Sespie export_symbols="$arg" 952*03a78d15Sespie if test ! -f "$arg"; then 953*03a78d15Sespie $echo "$modename: symbol file \`$arg' does not exist" 954*03a78d15Sespie exit 1 955*03a78d15Sespie fi 956*03a78d15Sespie prev= 957*03a78d15Sespie continue 958*03a78d15Sespie ;; 959*03a78d15Sespie expsyms_regex) 960*03a78d15Sespie export_symbols_regex="$arg" 961*03a78d15Sespie prev= 962*03a78d15Sespie continue 963*03a78d15Sespie ;; 964*03a78d15Sespie release) 965*03a78d15Sespie release="-$arg" 966*03a78d15Sespie prev= 967*03a78d15Sespie continue 968*03a78d15Sespie ;; 969*03a78d15Sespie objectlist) 970*03a78d15Sespie if test -f "$arg"; then 971*03a78d15Sespie save_arg=$arg 972*03a78d15Sespie moreargs= 973*03a78d15Sespie for fil in `cat $save_arg` 974*03a78d15Sespie do 975*03a78d15Sespie# moreargs="$moreargs $fil" 976*03a78d15Sespie arg=$fil 977*03a78d15Sespie # A libtool-controlled object. 978*03a78d15Sespie 979*03a78d15Sespie # Check to see that this really is a libtool object. 980*03a78d15Sespie if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 981*03a78d15Sespie pic_object= 982*03a78d15Sespie non_pic_object= 983*03a78d15Sespie 984*03a78d15Sespie # Read the .lo file 985*03a78d15Sespie # If there is no directory component, then add one. 986*03a78d15Sespie case $arg in 987*03a78d15Sespie */* | *\\*) . $arg ;; 988*03a78d15Sespie *) . ./$arg ;; 989*03a78d15Sespie esac 990*03a78d15Sespie 991*03a78d15Sespie if test -z "$pic_object" || \ 992*03a78d15Sespie test -z "$non_pic_object" || 993*03a78d15Sespie test "$pic_object" = none && \ 994*03a78d15Sespie test "$non_pic_object" = none; then 995*03a78d15Sespie $echo "$modename: cannot find name of object for \`$arg'" 1>&2 996*03a78d15Sespie exit 1 997*03a78d15Sespie fi 998*03a78d15Sespie 999*03a78d15Sespie # Extract subdirectory from the argument. 1000*03a78d15Sespie xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1001*03a78d15Sespie if test "X$xdir" = "X$arg"; then 1002*03a78d15Sespie xdir= 1003*03a78d15Sespie else 1004*03a78d15Sespie xdir="$xdir/" 1005*03a78d15Sespie fi 1006*03a78d15Sespie 1007*03a78d15Sespie if test "$pic_object" != none; then 1008*03a78d15Sespie # Prepend the subdirectory the object is found in. 1009*03a78d15Sespie pic_object="$xdir$pic_object" 1010*03a78d15Sespie 1011*03a78d15Sespie if test "$prev" = dlfiles; then 1012*03a78d15Sespie if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1013*03a78d15Sespie dlfiles="$dlfiles $pic_object" 1014*03a78d15Sespie prev= 1015*03a78d15Sespie continue 1016*03a78d15Sespie else 1017*03a78d15Sespie # If libtool objects are unsupported, then we need to preload. 1018*03a78d15Sespie prev=dlprefiles 1019*03a78d15Sespie fi 1020*03a78d15Sespie fi 1021*03a78d15Sespie 1022*03a78d15Sespie # CHECK ME: I think I busted this. -Ossama 1023*03a78d15Sespie if test "$prev" = dlprefiles; then 1024*03a78d15Sespie # Preload the old-style object. 1025*03a78d15Sespie dlprefiles="$dlprefiles $pic_object" 1026*03a78d15Sespie prev= 1027*03a78d15Sespie fi 1028*03a78d15Sespie 1029*03a78d15Sespie # A PIC object. 1030*03a78d15Sespie libobjs="$libobjs $pic_object" 1031*03a78d15Sespie arg="$pic_object" 1032*03a78d15Sespie fi 1033*03a78d15Sespie 1034*03a78d15Sespie # Non-PIC object. 1035*03a78d15Sespie if test "$non_pic_object" != none; then 1036*03a78d15Sespie # Prepend the subdirectory the object is found in. 1037*03a78d15Sespie non_pic_object="$xdir$non_pic_object" 1038*03a78d15Sespie 1039*03a78d15Sespie # A standard non-PIC object 1040*03a78d15Sespie non_pic_objects="$non_pic_objects $non_pic_object" 1041*03a78d15Sespie if test -z "$pic_object" || test "$pic_object" = none ; then 1042*03a78d15Sespie arg="$non_pic_object" 1043*03a78d15Sespie fi 1044*03a78d15Sespie fi 1045*03a78d15Sespie else 1046*03a78d15Sespie # Only an error if not doing a dry-run. 1047*03a78d15Sespie if test -z "$run"; then 1048*03a78d15Sespie $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1049*03a78d15Sespie exit 1 1050*03a78d15Sespie else 1051*03a78d15Sespie # Dry-run case. 1052*03a78d15Sespie 1053*03a78d15Sespie # Extract subdirectory from the argument. 1054*03a78d15Sespie xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1055*03a78d15Sespie if test "X$xdir" = "X$arg"; then 1056*03a78d15Sespie xdir= 1057*03a78d15Sespie else 1058*03a78d15Sespie xdir="$xdir/" 1059*03a78d15Sespie fi 1060*03a78d15Sespie 1061*03a78d15Sespie pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1062*03a78d15Sespie non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1063*03a78d15Sespie libobjs="$libobjs $pic_object" 1064*03a78d15Sespie non_pic_objects="$non_pic_objects $non_pic_object" 1065*03a78d15Sespie fi 1066*03a78d15Sespie fi 1067*03a78d15Sespie done 1068*03a78d15Sespie else 1069*03a78d15Sespie $echo "$modename: link input file \`$save_arg' does not exist" 1070*03a78d15Sespie exit 1 1071*03a78d15Sespie fi 1072*03a78d15Sespie arg=$save_arg 1073*03a78d15Sespie prev= 1074*03a78d15Sespie continue 1075*03a78d15Sespie ;; 1076*03a78d15Sespie rpath | xrpath) 1077*03a78d15Sespie # We need an absolute path. 1078*03a78d15Sespie case $arg in 1079*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) ;; 1080*03a78d15Sespie *) 1081*03a78d15Sespie $echo "$modename: only absolute run-paths are allowed" 1>&2 1082*03a78d15Sespie exit 1 1083*03a78d15Sespie ;; 1084*03a78d15Sespie esac 1085*03a78d15Sespie if test "$prev" = rpath; then 1086*03a78d15Sespie case "$rpath " in 1087*03a78d15Sespie *" $arg "*) ;; 1088*03a78d15Sespie *) rpath="$rpath $arg" ;; 1089*03a78d15Sespie esac 1090*03a78d15Sespie else 1091*03a78d15Sespie case "$xrpath " in 1092*03a78d15Sespie *" $arg "*) ;; 1093*03a78d15Sespie *) xrpath="$xrpath $arg" ;; 1094*03a78d15Sespie esac 1095*03a78d15Sespie fi 1096*03a78d15Sespie prev= 1097*03a78d15Sespie continue 1098*03a78d15Sespie ;; 1099*03a78d15Sespie xcompiler) 1100*03a78d15Sespie compiler_flags="$compiler_flags $qarg" 1101*03a78d15Sespie prev= 1102*03a78d15Sespie compile_command="$compile_command $qarg" 1103*03a78d15Sespie finalize_command="$finalize_command $qarg" 1104*03a78d15Sespie continue 1105*03a78d15Sespie ;; 1106*03a78d15Sespie xlinker) 1107*03a78d15Sespie linker_flags="$linker_flags $qarg" 1108*03a78d15Sespie compiler_flags="$compiler_flags $wl$qarg" 1109*03a78d15Sespie prev= 1110*03a78d15Sespie compile_command="$compile_command $wl$qarg" 1111*03a78d15Sespie finalize_command="$finalize_command $wl$qarg" 1112*03a78d15Sespie continue 1113*03a78d15Sespie ;; 1114*03a78d15Sespie *) 1115*03a78d15Sespie eval "$prev=\"\$arg\"" 1116*03a78d15Sespie prev= 1117*03a78d15Sespie continue 1118*03a78d15Sespie ;; 1119*03a78d15Sespie esac 1120*03a78d15Sespie fi # test -n $prev 1121*03a78d15Sespie 1122*03a78d15Sespie prevarg="$arg" 1123*03a78d15Sespie 1124*03a78d15Sespie case $arg in 1125*03a78d15Sespie -all-static) 1126*03a78d15Sespie if test -n "$link_static_flag"; then 1127*03a78d15Sespie compile_command="$compile_command $link_static_flag" 1128*03a78d15Sespie finalize_command="$finalize_command $link_static_flag" 1129*03a78d15Sespie fi 1130*03a78d15Sespie continue 1131*03a78d15Sespie ;; 1132*03a78d15Sespie 1133*03a78d15Sespie -allow-undefined) 1134*03a78d15Sespie # FIXME: remove this flag sometime in the future. 1135*03a78d15Sespie $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1136*03a78d15Sespie continue 1137*03a78d15Sespie ;; 1138*03a78d15Sespie 1139*03a78d15Sespie -avoid-version) 1140*03a78d15Sespie avoid_version=yes 1141*03a78d15Sespie continue 1142*03a78d15Sespie ;; 1143*03a78d15Sespie 1144*03a78d15Sespie -dlopen) 1145*03a78d15Sespie prev=dlfiles 1146*03a78d15Sespie continue 1147*03a78d15Sespie ;; 1148*03a78d15Sespie 1149*03a78d15Sespie -dlpreopen) 1150*03a78d15Sespie prev=dlprefiles 1151*03a78d15Sespie continue 1152*03a78d15Sespie ;; 1153*03a78d15Sespie 1154*03a78d15Sespie -export-dynamic) 1155*03a78d15Sespie export_dynamic=yes 1156*03a78d15Sespie continue 1157*03a78d15Sespie ;; 1158*03a78d15Sespie 1159*03a78d15Sespie -export-symbols | -export-symbols-regex) 1160*03a78d15Sespie if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1161*03a78d15Sespie $echo "$modename: more than one -exported-symbols argument is not allowed" 1162*03a78d15Sespie exit 1 1163*03a78d15Sespie fi 1164*03a78d15Sespie if test "X$arg" = "X-export-symbols"; then 1165*03a78d15Sespie prev=expsyms 1166*03a78d15Sespie else 1167*03a78d15Sespie prev=expsyms_regex 1168*03a78d15Sespie fi 1169*03a78d15Sespie continue 1170*03a78d15Sespie ;; 1171*03a78d15Sespie 1172*03a78d15Sespie # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1173*03a78d15Sespie # so, if we see these flags be careful not to treat them like -L 1174*03a78d15Sespie -L[A-Z][A-Z]*:*) 1175*03a78d15Sespie case $with_gcc/$host in 1176*03a78d15Sespie no/*-*-irix*) 1177*03a78d15Sespie compile_command="$compile_command $arg" 1178*03a78d15Sespie finalize_command="$finalize_command $arg" 1179*03a78d15Sespie ;; 1180*03a78d15Sespie esac 1181*03a78d15Sespie continue 1182*03a78d15Sespie ;; 1183*03a78d15Sespie 1184*03a78d15Sespie -L*) 1185*03a78d15Sespie dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1186*03a78d15Sespie # We need an absolute path. 1187*03a78d15Sespie case $dir in 1188*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) ;; 1189*03a78d15Sespie *) 1190*03a78d15Sespie absdir=`cd "$dir" && pwd` 1191*03a78d15Sespie if test -z "$absdir"; then 1192*03a78d15Sespie $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1193*03a78d15Sespie exit 1 1194*03a78d15Sespie fi 1195*03a78d15Sespie dir="$absdir" 1196*03a78d15Sespie ;; 1197*03a78d15Sespie esac 1198*03a78d15Sespie case "$deplibs " in 1199*03a78d15Sespie *" -L$dir "*) ;; 1200*03a78d15Sespie *) 1201*03a78d15Sespie deplibs="$deplibs -L$dir" 1202*03a78d15Sespie lib_search_path="$lib_search_path $dir" 1203*03a78d15Sespie ;; 1204*03a78d15Sespie esac 1205*03a78d15Sespie case $host in 1206*03a78d15Sespie *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1207*03a78d15Sespie case :$dllsearchpath: in 1208*03a78d15Sespie *":$dir:"*) ;; 1209*03a78d15Sespie *) dllsearchpath="$dllsearchpath:$dir";; 1210*03a78d15Sespie esac 1211*03a78d15Sespie ;; 1212*03a78d15Sespie esac 1213*03a78d15Sespie continue 1214*03a78d15Sespie ;; 1215*03a78d15Sespie 1216*03a78d15Sespie -l*) 1217*03a78d15Sespie if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1218*03a78d15Sespie case $host in 1219*03a78d15Sespie *-*-cygwin* | *-*-pw32* | *-*-beos*) 1220*03a78d15Sespie # These systems don't actually have a C or math library (as such) 1221*03a78d15Sespie continue 1222*03a78d15Sespie ;; 1223*03a78d15Sespie *-*-mingw* | *-*-os2*) 1224*03a78d15Sespie # These systems don't actually have a C library (as such) 1225*03a78d15Sespie test "X$arg" = "X-lc" && continue 1226*03a78d15Sespie ;; 1227*03a78d15Sespie esac 1228*03a78d15Sespie fi 1229*03a78d15Sespie deplibs="$deplibs $arg" 1230*03a78d15Sespie continue 1231*03a78d15Sespie ;; 1232*03a78d15Sespie 1233*03a78d15Sespie -module) 1234*03a78d15Sespie module=yes 1235*03a78d15Sespie continue 1236*03a78d15Sespie ;; 1237*03a78d15Sespie 1238*03a78d15Sespie -no-fast-install) 1239*03a78d15Sespie fast_install=no 1240*03a78d15Sespie continue 1241*03a78d15Sespie ;; 1242*03a78d15Sespie 1243*03a78d15Sespie -no-install) 1244*03a78d15Sespie case $host in 1245*03a78d15Sespie *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1246*03a78d15Sespie # The PATH hackery in wrapper scripts is required on Windows 1247*03a78d15Sespie # in order for the loader to find any dlls it needs. 1248*03a78d15Sespie $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1249*03a78d15Sespie $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1250*03a78d15Sespie fast_install=no 1251*03a78d15Sespie ;; 1252*03a78d15Sespie *) no_install=yes ;; 1253*03a78d15Sespie esac 1254*03a78d15Sespie continue 1255*03a78d15Sespie ;; 1256*03a78d15Sespie 1257*03a78d15Sespie -no-undefined) 1258*03a78d15Sespie allow_undefined=no 1259*03a78d15Sespie continue 1260*03a78d15Sespie ;; 1261*03a78d15Sespie 1262*03a78d15Sespie -objectlist) 1263*03a78d15Sespie prev=objectlist 1264*03a78d15Sespie continue 1265*03a78d15Sespie ;; 1266*03a78d15Sespie 1267*03a78d15Sespie -o) prev=output ;; 1268*03a78d15Sespie 1269*03a78d15Sespie -release) 1270*03a78d15Sespie prev=release 1271*03a78d15Sespie continue 1272*03a78d15Sespie ;; 1273*03a78d15Sespie 1274*03a78d15Sespie -rpath) 1275*03a78d15Sespie prev=rpath 1276*03a78d15Sespie continue 1277*03a78d15Sespie ;; 1278*03a78d15Sespie 1279*03a78d15Sespie -R) 1280*03a78d15Sespie prev=xrpath 1281*03a78d15Sespie continue 1282*03a78d15Sespie ;; 1283*03a78d15Sespie 1284*03a78d15Sespie -R*) 1285*03a78d15Sespie dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1286*03a78d15Sespie # We need an absolute path. 1287*03a78d15Sespie case $dir in 1288*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) ;; 1289*03a78d15Sespie *) 1290*03a78d15Sespie $echo "$modename: only absolute run-paths are allowed" 1>&2 1291*03a78d15Sespie exit 1 1292*03a78d15Sespie ;; 1293*03a78d15Sespie esac 1294*03a78d15Sespie case "$xrpath " in 1295*03a78d15Sespie *" $dir "*) ;; 1296*03a78d15Sespie *) xrpath="$xrpath $dir" ;; 1297*03a78d15Sespie esac 1298*03a78d15Sespie continue 1299*03a78d15Sespie ;; 1300*03a78d15Sespie 1301*03a78d15Sespie -static) 1302*03a78d15Sespie # The effects of -static are defined in a previous loop. 1303*03a78d15Sespie # We used to do the same as -all-static on platforms that 1304*03a78d15Sespie # didn't have a PIC flag, but the assumption that the effects 1305*03a78d15Sespie # would be equivalent was wrong. It would break on at least 1306*03a78d15Sespie # Digital Unix and AIX. 1307*03a78d15Sespie continue 1308*03a78d15Sespie ;; 1309*03a78d15Sespie 1310*03a78d15Sespie -thread-safe) 1311*03a78d15Sespie thread_safe=yes 1312*03a78d15Sespie continue 1313*03a78d15Sespie ;; 1314*03a78d15Sespie 1315*03a78d15Sespie -version-info) 1316*03a78d15Sespie prev=vinfo 1317*03a78d15Sespie continue 1318*03a78d15Sespie ;; 1319*03a78d15Sespie 1320*03a78d15Sespie -Wc,*) 1321*03a78d15Sespie args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1322*03a78d15Sespie arg= 1323*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 1324*03a78d15Sespie for flag in $args; do 1325*03a78d15Sespie IFS="$save_ifs" 1326*03a78d15Sespie case $flag in 1327*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1328*03a78d15Sespie flag="\"$flag\"" 1329*03a78d15Sespie ;; 1330*03a78d15Sespie esac 1331*03a78d15Sespie arg="$arg $wl$flag" 1332*03a78d15Sespie compiler_flags="$compiler_flags $flag" 1333*03a78d15Sespie done 1334*03a78d15Sespie IFS="$save_ifs" 1335*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1336*03a78d15Sespie ;; 1337*03a78d15Sespie 1338*03a78d15Sespie -Wl,*) 1339*03a78d15Sespie args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1340*03a78d15Sespie arg= 1341*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' 1342*03a78d15Sespie for flag in $args; do 1343*03a78d15Sespie IFS="$save_ifs" 1344*03a78d15Sespie case $flag in 1345*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1346*03a78d15Sespie flag="\"$flag\"" 1347*03a78d15Sespie ;; 1348*03a78d15Sespie esac 1349*03a78d15Sespie arg="$arg $wl$flag" 1350*03a78d15Sespie compiler_flags="$compiler_flags $wl$flag" 1351*03a78d15Sespie linker_flags="$linker_flags $flag" 1352*03a78d15Sespie done 1353*03a78d15Sespie IFS="$save_ifs" 1354*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1355*03a78d15Sespie ;; 1356*03a78d15Sespie 1357*03a78d15Sespie -Xcompiler) 1358*03a78d15Sespie prev=xcompiler 1359*03a78d15Sespie continue 1360*03a78d15Sespie ;; 1361*03a78d15Sespie 1362*03a78d15Sespie -Xlinker) 1363*03a78d15Sespie prev=xlinker 1364*03a78d15Sespie continue 1365*03a78d15Sespie ;; 1366*03a78d15Sespie 1367*03a78d15Sespie # Some other compiler flag. 1368*03a78d15Sespie -* | +*) 1369*03a78d15Sespie # Unknown arguments in both finalize_command and compile_command need 1370*03a78d15Sespie # to be aesthetically quoted because they are evaled later. 1371*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1372*03a78d15Sespie case $arg in 1373*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1374*03a78d15Sespie arg="\"$arg\"" 1375*03a78d15Sespie ;; 1376*03a78d15Sespie esac 1377*03a78d15Sespie ;; 1378*03a78d15Sespie 1379*03a78d15Sespie *.$objext) 1380*03a78d15Sespie # A standard object. 1381*03a78d15Sespie objs="$objs $arg" 1382*03a78d15Sespie ;; 1383*03a78d15Sespie 1384*03a78d15Sespie *.lo) 1385*03a78d15Sespie # A libtool-controlled object. 1386*03a78d15Sespie 1387*03a78d15Sespie # Check to see that this really is a libtool object. 1388*03a78d15Sespie if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1389*03a78d15Sespie pic_object= 1390*03a78d15Sespie non_pic_object= 1391*03a78d15Sespie 1392*03a78d15Sespie # Read the .lo file 1393*03a78d15Sespie # If there is no directory component, then add one. 1394*03a78d15Sespie case $arg in 1395*03a78d15Sespie */* | *\\*) . $arg ;; 1396*03a78d15Sespie *) . ./$arg ;; 1397*03a78d15Sespie esac 1398*03a78d15Sespie 1399*03a78d15Sespie if test -z "$pic_object" || \ 1400*03a78d15Sespie test -z "$non_pic_object" || 1401*03a78d15Sespie test "$pic_object" = none && \ 1402*03a78d15Sespie test "$non_pic_object" = none; then 1403*03a78d15Sespie $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1404*03a78d15Sespie exit 1 1405*03a78d15Sespie fi 1406*03a78d15Sespie 1407*03a78d15Sespie # Extract subdirectory from the argument. 1408*03a78d15Sespie xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1409*03a78d15Sespie if test "X$xdir" = "X$arg"; then 1410*03a78d15Sespie xdir= 1411*03a78d15Sespie else 1412*03a78d15Sespie xdir="$xdir/" 1413*03a78d15Sespie fi 1414*03a78d15Sespie 1415*03a78d15Sespie if test "$pic_object" != none; then 1416*03a78d15Sespie # Prepend the subdirectory the object is found in. 1417*03a78d15Sespie pic_object="$xdir$pic_object" 1418*03a78d15Sespie 1419*03a78d15Sespie if test "$prev" = dlfiles; then 1420*03a78d15Sespie if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1421*03a78d15Sespie dlfiles="$dlfiles $pic_object" 1422*03a78d15Sespie prev= 1423*03a78d15Sespie continue 1424*03a78d15Sespie else 1425*03a78d15Sespie # If libtool objects are unsupported, then we need to preload. 1426*03a78d15Sespie prev=dlprefiles 1427*03a78d15Sespie fi 1428*03a78d15Sespie fi 1429*03a78d15Sespie 1430*03a78d15Sespie # CHECK ME: I think I busted this. -Ossama 1431*03a78d15Sespie if test "$prev" = dlprefiles; then 1432*03a78d15Sespie # Preload the old-style object. 1433*03a78d15Sespie dlprefiles="$dlprefiles $pic_object" 1434*03a78d15Sespie prev= 1435*03a78d15Sespie fi 1436*03a78d15Sespie 1437*03a78d15Sespie # A PIC object. 1438*03a78d15Sespie libobjs="$libobjs $pic_object" 1439*03a78d15Sespie arg="$pic_object" 1440*03a78d15Sespie fi 1441*03a78d15Sespie 1442*03a78d15Sespie # Non-PIC object. 1443*03a78d15Sespie if test "$non_pic_object" != none; then 1444*03a78d15Sespie # Prepend the subdirectory the object is found in. 1445*03a78d15Sespie non_pic_object="$xdir$non_pic_object" 1446*03a78d15Sespie 1447*03a78d15Sespie # A standard non-PIC object 1448*03a78d15Sespie non_pic_objects="$non_pic_objects $non_pic_object" 1449*03a78d15Sespie if test -z "$pic_object" || test "$pic_object" = none ; then 1450*03a78d15Sespie arg="$non_pic_object" 1451*03a78d15Sespie fi 1452*03a78d15Sespie fi 1453*03a78d15Sespie else 1454*03a78d15Sespie # Only an error if not doing a dry-run. 1455*03a78d15Sespie if test -z "$run"; then 1456*03a78d15Sespie $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1457*03a78d15Sespie exit 1 1458*03a78d15Sespie else 1459*03a78d15Sespie # Dry-run case. 1460*03a78d15Sespie 1461*03a78d15Sespie # Extract subdirectory from the argument. 1462*03a78d15Sespie xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1463*03a78d15Sespie if test "X$xdir" = "X$arg"; then 1464*03a78d15Sespie xdir= 1465*03a78d15Sespie else 1466*03a78d15Sespie xdir="$xdir/" 1467*03a78d15Sespie fi 1468*03a78d15Sespie 1469*03a78d15Sespie pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1470*03a78d15Sespie non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1471*03a78d15Sespie libobjs="$libobjs $pic_object" 1472*03a78d15Sespie non_pic_objects="$non_pic_objects $non_pic_object" 1473*03a78d15Sespie fi 1474*03a78d15Sespie fi 1475*03a78d15Sespie ;; 1476*03a78d15Sespie 1477*03a78d15Sespie *.$libext) 1478*03a78d15Sespie # An archive. 1479*03a78d15Sespie deplibs="$deplibs $arg" 1480*03a78d15Sespie old_deplibs="$old_deplibs $arg" 1481*03a78d15Sespie continue 1482*03a78d15Sespie ;; 1483*03a78d15Sespie 1484*03a78d15Sespie *.la) 1485*03a78d15Sespie # A libtool-controlled library. 1486*03a78d15Sespie 1487*03a78d15Sespie if test "$prev" = dlfiles; then 1488*03a78d15Sespie # This library was specified with -dlopen. 1489*03a78d15Sespie dlfiles="$dlfiles $arg" 1490*03a78d15Sespie prev= 1491*03a78d15Sespie elif test "$prev" = dlprefiles; then 1492*03a78d15Sespie # The library was specified with -dlpreopen. 1493*03a78d15Sespie dlprefiles="$dlprefiles $arg" 1494*03a78d15Sespie prev= 1495*03a78d15Sespie else 1496*03a78d15Sespie deplibs="$deplibs $arg" 1497*03a78d15Sespie fi 1498*03a78d15Sespie continue 1499*03a78d15Sespie ;; 1500*03a78d15Sespie 1501*03a78d15Sespie # Some other compiler argument. 1502*03a78d15Sespie *) 1503*03a78d15Sespie # Unknown arguments in both finalize_command and compile_command need 1504*03a78d15Sespie # to be aesthetically quoted because they are evaled later. 1505*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1506*03a78d15Sespie case $arg in 1507*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1508*03a78d15Sespie arg="\"$arg\"" 1509*03a78d15Sespie ;; 1510*03a78d15Sespie esac 1511*03a78d15Sespie ;; 1512*03a78d15Sespie esac # arg 1513*03a78d15Sespie 1514*03a78d15Sespie # Now actually substitute the argument into the commands. 1515*03a78d15Sespie if test -n "$arg"; then 1516*03a78d15Sespie compile_command="$compile_command $arg" 1517*03a78d15Sespie finalize_command="$finalize_command $arg" 1518*03a78d15Sespie fi 1519*03a78d15Sespie done # argument parsing loop 1520*03a78d15Sespie 1521*03a78d15Sespie if test -n "$prev"; then 1522*03a78d15Sespie $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1523*03a78d15Sespie $echo "$help" 1>&2 1524*03a78d15Sespie exit 1 1525*03a78d15Sespie fi 1526*03a78d15Sespie 1527*03a78d15Sespie # Infer tagged configuration to use if any are available and 1528*03a78d15Sespie # if one wasn't chosen via the "--tag" command line option. 1529*03a78d15Sespie # Only attempt this if the compiler in the base link 1530*03a78d15Sespie # command doesn't match the default compiler. 1531*03a78d15Sespie if test -n "$available_tags" && test -z "$tagname"; then 1532*03a78d15Sespie case $base_compile in 1533*03a78d15Sespie "$CC "*) ;; 1534*03a78d15Sespie # Blanks in the command may have been stripped by the calling shell, 1535*03a78d15Sespie # but not from the CC environment variable when ltconfig was run. 1536*03a78d15Sespie "`$echo $CC` "*) ;; 1537*03a78d15Sespie *) 1538*03a78d15Sespie for z in $available_tags; do 1539*03a78d15Sespie if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then 1540*03a78d15Sespie # Evaluate the configuration. 1541*03a78d15Sespie eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" 1542*03a78d15Sespie case $base_compile in 1543*03a78d15Sespie "$CC "*) 1544*03a78d15Sespie # The compiler in $compile_command matches 1545*03a78d15Sespie # the one in the tagged configuration. 1546*03a78d15Sespie # Assume this is the tagged configuration we want. 1547*03a78d15Sespie tagname=$z 1548*03a78d15Sespie break 1549*03a78d15Sespie ;; 1550*03a78d15Sespie "`$echo $CC` "*) 1551*03a78d15Sespie tagname=$z 1552*03a78d15Sespie break 1553*03a78d15Sespie ;; 1554*03a78d15Sespie esac 1555*03a78d15Sespie fi 1556*03a78d15Sespie done 1557*03a78d15Sespie # If $tagname still isn't set, then no tagged configuration 1558*03a78d15Sespie # was found and let the user know that the "--tag" command 1559*03a78d15Sespie # line option must be used. 1560*03a78d15Sespie if test -z "$tagname"; then 1561*03a78d15Sespie echo "$modename: unable to infer tagged configuration" 1562*03a78d15Sespie echo "$modename: specify a tag with \`--tag'" 1>&2 1563*03a78d15Sespie exit 1 1564*03a78d15Sespie# else 1565*03a78d15Sespie# echo "$modename: using $tagname tagged configuration" 1566*03a78d15Sespie fi 1567*03a78d15Sespie ;; 1568*03a78d15Sespie esac 1569*03a78d15Sespie fi 1570*03a78d15Sespie 1571*03a78d15Sespie if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1572*03a78d15Sespie eval arg=\"$export_dynamic_flag_spec\" 1573*03a78d15Sespie compile_command="$compile_command $arg" 1574*03a78d15Sespie finalize_command="$finalize_command $arg" 1575*03a78d15Sespie fi 1576*03a78d15Sespie 1577*03a78d15Sespie # calculate the name of the file, without its directory 1578*03a78d15Sespie outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1579*03a78d15Sespie libobjs_save="$libobjs" 1580*03a78d15Sespie 1581*03a78d15Sespie if test -n "$shlibpath_var"; then 1582*03a78d15Sespie # get the directories listed in $shlibpath_var 1583*03a78d15Sespie eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1584*03a78d15Sespie else 1585*03a78d15Sespie shlib_search_path= 1586*03a78d15Sespie fi 1587*03a78d15Sespie eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1588*03a78d15Sespie eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1589*03a78d15Sespie 1590*03a78d15Sespie output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1591*03a78d15Sespie if test "X$output_objdir" = "X$output"; then 1592*03a78d15Sespie output_objdir="$objdir" 1593*03a78d15Sespie else 1594*03a78d15Sespie output_objdir="$output_objdir/$objdir" 1595*03a78d15Sespie fi 1596*03a78d15Sespie # Create the object directory. 1597*03a78d15Sespie if test ! -d $output_objdir; then 1598*03a78d15Sespie $show "$mkdir $output_objdir" 1599*03a78d15Sespie $run $mkdir $output_objdir 1600*03a78d15Sespie status=$? 1601*03a78d15Sespie if test $status -ne 0 && test ! -d $output_objdir; then 1602*03a78d15Sespie exit $status 1603*03a78d15Sespie fi 1604*03a78d15Sespie fi 1605*03a78d15Sespie 1606*03a78d15Sespie # Determine the type of output 1607*03a78d15Sespie case $output in 1608*03a78d15Sespie "") 1609*03a78d15Sespie $echo "$modename: you must specify an output file" 1>&2 1610*03a78d15Sespie $echo "$help" 1>&2 1611*03a78d15Sespie exit 1 1612*03a78d15Sespie ;; 1613*03a78d15Sespie *.$libext) linkmode=oldlib ;; 1614*03a78d15Sespie *.lo | *.$objext) linkmode=obj ;; 1615*03a78d15Sespie *.la) linkmode=lib ;; 1616*03a78d15Sespie *) linkmode=prog ;; # Anything else should be a program. 1617*03a78d15Sespie esac 1618*03a78d15Sespie 1619*03a78d15Sespie specialdeplibs= 1620*03a78d15Sespie libs= 1621*03a78d15Sespie # Find all interdependent deplibs by searching for libraries 1622*03a78d15Sespie # that are linked more than once (e.g. -la -lb -la) 1623*03a78d15Sespie for deplib in $deplibs; do 1624*03a78d15Sespie case "$libs " in 1625*03a78d15Sespie *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1626*03a78d15Sespie esac 1627*03a78d15Sespie libs="$libs $deplib" 1628*03a78d15Sespie done 1629*03a78d15Sespie 1630*03a78d15Sespie if test $linkmode = lib; then 1631*03a78d15Sespie libs="$predeps $libs $compiler_lib_search_path $postdeps" 1632*03a78d15Sespie 1633*03a78d15Sespie # Compute libraries that are listed more than once in $predeps 1634*03a78d15Sespie # $postdeps and mark them as special (i.e., whose duplicates are 1635*03a78d15Sespie # not to be eliminated). 1636*03a78d15Sespie pre_post_deps= 1637*03a78d15Sespie for pre_post_dep in $predeps $postdeps; do 1638*03a78d15Sespie case "$pre_post_deps " in 1639*03a78d15Sespie *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 1640*03a78d15Sespie esac 1641*03a78d15Sespie pre_post_deps="$pre_post_deps $pre_post_dep" 1642*03a78d15Sespie done 1643*03a78d15Sespie pre_post_deps= 1644*03a78d15Sespie fi 1645*03a78d15Sespie 1646*03a78d15Sespie deplibs= 1647*03a78d15Sespie newdependency_libs= 1648*03a78d15Sespie newlib_search_path= 1649*03a78d15Sespie need_relink=no # whether we're linking any uninstalled libtool libraries 1650*03a78d15Sespie notinst_deplibs= # not-installed libtool libraries 1651*03a78d15Sespie notinst_path= # paths that contain not-installed libtool libraries 1652*03a78d15Sespie case $linkmode in 1653*03a78d15Sespie lib) 1654*03a78d15Sespie passes="conv link" 1655*03a78d15Sespie for file in $dlfiles $dlprefiles; do 1656*03a78d15Sespie case $file in 1657*03a78d15Sespie *.la) ;; 1658*03a78d15Sespie *) 1659*03a78d15Sespie $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 1660*03a78d15Sespie exit 1 1661*03a78d15Sespie ;; 1662*03a78d15Sespie esac 1663*03a78d15Sespie done 1664*03a78d15Sespie ;; 1665*03a78d15Sespie prog) 1666*03a78d15Sespie compile_deplibs= 1667*03a78d15Sespie finalize_deplibs= 1668*03a78d15Sespie alldeplibs=no 1669*03a78d15Sespie newdlfiles= 1670*03a78d15Sespie newdlprefiles= 1671*03a78d15Sespie passes="conv scan dlopen dlpreopen link" 1672*03a78d15Sespie ;; 1673*03a78d15Sespie *) passes="conv" 1674*03a78d15Sespie ;; 1675*03a78d15Sespie esac 1676*03a78d15Sespie for pass in $passes; do 1677*03a78d15Sespie if test $linkmode = prog; then 1678*03a78d15Sespie # Determine which files to process 1679*03a78d15Sespie case $pass in 1680*03a78d15Sespie dlopen) 1681*03a78d15Sespie libs="$dlfiles" 1682*03a78d15Sespie save_deplibs="$deplibs" # Collect dlpreopened libraries 1683*03a78d15Sespie deplibs= 1684*03a78d15Sespie ;; 1685*03a78d15Sespie dlpreopen) libs="$dlprefiles" ;; 1686*03a78d15Sespie link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 1687*03a78d15Sespie esac 1688*03a78d15Sespie fi 1689*03a78d15Sespie for deplib in $libs; do 1690*03a78d15Sespie lib= 1691*03a78d15Sespie found=no 1692*03a78d15Sespie case $deplib in 1693*03a78d15Sespie -l*) 1694*03a78d15Sespie if test $linkmode = oldlib && test $linkmode = obj; then 1695*03a78d15Sespie $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 1696*03a78d15Sespie continue 1697*03a78d15Sespie fi 1698*03a78d15Sespie if test $pass = conv; then 1699*03a78d15Sespie deplibs="$deplib $deplibs" 1700*03a78d15Sespie continue 1701*03a78d15Sespie fi 1702*03a78d15Sespie name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 1703*03a78d15Sespie for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 1704*03a78d15Sespie # Search the libtool library 1705*03a78d15Sespie lib="$searchdir/lib${name}.la" 1706*03a78d15Sespie if test -f "$lib"; then 1707*03a78d15Sespie found=yes 1708*03a78d15Sespie break 1709*03a78d15Sespie fi 1710*03a78d15Sespie done 1711*03a78d15Sespie if test "$found" != yes; then 1712*03a78d15Sespie # deplib doesn't seem to be a libtool library 1713*03a78d15Sespie if test "$linkmode,$pass" = "prog,link"; then 1714*03a78d15Sespie compile_deplibs="$deplib $compile_deplibs" 1715*03a78d15Sespie finalize_deplibs="$deplib $finalize_deplibs" 1716*03a78d15Sespie else 1717*03a78d15Sespie deplibs="$deplib $deplibs" 1718*03a78d15Sespie test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" 1719*03a78d15Sespie fi 1720*03a78d15Sespie continue 1721*03a78d15Sespie fi 1722*03a78d15Sespie ;; # -l 1723*03a78d15Sespie -L*) 1724*03a78d15Sespie case $linkmode in 1725*03a78d15Sespie lib) 1726*03a78d15Sespie deplibs="$deplib $deplibs" 1727*03a78d15Sespie test $pass = conv && continue 1728*03a78d15Sespie newdependency_libs="$deplib $newdependency_libs" 1729*03a78d15Sespie newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1730*03a78d15Sespie ;; 1731*03a78d15Sespie prog) 1732*03a78d15Sespie if test $pass = conv; then 1733*03a78d15Sespie deplibs="$deplib $deplibs" 1734*03a78d15Sespie continue 1735*03a78d15Sespie fi 1736*03a78d15Sespie if test $pass = scan; then 1737*03a78d15Sespie deplibs="$deplib $deplibs" 1738*03a78d15Sespie newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1739*03a78d15Sespie else 1740*03a78d15Sespie compile_deplibs="$deplib $compile_deplibs" 1741*03a78d15Sespie finalize_deplibs="$deplib $finalize_deplibs" 1742*03a78d15Sespie fi 1743*03a78d15Sespie ;; 1744*03a78d15Sespie *) 1745*03a78d15Sespie $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 1746*03a78d15Sespie ;; 1747*03a78d15Sespie esac # linkmode 1748*03a78d15Sespie continue 1749*03a78d15Sespie ;; # -L 1750*03a78d15Sespie -R*) 1751*03a78d15Sespie if test $pass = link; then 1752*03a78d15Sespie dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 1753*03a78d15Sespie # Make sure the xrpath contains only unique directories. 1754*03a78d15Sespie case "$xrpath " in 1755*03a78d15Sespie *" $dir "*) ;; 1756*03a78d15Sespie *) xrpath="$xrpath $dir" ;; 1757*03a78d15Sespie esac 1758*03a78d15Sespie fi 1759*03a78d15Sespie deplibs="$deplib $deplibs" 1760*03a78d15Sespie continue 1761*03a78d15Sespie ;; 1762*03a78d15Sespie *.la) lib="$deplib" ;; 1763*03a78d15Sespie *.$libext) 1764*03a78d15Sespie if test $pass = conv; then 1765*03a78d15Sespie deplibs="$deplib $deplibs" 1766*03a78d15Sespie continue 1767*03a78d15Sespie fi 1768*03a78d15Sespie case $linkmode in 1769*03a78d15Sespie lib) 1770*03a78d15Sespie if test "$deplibs_check_method" != pass_all; then 1771*03a78d15Sespie echo 1772*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $deplib." 1773*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 1774*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 1775*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 1776*03a78d15Sespie else 1777*03a78d15Sespie echo 1778*03a78d15Sespie echo "*** Warning: Linking the shared library $output against the" 1779*03a78d15Sespie echo "*** static library $deplib is not portable!" 1780*03a78d15Sespie deplibs="$deplib $deplibs" 1781*03a78d15Sespie fi 1782*03a78d15Sespie continue 1783*03a78d15Sespie ;; 1784*03a78d15Sespie prog) 1785*03a78d15Sespie if test $pass != link; then 1786*03a78d15Sespie deplibs="$deplib $deplibs" 1787*03a78d15Sespie else 1788*03a78d15Sespie compile_deplibs="$deplib $compile_deplibs" 1789*03a78d15Sespie finalize_deplibs="$deplib $finalize_deplibs" 1790*03a78d15Sespie fi 1791*03a78d15Sespie continue 1792*03a78d15Sespie ;; 1793*03a78d15Sespie esac # linkmode 1794*03a78d15Sespie ;; # *.$libext 1795*03a78d15Sespie *.lo | *.$objext) 1796*03a78d15Sespie if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 1797*03a78d15Sespie # If there is no dlopen support or we're linking statically, 1798*03a78d15Sespie # we need to preload. 1799*03a78d15Sespie newdlprefiles="$newdlprefiles $deplib" 1800*03a78d15Sespie compile_deplibs="$deplib $compile_deplibs" 1801*03a78d15Sespie finalize_deplibs="$deplib $finalize_deplibs" 1802*03a78d15Sespie else 1803*03a78d15Sespie newdlfiles="$newdlfiles $deplib" 1804*03a78d15Sespie fi 1805*03a78d15Sespie continue 1806*03a78d15Sespie ;; 1807*03a78d15Sespie %DEPLIBS%) 1808*03a78d15Sespie alldeplibs=yes 1809*03a78d15Sespie continue 1810*03a78d15Sespie ;; 1811*03a78d15Sespie esac # case $deplib 1812*03a78d15Sespie if test $found = yes || test -f "$lib"; then : 1813*03a78d15Sespie else 1814*03a78d15Sespie $echo "$modename: cannot find the library \`$lib'" 1>&2 1815*03a78d15Sespie exit 1 1816*03a78d15Sespie fi 1817*03a78d15Sespie 1818*03a78d15Sespie # Check to see that this really is a libtool archive. 1819*03a78d15Sespie if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 1820*03a78d15Sespie else 1821*03a78d15Sespie $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 1822*03a78d15Sespie exit 1 1823*03a78d15Sespie fi 1824*03a78d15Sespie 1825*03a78d15Sespie ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 1826*03a78d15Sespie test "X$ladir" = "X$lib" && ladir="." 1827*03a78d15Sespie 1828*03a78d15Sespie dlname= 1829*03a78d15Sespie dlopen= 1830*03a78d15Sespie dlpreopen= 1831*03a78d15Sespie libdir= 1832*03a78d15Sespie library_names= 1833*03a78d15Sespie old_library= 1834*03a78d15Sespie # If the library was installed with an old release of libtool, 1835*03a78d15Sespie # it will not redefine variable installed. 1836*03a78d15Sespie installed=yes 1837*03a78d15Sespie 1838*03a78d15Sespie # Read the .la file 1839*03a78d15Sespie case $lib in 1840*03a78d15Sespie */* | *\\*) . $lib ;; 1841*03a78d15Sespie *) . ./$lib ;; 1842*03a78d15Sespie esac 1843*03a78d15Sespie 1844*03a78d15Sespie if test "$linkmode,$pass" = "lib,link" || 1845*03a78d15Sespie test "$linkmode,$pass" = "prog,scan" || 1846*03a78d15Sespie { test $linkmode = oldlib && test $linkmode = obj; }; then 1847*03a78d15Sespie # Add dl[pre]opened files of deplib 1848*03a78d15Sespie test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 1849*03a78d15Sespie test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 1850*03a78d15Sespie fi 1851*03a78d15Sespie 1852*03a78d15Sespie if test $pass = conv; then 1853*03a78d15Sespie # Only check for convenience libraries 1854*03a78d15Sespie deplibs="$lib $deplibs" 1855*03a78d15Sespie if test -z "$libdir"; then 1856*03a78d15Sespie if test -z "$old_library"; then 1857*03a78d15Sespie $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 1858*03a78d15Sespie exit 1 1859*03a78d15Sespie fi 1860*03a78d15Sespie # It is a libtool convenience library, so add in its objects. 1861*03a78d15Sespie convenience="$convenience $ladir/$objdir/$old_library" 1862*03a78d15Sespie old_convenience="$old_convenience $ladir/$objdir/$old_library" 1863*03a78d15Sespie tmp_libs= 1864*03a78d15Sespie for deplib in $dependency_libs; do 1865*03a78d15Sespie deplibs="$deplib $deplibs" 1866*03a78d15Sespie case "$tmp_libs " in 1867*03a78d15Sespie *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1868*03a78d15Sespie esac 1869*03a78d15Sespie tmp_libs="$tmp_libs $deplib" 1870*03a78d15Sespie done 1871*03a78d15Sespie elif test $linkmode != prog && test $linkmode != lib; then 1872*03a78d15Sespie $echo "$modename: \`$lib' is not a convenience library" 1>&2 1873*03a78d15Sespie exit 1 1874*03a78d15Sespie fi 1875*03a78d15Sespie continue 1876*03a78d15Sespie fi # $pass = conv 1877*03a78d15Sespie 1878*03a78d15Sespie # Get the name of the library we link against. 1879*03a78d15Sespie linklib= 1880*03a78d15Sespie for l in $old_library $library_names; do 1881*03a78d15Sespie linklib="$l" 1882*03a78d15Sespie done 1883*03a78d15Sespie if test -z "$linklib"; then 1884*03a78d15Sespie $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 1885*03a78d15Sespie exit 1 1886*03a78d15Sespie fi 1887*03a78d15Sespie 1888*03a78d15Sespie # This library was specified with -dlopen. 1889*03a78d15Sespie if test $pass = dlopen; then 1890*03a78d15Sespie if test -z "$libdir"; then 1891*03a78d15Sespie $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 1892*03a78d15Sespie exit 1 1893*03a78d15Sespie fi 1894*03a78d15Sespie if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 1895*03a78d15Sespie # If there is no dlname, no dlopen support or we're linking 1896*03a78d15Sespie # statically, we need to preload. 1897*03a78d15Sespie dlprefiles="$dlprefiles $lib" 1898*03a78d15Sespie else 1899*03a78d15Sespie newdlfiles="$newdlfiles $lib" 1900*03a78d15Sespie fi 1901*03a78d15Sespie continue 1902*03a78d15Sespie fi # $pass = dlopen 1903*03a78d15Sespie 1904*03a78d15Sespie # We need an absolute path. 1905*03a78d15Sespie case $ladir in 1906*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 1907*03a78d15Sespie *) 1908*03a78d15Sespie abs_ladir=`cd "$ladir" && pwd` 1909*03a78d15Sespie if test -z "$abs_ladir"; then 1910*03a78d15Sespie $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 1911*03a78d15Sespie $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 1912*03a78d15Sespie abs_ladir="$ladir" 1913*03a78d15Sespie fi 1914*03a78d15Sespie ;; 1915*03a78d15Sespie esac 1916*03a78d15Sespie laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 1917*03a78d15Sespie 1918*03a78d15Sespie # Find the relevant object directory and library name. 1919*03a78d15Sespie if test "X$installed" = Xyes; then 1920*03a78d15Sespie if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 1921*03a78d15Sespie $echo "$modename: warning: library \`$lib' was moved." 1>&2 1922*03a78d15Sespie dir="$ladir" 1923*03a78d15Sespie absdir="$abs_ladir" 1924*03a78d15Sespie libdir="$abs_ladir" 1925*03a78d15Sespie else 1926*03a78d15Sespie dir="$libdir" 1927*03a78d15Sespie absdir="$libdir" 1928*03a78d15Sespie fi 1929*03a78d15Sespie else 1930*03a78d15Sespie dir="$ladir/$objdir" 1931*03a78d15Sespie absdir="$abs_ladir/$objdir" 1932*03a78d15Sespie # Remove this search path later 1933*03a78d15Sespie notinst_path="$notinst_path $abs_ladir" 1934*03a78d15Sespie fi # $installed = yes 1935*03a78d15Sespie name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 1936*03a78d15Sespie 1937*03a78d15Sespie # This library was specified with -dlpreopen. 1938*03a78d15Sespie if test $pass = dlpreopen; then 1939*03a78d15Sespie if test -z "$libdir"; then 1940*03a78d15Sespie $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 1941*03a78d15Sespie exit 1 1942*03a78d15Sespie fi 1943*03a78d15Sespie # Prefer using a static library (so that no silly _DYNAMIC symbols 1944*03a78d15Sespie # are required to link). 1945*03a78d15Sespie if test -n "$old_library"; then 1946*03a78d15Sespie newdlprefiles="$newdlprefiles $dir/$old_library" 1947*03a78d15Sespie # Otherwise, use the dlname, so that lt_dlopen finds it. 1948*03a78d15Sespie elif test -n "$dlname"; then 1949*03a78d15Sespie newdlprefiles="$newdlprefiles $dir/$dlname" 1950*03a78d15Sespie else 1951*03a78d15Sespie newdlprefiles="$newdlprefiles $dir/$linklib" 1952*03a78d15Sespie fi 1953*03a78d15Sespie fi # $pass = dlpreopen 1954*03a78d15Sespie 1955*03a78d15Sespie if test -z "$libdir"; then 1956*03a78d15Sespie # Link the convenience library 1957*03a78d15Sespie if test $linkmode = lib; then 1958*03a78d15Sespie deplibs="$dir/$old_library $deplibs" 1959*03a78d15Sespie elif test "$linkmode,$pass" = "prog,link"; then 1960*03a78d15Sespie compile_deplibs="$dir/$old_library $compile_deplibs" 1961*03a78d15Sespie finalize_deplibs="$dir/$old_library $finalize_deplibs" 1962*03a78d15Sespie else 1963*03a78d15Sespie deplibs="$lib $deplibs" 1964*03a78d15Sespie fi 1965*03a78d15Sespie continue 1966*03a78d15Sespie fi 1967*03a78d15Sespie 1968*03a78d15Sespie if test $linkmode = prog && test $pass != link; then 1969*03a78d15Sespie newlib_search_path="$newlib_search_path $ladir" 1970*03a78d15Sespie deplibs="$lib $deplibs" 1971*03a78d15Sespie 1972*03a78d15Sespie linkalldeplibs=no 1973*03a78d15Sespie if test "$link_all_deplibs" != no || test -z "$library_names" || 1974*03a78d15Sespie test "$build_libtool_libs" = no; then 1975*03a78d15Sespie linkalldeplibs=yes 1976*03a78d15Sespie fi 1977*03a78d15Sespie 1978*03a78d15Sespie tmp_libs= 1979*03a78d15Sespie for deplib in $dependency_libs; do 1980*03a78d15Sespie case $deplib in 1981*03a78d15Sespie -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 1982*03a78d15Sespie esac 1983*03a78d15Sespie # Need to link against all dependency_libs? 1984*03a78d15Sespie if test $linkalldeplibs = yes; then 1985*03a78d15Sespie deplibs="$deplib $deplibs" 1986*03a78d15Sespie else 1987*03a78d15Sespie # Need to hardcode shared library paths 1988*03a78d15Sespie # or/and link against static libraries 1989*03a78d15Sespie newdependency_libs="$deplib $newdependency_libs" 1990*03a78d15Sespie fi 1991*03a78d15Sespie case "$tmp_libs " in 1992*03a78d15Sespie *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1993*03a78d15Sespie esac 1994*03a78d15Sespie tmp_libs="$tmp_libs $deplib" 1995*03a78d15Sespie done # for deplib 1996*03a78d15Sespie continue 1997*03a78d15Sespie fi # $linkmode = prog... 1998*03a78d15Sespie 1999*03a78d15Sespie link_static=no # Whether the deplib will be linked statically 2000*03a78d15Sespie if test -n "$library_names" && 2001*03a78d15Sespie { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2002*03a78d15Sespie # Link against this shared library 2003*03a78d15Sespie 2004*03a78d15Sespie if test "$linkmode,$pass" = "prog,link" || 2005*03a78d15Sespie { test $linkmode = lib && test $hardcode_into_libs = yes; }; then 2006*03a78d15Sespie # Hardcode the library path. 2007*03a78d15Sespie # Skip directories that are in the system default run-time 2008*03a78d15Sespie # search path. 2009*03a78d15Sespie case " $sys_lib_dlsearch_path " in 2010*03a78d15Sespie *" $absdir "*) ;; 2011*03a78d15Sespie *) 2012*03a78d15Sespie case "$compile_rpath " in 2013*03a78d15Sespie *" $absdir "*) ;; 2014*03a78d15Sespie *) compile_rpath="$compile_rpath $absdir" 2015*03a78d15Sespie esac 2016*03a78d15Sespie ;; 2017*03a78d15Sespie esac 2018*03a78d15Sespie case " $sys_lib_dlsearch_path " in 2019*03a78d15Sespie *" $libdir "*) ;; 2020*03a78d15Sespie *) 2021*03a78d15Sespie case "$finalize_rpath " in 2022*03a78d15Sespie *" $libdir "*) ;; 2023*03a78d15Sespie *) finalize_rpath="$finalize_rpath $libdir" 2024*03a78d15Sespie esac 2025*03a78d15Sespie ;; 2026*03a78d15Sespie esac 2027*03a78d15Sespie if test $linkmode = prog; then 2028*03a78d15Sespie # We need to hardcode the library path 2029*03a78d15Sespie if test -n "$shlibpath_var"; then 2030*03a78d15Sespie # Make sure the rpath contains only unique directories. 2031*03a78d15Sespie case "$temp_rpath " in 2032*03a78d15Sespie *" $dir "*) ;; 2033*03a78d15Sespie *" $absdir "*) ;; 2034*03a78d15Sespie *) temp_rpath="$temp_rpath $dir" ;; 2035*03a78d15Sespie esac 2036*03a78d15Sespie fi 2037*03a78d15Sespie fi 2038*03a78d15Sespie fi # $linkmode,$pass = prog,link... 2039*03a78d15Sespie 2040*03a78d15Sespie if test "$alldeplibs" = yes && 2041*03a78d15Sespie { test "$deplibs_check_method" = pass_all || 2042*03a78d15Sespie { test "$build_libtool_libs" = yes && 2043*03a78d15Sespie test -n "$library_names"; }; }; then 2044*03a78d15Sespie # We only need to search for static libraries 2045*03a78d15Sespie continue 2046*03a78d15Sespie fi 2047*03a78d15Sespie 2048*03a78d15Sespie if test "$installed" = no; then 2049*03a78d15Sespie notinst_deplibs="$notinst_deplibs $lib" 2050*03a78d15Sespie need_relink=yes 2051*03a78d15Sespie fi 2052*03a78d15Sespie 2053*03a78d15Sespie if test -n "$old_archive_from_expsyms_cmds"; then 2054*03a78d15Sespie # figure out the soname 2055*03a78d15Sespie set dummy $library_names 2056*03a78d15Sespie realname="$2" 2057*03a78d15Sespie shift; shift 2058*03a78d15Sespie libname=`eval \\$echo \"$libname_spec\"` 2059*03a78d15Sespie # use dlname if we got it. it's perfectly good, no? 2060*03a78d15Sespie if test -n "$dlname"; then 2061*03a78d15Sespie soname="$dlname" 2062*03a78d15Sespie elif test -n "$soname_spec"; then 2063*03a78d15Sespie # bleh windows 2064*03a78d15Sespie case $host in 2065*03a78d15Sespie *cygwin*) 2066*03a78d15Sespie major=`expr $current - $age` 2067*03a78d15Sespie versuffix="-$major" 2068*03a78d15Sespie ;; 2069*03a78d15Sespie esac 2070*03a78d15Sespie eval soname=\"$soname_spec\" 2071*03a78d15Sespie else 2072*03a78d15Sespie soname="$realname" 2073*03a78d15Sespie fi 2074*03a78d15Sespie 2075*03a78d15Sespie # Make a new name for the extract_expsyms_cmds to use 2076*03a78d15Sespie soroot="$soname" 2077*03a78d15Sespie soname=`echo $soroot | sed -e 's/^.*\///'` 2078*03a78d15Sespie newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" 2079*03a78d15Sespie 2080*03a78d15Sespie # If the library has no export list, then create one now 2081*03a78d15Sespie if test -f "$output_objdir/$soname-def"; then : 2082*03a78d15Sespie else 2083*03a78d15Sespie $show "extracting exported symbol list from \`$soname'" 2084*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 2085*03a78d15Sespie eval cmds=\"$extract_expsyms_cmds\" 2086*03a78d15Sespie for cmd in $cmds; do 2087*03a78d15Sespie IFS="$save_ifs" 2088*03a78d15Sespie $show "$cmd" 2089*03a78d15Sespie $run eval "$cmd" || exit $? 2090*03a78d15Sespie done 2091*03a78d15Sespie IFS="$save_ifs" 2092*03a78d15Sespie fi 2093*03a78d15Sespie 2094*03a78d15Sespie # Create $newlib 2095*03a78d15Sespie if test -f "$output_objdir/$newlib"; then :; else 2096*03a78d15Sespie $show "generating import library for \`$soname'" 2097*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 2098*03a78d15Sespie eval cmds=\"$old_archive_from_expsyms_cmds\" 2099*03a78d15Sespie for cmd in $cmds; do 2100*03a78d15Sespie IFS="$save_ifs" 2101*03a78d15Sespie $show "$cmd" 2102*03a78d15Sespie $run eval "$cmd" || exit $? 2103*03a78d15Sespie done 2104*03a78d15Sespie IFS="$save_ifs" 2105*03a78d15Sespie fi 2106*03a78d15Sespie # make sure the library variables are pointing to the new library 2107*03a78d15Sespie dir=$output_objdir 2108*03a78d15Sespie linklib=$newlib 2109*03a78d15Sespie fi # test -n $old_archive_from_expsyms_cmds 2110*03a78d15Sespie 2111*03a78d15Sespie if test $linkmode = prog || test "$mode" != relink; then 2112*03a78d15Sespie add_shlibpath= 2113*03a78d15Sespie add_dir= 2114*03a78d15Sespie add= 2115*03a78d15Sespie lib_linked=yes 2116*03a78d15Sespie case $hardcode_action in 2117*03a78d15Sespie immediate | unsupported) 2118*03a78d15Sespie if test "$hardcode_direct" = no; then 2119*03a78d15Sespie add="$dir/$linklib" 2120*03a78d15Sespie elif test "$hardcode_minus_L" = no; then 2121*03a78d15Sespie case $host in 2122*03a78d15Sespie *-*-sunos*) add_shlibpath="$dir" ;; 2123*03a78d15Sespie esac 2124*03a78d15Sespie add_dir="-L$dir" 2125*03a78d15Sespie add="-l$name" 2126*03a78d15Sespie elif test "$hardcode_shlibpath_var" = no; then 2127*03a78d15Sespie add_shlibpath="$dir" 2128*03a78d15Sespie add="-l$name" 2129*03a78d15Sespie else 2130*03a78d15Sespie lib_linked=no 2131*03a78d15Sespie fi 2132*03a78d15Sespie ;; 2133*03a78d15Sespie relink) 2134*03a78d15Sespie if test "$hardcode_direct" = yes; then 2135*03a78d15Sespie add="$dir/$linklib" 2136*03a78d15Sespie elif test "$hardcode_minus_L" = yes; then 2137*03a78d15Sespie add_dir="-L$dir" 2138*03a78d15Sespie add="-l$name" 2139*03a78d15Sespie elif test "$hardcode_shlibpath_var" = yes; then 2140*03a78d15Sespie add_shlibpath="$dir" 2141*03a78d15Sespie add="-l$name" 2142*03a78d15Sespie else 2143*03a78d15Sespie lib_linked=no 2144*03a78d15Sespie fi 2145*03a78d15Sespie ;; 2146*03a78d15Sespie *) lib_linked=no ;; 2147*03a78d15Sespie esac 2148*03a78d15Sespie 2149*03a78d15Sespie if test "$lib_linked" != yes; then 2150*03a78d15Sespie $echo "$modename: configuration error: unsupported hardcode properties" 2151*03a78d15Sespie exit 1 2152*03a78d15Sespie fi 2153*03a78d15Sespie 2154*03a78d15Sespie if test -n "$add_shlibpath"; then 2155*03a78d15Sespie case :$compile_shlibpath: in 2156*03a78d15Sespie *":$add_shlibpath:"*) ;; 2157*03a78d15Sespie *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2158*03a78d15Sespie esac 2159*03a78d15Sespie fi 2160*03a78d15Sespie if test $linkmode = prog; then 2161*03a78d15Sespie test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2162*03a78d15Sespie test -n "$add" && compile_deplibs="$add $compile_deplibs" 2163*03a78d15Sespie else 2164*03a78d15Sespie test -n "$add_dir" && deplibs="$add_dir $deplibs" 2165*03a78d15Sespie test -n "$add" && deplibs="$add $deplibs" 2166*03a78d15Sespie if test "$hardcode_direct" != yes && \ 2167*03a78d15Sespie test "$hardcode_minus_L" != yes && \ 2168*03a78d15Sespie test "$hardcode_shlibpath_var" = yes; then 2169*03a78d15Sespie case :$finalize_shlibpath: in 2170*03a78d15Sespie *":$libdir:"*) ;; 2171*03a78d15Sespie *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2172*03a78d15Sespie esac 2173*03a78d15Sespie fi 2174*03a78d15Sespie fi 2175*03a78d15Sespie fi 2176*03a78d15Sespie 2177*03a78d15Sespie if test $linkmode = prog || test "$mode" = relink; then 2178*03a78d15Sespie add_shlibpath= 2179*03a78d15Sespie add_dir= 2180*03a78d15Sespie add= 2181*03a78d15Sespie # Finalize command for both is simple: just hardcode it. 2182*03a78d15Sespie if test "$hardcode_direct" = yes; then 2183*03a78d15Sespie add="$libdir/$linklib" 2184*03a78d15Sespie elif test "$hardcode_minus_L" = yes; then 2185*03a78d15Sespie add_dir="-L$libdir" 2186*03a78d15Sespie add="-l$name" 2187*03a78d15Sespie elif test "$hardcode_shlibpath_var" = yes; then 2188*03a78d15Sespie case :$finalize_shlibpath: in 2189*03a78d15Sespie *":$libdir:"*) ;; 2190*03a78d15Sespie *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2191*03a78d15Sespie esac 2192*03a78d15Sespie add="-l$name" 2193*03a78d15Sespie else 2194*03a78d15Sespie # We cannot seem to hardcode it, guess we'll fake it. 2195*03a78d15Sespie add_dir="-L$libdir" 2196*03a78d15Sespie add="-l$name" 2197*03a78d15Sespie fi 2198*03a78d15Sespie 2199*03a78d15Sespie if test $linkmode = prog; then 2200*03a78d15Sespie test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2201*03a78d15Sespie test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2202*03a78d15Sespie else 2203*03a78d15Sespie test -n "$add_dir" && deplibs="$add_dir $deplibs" 2204*03a78d15Sespie test -n "$add" && deplibs="$add $deplibs" 2205*03a78d15Sespie fi 2206*03a78d15Sespie fi 2207*03a78d15Sespie elif test $linkmode = prog; then 2208*03a78d15Sespie if test "$alldeplibs" = yes && 2209*03a78d15Sespie { test "$deplibs_check_method" = pass_all || 2210*03a78d15Sespie { test "$build_libtool_libs" = yes && 2211*03a78d15Sespie test -n "$library_names"; }; }; then 2212*03a78d15Sespie # We only need to search for static libraries 2213*03a78d15Sespie continue 2214*03a78d15Sespie fi 2215*03a78d15Sespie 2216*03a78d15Sespie # Try to link the static library 2217*03a78d15Sespie # Here we assume that one of hardcode_direct or hardcode_minus_L 2218*03a78d15Sespie # is not unsupported. This is valid on all known static and 2219*03a78d15Sespie # shared platforms. 2220*03a78d15Sespie if test "$hardcode_direct" != unsupported; then 2221*03a78d15Sespie test -n "$old_library" && linklib="$old_library" 2222*03a78d15Sespie compile_deplibs="$dir/$linklib $compile_deplibs" 2223*03a78d15Sespie finalize_deplibs="$dir/$linklib $finalize_deplibs" 2224*03a78d15Sespie else 2225*03a78d15Sespie compile_deplibs="-l$name -L$dir $compile_deplibs" 2226*03a78d15Sespie finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2227*03a78d15Sespie fi 2228*03a78d15Sespie elif test "$build_libtool_libs" = yes; then 2229*03a78d15Sespie # Not a shared library 2230*03a78d15Sespie if test "$deplibs_check_method" != pass_all; then 2231*03a78d15Sespie # We're trying link a shared library against a static one 2232*03a78d15Sespie # but the system doesn't support it. 2233*03a78d15Sespie 2234*03a78d15Sespie # Just print a warning and add the library to dependency_libs so 2235*03a78d15Sespie # that the program can be linked against the static library. 2236*03a78d15Sespie echo 2237*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $lib." 2238*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 2239*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 2240*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 2241*03a78d15Sespie if test "$module" = yes; then 2242*03a78d15Sespie echo "*** Therefore, libtool will create a static module, that should work " 2243*03a78d15Sespie echo "*** as long as the dlopening application is linked with the -dlopen flag." 2244*03a78d15Sespie if test -z "$global_symbol_pipe"; then 2245*03a78d15Sespie echo 2246*03a78d15Sespie echo "*** However, this would only work if libtool was able to extract symbol" 2247*03a78d15Sespie echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2248*03a78d15Sespie echo "*** not find such a program. So, this module is probably useless." 2249*03a78d15Sespie echo "*** \`nm' from GNU binutils and a full rebuild may help." 2250*03a78d15Sespie fi 2251*03a78d15Sespie if test "$build_old_libs" = no; then 2252*03a78d15Sespie build_libtool_libs=module 2253*03a78d15Sespie build_old_libs=yes 2254*03a78d15Sespie else 2255*03a78d15Sespie build_libtool_libs=no 2256*03a78d15Sespie fi 2257*03a78d15Sespie fi 2258*03a78d15Sespie else 2259*03a78d15Sespie convenience="$convenience $dir/$old_library" 2260*03a78d15Sespie old_convenience="$old_convenience $dir/$old_library" 2261*03a78d15Sespie deplibs="$dir/$old_library $deplibs" 2262*03a78d15Sespie link_static=yes 2263*03a78d15Sespie fi 2264*03a78d15Sespie fi # link shared/static library? 2265*03a78d15Sespie 2266*03a78d15Sespie if test $linkmode = lib; then 2267*03a78d15Sespie if test -n "$dependency_libs" && 2268*03a78d15Sespie { test $hardcode_into_libs != yes || test $build_old_libs = yes || 2269*03a78d15Sespie test $link_static = yes; }; then 2270*03a78d15Sespie # Extract -R from dependency_libs 2271*03a78d15Sespie temp_deplibs= 2272*03a78d15Sespie for libdir in $dependency_libs; do 2273*03a78d15Sespie case $libdir in 2274*03a78d15Sespie -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2275*03a78d15Sespie case " $xrpath " in 2276*03a78d15Sespie *" $temp_xrpath "*) ;; 2277*03a78d15Sespie *) xrpath="$xrpath $temp_xrpath";; 2278*03a78d15Sespie esac;; 2279*03a78d15Sespie *) temp_deplibs="$temp_deplibs $libdir";; 2280*03a78d15Sespie esac 2281*03a78d15Sespie done 2282*03a78d15Sespie dependency_libs="$temp_deplibs" 2283*03a78d15Sespie fi 2284*03a78d15Sespie 2285*03a78d15Sespie newlib_search_path="$newlib_search_path $absdir" 2286*03a78d15Sespie # Link against this library 2287*03a78d15Sespie test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2288*03a78d15Sespie # ... and its dependency_libs 2289*03a78d15Sespie tmp_libs= 2290*03a78d15Sespie for deplib in $dependency_libs; do 2291*03a78d15Sespie newdependency_libs="$deplib $newdependency_libs" 2292*03a78d15Sespie case "$tmp_libs " in 2293*03a78d15Sespie *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2294*03a78d15Sespie esac 2295*03a78d15Sespie tmp_libs="$tmp_libs $deplib" 2296*03a78d15Sespie done 2297*03a78d15Sespie 2298*03a78d15Sespie if test $link_all_deplibs != no; then 2299*03a78d15Sespie # Add the search paths of all dependency libraries 2300*03a78d15Sespie for deplib in $dependency_libs; do 2301*03a78d15Sespie case $deplib in 2302*03a78d15Sespie -L*) path="$deplib" ;; 2303*03a78d15Sespie *.la) 2304*03a78d15Sespie dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2305*03a78d15Sespie test "X$dir" = "X$deplib" && dir="." 2306*03a78d15Sespie # We need an absolute path. 2307*03a78d15Sespie case $dir in 2308*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2309*03a78d15Sespie *) 2310*03a78d15Sespie absdir=`cd "$dir" && pwd` 2311*03a78d15Sespie if test -z "$absdir"; then 2312*03a78d15Sespie $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2313*03a78d15Sespie absdir="$dir" 2314*03a78d15Sespie fi 2315*03a78d15Sespie ;; 2316*03a78d15Sespie esac 2317*03a78d15Sespie if grep "^installed=no" $deplib > /dev/null; then 2318*03a78d15Sespie path="-L$absdir/$objdir" 2319*03a78d15Sespie else 2320*03a78d15Sespie eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2321*03a78d15Sespie if test -z "$libdir"; then 2322*03a78d15Sespie $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2323*03a78d15Sespie exit 1 2324*03a78d15Sespie fi 2325*03a78d15Sespie if test "$absdir" != "$libdir"; then 2326*03a78d15Sespie $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2327*03a78d15Sespie fi 2328*03a78d15Sespie path="-L$absdir" 2329*03a78d15Sespie fi 2330*03a78d15Sespie ;; 2331*03a78d15Sespie *) continue ;; 2332*03a78d15Sespie esac 2333*03a78d15Sespie case " $deplibs " in 2334*03a78d15Sespie *" $path "*) ;; 2335*03a78d15Sespie *) deplibs="$path $deplibs" ;; 2336*03a78d15Sespie esac 2337*03a78d15Sespie done 2338*03a78d15Sespie fi # link_all_deplibs != no 2339*03a78d15Sespie fi # linkmode = lib 2340*03a78d15Sespie done # for deplib in $libs 2341*03a78d15Sespie if test $pass = dlpreopen; then 2342*03a78d15Sespie # Link the dlpreopened libraries before other libraries 2343*03a78d15Sespie for deplib in $save_deplibs; do 2344*03a78d15Sespie deplibs="$deplib $deplibs" 2345*03a78d15Sespie done 2346*03a78d15Sespie fi 2347*03a78d15Sespie if test $pass != dlopen; then 2348*03a78d15Sespie test $pass != scan && dependency_libs="$newdependency_libs" 2349*03a78d15Sespie if test $pass != conv; then 2350*03a78d15Sespie # Make sure lib_search_path contains only unique directories. 2351*03a78d15Sespie lib_search_path= 2352*03a78d15Sespie for dir in $newlib_search_path; do 2353*03a78d15Sespie case "$lib_search_path " in 2354*03a78d15Sespie *" $dir "*) ;; 2355*03a78d15Sespie *) lib_search_path="$lib_search_path $dir" ;; 2356*03a78d15Sespie esac 2357*03a78d15Sespie done 2358*03a78d15Sespie newlib_search_path= 2359*03a78d15Sespie fi 2360*03a78d15Sespie 2361*03a78d15Sespie if test "$linkmode,$pass" != "prog,link"; then 2362*03a78d15Sespie vars="deplibs" 2363*03a78d15Sespie else 2364*03a78d15Sespie vars="compile_deplibs finalize_deplibs" 2365*03a78d15Sespie fi 2366*03a78d15Sespie for var in $vars dependency_libs; do 2367*03a78d15Sespie # Add libraries to $var in reverse order 2368*03a78d15Sespie eval tmp_libs=\"\$$var\" 2369*03a78d15Sespie new_libs= 2370*03a78d15Sespie for deplib in $tmp_libs; do 2371*03a78d15Sespie case $deplib in 2372*03a78d15Sespie -L*) new_libs="$deplib $new_libs" ;; 2373*03a78d15Sespie *) 2374*03a78d15Sespie case " $specialdeplibs " in 2375*03a78d15Sespie *" $deplib "*) new_libs="$deplib $new_libs" ;; 2376*03a78d15Sespie *) 2377*03a78d15Sespie case " $new_libs " in 2378*03a78d15Sespie *" $deplib "*) ;; 2379*03a78d15Sespie *) new_libs="$deplib $new_libs" ;; 2380*03a78d15Sespie esac 2381*03a78d15Sespie ;; 2382*03a78d15Sespie esac 2383*03a78d15Sespie ;; 2384*03a78d15Sespie esac 2385*03a78d15Sespie done 2386*03a78d15Sespie tmp_libs= 2387*03a78d15Sespie for deplib in $new_libs; do 2388*03a78d15Sespie case $deplib in 2389*03a78d15Sespie -L*) 2390*03a78d15Sespie case " $tmp_libs " in 2391*03a78d15Sespie *" $deplib "*) ;; 2392*03a78d15Sespie *) tmp_libs="$tmp_libs $deplib" ;; 2393*03a78d15Sespie esac 2394*03a78d15Sespie ;; 2395*03a78d15Sespie *) tmp_libs="$tmp_libs $deplib" ;; 2396*03a78d15Sespie esac 2397*03a78d15Sespie done 2398*03a78d15Sespie eval $var=\"$tmp_libs\" 2399*03a78d15Sespie done # for var 2400*03a78d15Sespie fi 2401*03a78d15Sespie if test "$pass" = "conv" && 2402*03a78d15Sespie { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then 2403*03a78d15Sespie libs="$deplibs" # reset libs 2404*03a78d15Sespie deplibs= 2405*03a78d15Sespie fi 2406*03a78d15Sespie done # for pass 2407*03a78d15Sespie if test $linkmode = prog; then 2408*03a78d15Sespie dlfiles="$newdlfiles" 2409*03a78d15Sespie dlprefiles="$newdlprefiles" 2410*03a78d15Sespie fi 2411*03a78d15Sespie 2412*03a78d15Sespie case $linkmode in 2413*03a78d15Sespie oldlib) 2414*03a78d15Sespie if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2415*03a78d15Sespie $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 2416*03a78d15Sespie fi 2417*03a78d15Sespie 2418*03a78d15Sespie if test -n "$rpath"; then 2419*03a78d15Sespie $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 2420*03a78d15Sespie fi 2421*03a78d15Sespie 2422*03a78d15Sespie if test -n "$xrpath"; then 2423*03a78d15Sespie $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 2424*03a78d15Sespie fi 2425*03a78d15Sespie 2426*03a78d15Sespie if test -n "$vinfo"; then 2427*03a78d15Sespie $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 2428*03a78d15Sespie fi 2429*03a78d15Sespie 2430*03a78d15Sespie if test -n "$release"; then 2431*03a78d15Sespie $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 2432*03a78d15Sespie fi 2433*03a78d15Sespie 2434*03a78d15Sespie if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 2435*03a78d15Sespie $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 2436*03a78d15Sespie fi 2437*03a78d15Sespie 2438*03a78d15Sespie # Now set the variables for building old libraries. 2439*03a78d15Sespie build_libtool_libs=no 2440*03a78d15Sespie oldlibs="$output" 2441*03a78d15Sespie objs="$objs$old_deplibs" 2442*03a78d15Sespie ;; 2443*03a78d15Sespie 2444*03a78d15Sespie lib) 2445*03a78d15Sespie # Make sure we only generate libraries of the form `libNAME.la'. 2446*03a78d15Sespie case $outputname in 2447*03a78d15Sespie lib*) 2448*03a78d15Sespie name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2449*03a78d15Sespie eval libname=\"$libname_spec\" 2450*03a78d15Sespie ;; 2451*03a78d15Sespie *) 2452*03a78d15Sespie if test "$module" = no; then 2453*03a78d15Sespie $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 2454*03a78d15Sespie $echo "$help" 1>&2 2455*03a78d15Sespie exit 1 2456*03a78d15Sespie fi 2457*03a78d15Sespie if test "$need_lib_prefix" != no; then 2458*03a78d15Sespie # Add the "lib" prefix for modules if required 2459*03a78d15Sespie name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 2460*03a78d15Sespie eval libname=\"$libname_spec\" 2461*03a78d15Sespie else 2462*03a78d15Sespie libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 2463*03a78d15Sespie fi 2464*03a78d15Sespie ;; 2465*03a78d15Sespie esac 2466*03a78d15Sespie 2467*03a78d15Sespie if test -n "$objs"; then 2468*03a78d15Sespie if test "$deplibs_check_method" != pass_all; then 2469*03a78d15Sespie $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 2470*03a78d15Sespie exit 1 2471*03a78d15Sespie else 2472*03a78d15Sespie echo 2473*03a78d15Sespie echo "*** Warning: Linking the shared library $output against the non-libtool" 2474*03a78d15Sespie echo "*** objects $objs is not portable!" 2475*03a78d15Sespie libobjs="$libobjs $objs" 2476*03a78d15Sespie fi 2477*03a78d15Sespie fi 2478*03a78d15Sespie 2479*03a78d15Sespie if test "$dlself" != no; then 2480*03a78d15Sespie $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 2481*03a78d15Sespie fi 2482*03a78d15Sespie 2483*03a78d15Sespie set dummy $rpath 2484*03a78d15Sespie if test $# -gt 2; then 2485*03a78d15Sespie $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 2486*03a78d15Sespie fi 2487*03a78d15Sespie install_libdir="$2" 2488*03a78d15Sespie 2489*03a78d15Sespie oldlibs= 2490*03a78d15Sespie if test -z "$rpath"; then 2491*03a78d15Sespie if test "$build_libtool_libs" = yes; then 2492*03a78d15Sespie # Building a libtool convenience library. 2493*03a78d15Sespie # Some compilers have problems with a `.al' extension so 2494*03a78d15Sespie # convenience libraries should have the same extension an 2495*03a78d15Sespie # archive normally would. 2496*03a78d15Sespie oldlibs="$output_objdir/$libname.$libext $oldlibs" 2497*03a78d15Sespie build_libtool_libs=convenience 2498*03a78d15Sespie build_old_libs=yes 2499*03a78d15Sespie fi 2500*03a78d15Sespie 2501*03a78d15Sespie if test -n "$vinfo"; then 2502*03a78d15Sespie $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 2503*03a78d15Sespie fi 2504*03a78d15Sespie 2505*03a78d15Sespie if test -n "$release"; then 2506*03a78d15Sespie $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 2507*03a78d15Sespie fi 2508*03a78d15Sespie else 2509*03a78d15Sespie 2510*03a78d15Sespie # Parse the version information argument. 2511*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' 2512*03a78d15Sespie set dummy $vinfo 0 0 0 2513*03a78d15Sespie IFS="$save_ifs" 2514*03a78d15Sespie 2515*03a78d15Sespie if test -n "$8"; then 2516*03a78d15Sespie $echo "$modename: too many parameters to \`-version-info'" 1>&2 2517*03a78d15Sespie $echo "$help" 1>&2 2518*03a78d15Sespie exit 1 2519*03a78d15Sespie fi 2520*03a78d15Sespie 2521*03a78d15Sespie current="$2" 2522*03a78d15Sespie revision="$3" 2523*03a78d15Sespie age="$4" 2524*03a78d15Sespie 2525*03a78d15Sespie # Check that each of the things are valid numbers. 2526*03a78d15Sespie case $current in 2527*03a78d15Sespie 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2528*03a78d15Sespie *) 2529*03a78d15Sespie $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 2530*03a78d15Sespie $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2531*03a78d15Sespie exit 1 2532*03a78d15Sespie ;; 2533*03a78d15Sespie esac 2534*03a78d15Sespie 2535*03a78d15Sespie case $revision in 2536*03a78d15Sespie 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2537*03a78d15Sespie *) 2538*03a78d15Sespie $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 2539*03a78d15Sespie $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2540*03a78d15Sespie exit 1 2541*03a78d15Sespie ;; 2542*03a78d15Sespie esac 2543*03a78d15Sespie 2544*03a78d15Sespie case $age in 2545*03a78d15Sespie 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 2546*03a78d15Sespie *) 2547*03a78d15Sespie $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 2548*03a78d15Sespie $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2549*03a78d15Sespie exit 1 2550*03a78d15Sespie ;; 2551*03a78d15Sespie esac 2552*03a78d15Sespie 2553*03a78d15Sespie if test $age -gt $current; then 2554*03a78d15Sespie $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 2555*03a78d15Sespie $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2556*03a78d15Sespie exit 1 2557*03a78d15Sespie fi 2558*03a78d15Sespie 2559*03a78d15Sespie # Calculate the version variables. 2560*03a78d15Sespie major= 2561*03a78d15Sespie versuffix= 2562*03a78d15Sespie verstring= 2563*03a78d15Sespie case $version_type in 2564*03a78d15Sespie none) ;; 2565*03a78d15Sespie 2566*03a78d15Sespie darwin) 2567*03a78d15Sespie # Like Linux, but with the current version available in 2568*03a78d15Sespie # verstring for coding it into the library header 2569*03a78d15Sespie major=.`expr $current - $age` 2570*03a78d15Sespie versuffix="$major.$age.$revision" 2571*03a78d15Sespie # Darwin ld doesn't like 0 for these options... 2572*03a78d15Sespie minor_current=`expr $current + 1` 2573*03a78d15Sespie verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 2574*03a78d15Sespie ;; 2575*03a78d15Sespie 2576*03a78d15Sespie freebsd-aout) 2577*03a78d15Sespie major=".$current" 2578*03a78d15Sespie versuffix=".$current.$revision"; 2579*03a78d15Sespie ;; 2580*03a78d15Sespie 2581*03a78d15Sespie freebsd-elf) 2582*03a78d15Sespie major=".$current" 2583*03a78d15Sespie versuffix=".$current"; 2584*03a78d15Sespie ;; 2585*03a78d15Sespie 2586*03a78d15Sespie irix) 2587*03a78d15Sespie major=`expr $current - $age + 1` 2588*03a78d15Sespie verstring="sgi$major.$revision" 2589*03a78d15Sespie 2590*03a78d15Sespie # Add in all the interfaces that we are compatible with. 2591*03a78d15Sespie loop=$revision 2592*03a78d15Sespie while test $loop != 0; do 2593*03a78d15Sespie iface=`expr $revision - $loop` 2594*03a78d15Sespie loop=`expr $loop - 1` 2595*03a78d15Sespie verstring="sgi$major.$iface:$verstring" 2596*03a78d15Sespie done 2597*03a78d15Sespie 2598*03a78d15Sespie # Before this point, $major must not contain `.'. 2599*03a78d15Sespie major=.$major 2600*03a78d15Sespie versuffix="$major.$revision" 2601*03a78d15Sespie ;; 2602*03a78d15Sespie 2603*03a78d15Sespie linux) 2604*03a78d15Sespie major=.`expr $current - $age` 2605*03a78d15Sespie versuffix="$major.$age.$revision" 2606*03a78d15Sespie ;; 2607*03a78d15Sespie 2608*03a78d15Sespie osf) 2609*03a78d15Sespie major=.`expr $current - $age` 2610*03a78d15Sespie versuffix=".$current.$age.$revision" 2611*03a78d15Sespie verstring="$current.$age.$revision" 2612*03a78d15Sespie 2613*03a78d15Sespie # Add in all the interfaces that we are compatible with. 2614*03a78d15Sespie loop=$age 2615*03a78d15Sespie while test $loop != 0; do 2616*03a78d15Sespie iface=`expr $current - $loop` 2617*03a78d15Sespie loop=`expr $loop - 1` 2618*03a78d15Sespie verstring="$verstring:${iface}.0" 2619*03a78d15Sespie done 2620*03a78d15Sespie 2621*03a78d15Sespie # Make executables depend on our current version. 2622*03a78d15Sespie verstring="$verstring:${current}.0" 2623*03a78d15Sespie ;; 2624*03a78d15Sespie 2625*03a78d15Sespie sunos) 2626*03a78d15Sespie major=".$current" 2627*03a78d15Sespie versuffix=".$current.$revision" 2628*03a78d15Sespie ;; 2629*03a78d15Sespie 2630*03a78d15Sespie windows) 2631*03a78d15Sespie # Use '-' rather than '.', since we only want one 2632*03a78d15Sespie # extension on DOS 8.3 filesystems. 2633*03a78d15Sespie major=`expr $current - $age` 2634*03a78d15Sespie versuffix="-$major" 2635*03a78d15Sespie ;; 2636*03a78d15Sespie 2637*03a78d15Sespie *) 2638*03a78d15Sespie $echo "$modename: unknown library version type \`$version_type'" 1>&2 2639*03a78d15Sespie echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 2640*03a78d15Sespie exit 1 2641*03a78d15Sespie ;; 2642*03a78d15Sespie esac 2643*03a78d15Sespie 2644*03a78d15Sespie # Clear the version info if we defaulted, and they specified a release. 2645*03a78d15Sespie if test -z "$vinfo" && test -n "$release"; then 2646*03a78d15Sespie major= 2647*03a78d15Sespie verstring="0.0" 2648*03a78d15Sespie if test "$need_version" = no; then 2649*03a78d15Sespie versuffix= 2650*03a78d15Sespie else 2651*03a78d15Sespie versuffix=".0.0" 2652*03a78d15Sespie fi 2653*03a78d15Sespie fi 2654*03a78d15Sespie 2655*03a78d15Sespie # Remove version info from name if versioning should be avoided 2656*03a78d15Sespie if test "$avoid_version" = yes && test "$need_version" = no; then 2657*03a78d15Sespie major= 2658*03a78d15Sespie versuffix= 2659*03a78d15Sespie verstring="" 2660*03a78d15Sespie fi 2661*03a78d15Sespie 2662*03a78d15Sespie # Check to see if the archive will have undefined symbols. 2663*03a78d15Sespie if test "$allow_undefined" = yes; then 2664*03a78d15Sespie if test "$allow_undefined_flag" = unsupported; then 2665*03a78d15Sespie $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 2666*03a78d15Sespie build_libtool_libs=no 2667*03a78d15Sespie build_old_libs=yes 2668*03a78d15Sespie fi 2669*03a78d15Sespie else 2670*03a78d15Sespie # Don't allow undefined symbols. 2671*03a78d15Sespie allow_undefined_flag="$no_undefined_flag" 2672*03a78d15Sespie fi 2673*03a78d15Sespie fi 2674*03a78d15Sespie 2675*03a78d15Sespie if test "$mode" != relink; then 2676*03a78d15Sespie # Remove our outputs, but don't remove object files since they 2677*03a78d15Sespie # may have been created when compiling PIC objects. 2678*03a78d15Sespie removelist= 2679*03a78d15Sespie tempremovelist=`echo "$output_objdir/*"` 2680*03a78d15Sespie for p in $tempremovelist; do 2681*03a78d15Sespie case $p in 2682*03a78d15Sespie *.$objext) 2683*03a78d15Sespie ;; 2684*03a78d15Sespie $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 2685*03a78d15Sespie removelist="$removelist $p" 2686*03a78d15Sespie ;; 2687*03a78d15Sespie *) ;; 2688*03a78d15Sespie esac 2689*03a78d15Sespie done 2690*03a78d15Sespie if test -n "$removelist"; then 2691*03a78d15Sespie $show "${rm}r $removelist" 2692*03a78d15Sespie $run ${rm}r $removelist 2693*03a78d15Sespie fi 2694*03a78d15Sespie fi 2695*03a78d15Sespie 2696*03a78d15Sespie # Now set the variables for building old libraries. 2697*03a78d15Sespie if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 2698*03a78d15Sespie oldlibs="$oldlibs $output_objdir/$libname.$libext" 2699*03a78d15Sespie 2700*03a78d15Sespie # Transform .lo files to .o files. 2701*03a78d15Sespie oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 2702*03a78d15Sespie fi 2703*03a78d15Sespie 2704*03a78d15Sespie # Eliminate all temporary directories. 2705*03a78d15Sespie for path in $notinst_path; do 2706*03a78d15Sespie lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` 2707*03a78d15Sespie deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` 2708*03a78d15Sespie dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` 2709*03a78d15Sespie done 2710*03a78d15Sespie 2711*03a78d15Sespie if test -n "$xrpath"; then 2712*03a78d15Sespie # If the user specified any rpath flags, then add them. 2713*03a78d15Sespie temp_xrpath= 2714*03a78d15Sespie for libdir in $xrpath; do 2715*03a78d15Sespie temp_xrpath="$temp_xrpath -R$libdir" 2716*03a78d15Sespie case "$finalize_rpath " in 2717*03a78d15Sespie *" $libdir "*) ;; 2718*03a78d15Sespie *) finalize_rpath="$finalize_rpath $libdir" ;; 2719*03a78d15Sespie esac 2720*03a78d15Sespie done 2721*03a78d15Sespie if test $hardcode_into_libs != yes || test $build_old_libs = yes; then 2722*03a78d15Sespie dependency_libs="$temp_xrpath $dependency_libs" 2723*03a78d15Sespie fi 2724*03a78d15Sespie fi 2725*03a78d15Sespie 2726*03a78d15Sespie # Make sure dlfiles contains only unique files that won't be dlpreopened 2727*03a78d15Sespie old_dlfiles="$dlfiles" 2728*03a78d15Sespie dlfiles= 2729*03a78d15Sespie for lib in $old_dlfiles; do 2730*03a78d15Sespie case " $dlprefiles $dlfiles " in 2731*03a78d15Sespie *" $lib "*) ;; 2732*03a78d15Sespie *) dlfiles="$dlfiles $lib" ;; 2733*03a78d15Sespie esac 2734*03a78d15Sespie done 2735*03a78d15Sespie 2736*03a78d15Sespie # Make sure dlprefiles contains only unique files 2737*03a78d15Sespie old_dlprefiles="$dlprefiles" 2738*03a78d15Sespie dlprefiles= 2739*03a78d15Sespie for lib in $old_dlprefiles; do 2740*03a78d15Sespie case "$dlprefiles " in 2741*03a78d15Sespie *" $lib "*) ;; 2742*03a78d15Sespie *) dlprefiles="$dlprefiles $lib" ;; 2743*03a78d15Sespie esac 2744*03a78d15Sespie done 2745*03a78d15Sespie 2746*03a78d15Sespie if test "$build_libtool_libs" = yes; then 2747*03a78d15Sespie if test -n "$rpath"; then 2748*03a78d15Sespie case $host in 2749*03a78d15Sespie *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 2750*03a78d15Sespie # these systems don't actually have a c library (as such)! 2751*03a78d15Sespie ;; 2752*03a78d15Sespie *-*-rhapsody* | *-*-darwin1.[012]) 2753*03a78d15Sespie # Rhapsody C library is in the System framework 2754*03a78d15Sespie deplibs="$deplibs -framework System" 2755*03a78d15Sespie ;; 2756*03a78d15Sespie *-*-netbsd*) 2757*03a78d15Sespie # Don't link with libc until the a.out ld.so is fixed. 2758*03a78d15Sespie ;; 2759*03a78d15Sespie *) 2760*03a78d15Sespie # Add libc to deplibs on all other systems if necessary. 2761*03a78d15Sespie if test $build_libtool_need_lc = "yes"; then 2762*03a78d15Sespie deplibs="$deplibs -lc" 2763*03a78d15Sespie fi 2764*03a78d15Sespie ;; 2765*03a78d15Sespie esac 2766*03a78d15Sespie fi 2767*03a78d15Sespie 2768*03a78d15Sespie # Transform deplibs into only deplibs that can be linked in shared. 2769*03a78d15Sespie name_save=$name 2770*03a78d15Sespie libname_save=$libname 2771*03a78d15Sespie release_save=$release 2772*03a78d15Sespie versuffix_save=$versuffix 2773*03a78d15Sespie major_save=$major 2774*03a78d15Sespie # I'm not sure if I'm treating the release correctly. I think 2775*03a78d15Sespie # release should show up in the -l (ie -lgmp5) so we don't want to 2776*03a78d15Sespie # add it in twice. Is that correct? 2777*03a78d15Sespie release="" 2778*03a78d15Sespie versuffix="" 2779*03a78d15Sespie major="" 2780*03a78d15Sespie newdeplibs= 2781*03a78d15Sespie droppeddeps=no 2782*03a78d15Sespie case $deplibs_check_method in 2783*03a78d15Sespie pass_all) 2784*03a78d15Sespie # Don't check for shared/static. Everything works. 2785*03a78d15Sespie # This might be a little naive. We might want to check 2786*03a78d15Sespie # whether the library exists or not. But this is on 2787*03a78d15Sespie # osf3 & osf4 and I'm not really sure... Just 2788*03a78d15Sespie # implementing what was already the behaviour. 2789*03a78d15Sespie newdeplibs=$deplibs 2790*03a78d15Sespie ;; 2791*03a78d15Sespie test_compile) 2792*03a78d15Sespie # This code stresses the "libraries are programs" paradigm to its 2793*03a78d15Sespie # limits. Maybe even breaks it. We compile a program, linking it 2794*03a78d15Sespie # against the deplibs as a proxy for the library. Then we can check 2795*03a78d15Sespie # whether they linked in statically or dynamically with ldd. 2796*03a78d15Sespie $rm conftest.c 2797*03a78d15Sespie cat > conftest.c <<EOF 2798*03a78d15Sespie int main() { return 0; } 2799*03a78d15SespieEOF 2800*03a78d15Sespie $rm conftest 2801*03a78d15Sespie $LTCC -o conftest conftest.c $deplibs 2802*03a78d15Sespie if test $? -eq 0 ; then 2803*03a78d15Sespie ldd_output=`ldd conftest` 2804*03a78d15Sespie for i in $deplibs; do 2805*03a78d15Sespie name="`expr $i : '-l\(.*\)'`" 2806*03a78d15Sespie # If $name is empty we are operating on a -L argument. 2807*03a78d15Sespie if test -n "$name" && test "$name" != "0"; then 2808*03a78d15Sespie libname=`eval \\$echo \"$libname_spec\"` 2809*03a78d15Sespie deplib_matches=`eval \\$echo \"$library_names_spec\"` 2810*03a78d15Sespie set dummy $deplib_matches 2811*03a78d15Sespie deplib_match=$2 2812*03a78d15Sespie if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 2813*03a78d15Sespie newdeplibs="$newdeplibs $i" 2814*03a78d15Sespie else 2815*03a78d15Sespie droppeddeps=yes 2816*03a78d15Sespie echo 2817*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $i." 2818*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 2819*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 2820*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 2821*03a78d15Sespie fi 2822*03a78d15Sespie else 2823*03a78d15Sespie newdeplibs="$newdeplibs $i" 2824*03a78d15Sespie fi 2825*03a78d15Sespie done 2826*03a78d15Sespie else 2827*03a78d15Sespie # Error occured in the first compile. Let's try to salvage the situation: 2828*03a78d15Sespie # Compile a seperate program for each library. 2829*03a78d15Sespie for i in $deplibs; do 2830*03a78d15Sespie name="`expr $i : '-l\(.*\)'`" 2831*03a78d15Sespie # If $name is empty we are operating on a -L argument. 2832*03a78d15Sespie if test -n "$name" && test "$name" != "0"; then 2833*03a78d15Sespie $rm conftest 2834*03a78d15Sespie $LTCC -o conftest conftest.c $i 2835*03a78d15Sespie # Did it work? 2836*03a78d15Sespie if test $? -eq 0 ; then 2837*03a78d15Sespie ldd_output=`ldd conftest` 2838*03a78d15Sespie libname=`eval \\$echo \"$libname_spec\"` 2839*03a78d15Sespie deplib_matches=`eval \\$echo \"$library_names_spec\"` 2840*03a78d15Sespie set dummy $deplib_matches 2841*03a78d15Sespie deplib_match=$2 2842*03a78d15Sespie if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 2843*03a78d15Sespie newdeplibs="$newdeplibs $i" 2844*03a78d15Sespie else 2845*03a78d15Sespie droppeddeps=yes 2846*03a78d15Sespie echo 2847*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $i." 2848*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 2849*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 2850*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 2851*03a78d15Sespie fi 2852*03a78d15Sespie else 2853*03a78d15Sespie droppeddeps=yes 2854*03a78d15Sespie echo 2855*03a78d15Sespie echo "*** Warning! Library $i is needed by this library but I was not able to" 2856*03a78d15Sespie echo "*** make it link in! You will probably need to install it or some" 2857*03a78d15Sespie echo "*** library that it depends on before this library will be fully" 2858*03a78d15Sespie echo "*** functional. Installing it before continuing would be even better." 2859*03a78d15Sespie fi 2860*03a78d15Sespie else 2861*03a78d15Sespie newdeplibs="$newdeplibs $i" 2862*03a78d15Sespie fi 2863*03a78d15Sespie done 2864*03a78d15Sespie fi 2865*03a78d15Sespie ;; 2866*03a78d15Sespie file_magic*) 2867*03a78d15Sespie set dummy $deplibs_check_method 2868*03a78d15Sespie file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2869*03a78d15Sespie for a_deplib in $deplibs; do 2870*03a78d15Sespie name="`expr $a_deplib : '-l\(.*\)'`" 2871*03a78d15Sespie # If $name is empty we are operating on a -L argument. 2872*03a78d15Sespie if test -n "$name" && test "$name" != "0"; then 2873*03a78d15Sespie libname=`eval \\$echo \"$libname_spec\"` 2874*03a78d15Sespie for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 2875*03a78d15Sespie potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 2876*03a78d15Sespie for potent_lib in $potential_libs; do 2877*03a78d15Sespie # Follow soft links. 2878*03a78d15Sespie if ls -lLd "$potent_lib" 2>/dev/null \ 2879*03a78d15Sespie | grep " -> " >/dev/null; then 2880*03a78d15Sespie continue 2881*03a78d15Sespie fi 2882*03a78d15Sespie # The statement above tries to avoid entering an 2883*03a78d15Sespie # endless loop below, in case of cyclic links. 2884*03a78d15Sespie # We might still enter an endless loop, since a link 2885*03a78d15Sespie # loop can be closed while we follow links, 2886*03a78d15Sespie # but so what? 2887*03a78d15Sespie potlib="$potent_lib" 2888*03a78d15Sespie while test -h "$potlib" 2>/dev/null; do 2889*03a78d15Sespie potliblink=`ls -ld $potlib | sed 's/.* -> //'` 2890*03a78d15Sespie case $potliblink in 2891*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 2892*03a78d15Sespie *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 2893*03a78d15Sespie esac 2894*03a78d15Sespie done 2895*03a78d15Sespie if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 2896*03a78d15Sespie | sed 10q \ 2897*03a78d15Sespie | egrep "$file_magic_regex" > /dev/null; then 2898*03a78d15Sespie newdeplibs="$newdeplibs $a_deplib" 2899*03a78d15Sespie a_deplib="" 2900*03a78d15Sespie break 2 2901*03a78d15Sespie fi 2902*03a78d15Sespie done 2903*03a78d15Sespie done 2904*03a78d15Sespie if test -n "$a_deplib" ; then 2905*03a78d15Sespie droppeddeps=yes 2906*03a78d15Sespie echo 2907*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $a_deplib." 2908*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 2909*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 2910*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 2911*03a78d15Sespie fi 2912*03a78d15Sespie else 2913*03a78d15Sespie # Add a -L argument. 2914*03a78d15Sespie newdeplibs="$newdeplibs $a_deplib" 2915*03a78d15Sespie fi 2916*03a78d15Sespie done # Gone through all deplibs. 2917*03a78d15Sespie ;; 2918*03a78d15Sespie match_pattern*) 2919*03a78d15Sespie set dummy $deplibs_check_method 2920*03a78d15Sespie match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2921*03a78d15Sespie for a_deplib in $deplibs; do 2922*03a78d15Sespie name="`expr $a_deplib : '-l\(.*\)'`" 2923*03a78d15Sespie # If $name is empty we are operating on a -L argument. 2924*03a78d15Sespie if test -n "$name" && test "$name" != "0"; then 2925*03a78d15Sespie libname=`eval \\$echo \"$libname_spec\"` 2926*03a78d15Sespie for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 2927*03a78d15Sespie potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 2928*03a78d15Sespie for potent_lib in $potential_libs; do 2929*03a78d15Sespie if eval echo \"$potent_lib\" 2>/dev/null \ 2930*03a78d15Sespie | sed 10q \ 2931*03a78d15Sespie | egrep "$match_pattern_regex" > /dev/null; then 2932*03a78d15Sespie newdeplibs="$newdeplibs $a_deplib" 2933*03a78d15Sespie a_deplib="" 2934*03a78d15Sespie break 2 2935*03a78d15Sespie fi 2936*03a78d15Sespie done 2937*03a78d15Sespie done 2938*03a78d15Sespie if test -n "$a_deplib" ; then 2939*03a78d15Sespie droppeddeps=yes 2940*03a78d15Sespie echo 2941*03a78d15Sespie echo "*** Warning: This library needs some functionality provided by $a_deplib." 2942*03a78d15Sespie echo "*** I have the capability to make that library automatically link in when" 2943*03a78d15Sespie echo "*** you link to this library. But I can only do this if you have a" 2944*03a78d15Sespie echo "*** shared version of the library, which you do not appear to have." 2945*03a78d15Sespie fi 2946*03a78d15Sespie else 2947*03a78d15Sespie # Add a -L argument. 2948*03a78d15Sespie newdeplibs="$newdeplibs $a_deplib" 2949*03a78d15Sespie fi 2950*03a78d15Sespie done # Gone through all deplibs. 2951*03a78d15Sespie ;; 2952*03a78d15Sespie none | unknown | *) 2953*03a78d15Sespie newdeplibs="" 2954*03a78d15Sespie if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 2955*03a78d15Sespie -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | 2956*03a78d15Sespie grep . >/dev/null; then 2957*03a78d15Sespie echo 2958*03a78d15Sespie if test "X$deplibs_check_method" = "Xnone"; then 2959*03a78d15Sespie echo "*** Warning: inter-library dependencies are not supported in this platform." 2960*03a78d15Sespie else 2961*03a78d15Sespie echo "*** Warning: inter-library dependencies are not known to be supported." 2962*03a78d15Sespie fi 2963*03a78d15Sespie echo "*** All declared inter-library dependencies are being dropped." 2964*03a78d15Sespie droppeddeps=yes 2965*03a78d15Sespie fi 2966*03a78d15Sespie ;; 2967*03a78d15Sespie esac 2968*03a78d15Sespie versuffix=$versuffix_save 2969*03a78d15Sespie major=$major_save 2970*03a78d15Sespie release=$release_save 2971*03a78d15Sespie libname=$libname_save 2972*03a78d15Sespie name=$name_save 2973*03a78d15Sespie 2974*03a78d15Sespie case $host in 2975*03a78d15Sespie *-*-rhapsody* | *-*-darwin1.[012]) 2976*03a78d15Sespie # On Rhapsody replace the C library is the System framework 2977*03a78d15Sespie newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 2978*03a78d15Sespie ;; 2979*03a78d15Sespie esac 2980*03a78d15Sespie 2981*03a78d15Sespie if test "$droppeddeps" = yes; then 2982*03a78d15Sespie if test "$module" = yes; then 2983*03a78d15Sespie echo 2984*03a78d15Sespie echo "*** Warning: libtool could not satisfy all declared inter-library" 2985*03a78d15Sespie echo "*** dependencies of module $libname. Therefore, libtool will create" 2986*03a78d15Sespie echo "*** a static module, that should work as long as the dlopening" 2987*03a78d15Sespie echo "*** application is linked with the -dlopen flag." 2988*03a78d15Sespie if test -z "$global_symbol_pipe"; then 2989*03a78d15Sespie echo 2990*03a78d15Sespie echo "*** However, this would only work if libtool was able to extract symbol" 2991*03a78d15Sespie echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2992*03a78d15Sespie echo "*** not find such a program. So, this module is probably useless." 2993*03a78d15Sespie echo "*** \`nm' from GNU binutils and a full rebuild may help." 2994*03a78d15Sespie fi 2995*03a78d15Sespie if test "$build_old_libs" = no; then 2996*03a78d15Sespie oldlibs="$output_objdir/$libname.$libext" 2997*03a78d15Sespie build_libtool_libs=module 2998*03a78d15Sespie build_old_libs=yes 2999*03a78d15Sespie else 3000*03a78d15Sespie build_libtool_libs=no 3001*03a78d15Sespie fi 3002*03a78d15Sespie else 3003*03a78d15Sespie echo "*** The inter-library dependencies that have been dropped here will be" 3004*03a78d15Sespie echo "*** automatically added whenever a program is linked with this library" 3005*03a78d15Sespie echo "*** or is declared to -dlopen it." 3006*03a78d15Sespie 3007*03a78d15Sespie if test $allow_undefined = no; then 3008*03a78d15Sespie echo 3009*03a78d15Sespie echo "*** Since this library must not contain undefined symbols," 3010*03a78d15Sespie echo "*** because either the platform does not support them or" 3011*03a78d15Sespie echo "*** it was explicitly requested with -no-undefined," 3012*03a78d15Sespie echo "*** libtool will only create a static version of it." 3013*03a78d15Sespie if test "$build_old_libs" = no; then 3014*03a78d15Sespie oldlibs="$output_objdir/$libname.$libext" 3015*03a78d15Sespie build_libtool_libs=module 3016*03a78d15Sespie build_old_libs=yes 3017*03a78d15Sespie else 3018*03a78d15Sespie build_libtool_libs=no 3019*03a78d15Sespie fi 3020*03a78d15Sespie fi 3021*03a78d15Sespie fi 3022*03a78d15Sespie fi 3023*03a78d15Sespie # Done checking deplibs! 3024*03a78d15Sespie deplibs=$newdeplibs 3025*03a78d15Sespie fi 3026*03a78d15Sespie 3027*03a78d15Sespie # All the library-specific variables (install_libdir is set above). 3028*03a78d15Sespie library_names= 3029*03a78d15Sespie old_library= 3030*03a78d15Sespie dlname= 3031*03a78d15Sespie 3032*03a78d15Sespie # Test again, we may have decided not to build it any more 3033*03a78d15Sespie if test "$build_libtool_libs" = yes; then 3034*03a78d15Sespie if test $hardcode_into_libs = yes; then 3035*03a78d15Sespie # Hardcode the library paths 3036*03a78d15Sespie hardcode_libdirs= 3037*03a78d15Sespie dep_rpath= 3038*03a78d15Sespie rpath="$finalize_rpath" 3039*03a78d15Sespie test "$mode" != relink && rpath="$compile_rpath$rpath" 3040*03a78d15Sespie for libdir in $rpath; do 3041*03a78d15Sespie if test -n "$hardcode_libdir_flag_spec"; then 3042*03a78d15Sespie if test -n "$hardcode_libdir_separator"; then 3043*03a78d15Sespie if test -z "$hardcode_libdirs"; then 3044*03a78d15Sespie hardcode_libdirs="$libdir" 3045*03a78d15Sespie else 3046*03a78d15Sespie # Just accumulate the unique libdirs. 3047*03a78d15Sespie case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3048*03a78d15Sespie *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3049*03a78d15Sespie ;; 3050*03a78d15Sespie *) 3051*03a78d15Sespie hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3052*03a78d15Sespie ;; 3053*03a78d15Sespie esac 3054*03a78d15Sespie fi 3055*03a78d15Sespie else 3056*03a78d15Sespie eval flag=\"$hardcode_libdir_flag_spec\" 3057*03a78d15Sespie dep_rpath="$dep_rpath $flag" 3058*03a78d15Sespie fi 3059*03a78d15Sespie elif test -n "$runpath_var"; then 3060*03a78d15Sespie case "$perm_rpath " in 3061*03a78d15Sespie *" $libdir "*) ;; 3062*03a78d15Sespie *) perm_rpath="$perm_rpath $libdir" ;; 3063*03a78d15Sespie esac 3064*03a78d15Sespie fi 3065*03a78d15Sespie done 3066*03a78d15Sespie # Substitute the hardcoded libdirs into the rpath. 3067*03a78d15Sespie if test -n "$hardcode_libdir_separator" && 3068*03a78d15Sespie test -n "$hardcode_libdirs"; then 3069*03a78d15Sespie libdir="$hardcode_libdirs" 3070*03a78d15Sespie eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3071*03a78d15Sespie fi 3072*03a78d15Sespie if test -n "$runpath_var" && test -n "$perm_rpath"; then 3073*03a78d15Sespie # We should set the runpath_var. 3074*03a78d15Sespie rpath= 3075*03a78d15Sespie for dir in $perm_rpath; do 3076*03a78d15Sespie rpath="$rpath$dir:" 3077*03a78d15Sespie done 3078*03a78d15Sespie eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3079*03a78d15Sespie fi 3080*03a78d15Sespie test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3081*03a78d15Sespie fi 3082*03a78d15Sespie 3083*03a78d15Sespie shlibpath="$finalize_shlibpath" 3084*03a78d15Sespie test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3085*03a78d15Sespie if test -n "$shlibpath"; then 3086*03a78d15Sespie eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3087*03a78d15Sespie fi 3088*03a78d15Sespie 3089*03a78d15Sespie # Get the real and link names of the library. 3090*03a78d15Sespie eval library_names=\"$library_names_spec\" 3091*03a78d15Sespie set dummy $library_names 3092*03a78d15Sespie realname="$2" 3093*03a78d15Sespie shift; shift 3094*03a78d15Sespie 3095*03a78d15Sespie if test -n "$soname_spec"; then 3096*03a78d15Sespie eval soname=\"$soname_spec\" 3097*03a78d15Sespie else 3098*03a78d15Sespie soname="$realname" 3099*03a78d15Sespie fi 3100*03a78d15Sespie test -z "$dlname" && dlname=$soname 3101*03a78d15Sespie 3102*03a78d15Sespie lib="$output_objdir/$realname" 3103*03a78d15Sespie for link 3104*03a78d15Sespie do 3105*03a78d15Sespie linknames="$linknames $link" 3106*03a78d15Sespie done 3107*03a78d15Sespie 3108*03a78d15Sespie# # Ensure that we have .o objects for linkers which dislike .lo 3109*03a78d15Sespie# # (e.g. aix) in case we are running --disable-static 3110*03a78d15Sespie# for obj in $libobjs; do 3111*03a78d15Sespie# xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 3112*03a78d15Sespie# if test "X$xdir" = "X$obj"; then 3113*03a78d15Sespie# xdir="." 3114*03a78d15Sespie# else 3115*03a78d15Sespie# xdir="$xdir" 3116*03a78d15Sespie# fi 3117*03a78d15Sespie# baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 3118*03a78d15Sespie# oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` 3119*03a78d15Sespie# if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then 3120*03a78d15Sespie# $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" 3121*03a78d15Sespie# $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? 3122*03a78d15Sespie# fi 3123*03a78d15Sespie# done 3124*03a78d15Sespie 3125*03a78d15Sespie # Use standard objects if they are pic 3126*03a78d15Sespie test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3127*03a78d15Sespie 3128*03a78d15Sespie # Prepare the list of exported symbols 3129*03a78d15Sespie if test -z "$export_symbols"; then 3130*03a78d15Sespie if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 3131*03a78d15Sespie $show "generating symbol list for \`$libname.la'" 3132*03a78d15Sespie export_symbols="$output_objdir/$libname.exp" 3133*03a78d15Sespie $run $rm $export_symbols 3134*03a78d15Sespie eval cmds=\"$export_symbols_cmds\" 3135*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3136*03a78d15Sespie for cmd in $cmds; do 3137*03a78d15Sespie IFS="$save_ifs" 3138*03a78d15Sespie $show "$cmd" 3139*03a78d15Sespie $run eval "$cmd" || exit $? 3140*03a78d15Sespie done 3141*03a78d15Sespie IFS="$save_ifs" 3142*03a78d15Sespie if test -n "$export_symbols_regex"; then 3143*03a78d15Sespie $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3144*03a78d15Sespie $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 3145*03a78d15Sespie $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 3146*03a78d15Sespie $run eval '$mv "${export_symbols}T" "$export_symbols"' 3147*03a78d15Sespie fi 3148*03a78d15Sespie fi 3149*03a78d15Sespie fi 3150*03a78d15Sespie 3151*03a78d15Sespie if test -n "$export_symbols" && test -n "$include_expsyms"; then 3152*03a78d15Sespie $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 3153*03a78d15Sespie fi 3154*03a78d15Sespie 3155*03a78d15Sespie if test -n "$convenience"; then 3156*03a78d15Sespie if test -n "$whole_archive_flag_spec"; then 3157*03a78d15Sespie save_libobjs=$libobjs 3158*03a78d15Sespie eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3159*03a78d15Sespie else 3160*03a78d15Sespie gentop="$output_objdir/${outputname}x" 3161*03a78d15Sespie $show "${rm}r $gentop" 3162*03a78d15Sespie $run ${rm}r "$gentop" 3163*03a78d15Sespie $show "$mkdir $gentop" 3164*03a78d15Sespie $run $mkdir "$gentop" 3165*03a78d15Sespie status=$? 3166*03a78d15Sespie if test $status -ne 0 && test ! -d "$gentop"; then 3167*03a78d15Sespie exit $status 3168*03a78d15Sespie fi 3169*03a78d15Sespie generated="$generated $gentop" 3170*03a78d15Sespie 3171*03a78d15Sespie for xlib in $convenience; do 3172*03a78d15Sespie # Extract the objects. 3173*03a78d15Sespie case $xlib in 3174*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 3175*03a78d15Sespie *) xabs=`pwd`"/$xlib" ;; 3176*03a78d15Sespie esac 3177*03a78d15Sespie xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 3178*03a78d15Sespie xdir="$gentop/$xlib" 3179*03a78d15Sespie 3180*03a78d15Sespie $show "${rm}r $xdir" 3181*03a78d15Sespie $run ${rm}r "$xdir" 3182*03a78d15Sespie $show "$mkdir $xdir" 3183*03a78d15Sespie $run $mkdir "$xdir" 3184*03a78d15Sespie status=$? 3185*03a78d15Sespie if test $status -ne 0 && test ! -d "$xdir"; then 3186*03a78d15Sespie exit $status 3187*03a78d15Sespie fi 3188*03a78d15Sespie $show "(cd $xdir && $AR x $xabs)" 3189*03a78d15Sespie $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 3190*03a78d15Sespie 3191*03a78d15Sespie libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 3192*03a78d15Sespie done 3193*03a78d15Sespie fi 3194*03a78d15Sespie fi 3195*03a78d15Sespie 3196*03a78d15Sespie if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 3197*03a78d15Sespie eval flag=\"$thread_safe_flag_spec\" 3198*03a78d15Sespie linker_flags="$linker_flags $flag" 3199*03a78d15Sespie fi 3200*03a78d15Sespie 3201*03a78d15Sespie # Make a backup of the uninstalled library when relinking 3202*03a78d15Sespie if test "$mode" = relink; then 3203*03a78d15Sespie $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 3204*03a78d15Sespie fi 3205*03a78d15Sespie 3206*03a78d15Sespie # Do each of the archive commands. 3207*03a78d15Sespie if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 3208*03a78d15Sespie eval cmds=\"$archive_expsym_cmds\" 3209*03a78d15Sespie else 3210*03a78d15Sespie eval cmds=\"$archive_cmds\" 3211*03a78d15Sespie fi 3212*03a78d15Sespie if len=`expr "X$cmds" : ".*"` && 3213*03a78d15Sespie test $len -le $max_cmd_len; then 3214*03a78d15Sespie : 3215*03a78d15Sespie else 3216*03a78d15Sespie # The command line is too long to link in one step, link piecewise. 3217*03a78d15Sespie $echo "creating reloadable object files..." 3218*03a78d15Sespie 3219*03a78d15Sespie # Save the value of $output and $libobjs because we want to 3220*03a78d15Sespie # use them later. If we have whole_archive_flag_spec, we 3221*03a78d15Sespie # want to use save_libobjs as it was before 3222*03a78d15Sespie # whole_archive_flag_spec was expanded, because we can't 3223*03a78d15Sespie # assume the linker understands whole_archive_flag_spec. 3224*03a78d15Sespie # This may have to be revisited, in case too many 3225*03a78d15Sespie # convenience libraries get linked in and end up exceeding 3226*03a78d15Sespie # the spec. 3227*03a78d15Sespie if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 3228*03a78d15Sespie save_libobjs=$libobjs 3229*03a78d15Sespie fi 3230*03a78d15Sespie save_output=$output 3231*03a78d15Sespie 3232*03a78d15Sespie # Clear the reloadable object creation command queue and 3233*03a78d15Sespie # initialize k to one. 3234*03a78d15Sespie test_cmds= 3235*03a78d15Sespie concat_cmds= 3236*03a78d15Sespie objlist= 3237*03a78d15Sespie delfiles= 3238*03a78d15Sespie last_robj= 3239*03a78d15Sespie k=1 3240*03a78d15Sespie output=$output_objdir/$save_output-${k}.$objext 3241*03a78d15Sespie # Loop over the list of objects to be linked. 3242*03a78d15Sespie for obj in $save_libobjs 3243*03a78d15Sespie do 3244*03a78d15Sespie eval test_cmds=\"$reload_cmds $objlist $last_robj\" 3245*03a78d15Sespie if test "X$objlist" = X || 3246*03a78d15Sespie { len=`expr "X$test_cmds" : ".*"` && 3247*03a78d15Sespie test $len -le $max_cmd_len; }; then 3248*03a78d15Sespie objlist="$objlist $obj" 3249*03a78d15Sespie else 3250*03a78d15Sespie # The command $test_cmds is almost too long, add a 3251*03a78d15Sespie # command to the queue. 3252*03a78d15Sespie if test $k -eq 1 ; then 3253*03a78d15Sespie # The first file doesn't have a previous command to add. 3254*03a78d15Sespie eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 3255*03a78d15Sespie else 3256*03a78d15Sespie # All subsequent reloadable object files will link in 3257*03a78d15Sespie # the last one created. 3258*03a78d15Sespie eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 3259*03a78d15Sespie fi 3260*03a78d15Sespie last_robj=$output_objdir/$save_output-${k}.$objext 3261*03a78d15Sespie k=`expr $k + 1` 3262*03a78d15Sespie output=$output_objdir/$save_output-${k}.$objext 3263*03a78d15Sespie objlist=$obj 3264*03a78d15Sespie len=1 3265*03a78d15Sespie fi 3266*03a78d15Sespie done 3267*03a78d15Sespie # Handle the remaining objects by creating one last 3268*03a78d15Sespie # reloadable object file. All subsequent reloadable object 3269*03a78d15Sespie # files will link in the last one created. 3270*03a78d15Sespie test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 3271*03a78d15Sespie eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 3272*03a78d15Sespie 3273*03a78d15Sespie # Set up a command to remove the reloadale object files 3274*03a78d15Sespie # after they are used. 3275*03a78d15Sespie i=0 3276*03a78d15Sespie while test $i -lt $k 3277*03a78d15Sespie do 3278*03a78d15Sespie i=`expr $i + 1` 3279*03a78d15Sespie delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 3280*03a78d15Sespie done 3281*03a78d15Sespie 3282*03a78d15Sespie $echo "creating a temporary reloadable object file: $output" 3283*03a78d15Sespie 3284*03a78d15Sespie # Loop through the commands generated above and execute them. 3285*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3286*03a78d15Sespie for cmd in $concat_cmds; do 3287*03a78d15Sespie IFS="$save_ifs" 3288*03a78d15Sespie $show "$cmd" 3289*03a78d15Sespie $run eval "$cmd" || exit $? 3290*03a78d15Sespie done 3291*03a78d15Sespie IFS="$save_ifs" 3292*03a78d15Sespie 3293*03a78d15Sespie libobjs=$output 3294*03a78d15Sespie # Restore the value of output. 3295*03a78d15Sespie output=$save_output 3296*03a78d15Sespie 3297*03a78d15Sespie if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 3298*03a78d15Sespie eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3299*03a78d15Sespie fi 3300*03a78d15Sespie # Expand the library linking commands again to reset the 3301*03a78d15Sespie # value of $libobjs for piecewise linking. 3302*03a78d15Sespie 3303*03a78d15Sespie # Do each of the archive commands. 3304*03a78d15Sespie if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 3305*03a78d15Sespie eval cmds=\"$archive_expsym_cmds\" 3306*03a78d15Sespie else 3307*03a78d15Sespie eval cmds=\"$archive_cmds\" 3308*03a78d15Sespie fi 3309*03a78d15Sespie 3310*03a78d15Sespie # Append the command to remove the reloadable object files 3311*03a78d15Sespie # to the just-reset $cmds. 3312*03a78d15Sespie eval cmds=\"\$cmds~$rm $delfiles\" 3313*03a78d15Sespie fi 3314*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3315*03a78d15Sespie for cmd in $cmds; do 3316*03a78d15Sespie IFS="$save_ifs" 3317*03a78d15Sespie $show "$cmd" 3318*03a78d15Sespie $run eval "$cmd" || exit $? 3319*03a78d15Sespie done 3320*03a78d15Sespie IFS="$save_ifs" 3321*03a78d15Sespie 3322*03a78d15Sespie # Restore the uninstalled library and exit 3323*03a78d15Sespie if test "$mode" = relink; then 3324*03a78d15Sespie $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 3325*03a78d15Sespie exit 0 3326*03a78d15Sespie fi 3327*03a78d15Sespie 3328*03a78d15Sespie # Create links to the real library. 3329*03a78d15Sespie for linkname in $linknames; do 3330*03a78d15Sespie if test "$realname" != "$linkname"; then 3331*03a78d15Sespie $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 3332*03a78d15Sespie $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 3333*03a78d15Sespie fi 3334*03a78d15Sespie done 3335*03a78d15Sespie 3336*03a78d15Sespie # If -module or -export-dynamic was specified, set the dlname. 3337*03a78d15Sespie if test "$module" = yes || test "$export_dynamic" = yes; then 3338*03a78d15Sespie # On all known operating systems, these are identical. 3339*03a78d15Sespie dlname="$soname" 3340*03a78d15Sespie fi 3341*03a78d15Sespie fi 3342*03a78d15Sespie ;; 3343*03a78d15Sespie 3344*03a78d15Sespie obj) 3345*03a78d15Sespie if test -n "$deplibs"; then 3346*03a78d15Sespie $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 3347*03a78d15Sespie fi 3348*03a78d15Sespie 3349*03a78d15Sespie if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3350*03a78d15Sespie $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 3351*03a78d15Sespie fi 3352*03a78d15Sespie 3353*03a78d15Sespie if test -n "$rpath"; then 3354*03a78d15Sespie $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 3355*03a78d15Sespie fi 3356*03a78d15Sespie 3357*03a78d15Sespie if test -n "$xrpath"; then 3358*03a78d15Sespie $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 3359*03a78d15Sespie fi 3360*03a78d15Sespie 3361*03a78d15Sespie if test -n "$vinfo"; then 3362*03a78d15Sespie $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 3363*03a78d15Sespie fi 3364*03a78d15Sespie 3365*03a78d15Sespie if test -n "$release"; then 3366*03a78d15Sespie $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 3367*03a78d15Sespie fi 3368*03a78d15Sespie 3369*03a78d15Sespie case $output in 3370*03a78d15Sespie *.lo) 3371*03a78d15Sespie if test -n "$objs$old_deplibs"; then 3372*03a78d15Sespie $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 3373*03a78d15Sespie exit 1 3374*03a78d15Sespie fi 3375*03a78d15Sespie libobj="$output" 3376*03a78d15Sespie obj=`$echo "X$output" | $Xsed -e "$lo2o"` 3377*03a78d15Sespie ;; 3378*03a78d15Sespie *) 3379*03a78d15Sespie libobj= 3380*03a78d15Sespie obj="$output" 3381*03a78d15Sespie ;; 3382*03a78d15Sespie esac 3383*03a78d15Sespie 3384*03a78d15Sespie # Delete the old objects. 3385*03a78d15Sespie $run $rm $obj $libobj 3386*03a78d15Sespie 3387*03a78d15Sespie # Objects from convenience libraries. This assumes 3388*03a78d15Sespie # single-version convenience libraries. Whenever we create 3389*03a78d15Sespie # different ones for PIC/non-PIC, this we'll have to duplicate 3390*03a78d15Sespie # the extraction. 3391*03a78d15Sespie reload_conv_objs= 3392*03a78d15Sespie gentop= 3393*03a78d15Sespie # reload_cmds runs $LD directly, so let us get rid of 3394*03a78d15Sespie # -Wl from whole_archive_flag_spec 3395*03a78d15Sespie wl= 3396*03a78d15Sespie 3397*03a78d15Sespie if test -n "$convenience"; then 3398*03a78d15Sespie if test -n "$whole_archive_flag_spec"; then 3399*03a78d15Sespie eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 3400*03a78d15Sespie else 3401*03a78d15Sespie gentop="$output_objdir/${obj}x" 3402*03a78d15Sespie $show "${rm}r $gentop" 3403*03a78d15Sespie $run ${rm}r "$gentop" 3404*03a78d15Sespie $show "$mkdir $gentop" 3405*03a78d15Sespie $run $mkdir "$gentop" 3406*03a78d15Sespie status=$? 3407*03a78d15Sespie if test $status -ne 0 && test ! -d "$gentop"; then 3408*03a78d15Sespie exit $status 3409*03a78d15Sespie fi 3410*03a78d15Sespie generated="$generated $gentop" 3411*03a78d15Sespie 3412*03a78d15Sespie for xlib in $convenience; do 3413*03a78d15Sespie # Extract the objects. 3414*03a78d15Sespie case $xlib in 3415*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 3416*03a78d15Sespie *) xabs=`pwd`"/$xlib" ;; 3417*03a78d15Sespie esac 3418*03a78d15Sespie xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 3419*03a78d15Sespie xdir="$gentop/$xlib" 3420*03a78d15Sespie 3421*03a78d15Sespie $show "${rm}r $xdir" 3422*03a78d15Sespie $run ${rm}r "$xdir" 3423*03a78d15Sespie $show "$mkdir $xdir" 3424*03a78d15Sespie $run $mkdir "$xdir" 3425*03a78d15Sespie status=$? 3426*03a78d15Sespie if test $status -ne 0 && test ! -d "$xdir"; then 3427*03a78d15Sespie exit $status 3428*03a78d15Sespie fi 3429*03a78d15Sespie $show "(cd $xdir && $AR x $xabs)" 3430*03a78d15Sespie $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 3431*03a78d15Sespie 3432*03a78d15Sespie reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 3433*03a78d15Sespie done 3434*03a78d15Sespie fi 3435*03a78d15Sespie fi 3436*03a78d15Sespie 3437*03a78d15Sespie # Create the old-style object. 3438*03a78d15Sespie 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 3439*03a78d15Sespie 3440*03a78d15Sespie output="$obj" 3441*03a78d15Sespie eval cmds=\"$reload_cmds\" 3442*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3443*03a78d15Sespie for cmd in $cmds; do 3444*03a78d15Sespie IFS="$save_ifs" 3445*03a78d15Sespie $show "$cmd" 3446*03a78d15Sespie $run eval "$cmd" || exit $? 3447*03a78d15Sespie done 3448*03a78d15Sespie IFS="$save_ifs" 3449*03a78d15Sespie 3450*03a78d15Sespie # Exit if we aren't doing a library object file. 3451*03a78d15Sespie if test -z "$libobj"; then 3452*03a78d15Sespie if test -n "$gentop"; then 3453*03a78d15Sespie $show "${rm}r $gentop" 3454*03a78d15Sespie $run ${rm}r $gentop 3455*03a78d15Sespie fi 3456*03a78d15Sespie 3457*03a78d15Sespie exit 0 3458*03a78d15Sespie fi 3459*03a78d15Sespie 3460*03a78d15Sespie if test "$build_libtool_libs" != yes; then 3461*03a78d15Sespie if test -n "$gentop"; then 3462*03a78d15Sespie $show "${rm}r $gentop" 3463*03a78d15Sespie $run ${rm}r $gentop 3464*03a78d15Sespie fi 3465*03a78d15Sespie 3466*03a78d15Sespie # Create an invalid libtool object if no PIC, so that we don't 3467*03a78d15Sespie # accidentally link it into a program. 3468*03a78d15Sespie # $show "echo timestamp > $libobj" 3469*03a78d15Sespie # $run eval "echo timestamp > $libobj" || exit $? 3470*03a78d15Sespie exit 0 3471*03a78d15Sespie fi 3472*03a78d15Sespie 3473*03a78d15Sespie if test -n "$pic_flag" || test "$pic_mode" != default; then 3474*03a78d15Sespie # Only do commands if we really have different PIC objects. 3475*03a78d15Sespie reload_objs="$libobjs $reload_conv_objs" 3476*03a78d15Sespie output="$libobj" 3477*03a78d15Sespie eval cmds=\"$reload_cmds\" 3478*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3479*03a78d15Sespie for cmd in $cmds; do 3480*03a78d15Sespie IFS="$save_ifs" 3481*03a78d15Sespie $show "$cmd" 3482*03a78d15Sespie $run eval "$cmd" || exit $? 3483*03a78d15Sespie done 3484*03a78d15Sespie IFS="$save_ifs" 3485*03a78d15Sespie# else 3486*03a78d15Sespie# # Just create a symlink. 3487*03a78d15Sespie# $show $rm $libobj 3488*03a78d15Sespie# $run $rm $libobj 3489*03a78d15Sespie# xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` 3490*03a78d15Sespie# if test "X$xdir" = "X$libobj"; then 3491*03a78d15Sespie# xdir="." 3492*03a78d15Sespie# else 3493*03a78d15Sespie# xdir="$xdir" 3494*03a78d15Sespie# fi 3495*03a78d15Sespie# baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` 3496*03a78d15Sespie# oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` 3497*03a78d15Sespie# $show "(cd $xdir && $LN_S $oldobj $baseobj)" 3498*03a78d15Sespie# $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? 3499*03a78d15Sespie fi 3500*03a78d15Sespie 3501*03a78d15Sespie if test -n "$gentop"; then 3502*03a78d15Sespie $show "${rm}r $gentop" 3503*03a78d15Sespie $run ${rm}r $gentop 3504*03a78d15Sespie fi 3505*03a78d15Sespie 3506*03a78d15Sespie exit 0 3507*03a78d15Sespie ;; 3508*03a78d15Sespie 3509*03a78d15Sespie prog) 3510*03a78d15Sespie case $host in 3511*03a78d15Sespie *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; 3512*03a78d15Sespie esac 3513*03a78d15Sespie if test -n "$vinfo"; then 3514*03a78d15Sespie $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 3515*03a78d15Sespie fi 3516*03a78d15Sespie 3517*03a78d15Sespie if test -n "$release"; then 3518*03a78d15Sespie $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 3519*03a78d15Sespie fi 3520*03a78d15Sespie 3521*03a78d15Sespie if test "$preload" = yes; then 3522*03a78d15Sespie if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 3523*03a78d15Sespie test "$dlopen_self_static" = unknown; then 3524*03a78d15Sespie $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 3525*03a78d15Sespie fi 3526*03a78d15Sespie fi 3527*03a78d15Sespie 3528*03a78d15Sespie case $host in 3529*03a78d15Sespie *-*-rhapsody* | *-*-darwin1.[012]) 3530*03a78d15Sespie # On Rhapsody replace the C library is the System framework 3531*03a78d15Sespie compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 3532*03a78d15Sespie finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 3533*03a78d15Sespie ;; 3534*03a78d15Sespie esac 3535*03a78d15Sespie 3536*03a78d15Sespie compile_command="$compile_command $compile_deplibs" 3537*03a78d15Sespie finalize_command="$finalize_command $finalize_deplibs" 3538*03a78d15Sespie 3539*03a78d15Sespie if test -n "$rpath$xrpath"; then 3540*03a78d15Sespie # If the user specified any rpath flags, then add them. 3541*03a78d15Sespie for libdir in $rpath $xrpath; do 3542*03a78d15Sespie # This is the magic to use -rpath. 3543*03a78d15Sespie case "$finalize_rpath " in 3544*03a78d15Sespie *" $libdir "*) ;; 3545*03a78d15Sespie *) finalize_rpath="$finalize_rpath $libdir" ;; 3546*03a78d15Sespie esac 3547*03a78d15Sespie done 3548*03a78d15Sespie fi 3549*03a78d15Sespie 3550*03a78d15Sespie # Now hardcode the library paths 3551*03a78d15Sespie rpath= 3552*03a78d15Sespie hardcode_libdirs= 3553*03a78d15Sespie for libdir in $compile_rpath $finalize_rpath; do 3554*03a78d15Sespie if test -n "$hardcode_libdir_flag_spec"; then 3555*03a78d15Sespie if test -n "$hardcode_libdir_separator"; then 3556*03a78d15Sespie if test -z "$hardcode_libdirs"; then 3557*03a78d15Sespie hardcode_libdirs="$libdir" 3558*03a78d15Sespie else 3559*03a78d15Sespie # Just accumulate the unique libdirs. 3560*03a78d15Sespie case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3561*03a78d15Sespie *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3562*03a78d15Sespie ;; 3563*03a78d15Sespie *) 3564*03a78d15Sespie hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3565*03a78d15Sespie ;; 3566*03a78d15Sespie esac 3567*03a78d15Sespie fi 3568*03a78d15Sespie else 3569*03a78d15Sespie eval flag=\"$hardcode_libdir_flag_spec\" 3570*03a78d15Sespie rpath="$rpath $flag" 3571*03a78d15Sespie fi 3572*03a78d15Sespie elif test -n "$runpath_var"; then 3573*03a78d15Sespie case "$perm_rpath " in 3574*03a78d15Sespie *" $libdir "*) ;; 3575*03a78d15Sespie *) perm_rpath="$perm_rpath $libdir" ;; 3576*03a78d15Sespie esac 3577*03a78d15Sespie fi 3578*03a78d15Sespie case $host in 3579*03a78d15Sespie *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 3580*03a78d15Sespie case :$dllsearchpath: in 3581*03a78d15Sespie *":$libdir:"*) ;; 3582*03a78d15Sespie *) dllsearchpath="$dllsearchpath:$libdir";; 3583*03a78d15Sespie esac 3584*03a78d15Sespie ;; 3585*03a78d15Sespie esac 3586*03a78d15Sespie done 3587*03a78d15Sespie # Substitute the hardcoded libdirs into the rpath. 3588*03a78d15Sespie if test -n "$hardcode_libdir_separator" && 3589*03a78d15Sespie test -n "$hardcode_libdirs"; then 3590*03a78d15Sespie libdir="$hardcode_libdirs" 3591*03a78d15Sespie eval rpath=\" $hardcode_libdir_flag_spec\" 3592*03a78d15Sespie fi 3593*03a78d15Sespie compile_rpath="$rpath" 3594*03a78d15Sespie 3595*03a78d15Sespie rpath= 3596*03a78d15Sespie hardcode_libdirs= 3597*03a78d15Sespie for libdir in $finalize_rpath; do 3598*03a78d15Sespie if test -n "$hardcode_libdir_flag_spec"; then 3599*03a78d15Sespie if test -n "$hardcode_libdir_separator"; then 3600*03a78d15Sespie if test -z "$hardcode_libdirs"; then 3601*03a78d15Sespie hardcode_libdirs="$libdir" 3602*03a78d15Sespie else 3603*03a78d15Sespie # Just accumulate the unique libdirs. 3604*03a78d15Sespie case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3605*03a78d15Sespie *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3606*03a78d15Sespie ;; 3607*03a78d15Sespie *) 3608*03a78d15Sespie hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3609*03a78d15Sespie ;; 3610*03a78d15Sespie esac 3611*03a78d15Sespie fi 3612*03a78d15Sespie else 3613*03a78d15Sespie eval flag=\"$hardcode_libdir_flag_spec\" 3614*03a78d15Sespie rpath="$rpath $flag" 3615*03a78d15Sespie fi 3616*03a78d15Sespie elif test -n "$runpath_var"; then 3617*03a78d15Sespie case "$finalize_perm_rpath " in 3618*03a78d15Sespie *" $libdir "*) ;; 3619*03a78d15Sespie *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 3620*03a78d15Sespie esac 3621*03a78d15Sespie fi 3622*03a78d15Sespie done 3623*03a78d15Sespie # Substitute the hardcoded libdirs into the rpath. 3624*03a78d15Sespie if test -n "$hardcode_libdir_separator" && 3625*03a78d15Sespie test -n "$hardcode_libdirs"; then 3626*03a78d15Sespie libdir="$hardcode_libdirs" 3627*03a78d15Sespie eval rpath=\" $hardcode_libdir_flag_spec\" 3628*03a78d15Sespie fi 3629*03a78d15Sespie finalize_rpath="$rpath" 3630*03a78d15Sespie 3631*03a78d15Sespie dlsyms= 3632*03a78d15Sespie if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3633*03a78d15Sespie if test -n "$NM" && test -n "$global_symbol_pipe"; then 3634*03a78d15Sespie dlsyms="${outputname}S.c" 3635*03a78d15Sespie else 3636*03a78d15Sespie $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 3637*03a78d15Sespie fi 3638*03a78d15Sespie fi 3639*03a78d15Sespie 3640*03a78d15Sespie if test -n "$dlsyms"; then 3641*03a78d15Sespie case $dlsyms in 3642*03a78d15Sespie "") ;; 3643*03a78d15Sespie *.c) 3644*03a78d15Sespie # Discover the nlist of each of the dlfiles. 3645*03a78d15Sespie nlist="$output_objdir/${outputname}.nm" 3646*03a78d15Sespie 3647*03a78d15Sespie $show "$rm $nlist ${nlist}S ${nlist}T" 3648*03a78d15Sespie $run $rm "$nlist" "${nlist}S" "${nlist}T" 3649*03a78d15Sespie 3650*03a78d15Sespie # Parse the name list into a source file. 3651*03a78d15Sespie $show "creating $output_objdir/$dlsyms" 3652*03a78d15Sespie 3653*03a78d15Sespie test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 3654*03a78d15Sespie/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 3655*03a78d15Sespie/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 3656*03a78d15Sespie 3657*03a78d15Sespie#ifdef __cplusplus 3658*03a78d15Sespieextern \"C\" { 3659*03a78d15Sespie#endif 3660*03a78d15Sespie 3661*03a78d15Sespie/* Prevent the only kind of declaration conflicts we can make. */ 3662*03a78d15Sespie#define lt_preloaded_symbols some_other_symbol 3663*03a78d15Sespie 3664*03a78d15Sespie/* External symbol declarations for the compiler. */\ 3665*03a78d15Sespie" 3666*03a78d15Sespie 3667*03a78d15Sespie if test "$dlself" = yes; then 3668*03a78d15Sespie $show "generating symbol list for \`$output'" 3669*03a78d15Sespie 3670*03a78d15Sespie test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 3671*03a78d15Sespie 3672*03a78d15Sespie # Add our own program objects to the symbol list. 3673*03a78d15Sespie progfiles="$objs$old_deplibs" 3674*03a78d15Sespie for arg in $progfiles; do 3675*03a78d15Sespie $show "extracting global C symbols from \`$arg'" 3676*03a78d15Sespie $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 3677*03a78d15Sespie done 3678*03a78d15Sespie 3679*03a78d15Sespie if test -n "$exclude_expsyms"; then 3680*03a78d15Sespie $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3681*03a78d15Sespie $run eval '$mv "$nlist"T "$nlist"' 3682*03a78d15Sespie fi 3683*03a78d15Sespie 3684*03a78d15Sespie if test -n "$export_symbols_regex"; then 3685*03a78d15Sespie $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3686*03a78d15Sespie $run eval '$mv "$nlist"T "$nlist"' 3687*03a78d15Sespie fi 3688*03a78d15Sespie 3689*03a78d15Sespie # Prepare the list of exported symbols 3690*03a78d15Sespie if test -z "$export_symbols"; then 3691*03a78d15Sespie export_symbols="$output_objdir/$output.exp" 3692*03a78d15Sespie $run $rm $export_symbols 3693*03a78d15Sespie $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3694*03a78d15Sespie else 3695*03a78d15Sespie $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' 3696*03a78d15Sespie $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' 3697*03a78d15Sespie $run eval 'mv "$nlist"T "$nlist"' 3698*03a78d15Sespie fi 3699*03a78d15Sespie fi 3700*03a78d15Sespie 3701*03a78d15Sespie for arg in $dlprefiles; do 3702*03a78d15Sespie $show "extracting global C symbols from \`$arg'" 3703*03a78d15Sespie name=`echo "$arg" | sed -e 's%^.*/%%'` 3704*03a78d15Sespie $run eval 'echo ": $name " >> "$nlist"' 3705*03a78d15Sespie $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 3706*03a78d15Sespie done 3707*03a78d15Sespie 3708*03a78d15Sespie if test -z "$run"; then 3709*03a78d15Sespie # Make sure we have at least an empty file. 3710*03a78d15Sespie test -f "$nlist" || : > "$nlist" 3711*03a78d15Sespie 3712*03a78d15Sespie if test -n "$exclude_expsyms"; then 3713*03a78d15Sespie egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3714*03a78d15Sespie $mv "$nlist"T "$nlist" 3715*03a78d15Sespie fi 3716*03a78d15Sespie 3717*03a78d15Sespie # Try sorting and uniquifying the output. 3718*03a78d15Sespie if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then 3719*03a78d15Sespie : 3720*03a78d15Sespie else 3721*03a78d15Sespie grep -v "^: " < "$nlist" > "$nlist"S 3722*03a78d15Sespie fi 3723*03a78d15Sespie 3724*03a78d15Sespie if test -f "$nlist"S; then 3725*03a78d15Sespie eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 3726*03a78d15Sespie else 3727*03a78d15Sespie echo '/* NONE */' >> "$output_objdir/$dlsyms" 3728*03a78d15Sespie fi 3729*03a78d15Sespie 3730*03a78d15Sespie $echo >> "$output_objdir/$dlsyms" "\ 3731*03a78d15Sespie 3732*03a78d15Sespie#undef lt_preloaded_symbols 3733*03a78d15Sespie 3734*03a78d15Sespie#if defined (__STDC__) && __STDC__ 3735*03a78d15Sespie# define lt_ptr_t void * 3736*03a78d15Sespie#else 3737*03a78d15Sespie# define lt_ptr_t char * 3738*03a78d15Sespie# define const 3739*03a78d15Sespie#endif 3740*03a78d15Sespie 3741*03a78d15Sespie/* The mapping between symbol names and symbols. */ 3742*03a78d15Sespieconst struct { 3743*03a78d15Sespie const char *name; 3744*03a78d15Sespie lt_ptr_t address; 3745*03a78d15Sespie} 3746*03a78d15Sespielt_preloaded_symbols[] = 3747*03a78d15Sespie{\ 3748*03a78d15Sespie" 3749*03a78d15Sespie 3750*03a78d15Sespie sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ 3751*03a78d15Sespie -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ 3752*03a78d15Sespie < "$nlist" >> "$output_objdir/$dlsyms" 3753*03a78d15Sespie 3754*03a78d15Sespie $echo >> "$output_objdir/$dlsyms" "\ 3755*03a78d15Sespie {0, (lt_ptr_t) 0} 3756*03a78d15Sespie}; 3757*03a78d15Sespie 3758*03a78d15Sespie/* This works around a problem in FreeBSD linker */ 3759*03a78d15Sespie#ifdef FREEBSD_WORKAROUND 3760*03a78d15Sespiestatic const void *lt_preloaded_setup() { 3761*03a78d15Sespie return lt_preloaded_symbols; 3762*03a78d15Sespie} 3763*03a78d15Sespie#endif 3764*03a78d15Sespie 3765*03a78d15Sespie#ifdef __cplusplus 3766*03a78d15Sespie} 3767*03a78d15Sespie#endif\ 3768*03a78d15Sespie" 3769*03a78d15Sespie fi 3770*03a78d15Sespie 3771*03a78d15Sespie pic_flag_for_symtable= 3772*03a78d15Sespie case $host in 3773*03a78d15Sespie # compiling the symbol table file with pic_flag works around 3774*03a78d15Sespie # a FreeBSD bug that causes programs to crash when -lm is 3775*03a78d15Sespie # linked before any other PIC object. But we must not use 3776*03a78d15Sespie # pic_flag when linking with -static. The problem exists in 3777*03a78d15Sespie # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3778*03a78d15Sespie *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3779*03a78d15Sespie case "$compile_command " in 3780*03a78d15Sespie *" -static "*) ;; 3781*03a78d15Sespie *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 3782*03a78d15Sespie esac;; 3783*03a78d15Sespie *-*-hpux*) 3784*03a78d15Sespie case "$compile_command " in 3785*03a78d15Sespie *" -static "*) ;; 3786*03a78d15Sespie *) pic_flag_for_symtable=" $pic_flag";; 3787*03a78d15Sespie esac 3788*03a78d15Sespie esac 3789*03a78d15Sespie 3790*03a78d15Sespie # Now compile the dynamic symbol file. 3791*03a78d15Sespie $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 3792*03a78d15Sespie $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 3793*03a78d15Sespie 3794*03a78d15Sespie # Clean up the generated files. 3795*03a78d15Sespie $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 3796*03a78d15Sespie $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 3797*03a78d15Sespie 3798*03a78d15Sespie # Transform the symbol file into the correct name. 3799*03a78d15Sespie compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 3800*03a78d15Sespie finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 3801*03a78d15Sespie ;; 3802*03a78d15Sespie *) 3803*03a78d15Sespie $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 3804*03a78d15Sespie exit 1 3805*03a78d15Sespie ;; 3806*03a78d15Sespie esac 3807*03a78d15Sespie else 3808*03a78d15Sespie # We keep going just in case the user didn't refer to 3809*03a78d15Sespie # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3810*03a78d15Sespie # really was required. 3811*03a78d15Sespie 3812*03a78d15Sespie # Nullify the symbol file. 3813*03a78d15Sespie compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 3814*03a78d15Sespie finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 3815*03a78d15Sespie fi 3816*03a78d15Sespie 3817*03a78d15Sespie if test $need_relink = no || test "$build_libtool_libs" != yes; then 3818*03a78d15Sespie # Replace the output file specification. 3819*03a78d15Sespie compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 3820*03a78d15Sespie link_command="$compile_command$compile_rpath" 3821*03a78d15Sespie 3822*03a78d15Sespie # We have no uninstalled library dependencies, so finalize right now. 3823*03a78d15Sespie $show "$link_command" 3824*03a78d15Sespie $run eval "$link_command" 3825*03a78d15Sespie status=$? 3826*03a78d15Sespie 3827*03a78d15Sespie # Delete the generated files. 3828*03a78d15Sespie if test -n "$dlsyms"; then 3829*03a78d15Sespie $show "$rm $output_objdir/${outputname}S.${objext}" 3830*03a78d15Sespie $run $rm "$output_objdir/${outputname}S.${objext}" 3831*03a78d15Sespie fi 3832*03a78d15Sespie 3833*03a78d15Sespie exit $status 3834*03a78d15Sespie fi 3835*03a78d15Sespie 3836*03a78d15Sespie if test -n "$shlibpath_var"; then 3837*03a78d15Sespie # We should set the shlibpath_var 3838*03a78d15Sespie rpath= 3839*03a78d15Sespie for dir in $temp_rpath; do 3840*03a78d15Sespie case $dir in 3841*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) 3842*03a78d15Sespie # Absolute path. 3843*03a78d15Sespie rpath="$rpath$dir:" 3844*03a78d15Sespie ;; 3845*03a78d15Sespie *) 3846*03a78d15Sespie # Relative path: add a thisdir entry. 3847*03a78d15Sespie rpath="$rpath\$thisdir/$dir:" 3848*03a78d15Sespie ;; 3849*03a78d15Sespie esac 3850*03a78d15Sespie done 3851*03a78d15Sespie temp_rpath="$rpath" 3852*03a78d15Sespie fi 3853*03a78d15Sespie 3854*03a78d15Sespie if test -n "$compile_shlibpath$finalize_shlibpath"; then 3855*03a78d15Sespie compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 3856*03a78d15Sespie fi 3857*03a78d15Sespie if test -n "$finalize_shlibpath"; then 3858*03a78d15Sespie finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 3859*03a78d15Sespie fi 3860*03a78d15Sespie 3861*03a78d15Sespie compile_var= 3862*03a78d15Sespie finalize_var= 3863*03a78d15Sespie if test -n "$runpath_var"; then 3864*03a78d15Sespie if test -n "$perm_rpath"; then 3865*03a78d15Sespie # We should set the runpath_var. 3866*03a78d15Sespie rpath= 3867*03a78d15Sespie for dir in $perm_rpath; do 3868*03a78d15Sespie rpath="$rpath$dir:" 3869*03a78d15Sespie done 3870*03a78d15Sespie compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 3871*03a78d15Sespie fi 3872*03a78d15Sespie if test -n "$finalize_perm_rpath"; then 3873*03a78d15Sespie # We should set the runpath_var. 3874*03a78d15Sespie rpath= 3875*03a78d15Sespie for dir in $finalize_perm_rpath; do 3876*03a78d15Sespie rpath="$rpath$dir:" 3877*03a78d15Sespie done 3878*03a78d15Sespie finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 3879*03a78d15Sespie fi 3880*03a78d15Sespie fi 3881*03a78d15Sespie 3882*03a78d15Sespie if test "$no_install" = yes; then 3883*03a78d15Sespie # We don't need to create a wrapper script. 3884*03a78d15Sespie link_command="$compile_var$compile_command$compile_rpath" 3885*03a78d15Sespie # Replace the output file specification. 3886*03a78d15Sespie link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 3887*03a78d15Sespie # Delete the old output file. 3888*03a78d15Sespie $run $rm $output 3889*03a78d15Sespie # Link the executable and exit 3890*03a78d15Sespie $show "$link_command" 3891*03a78d15Sespie $run eval "$link_command" || exit $? 3892*03a78d15Sespie exit 0 3893*03a78d15Sespie fi 3894*03a78d15Sespie 3895*03a78d15Sespie if test "$hardcode_action" = relink; then 3896*03a78d15Sespie # Fast installation is not supported 3897*03a78d15Sespie link_command="$compile_var$compile_command$compile_rpath" 3898*03a78d15Sespie relink_command="$finalize_var$finalize_command$finalize_rpath" 3899*03a78d15Sespie 3900*03a78d15Sespie $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 3901*03a78d15Sespie $echo "$modename: \`$output' will be relinked during installation" 1>&2 3902*03a78d15Sespie else 3903*03a78d15Sespie if test "$fast_install" != no; then 3904*03a78d15Sespie link_command="$finalize_var$compile_command$finalize_rpath" 3905*03a78d15Sespie if test "$fast_install" = yes; then 3906*03a78d15Sespie relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 3907*03a78d15Sespie else 3908*03a78d15Sespie # fast_install is set to needless 3909*03a78d15Sespie relink_command= 3910*03a78d15Sespie fi 3911*03a78d15Sespie else 3912*03a78d15Sespie link_command="$compile_var$compile_command$compile_rpath" 3913*03a78d15Sespie relink_command="$finalize_var$finalize_command$finalize_rpath" 3914*03a78d15Sespie fi 3915*03a78d15Sespie fi 3916*03a78d15Sespie 3917*03a78d15Sespie # Replace the output file specification. 3918*03a78d15Sespie link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 3919*03a78d15Sespie 3920*03a78d15Sespie # Delete the old output files. 3921*03a78d15Sespie $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 3922*03a78d15Sespie 3923*03a78d15Sespie $show "$link_command" 3924*03a78d15Sespie $run eval "$link_command" || exit $? 3925*03a78d15Sespie 3926*03a78d15Sespie # Now create the wrapper script. 3927*03a78d15Sespie $show "creating $output" 3928*03a78d15Sespie 3929*03a78d15Sespie # Quote the relink command for shipping. 3930*03a78d15Sespie if test -n "$relink_command"; then 3931*03a78d15Sespie # Preserve any variables that may affect compiler behavior 3932*03a78d15Sespie for var in $variables_saved_for_relink; do 3933*03a78d15Sespie if eval test -z \"\${$var+set}\"; then 3934*03a78d15Sespie relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 3935*03a78d15Sespie elif eval var_value=\$$var; test -z "$var_value"; then 3936*03a78d15Sespie relink_command="$var=; export $var; $relink_command" 3937*03a78d15Sespie else 3938*03a78d15Sespie var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 3939*03a78d15Sespie relink_command="$var=\"$var_value\"; export $var; $relink_command" 3940*03a78d15Sespie fi 3941*03a78d15Sespie done 3942*03a78d15Sespie relink_command="cd `pwd`; $relink_command" 3943*03a78d15Sespie relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 3944*03a78d15Sespie fi 3945*03a78d15Sespie 3946*03a78d15Sespie # Quote $echo for shipping. 3947*03a78d15Sespie if test "X$echo" = "X$SHELL $0 --fallback-echo"; then 3948*03a78d15Sespie case $0 in 3949*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; 3950*03a78d15Sespie *) qecho="$SHELL `pwd`/$0 --fallback-echo";; 3951*03a78d15Sespie esac 3952*03a78d15Sespie qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 3953*03a78d15Sespie else 3954*03a78d15Sespie qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 3955*03a78d15Sespie fi 3956*03a78d15Sespie 3957*03a78d15Sespie # Only actually do things if our run command is non-null. 3958*03a78d15Sespie if test -z "$run"; then 3959*03a78d15Sespie # win32 will think the script is a binary if it has 3960*03a78d15Sespie # a .exe suffix, so we strip it off here. 3961*03a78d15Sespie case $output in 3962*03a78d15Sespie *.exe) output=`echo $output|sed 's,.exe$,,'` ;; 3963*03a78d15Sespie esac 3964*03a78d15Sespie # test for cygwin because mv fails w/o .exe extensions 3965*03a78d15Sespie case $host in 3966*03a78d15Sespie *cygwin*) exeext=.exe ;; 3967*03a78d15Sespie *) exeext= ;; 3968*03a78d15Sespie esac 3969*03a78d15Sespie $rm $output 3970*03a78d15Sespie trap "$rm $output; exit 1" 1 2 15 3971*03a78d15Sespie 3972*03a78d15Sespie $echo > $output "\ 3973*03a78d15Sespie#! $SHELL 3974*03a78d15Sespie 3975*03a78d15Sespie# $output - temporary wrapper script for $objdir/$outputname 3976*03a78d15Sespie# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 3977*03a78d15Sespie# 3978*03a78d15Sespie# The $output program cannot be directly executed until all the libtool 3979*03a78d15Sespie# libraries that it depends on are installed. 3980*03a78d15Sespie# 3981*03a78d15Sespie# This wrapper script should never be moved out of the build directory. 3982*03a78d15Sespie# If it is, it will not operate correctly. 3983*03a78d15Sespie 3984*03a78d15Sespie# Sed substitution that helps us do robust quoting. It backslashifies 3985*03a78d15Sespie# metacharacters that are still active within double-quoted strings. 3986*03a78d15SespieXsed='sed -e 1s/^X//' 3987*03a78d15Sespiesed_quote_subst='$sed_quote_subst' 3988*03a78d15Sespie 3989*03a78d15Sespie# The HP-UX ksh and POSIX shell print the target directory to stdout 3990*03a78d15Sespie# if CDPATH is set. 3991*03a78d15Sespieif test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi 3992*03a78d15Sespie 3993*03a78d15Sespierelink_command=\"$relink_command\" 3994*03a78d15Sespie 3995*03a78d15Sespie# This environment variable determines our operation mode. 3996*03a78d15Sespieif test \"\$libtool_install_magic\" = \"$magic\"; then 3997*03a78d15Sespie # install mode needs the following variable: 3998*03a78d15Sespie notinst_deplibs='$notinst_deplibs' 3999*03a78d15Sespieelse 4000*03a78d15Sespie # When we are sourced in execute mode, \$file and \$echo are already set. 4001*03a78d15Sespie if test \"\$libtool_execute_magic\" != \"$magic\"; then 4002*03a78d15Sespie echo=\"$qecho\" 4003*03a78d15Sespie file=\"\$0\" 4004*03a78d15Sespie # Make sure echo works. 4005*03a78d15Sespie if test \"X\$1\" = X--no-reexec; then 4006*03a78d15Sespie # Discard the --no-reexec flag, and continue. 4007*03a78d15Sespie shift 4008*03a78d15Sespie elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 4009*03a78d15Sespie # Yippee, \$echo works! 4010*03a78d15Sespie : 4011*03a78d15Sespie else 4012*03a78d15Sespie # Restart under the correct shell, and then maybe \$echo will work. 4013*03a78d15Sespie exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 4014*03a78d15Sespie fi 4015*03a78d15Sespie fi\ 4016*03a78d15Sespie" 4017*03a78d15Sespie $echo >> $output "\ 4018*03a78d15Sespie 4019*03a78d15Sespie # Find the directory that this script lives in. 4020*03a78d15Sespie thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 4021*03a78d15Sespie test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4022*03a78d15Sespie 4023*03a78d15Sespie # Follow symbolic links until we get to the real thisdir. 4024*03a78d15Sespie file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` 4025*03a78d15Sespie while test -n \"\$file\"; do 4026*03a78d15Sespie destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 4027*03a78d15Sespie 4028*03a78d15Sespie # If there was a directory component, then change thisdir. 4029*03a78d15Sespie if test \"x\$destdir\" != \"x\$file\"; then 4030*03a78d15Sespie case \"\$destdir\" in 4031*03a78d15Sespie [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4032*03a78d15Sespie *) thisdir=\"\$thisdir/\$destdir\" ;; 4033*03a78d15Sespie esac 4034*03a78d15Sespie fi 4035*03a78d15Sespie 4036*03a78d15Sespie file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 4037*03a78d15Sespie file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` 4038*03a78d15Sespie done 4039*03a78d15Sespie 4040*03a78d15Sespie # Try to get the absolute directory name. 4041*03a78d15Sespie absdir=\`cd \"\$thisdir\" && pwd\` 4042*03a78d15Sespie test -n \"\$absdir\" && thisdir=\"\$absdir\" 4043*03a78d15Sespie" 4044*03a78d15Sespie 4045*03a78d15Sespie if test "$fast_install" = yes; then 4046*03a78d15Sespie echo >> $output "\ 4047*03a78d15Sespie program=lt-'$outputname'$exeext 4048*03a78d15Sespie progdir=\"\$thisdir/$objdir\" 4049*03a78d15Sespie 4050*03a78d15Sespie if test ! -f \"\$progdir/\$program\" || \\ 4051*03a78d15Sespie { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ 4052*03a78d15Sespie test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4053*03a78d15Sespie 4054*03a78d15Sespie file=\"\$\$-\$program\" 4055*03a78d15Sespie 4056*03a78d15Sespie if test ! -d \"\$progdir\"; then 4057*03a78d15Sespie $mkdir \"\$progdir\" 4058*03a78d15Sespie else 4059*03a78d15Sespie $rm \"\$progdir/\$file\" 4060*03a78d15Sespie fi" 4061*03a78d15Sespie 4062*03a78d15Sespie echo >> $output "\ 4063*03a78d15Sespie 4064*03a78d15Sespie # relink executable if necessary 4065*03a78d15Sespie if test -n \"\$relink_command\"; then 4066*03a78d15Sespie if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4067*03a78d15Sespie else 4068*03a78d15Sespie $echo \"\$relink_command_output\" >&2 4069*03a78d15Sespie $rm \"\$progdir/\$file\" 4070*03a78d15Sespie exit 1 4071*03a78d15Sespie fi 4072*03a78d15Sespie fi 4073*03a78d15Sespie 4074*03a78d15Sespie $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4075*03a78d15Sespie { $rm \"\$progdir/\$program\"; 4076*03a78d15Sespie $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4077*03a78d15Sespie $rm \"\$progdir/\$file\" 4078*03a78d15Sespie fi" 4079*03a78d15Sespie else 4080*03a78d15Sespie echo >> $output "\ 4081*03a78d15Sespie program='$outputname' 4082*03a78d15Sespie progdir=\"\$thisdir/$objdir\" 4083*03a78d15Sespie" 4084*03a78d15Sespie fi 4085*03a78d15Sespie 4086*03a78d15Sespie echo >> $output "\ 4087*03a78d15Sespie 4088*03a78d15Sespie if test -f \"\$progdir/\$program\"; then" 4089*03a78d15Sespie 4090*03a78d15Sespie # Export our shlibpath_var if we have one. 4091*03a78d15Sespie if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4092*03a78d15Sespie $echo >> $output "\ 4093*03a78d15Sespie # Add our own library path to $shlibpath_var 4094*03a78d15Sespie $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4095*03a78d15Sespie 4096*03a78d15Sespie # Some systems cannot cope with colon-terminated $shlibpath_var 4097*03a78d15Sespie # The second colon is a workaround for a bug in BeOS R4 sed 4098*03a78d15Sespie $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 4099*03a78d15Sespie 4100*03a78d15Sespie export $shlibpath_var 4101*03a78d15Sespie" 4102*03a78d15Sespie fi 4103*03a78d15Sespie 4104*03a78d15Sespie # fixup the dll searchpath if we need to. 4105*03a78d15Sespie if test -n "$dllsearchpath"; then 4106*03a78d15Sespie $echo >> $output "\ 4107*03a78d15Sespie # Add the dll search path components to the executable PATH 4108*03a78d15Sespie PATH=$dllsearchpath:\$PATH 4109*03a78d15Sespie" 4110*03a78d15Sespie fi 4111*03a78d15Sespie 4112*03a78d15Sespie $echo >> $output "\ 4113*03a78d15Sespie if test \"\$libtool_execute_magic\" != \"$magic\"; then 4114*03a78d15Sespie # Run the actual program with our arguments. 4115*03a78d15Sespie" 4116*03a78d15Sespie case $host in 4117*03a78d15Sespie # win32 systems need to use the prog path for dll 4118*03a78d15Sespie # lookup to work 4119*03a78d15Sespie *-*-cygwin* | *-*-pw32*) 4120*03a78d15Sespie $echo >> $output "\ 4121*03a78d15Sespie exec \$progdir/\$program \${1+\"\$@\"} 4122*03a78d15Sespie" 4123*03a78d15Sespie ;; 4124*03a78d15Sespie 4125*03a78d15Sespie # Backslashes separate directories on plain windows 4126*03a78d15Sespie *-*-mingw | *-*-os2*) 4127*03a78d15Sespie $echo >> $output "\ 4128*03a78d15Sespie exec \$progdir\\\\\$program \${1+\"\$@\"} 4129*03a78d15Sespie" 4130*03a78d15Sespie ;; 4131*03a78d15Sespie 4132*03a78d15Sespie *) 4133*03a78d15Sespie $echo >> $output "\ 4134*03a78d15Sespie # Export the path to the program. 4135*03a78d15Sespie PATH=\"\$progdir:\$PATH\" 4136*03a78d15Sespie export PATH 4137*03a78d15Sespie 4138*03a78d15Sespie exec \$program \${1+\"\$@\"} 4139*03a78d15Sespie" 4140*03a78d15Sespie ;; 4141*03a78d15Sespie esac 4142*03a78d15Sespie $echo >> $output "\ 4143*03a78d15Sespie \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 4144*03a78d15Sespie exit 1 4145*03a78d15Sespie fi 4146*03a78d15Sespie else 4147*03a78d15Sespie # The program doesn't exist. 4148*03a78d15Sespie \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 4149*03a78d15Sespie \$echo \"This script is just a wrapper for \$program.\" 1>&2 4150*03a78d15Sespie echo \"See the $PACKAGE documentation for more information.\" 1>&2 4151*03a78d15Sespie exit 1 4152*03a78d15Sespie fi 4153*03a78d15Sespiefi\ 4154*03a78d15Sespie" 4155*03a78d15Sespie chmod +x $output 4156*03a78d15Sespie fi 4157*03a78d15Sespie exit 0 4158*03a78d15Sespie ;; 4159*03a78d15Sespie esac 4160*03a78d15Sespie 4161*03a78d15Sespie # See if we need to build an old-fashioned archive. 4162*03a78d15Sespie for oldlib in $oldlibs; do 4163*03a78d15Sespie 4164*03a78d15Sespie if test "$build_libtool_libs" = convenience; then 4165*03a78d15Sespie oldobjs="$libobjs_save" 4166*03a78d15Sespie addlibs="$convenience" 4167*03a78d15Sespie build_libtool_libs=no 4168*03a78d15Sespie else 4169*03a78d15Sespie if test "$build_libtool_libs" = module; then 4170*03a78d15Sespie oldobjs="$libobjs_save" 4171*03a78d15Sespie build_libtool_libs=no 4172*03a78d15Sespie else 4173*03a78d15Sespie oldobjs="$objs$old_deplibs $non_pic_objects" 4174*03a78d15Sespie fi 4175*03a78d15Sespie addlibs="$old_convenience" 4176*03a78d15Sespie fi 4177*03a78d15Sespie 4178*03a78d15Sespie if test -n "$addlibs"; then 4179*03a78d15Sespie gentop="$output_objdir/${outputname}x" 4180*03a78d15Sespie $show "${rm}r $gentop" 4181*03a78d15Sespie $run ${rm}r "$gentop" 4182*03a78d15Sespie $show "$mkdir $gentop" 4183*03a78d15Sespie $run $mkdir "$gentop" 4184*03a78d15Sespie status=$? 4185*03a78d15Sespie if test $status -ne 0 && test ! -d "$gentop"; then 4186*03a78d15Sespie exit $status 4187*03a78d15Sespie fi 4188*03a78d15Sespie generated="$generated $gentop" 4189*03a78d15Sespie 4190*03a78d15Sespie # Add in members from convenience archives. 4191*03a78d15Sespie for xlib in $addlibs; do 4192*03a78d15Sespie # Extract the objects. 4193*03a78d15Sespie case $xlib in 4194*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 4195*03a78d15Sespie *) xabs=`pwd`"/$xlib" ;; 4196*03a78d15Sespie esac 4197*03a78d15Sespie xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 4198*03a78d15Sespie xdir="$gentop/$xlib" 4199*03a78d15Sespie 4200*03a78d15Sespie $show "${rm}r $xdir" 4201*03a78d15Sespie $run ${rm}r "$xdir" 4202*03a78d15Sespie $show "$mkdir $xdir" 4203*03a78d15Sespie $run $mkdir "$xdir" 4204*03a78d15Sespie status=$? 4205*03a78d15Sespie if test $status -ne 0 && test ! -d "$xdir"; then 4206*03a78d15Sespie exit $status 4207*03a78d15Sespie fi 4208*03a78d15Sespie $show "(cd $xdir && $AR x $xabs)" 4209*03a78d15Sespie $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? 4210*03a78d15Sespie 4211*03a78d15Sespie oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP` 4212*03a78d15Sespie done 4213*03a78d15Sespie fi 4214*03a78d15Sespie 4215*03a78d15Sespie # Do each command in the archive commands. 4216*03a78d15Sespie if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 4217*03a78d15Sespie eval cmds=\"$old_archive_from_new_cmds\" 4218*03a78d15Sespie else 4219*03a78d15Sespie# # Ensure that we have .o objects in place in case we decided 4220*03a78d15Sespie# # not to build a shared library, and have fallen back to building 4221*03a78d15Sespie# # static libs even though --disable-static was passed! 4222*03a78d15Sespie# for oldobj in $oldobjs; do 4223*03a78d15Sespie# if test ! -f $oldobj; then 4224*03a78d15Sespie# xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` 4225*03a78d15Sespie# if test "X$xdir" = "X$oldobj"; then 4226*03a78d15Sespie# xdir="." 4227*03a78d15Sespie# else 4228*03a78d15Sespie# xdir="$xdir" 4229*03a78d15Sespie# fi 4230*03a78d15Sespie# baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` 4231*03a78d15Sespie# obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` 4232*03a78d15Sespie# $show "(cd $xdir && ${LN_S} $obj $baseobj)" 4233*03a78d15Sespie# $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? 4234*03a78d15Sespie# fi 4235*03a78d15Sespie# done 4236*03a78d15Sespie 4237*03a78d15Sespie eval cmds=\"$old_archive_cmds\" 4238*03a78d15Sespie 4239*03a78d15Sespie if len=`expr "X$cmds" : ".*"` && 4240*03a78d15Sespie test $len -le $max_cmd_len; then 4241*03a78d15Sespie : 4242*03a78d15Sespie else 4243*03a78d15Sespie # the command line is too long to link in one step, link in parts 4244*03a78d15Sespie $echo "using piecewise archive linking..." 4245*03a78d15Sespie save_RANLIB=$RANLIB 4246*03a78d15Sespie RANLIB=: 4247*03a78d15Sespie objlist= 4248*03a78d15Sespie concat_cmds= 4249*03a78d15Sespie save_oldobjs=$oldobjs 4250*03a78d15Sespie # GNU ar 2.10+ was changed to match POSIX; thus no paths are 4251*03a78d15Sespie # encoded into archives. This makes 'ar r' malfunction in 4252*03a78d15Sespie # this piecewise linking case whenever conflicting object 4253*03a78d15Sespie # names appear in distinct ar calls; check, warn and compensate. 4254*03a78d15Sespie if (for obj in $save_oldobjs 4255*03a78d15Sespie do 4256*03a78d15Sespie $echo "X$obj" | $Xsed -e 's%^.*/%%' 4257*03a78d15Sespie done | sort | sort -uc >/dev/null 2>&1); then 4258*03a78d15Sespie : 4259*03a78d15Sespie else 4260*03a78d15Sespie $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 4261*03a78d15Sespie $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 4262*03a78d15Sespie AR_FLAGS=cq 4263*03a78d15Sespie fi 4264*03a78d15Sespie for obj in $save_oldobjs 4265*03a78d15Sespie do 4266*03a78d15Sespie oldobjs="$objlist $obj" 4267*03a78d15Sespie objlist="$objlist $obj" 4268*03a78d15Sespie eval test_cmds=\"$old_archive_cmds\" 4269*03a78d15Sespie if len=`expr "X$test_cmds" : ".*"` && 4270*03a78d15Sespie test $len -le $max_cmd_len; then 4271*03a78d15Sespie : 4272*03a78d15Sespie else 4273*03a78d15Sespie # the above command should be used before it gets too long 4274*03a78d15Sespie oldobjs=$objlist 4275*03a78d15Sespie test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4276*03a78d15Sespie eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 4277*03a78d15Sespie objlist= 4278*03a78d15Sespie fi 4279*03a78d15Sespie done 4280*03a78d15Sespie RANLIB=$save_RANLIB 4281*03a78d15Sespie oldobjs=$objlist 4282*03a78d15Sespie eval cmds=\"\$concat_cmds~$old_archive_cmds\" 4283*03a78d15Sespie fi 4284*03a78d15Sespie fi 4285*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4286*03a78d15Sespie for cmd in $cmds; do 4287*03a78d15Sespie IFS="$save_ifs" 4288*03a78d15Sespie $show "$cmd" 4289*03a78d15Sespie $run eval "$cmd" || exit $? 4290*03a78d15Sespie done 4291*03a78d15Sespie IFS="$save_ifs" 4292*03a78d15Sespie done 4293*03a78d15Sespie 4294*03a78d15Sespie if test -n "$generated"; then 4295*03a78d15Sespie $show "${rm}r$generated" 4296*03a78d15Sespie $run ${rm}r$generated 4297*03a78d15Sespie fi 4298*03a78d15Sespie 4299*03a78d15Sespie # Now create the libtool archive. 4300*03a78d15Sespie case $output in 4301*03a78d15Sespie *.la) 4302*03a78d15Sespie old_library= 4303*03a78d15Sespie test "$build_old_libs" = yes && old_library="$libname.$libext" 4304*03a78d15Sespie $show "creating $output" 4305*03a78d15Sespie 4306*03a78d15Sespie # Preserve any variables that may affect compiler behavior 4307*03a78d15Sespie for var in $variables_saved_for_relink; do 4308*03a78d15Sespie if eval test -z \"\${$var+set}\"; then 4309*03a78d15Sespie relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4310*03a78d15Sespie elif eval var_value=\$$var; test -z "$var_value"; then 4311*03a78d15Sespie relink_command="$var=; export $var; $relink_command" 4312*03a78d15Sespie else 4313*03a78d15Sespie var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4314*03a78d15Sespie relink_command="$var=\"$var_value\"; export $var; $relink_command" 4315*03a78d15Sespie fi 4316*03a78d15Sespie done 4317*03a78d15Sespie # Quote the link command for shipping. 4318*03a78d15Sespie tagopts= 4319*03a78d15Sespie for tag in $taglist; do 4320*03a78d15Sespie tagopts="$tagopts --tag $tag" 4321*03a78d15Sespie done 4322*03a78d15Sespie relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" 4323*03a78d15Sespie relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 4324*03a78d15Sespie 4325*03a78d15Sespie # Only create the output if not a dry run. 4326*03a78d15Sespie if test -z "$run"; then 4327*03a78d15Sespie for installed in no yes; do 4328*03a78d15Sespie if test "$installed" = yes; then 4329*03a78d15Sespie if test -z "$install_libdir"; then 4330*03a78d15Sespie break 4331*03a78d15Sespie fi 4332*03a78d15Sespie output="$output_objdir/$outputname"i 4333*03a78d15Sespie # Replace all uninstalled libtool libraries with the installed ones 4334*03a78d15Sespie newdependency_libs= 4335*03a78d15Sespie for deplib in $dependency_libs; do 4336*03a78d15Sespie case $deplib in 4337*03a78d15Sespie *.la) 4338*03a78d15Sespie name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 4339*03a78d15Sespie eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 4340*03a78d15Sespie if test -z "$libdir"; then 4341*03a78d15Sespie $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 4342*03a78d15Sespie exit 1 4343*03a78d15Sespie fi 4344*03a78d15Sespie newdependency_libs="$newdependency_libs $libdir/$name" 4345*03a78d15Sespie ;; 4346*03a78d15Sespie *) newdependency_libs="$newdependency_libs $deplib" ;; 4347*03a78d15Sespie esac 4348*03a78d15Sespie done 4349*03a78d15Sespie dependency_libs="$newdependency_libs" 4350*03a78d15Sespie newdlfiles= 4351*03a78d15Sespie for lib in $dlfiles; do 4352*03a78d15Sespie name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 4353*03a78d15Sespie eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 4354*03a78d15Sespie if test -z "$libdir"; then 4355*03a78d15Sespie $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4356*03a78d15Sespie exit 1 4357*03a78d15Sespie fi 4358*03a78d15Sespie newdlfiles="$newdlfiles $libdir/$name" 4359*03a78d15Sespie done 4360*03a78d15Sespie dlfiles="$newdlfiles" 4361*03a78d15Sespie newdlprefiles= 4362*03a78d15Sespie for lib in $dlprefiles; do 4363*03a78d15Sespie name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 4364*03a78d15Sespie eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 4365*03a78d15Sespie if test -z "$libdir"; then 4366*03a78d15Sespie $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4367*03a78d15Sespie exit 1 4368*03a78d15Sespie fi 4369*03a78d15Sespie newdlprefiles="$newdlprefiles $libdir/$name" 4370*03a78d15Sespie done 4371*03a78d15Sespie dlprefiles="$newdlprefiles" 4372*03a78d15Sespie fi 4373*03a78d15Sespie $rm $output 4374*03a78d15Sespie # place dlname in correct position for cygwin 4375*03a78d15Sespie tdlname=$dlname 4376*03a78d15Sespie case $host,$output,$installed,$module,$dlname in 4377*03a78d15Sespie *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 4378*03a78d15Sespie esac 4379*03a78d15Sespie $echo > $output "\ 4380*03a78d15Sespie# $outputname - a libtool library file 4381*03a78d15Sespie# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4382*03a78d15Sespie# 4383*03a78d15Sespie# Please DO NOT delete this file! 4384*03a78d15Sespie# It is necessary for linking the library. 4385*03a78d15Sespie 4386*03a78d15Sespie# The name that we can dlopen(3). 4387*03a78d15Sespiedlname='$tdlname' 4388*03a78d15Sespie 4389*03a78d15Sespie# Names of this library. 4390*03a78d15Sespielibrary_names='$library_names' 4391*03a78d15Sespie 4392*03a78d15Sespie# The name of the static archive. 4393*03a78d15Sespieold_library='$old_library' 4394*03a78d15Sespie 4395*03a78d15Sespie# Libraries that this one depends upon. 4396*03a78d15Sespiedependency_libs='$dependency_libs' 4397*03a78d15Sespie 4398*03a78d15Sespie# Version information for $libname. 4399*03a78d15Sespiecurrent=$current 4400*03a78d15Sespieage=$age 4401*03a78d15Sespierevision=$revision 4402*03a78d15Sespie 4403*03a78d15Sespie# Is this an already installed library? 4404*03a78d15Sespieinstalled=$installed 4405*03a78d15Sespie 4406*03a78d15Sespie# Files to dlopen/dlpreopen 4407*03a78d15Sespiedlopen='$dlfiles' 4408*03a78d15Sespiedlpreopen='$dlprefiles' 4409*03a78d15Sespie 4410*03a78d15Sespie# Directory that this library needs to be installed in: 4411*03a78d15Sespielibdir='$install_libdir'" 4412*03a78d15Sespie if test "$installed" = no && test $need_relink = yes; then 4413*03a78d15Sespie $echo >> $output "\ 4414*03a78d15Sespierelink_command=\"$relink_command\"" 4415*03a78d15Sespie fi 4416*03a78d15Sespie done 4417*03a78d15Sespie fi 4418*03a78d15Sespie 4419*03a78d15Sespie # Do a symbolic link so that the libtool archive can be found in 4420*03a78d15Sespie # LD_LIBRARY_PATH before the program is installed. 4421*03a78d15Sespie $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 4422*03a78d15Sespie $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 4423*03a78d15Sespie ;; 4424*03a78d15Sespie esac 4425*03a78d15Sespie exit 0 4426*03a78d15Sespie ;; 4427*03a78d15Sespie 4428*03a78d15Sespie # libtool install mode 4429*03a78d15Sespie install) 4430*03a78d15Sespie modename="$modename: install" 4431*03a78d15Sespie 4432*03a78d15Sespie # There may be an optional sh(1) argument at the beginning of 4433*03a78d15Sespie # install_prog (especially on Windows NT). 4434*03a78d15Sespie if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 4435*03a78d15Sespie # Allow the use of GNU shtool's install command. 4436*03a78d15Sespie $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 4437*03a78d15Sespie # Aesthetically quote it. 4438*03a78d15Sespie arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 4439*03a78d15Sespie case $arg in 4440*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4441*03a78d15Sespie arg="\"$arg\"" 4442*03a78d15Sespie ;; 4443*03a78d15Sespie esac 4444*03a78d15Sespie install_prog="$arg " 4445*03a78d15Sespie arg="$1" 4446*03a78d15Sespie shift 4447*03a78d15Sespie else 4448*03a78d15Sespie install_prog= 4449*03a78d15Sespie arg="$nonopt" 4450*03a78d15Sespie fi 4451*03a78d15Sespie 4452*03a78d15Sespie # The real first argument should be the name of the installation program. 4453*03a78d15Sespie # Aesthetically quote it. 4454*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 4455*03a78d15Sespie case $arg in 4456*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4457*03a78d15Sespie arg="\"$arg\"" 4458*03a78d15Sespie ;; 4459*03a78d15Sespie esac 4460*03a78d15Sespie install_prog="$install_prog$arg" 4461*03a78d15Sespie 4462*03a78d15Sespie # We need to accept at least all the BSD install flags. 4463*03a78d15Sespie dest= 4464*03a78d15Sespie files= 4465*03a78d15Sespie opts= 4466*03a78d15Sespie prev= 4467*03a78d15Sespie install_type= 4468*03a78d15Sespie isdir=no 4469*03a78d15Sespie stripme= 4470*03a78d15Sespie for arg 4471*03a78d15Sespie do 4472*03a78d15Sespie if test -n "$dest"; then 4473*03a78d15Sespie files="$files $dest" 4474*03a78d15Sespie dest="$arg" 4475*03a78d15Sespie continue 4476*03a78d15Sespie fi 4477*03a78d15Sespie 4478*03a78d15Sespie case $arg in 4479*03a78d15Sespie -d) isdir=yes ;; 4480*03a78d15Sespie -f) prev="-f" ;; 4481*03a78d15Sespie -g) prev="-g" ;; 4482*03a78d15Sespie -m) prev="-m" ;; 4483*03a78d15Sespie -o) prev="-o" ;; 4484*03a78d15Sespie -s) 4485*03a78d15Sespie stripme=" -s" 4486*03a78d15Sespie continue 4487*03a78d15Sespie ;; 4488*03a78d15Sespie -*) ;; 4489*03a78d15Sespie 4490*03a78d15Sespie *) 4491*03a78d15Sespie # If the previous option needed an argument, then skip it. 4492*03a78d15Sespie if test -n "$prev"; then 4493*03a78d15Sespie prev= 4494*03a78d15Sespie else 4495*03a78d15Sespie dest="$arg" 4496*03a78d15Sespie continue 4497*03a78d15Sespie fi 4498*03a78d15Sespie ;; 4499*03a78d15Sespie esac 4500*03a78d15Sespie 4501*03a78d15Sespie # Aesthetically quote the argument. 4502*03a78d15Sespie arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 4503*03a78d15Sespie case $arg in 4504*03a78d15Sespie *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4505*03a78d15Sespie arg="\"$arg\"" 4506*03a78d15Sespie ;; 4507*03a78d15Sespie esac 4508*03a78d15Sespie install_prog="$install_prog $arg" 4509*03a78d15Sespie done 4510*03a78d15Sespie 4511*03a78d15Sespie if test -z "$install_prog"; then 4512*03a78d15Sespie $echo "$modename: you must specify an install program" 1>&2 4513*03a78d15Sespie $echo "$help" 1>&2 4514*03a78d15Sespie exit 1 4515*03a78d15Sespie fi 4516*03a78d15Sespie 4517*03a78d15Sespie if test -n "$prev"; then 4518*03a78d15Sespie $echo "$modename: the \`$prev' option requires an argument" 1>&2 4519*03a78d15Sespie $echo "$help" 1>&2 4520*03a78d15Sespie exit 1 4521*03a78d15Sespie fi 4522*03a78d15Sespie 4523*03a78d15Sespie if test -z "$files"; then 4524*03a78d15Sespie if test -z "$dest"; then 4525*03a78d15Sespie $echo "$modename: no file or destination specified" 1>&2 4526*03a78d15Sespie else 4527*03a78d15Sespie $echo "$modename: you must specify a destination" 1>&2 4528*03a78d15Sespie fi 4529*03a78d15Sespie $echo "$help" 1>&2 4530*03a78d15Sespie exit 1 4531*03a78d15Sespie fi 4532*03a78d15Sespie 4533*03a78d15Sespie # Strip any trailing slash from the destination. 4534*03a78d15Sespie dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 4535*03a78d15Sespie 4536*03a78d15Sespie # Check to see that the destination is a directory. 4537*03a78d15Sespie test -d "$dest" && isdir=yes 4538*03a78d15Sespie if test "$isdir" = yes; then 4539*03a78d15Sespie destdir="$dest" 4540*03a78d15Sespie destname= 4541*03a78d15Sespie else 4542*03a78d15Sespie destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 4543*03a78d15Sespie test "X$destdir" = "X$dest" && destdir=. 4544*03a78d15Sespie destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 4545*03a78d15Sespie 4546*03a78d15Sespie # Not a directory, so check to see that there is only one file specified. 4547*03a78d15Sespie set dummy $files 4548*03a78d15Sespie if test $# -gt 2; then 4549*03a78d15Sespie $echo "$modename: \`$dest' is not a directory" 1>&2 4550*03a78d15Sespie $echo "$help" 1>&2 4551*03a78d15Sespie exit 1 4552*03a78d15Sespie fi 4553*03a78d15Sespie fi 4554*03a78d15Sespie case $destdir in 4555*03a78d15Sespie [\\/]* | [A-Za-z]:[\\/]*) ;; 4556*03a78d15Sespie *) 4557*03a78d15Sespie for file in $files; do 4558*03a78d15Sespie case $file in 4559*03a78d15Sespie *.lo) ;; 4560*03a78d15Sespie *) 4561*03a78d15Sespie $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 4562*03a78d15Sespie $echo "$help" 1>&2 4563*03a78d15Sespie exit 1 4564*03a78d15Sespie ;; 4565*03a78d15Sespie esac 4566*03a78d15Sespie done 4567*03a78d15Sespie ;; 4568*03a78d15Sespie esac 4569*03a78d15Sespie 4570*03a78d15Sespie # This variable tells wrapper scripts just to set variables rather 4571*03a78d15Sespie # than running their programs. 4572*03a78d15Sespie libtool_install_magic="$magic" 4573*03a78d15Sespie 4574*03a78d15Sespie staticlibs= 4575*03a78d15Sespie future_libdirs= 4576*03a78d15Sespie current_libdirs= 4577*03a78d15Sespie for file in $files; do 4578*03a78d15Sespie 4579*03a78d15Sespie # Do each installation. 4580*03a78d15Sespie case $file in 4581*03a78d15Sespie *.$libext) 4582*03a78d15Sespie # Do the static libraries later. 4583*03a78d15Sespie staticlibs="$staticlibs $file" 4584*03a78d15Sespie ;; 4585*03a78d15Sespie 4586*03a78d15Sespie *.la) 4587*03a78d15Sespie # Check to see that this really is a libtool archive. 4588*03a78d15Sespie if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 4589*03a78d15Sespie else 4590*03a78d15Sespie $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 4591*03a78d15Sespie $echo "$help" 1>&2 4592*03a78d15Sespie exit 1 4593*03a78d15Sespie fi 4594*03a78d15Sespie 4595*03a78d15Sespie library_names= 4596*03a78d15Sespie old_library= 4597*03a78d15Sespie relink_command= 4598*03a78d15Sespie # If there is no directory component, then add one. 4599*03a78d15Sespie case $file in 4600*03a78d15Sespie */* | *\\*) . $file ;; 4601*03a78d15Sespie *) . ./$file ;; 4602*03a78d15Sespie esac 4603*03a78d15Sespie 4604*03a78d15Sespie # Add the libdir to current_libdirs if it is the destination. 4605*03a78d15Sespie if test "X$destdir" = "X$libdir"; then 4606*03a78d15Sespie case "$current_libdirs " in 4607*03a78d15Sespie *" $libdir "*) ;; 4608*03a78d15Sespie *) current_libdirs="$current_libdirs $libdir" ;; 4609*03a78d15Sespie esac 4610*03a78d15Sespie else 4611*03a78d15Sespie # Note the libdir as a future libdir. 4612*03a78d15Sespie case "$future_libdirs " in 4613*03a78d15Sespie *" $libdir "*) ;; 4614*03a78d15Sespie *) future_libdirs="$future_libdirs $libdir" ;; 4615*03a78d15Sespie esac 4616*03a78d15Sespie fi 4617*03a78d15Sespie 4618*03a78d15Sespie dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 4619*03a78d15Sespie test "X$dir" = "X$file/" && dir= 4620*03a78d15Sespie dir="$dir$objdir" 4621*03a78d15Sespie 4622*03a78d15Sespie if test -n "$relink_command"; then 4623*03a78d15Sespie $echo "$modename: warning: relinking \`$file'" 1>&2 4624*03a78d15Sespie $show "$relink_command" 4625*03a78d15Sespie if $run eval "$relink_command"; then : 4626*03a78d15Sespie else 4627*03a78d15Sespie $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 4628*03a78d15Sespie exit 1 4629*03a78d15Sespie fi 4630*03a78d15Sespie fi 4631*03a78d15Sespie 4632*03a78d15Sespie # See the names of the shared library. 4633*03a78d15Sespie set dummy $library_names 4634*03a78d15Sespie if test -n "$2"; then 4635*03a78d15Sespie realname="$2" 4636*03a78d15Sespie shift 4637*03a78d15Sespie shift 4638*03a78d15Sespie 4639*03a78d15Sespie srcname="$realname" 4640*03a78d15Sespie test -n "$relink_command" && srcname="$realname"T 4641*03a78d15Sespie 4642*03a78d15Sespie # Install the shared library and build the symlinks. 4643*03a78d15Sespie $show "$install_prog $dir/$srcname $destdir/$realname" 4644*03a78d15Sespie $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 4645*03a78d15Sespie if test -n "$stripme" && test -n "$striplib"; then 4646*03a78d15Sespie $show "$striplib $destdir/$realname" 4647*03a78d15Sespie $run eval "$striplib $destdir/$realname" || exit $? 4648*03a78d15Sespie fi 4649*03a78d15Sespie 4650*03a78d15Sespie if test $# -gt 0; then 4651*03a78d15Sespie # Delete the old symlinks, and create new ones. 4652*03a78d15Sespie for linkname 4653*03a78d15Sespie do 4654*03a78d15Sespie if test "$linkname" != "$realname"; then 4655*03a78d15Sespie $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 4656*03a78d15Sespie $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 4657*03a78d15Sespie fi 4658*03a78d15Sespie done 4659*03a78d15Sespie fi 4660*03a78d15Sespie 4661*03a78d15Sespie # Do each command in the postinstall commands. 4662*03a78d15Sespie lib="$destdir/$realname" 4663*03a78d15Sespie eval cmds=\"$postinstall_cmds\" 4664*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4665*03a78d15Sespie for cmd in $cmds; do 4666*03a78d15Sespie IFS="$save_ifs" 4667*03a78d15Sespie $show "$cmd" 4668*03a78d15Sespie $run eval "$cmd" || exit $? 4669*03a78d15Sespie done 4670*03a78d15Sespie IFS="$save_ifs" 4671*03a78d15Sespie fi 4672*03a78d15Sespie 4673*03a78d15Sespie # Install the pseudo-library for information purposes. 4674*03a78d15Sespie name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4675*03a78d15Sespie instname="$dir/$name"i 4676*03a78d15Sespie $show "$install_prog $instname $destdir/$name" 4677*03a78d15Sespie $run eval "$install_prog $instname $destdir/$name" || exit $? 4678*03a78d15Sespie 4679*03a78d15Sespie # Maybe install the static library, too. 4680*03a78d15Sespie test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 4681*03a78d15Sespie ;; 4682*03a78d15Sespie 4683*03a78d15Sespie *.lo) 4684*03a78d15Sespie # Install (i.e. copy) a libtool object. 4685*03a78d15Sespie 4686*03a78d15Sespie # Figure out destination file name, if it wasn't already specified. 4687*03a78d15Sespie if test -n "$destname"; then 4688*03a78d15Sespie destfile="$destdir/$destname" 4689*03a78d15Sespie else 4690*03a78d15Sespie destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4691*03a78d15Sespie destfile="$destdir/$destfile" 4692*03a78d15Sespie fi 4693*03a78d15Sespie 4694*03a78d15Sespie # Deduce the name of the destination old-style object file. 4695*03a78d15Sespie case $destfile in 4696*03a78d15Sespie *.lo) 4697*03a78d15Sespie staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 4698*03a78d15Sespie ;; 4699*03a78d15Sespie *.$objext) 4700*03a78d15Sespie staticdest="$destfile" 4701*03a78d15Sespie destfile= 4702*03a78d15Sespie ;; 4703*03a78d15Sespie *) 4704*03a78d15Sespie $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 4705*03a78d15Sespie $echo "$help" 1>&2 4706*03a78d15Sespie exit 1 4707*03a78d15Sespie ;; 4708*03a78d15Sespie esac 4709*03a78d15Sespie 4710*03a78d15Sespie # Install the libtool object if requested. 4711*03a78d15Sespie if test -n "$destfile"; then 4712*03a78d15Sespie $show "$install_prog $file $destfile" 4713*03a78d15Sespie $run eval "$install_prog $file $destfile" || exit $? 4714*03a78d15Sespie fi 4715*03a78d15Sespie 4716*03a78d15Sespie # Install the old object if enabled. 4717*03a78d15Sespie if test "$build_old_libs" = yes; then 4718*03a78d15Sespie # Deduce the name of the old-style object file. 4719*03a78d15Sespie staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 4720*03a78d15Sespie 4721*03a78d15Sespie $show "$install_prog $staticobj $staticdest" 4722*03a78d15Sespie $run eval "$install_prog \$staticobj \$staticdest" || exit $? 4723*03a78d15Sespie fi 4724*03a78d15Sespie exit 0 4725*03a78d15Sespie ;; 4726*03a78d15Sespie 4727*03a78d15Sespie *) 4728*03a78d15Sespie # Figure out destination file name, if it wasn't already specified. 4729*03a78d15Sespie if test -n "$destname"; then 4730*03a78d15Sespie destfile="$destdir/$destname" 4731*03a78d15Sespie else 4732*03a78d15Sespie destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4733*03a78d15Sespie destfile="$destdir/$destfile" 4734*03a78d15Sespie fi 4735*03a78d15Sespie 4736*03a78d15Sespie # Do a test to see if this is really a libtool program. 4737*03a78d15Sespie if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 4738*03a78d15Sespie notinst_deplibs= 4739*03a78d15Sespie relink_command= 4740*03a78d15Sespie 4741*03a78d15Sespie # If there is no directory component, then add one. 4742*03a78d15Sespie case $file in 4743*03a78d15Sespie */* | *\\*) . $file ;; 4744*03a78d15Sespie *) . ./$file ;; 4745*03a78d15Sespie esac 4746*03a78d15Sespie 4747*03a78d15Sespie # Check the variables that should have been set. 4748*03a78d15Sespie if test -z "$notinst_deplibs"; then 4749*03a78d15Sespie $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 4750*03a78d15Sespie exit 1 4751*03a78d15Sespie fi 4752*03a78d15Sespie 4753*03a78d15Sespie finalize=yes 4754*03a78d15Sespie for lib in $notinst_deplibs; do 4755*03a78d15Sespie # Check to see that each library is installed. 4756*03a78d15Sespie libdir= 4757*03a78d15Sespie if test -f "$lib"; then 4758*03a78d15Sespie # If there is no directory component, then add one. 4759*03a78d15Sespie case $lib in 4760*03a78d15Sespie */* | *\\*) . $lib ;; 4761*03a78d15Sespie *) . ./$lib ;; 4762*03a78d15Sespie esac 4763*03a78d15Sespie fi 4764*03a78d15Sespie libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 4765*03a78d15Sespie if test -n "$libdir" && test ! -f "$libfile"; then 4766*03a78d15Sespie $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 4767*03a78d15Sespie finalize=no 4768*03a78d15Sespie fi 4769*03a78d15Sespie done 4770*03a78d15Sespie 4771*03a78d15Sespie relink_command= 4772*03a78d15Sespie # If there is no directory component, then add one. 4773*03a78d15Sespie case $file in 4774*03a78d15Sespie */* | *\\*) . $file ;; 4775*03a78d15Sespie *) . ./$file ;; 4776*03a78d15Sespie esac 4777*03a78d15Sespie 4778*03a78d15Sespie outputname= 4779*03a78d15Sespie if test "$fast_install" = no && test -n "$relink_command"; then 4780*03a78d15Sespie if test "$finalize" = yes && test -z "$run"; then 4781*03a78d15Sespie tmpdir="/tmp" 4782*03a78d15Sespie test -n "$TMPDIR" && tmpdir="$TMPDIR" 4783*03a78d15Sespie tmpdir="$tmpdir/libtool-$$" 4784*03a78d15Sespie if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 4785*03a78d15Sespie else 4786*03a78d15Sespie $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 4787*03a78d15Sespie continue 4788*03a78d15Sespie fi 4789*03a78d15Sespie file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4790*03a78d15Sespie outputname="$tmpdir/$file" 4791*03a78d15Sespie # Replace the output file specification. 4792*03a78d15Sespie relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 4793*03a78d15Sespie 4794*03a78d15Sespie $show "$relink_command" 4795*03a78d15Sespie if $run eval "$relink_command"; then : 4796*03a78d15Sespie else 4797*03a78d15Sespie $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 4798*03a78d15Sespie ${rm}r "$tmpdir" 4799*03a78d15Sespie continue 4800*03a78d15Sespie fi 4801*03a78d15Sespie file="$outputname" 4802*03a78d15Sespie else 4803*03a78d15Sespie $echo "$modename: warning: cannot relink \`$file'" 1>&2 4804*03a78d15Sespie fi 4805*03a78d15Sespie else 4806*03a78d15Sespie # Install the binary that we compiled earlier. 4807*03a78d15Sespie file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 4808*03a78d15Sespie fi 4809*03a78d15Sespie fi 4810*03a78d15Sespie 4811*03a78d15Sespie 4812*03a78d15Sespie # remove .exe since cygwin /usr/bin/install will append another 4813*03a78d15Sespie # one anyways 4814*03a78d15Sespie case $install_prog,$host in 4815*03a78d15Sespie */usr/bin/install*,*cygwin*) 4816*03a78d15Sespie case $file:$destfile in 4817*03a78d15Sespie *.exe:*.exe) 4818*03a78d15Sespie # this is ok 4819*03a78d15Sespie ;; 4820*03a78d15Sespie *.exe:*) 4821*03a78d15Sespie destfile=$destfile.exe 4822*03a78d15Sespie ;; 4823*03a78d15Sespie *:*.exe) 4824*03a78d15Sespie destfile=`echo $destfile | sed -e 's,.exe$,,'` 4825*03a78d15Sespie ;; 4826*03a78d15Sespie esac 4827*03a78d15Sespie ;; 4828*03a78d15Sespie esac 4829*03a78d15Sespie 4830*03a78d15Sespie $show "$install_prog$stripme $file $destfile" 4831*03a78d15Sespie $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 4832*03a78d15Sespie test -n "$outputname" && ${rm}r "$tmpdir" 4833*03a78d15Sespie ;; 4834*03a78d15Sespie esac 4835*03a78d15Sespie done 4836*03a78d15Sespie 4837*03a78d15Sespie for file in $staticlibs; do 4838*03a78d15Sespie name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4839*03a78d15Sespie 4840*03a78d15Sespie # Set up the ranlib parameters. 4841*03a78d15Sespie oldlib="$destdir/$name" 4842*03a78d15Sespie 4843*03a78d15Sespie $show "$install_prog $file $oldlib" 4844*03a78d15Sespie $run eval "$install_prog \$file \$oldlib" || exit $? 4845*03a78d15Sespie 4846*03a78d15Sespie if test -n "$stripme" && test -n "$striplib"; then 4847*03a78d15Sespie $show "$old_striplib $oldlib" 4848*03a78d15Sespie $run eval "$old_striplib $oldlib" || exit $? 4849*03a78d15Sespie fi 4850*03a78d15Sespie 4851*03a78d15Sespie # Do each command in the postinstall commands. 4852*03a78d15Sespie eval cmds=\"$old_postinstall_cmds\" 4853*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4854*03a78d15Sespie for cmd in $cmds; do 4855*03a78d15Sespie IFS="$save_ifs" 4856*03a78d15Sespie $show "$cmd" 4857*03a78d15Sespie $run eval "$cmd" || exit $? 4858*03a78d15Sespie done 4859*03a78d15Sespie IFS="$save_ifs" 4860*03a78d15Sespie done 4861*03a78d15Sespie 4862*03a78d15Sespie if test -n "$future_libdirs"; then 4863*03a78d15Sespie $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 4864*03a78d15Sespie fi 4865*03a78d15Sespie 4866*03a78d15Sespie if test -n "$current_libdirs"; then 4867*03a78d15Sespie # Maybe just do a dry run. 4868*03a78d15Sespie test -n "$run" && current_libdirs=" -n$current_libdirs" 4869*03a78d15Sespie exec_cmd='$SHELL $0 --finish$current_libdirs' 4870*03a78d15Sespie else 4871*03a78d15Sespie exit 0 4872*03a78d15Sespie fi 4873*03a78d15Sespie ;; 4874*03a78d15Sespie 4875*03a78d15Sespie # libtool finish mode 4876*03a78d15Sespie finish) 4877*03a78d15Sespie modename="$modename: finish" 4878*03a78d15Sespie libdirs="$nonopt" 4879*03a78d15Sespie admincmds= 4880*03a78d15Sespie 4881*03a78d15Sespie if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4882*03a78d15Sespie for dir 4883*03a78d15Sespie do 4884*03a78d15Sespie libdirs="$libdirs $dir" 4885*03a78d15Sespie done 4886*03a78d15Sespie 4887*03a78d15Sespie for libdir in $libdirs; do 4888*03a78d15Sespie if test -n "$finish_cmds"; then 4889*03a78d15Sespie # Do each command in the finish commands. 4890*03a78d15Sespie eval cmds=\"$finish_cmds\" 4891*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4892*03a78d15Sespie for cmd in $cmds; do 4893*03a78d15Sespie IFS="$save_ifs" 4894*03a78d15Sespie $show "$cmd" 4895*03a78d15Sespie $run eval "$cmd" || admincmds="$admincmds 4896*03a78d15Sespie $cmd" 4897*03a78d15Sespie done 4898*03a78d15Sespie IFS="$save_ifs" 4899*03a78d15Sespie fi 4900*03a78d15Sespie if test -n "$finish_eval"; then 4901*03a78d15Sespie # Do the single finish_eval. 4902*03a78d15Sespie eval cmds=\"$finish_eval\" 4903*03a78d15Sespie $run eval "$cmds" || admincmds="$admincmds 4904*03a78d15Sespie $cmds" 4905*03a78d15Sespie fi 4906*03a78d15Sespie done 4907*03a78d15Sespie fi 4908*03a78d15Sespie 4909*03a78d15Sespie # Exit here if they wanted silent mode. 4910*03a78d15Sespie test "$show" = ":" && exit 0 4911*03a78d15Sespie 4912*03a78d15Sespie echo "----------------------------------------------------------------------" 4913*03a78d15Sespie echo "Libraries have been installed in:" 4914*03a78d15Sespie for libdir in $libdirs; do 4915*03a78d15Sespie echo " $libdir" 4916*03a78d15Sespie done 4917*03a78d15Sespie echo 4918*03a78d15Sespie echo "If you ever happen to want to link against installed libraries" 4919*03a78d15Sespie echo "in a given directory, LIBDIR, you must either use libtool, and" 4920*03a78d15Sespie echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 4921*03a78d15Sespie echo "flag during linking and do at least one of the following:" 4922*03a78d15Sespie if test -n "$shlibpath_var"; then 4923*03a78d15Sespie echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 4924*03a78d15Sespie echo " during execution" 4925*03a78d15Sespie fi 4926*03a78d15Sespie if test -n "$runpath_var"; then 4927*03a78d15Sespie echo " - add LIBDIR to the \`$runpath_var' environment variable" 4928*03a78d15Sespie echo " during linking" 4929*03a78d15Sespie fi 4930*03a78d15Sespie if test -n "$hardcode_libdir_flag_spec"; then 4931*03a78d15Sespie libdir=LIBDIR 4932*03a78d15Sespie eval flag=\"$hardcode_libdir_flag_spec\" 4933*03a78d15Sespie 4934*03a78d15Sespie echo " - use the \`$flag' linker flag" 4935*03a78d15Sespie fi 4936*03a78d15Sespie if test -n "$admincmds"; then 4937*03a78d15Sespie echo " - have your system administrator run these commands:$admincmds" 4938*03a78d15Sespie fi 4939*03a78d15Sespie if test -f /etc/ld.so.conf; then 4940*03a78d15Sespie echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 4941*03a78d15Sespie fi 4942*03a78d15Sespie echo 4943*03a78d15Sespie echo "See any operating system documentation about shared libraries for" 4944*03a78d15Sespie echo "more information, such as the ld(1) and ld.so(8) manual pages." 4945*03a78d15Sespie echo "----------------------------------------------------------------------" 4946*03a78d15Sespie exit 0 4947*03a78d15Sespie ;; 4948*03a78d15Sespie 4949*03a78d15Sespie # libtool execute mode 4950*03a78d15Sespie execute) 4951*03a78d15Sespie modename="$modename: execute" 4952*03a78d15Sespie 4953*03a78d15Sespie # The first argument is the command name. 4954*03a78d15Sespie cmd="$nonopt" 4955*03a78d15Sespie if test -z "$cmd"; then 4956*03a78d15Sespie $echo "$modename: you must specify a COMMAND" 1>&2 4957*03a78d15Sespie $echo "$help" 4958*03a78d15Sespie exit 1 4959*03a78d15Sespie fi 4960*03a78d15Sespie 4961*03a78d15Sespie # Handle -dlopen flags immediately. 4962*03a78d15Sespie for file in $execute_dlfiles; do 4963*03a78d15Sespie if test ! -f "$file"; then 4964*03a78d15Sespie $echo "$modename: \`$file' is not a file" 1>&2 4965*03a78d15Sespie $echo "$help" 1>&2 4966*03a78d15Sespie exit 1 4967*03a78d15Sespie fi 4968*03a78d15Sespie 4969*03a78d15Sespie dir= 4970*03a78d15Sespie case $file in 4971*03a78d15Sespie *.la) 4972*03a78d15Sespie # Check to see that this really is a libtool archive. 4973*03a78d15Sespie if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 4974*03a78d15Sespie else 4975*03a78d15Sespie $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4976*03a78d15Sespie $echo "$help" 1>&2 4977*03a78d15Sespie exit 1 4978*03a78d15Sespie fi 4979*03a78d15Sespie 4980*03a78d15Sespie # Read the libtool library. 4981*03a78d15Sespie dlname= 4982*03a78d15Sespie library_names= 4983*03a78d15Sespie 4984*03a78d15Sespie # If there is no directory component, then add one. 4985*03a78d15Sespie case $file in 4986*03a78d15Sespie */* | *\\*) . $file ;; 4987*03a78d15Sespie *) . ./$file ;; 4988*03a78d15Sespie esac 4989*03a78d15Sespie 4990*03a78d15Sespie # Skip this library if it cannot be dlopened. 4991*03a78d15Sespie if test -z "$dlname"; then 4992*03a78d15Sespie # Warn if it was a shared library. 4993*03a78d15Sespie test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 4994*03a78d15Sespie continue 4995*03a78d15Sespie fi 4996*03a78d15Sespie 4997*03a78d15Sespie dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 4998*03a78d15Sespie test "X$dir" = "X$file" && dir=. 4999*03a78d15Sespie 5000*03a78d15Sespie if test -f "$dir/$objdir/$dlname"; then 5001*03a78d15Sespie dir="$dir/$objdir" 5002*03a78d15Sespie else 5003*03a78d15Sespie $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 5004*03a78d15Sespie exit 1 5005*03a78d15Sespie fi 5006*03a78d15Sespie ;; 5007*03a78d15Sespie 5008*03a78d15Sespie *.lo) 5009*03a78d15Sespie # Just add the directory containing the .lo file. 5010*03a78d15Sespie dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 5011*03a78d15Sespie test "X$dir" = "X$file" && dir=. 5012*03a78d15Sespie ;; 5013*03a78d15Sespie 5014*03a78d15Sespie *) 5015*03a78d15Sespie $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 5016*03a78d15Sespie continue 5017*03a78d15Sespie ;; 5018*03a78d15Sespie esac 5019*03a78d15Sespie 5020*03a78d15Sespie # Get the absolute pathname. 5021*03a78d15Sespie absdir=`cd "$dir" && pwd` 5022*03a78d15Sespie test -n "$absdir" && dir="$absdir" 5023*03a78d15Sespie 5024*03a78d15Sespie # Now add the directory to shlibpath_var. 5025*03a78d15Sespie if eval "test -z \"\$$shlibpath_var\""; then 5026*03a78d15Sespie eval "$shlibpath_var=\"\$dir\"" 5027*03a78d15Sespie else 5028*03a78d15Sespie eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 5029*03a78d15Sespie fi 5030*03a78d15Sespie done 5031*03a78d15Sespie 5032*03a78d15Sespie # This variable tells wrapper scripts just to set shlibpath_var 5033*03a78d15Sespie # rather than running their programs. 5034*03a78d15Sespie libtool_execute_magic="$magic" 5035*03a78d15Sespie 5036*03a78d15Sespie # Check if any of the arguments is a wrapper script. 5037*03a78d15Sespie args= 5038*03a78d15Sespie for file 5039*03a78d15Sespie do 5040*03a78d15Sespie case $file in 5041*03a78d15Sespie -*) ;; 5042*03a78d15Sespie *) 5043*03a78d15Sespie # Do a test to see if this is really a libtool program. 5044*03a78d15Sespie if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5045*03a78d15Sespie # If there is no directory component, then add one. 5046*03a78d15Sespie case $file in 5047*03a78d15Sespie */* | *\\*) . $file ;; 5048*03a78d15Sespie *) . ./$file ;; 5049*03a78d15Sespie esac 5050*03a78d15Sespie 5051*03a78d15Sespie # Transform arg to wrapped name. 5052*03a78d15Sespie file="$progdir/$program" 5053*03a78d15Sespie fi 5054*03a78d15Sespie ;; 5055*03a78d15Sespie esac 5056*03a78d15Sespie # Quote arguments (to preserve shell metacharacters). 5057*03a78d15Sespie file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 5058*03a78d15Sespie args="$args \"$file\"" 5059*03a78d15Sespie done 5060*03a78d15Sespie 5061*03a78d15Sespie if test -z "$run"; then 5062*03a78d15Sespie if test -n "$shlibpath_var"; then 5063*03a78d15Sespie # Export the shlibpath_var. 5064*03a78d15Sespie eval "export $shlibpath_var" 5065*03a78d15Sespie fi 5066*03a78d15Sespie 5067*03a78d15Sespie # Restore saved enviroment variables 5068*03a78d15Sespie if test "${save_LC_ALL+set}" = set; then 5069*03a78d15Sespie LC_ALL="$save_LC_ALL"; export LC_ALL 5070*03a78d15Sespie fi 5071*03a78d15Sespie if test "${save_LANG+set}" = set; then 5072*03a78d15Sespie LANG="$save_LANG"; export LANG 5073*03a78d15Sespie fi 5074*03a78d15Sespie 5075*03a78d15Sespie # Now prepare to actually exec the command. 5076*03a78d15Sespie exec_cmd='"$cmd"$args' 5077*03a78d15Sespie else 5078*03a78d15Sespie # Display what would be done. 5079*03a78d15Sespie if test -n "$shlibpath_var"; then 5080*03a78d15Sespie eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 5081*03a78d15Sespie $echo "export $shlibpath_var" 5082*03a78d15Sespie fi 5083*03a78d15Sespie $echo "$cmd$args" 5084*03a78d15Sespie exit 0 5085*03a78d15Sespie fi 5086*03a78d15Sespie ;; 5087*03a78d15Sespie 5088*03a78d15Sespie # libtool clean and uninstall mode 5089*03a78d15Sespie clean | uninstall) 5090*03a78d15Sespie modename="$modename: $mode" 5091*03a78d15Sespie rm="$nonopt" 5092*03a78d15Sespie files= 5093*03a78d15Sespie rmforce= 5094*03a78d15Sespie exit_status=0 5095*03a78d15Sespie 5096*03a78d15Sespie # This variable tells wrapper scripts just to set variables rather 5097*03a78d15Sespie # than running their programs. 5098*03a78d15Sespie libtool_install_magic="$magic" 5099*03a78d15Sespie 5100*03a78d15Sespie for arg 5101*03a78d15Sespie do 5102*03a78d15Sespie case $arg in 5103*03a78d15Sespie -f) rm="$rm $arg"; rmforce=yes ;; 5104*03a78d15Sespie -*) rm="$rm $arg" ;; 5105*03a78d15Sespie *) files="$files $arg" ;; 5106*03a78d15Sespie esac 5107*03a78d15Sespie done 5108*03a78d15Sespie 5109*03a78d15Sespie if test -z "$rm"; then 5110*03a78d15Sespie $echo "$modename: you must specify an RM program" 1>&2 5111*03a78d15Sespie $echo "$help" 1>&2 5112*03a78d15Sespie exit 1 5113*03a78d15Sespie fi 5114*03a78d15Sespie 5115*03a78d15Sespie rmdirs= 5116*03a78d15Sespie 5117*03a78d15Sespie for file in $files; do 5118*03a78d15Sespie dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 5119*03a78d15Sespie if test "X$dir" = "X$file"; then 5120*03a78d15Sespie dir=. 5121*03a78d15Sespie objdir="$objdir" 5122*03a78d15Sespie else 5123*03a78d15Sespie objdir="$dir/$objdir" 5124*03a78d15Sespie fi 5125*03a78d15Sespie name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 5126*03a78d15Sespie test $mode = uninstall && objdir="$dir" 5127*03a78d15Sespie 5128*03a78d15Sespie # Remember objdir for removal later, being careful to avoid duplicates 5129*03a78d15Sespie if test $mode = clean; then 5130*03a78d15Sespie case " $rmdirs " in 5131*03a78d15Sespie *" $objdir "*) ;; 5132*03a78d15Sespie *) rmdirs="$rmdirs $objdir" ;; 5133*03a78d15Sespie esac 5134*03a78d15Sespie fi 5135*03a78d15Sespie 5136*03a78d15Sespie # Don't error if the file doesn't exist and rm -f was used. 5137*03a78d15Sespie if (test -L "$file") >/dev/null 2>&1 \ 5138*03a78d15Sespie || (test -h "$file") >/dev/null 2>&1 \ 5139*03a78d15Sespie || test -f "$file"; then 5140*03a78d15Sespie : 5141*03a78d15Sespie elif test -d "$file"; then 5142*03a78d15Sespie exit_status=1 5143*03a78d15Sespie continue 5144*03a78d15Sespie elif test "$rmforce" = yes; then 5145*03a78d15Sespie continue 5146*03a78d15Sespie fi 5147*03a78d15Sespie 5148*03a78d15Sespie rmfiles="$file" 5149*03a78d15Sespie 5150*03a78d15Sespie case $name in 5151*03a78d15Sespie *.la) 5152*03a78d15Sespie # Possibly a libtool archive, so verify it. 5153*03a78d15Sespie if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5154*03a78d15Sespie . $dir/$name 5155*03a78d15Sespie 5156*03a78d15Sespie # Delete the libtool libraries and symlinks. 5157*03a78d15Sespie for n in $library_names; do 5158*03a78d15Sespie rmfiles="$rmfiles $objdir/$n" 5159*03a78d15Sespie done 5160*03a78d15Sespie test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 5161*03a78d15Sespie test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 5162*03a78d15Sespie 5163*03a78d15Sespie if test $mode = uninstall; then 5164*03a78d15Sespie if test -n "$library_names"; then 5165*03a78d15Sespie # Do each command in the postuninstall commands. 5166*03a78d15Sespie eval cmds=\"$postuninstall_cmds\" 5167*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 5168*03a78d15Sespie for cmd in $cmds; do 5169*03a78d15Sespie IFS="$save_ifs" 5170*03a78d15Sespie $show "$cmd" 5171*03a78d15Sespie $run eval "$cmd" 5172*03a78d15Sespie if test $? != 0 && test "$rmforce" != yes; then 5173*03a78d15Sespie exit_status=1 5174*03a78d15Sespie fi 5175*03a78d15Sespie done 5176*03a78d15Sespie IFS="$save_ifs" 5177*03a78d15Sespie fi 5178*03a78d15Sespie 5179*03a78d15Sespie if test -n "$old_library"; then 5180*03a78d15Sespie # Do each command in the old_postuninstall commands. 5181*03a78d15Sespie eval cmds=\"$old_postuninstall_cmds\" 5182*03a78d15Sespie IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 5183*03a78d15Sespie for cmd in $cmds; do 5184*03a78d15Sespie IFS="$save_ifs" 5185*03a78d15Sespie $show "$cmd" 5186*03a78d15Sespie $run eval "$cmd" 5187*03a78d15Sespie if test $? != 0 && test "$rmforce" != yes; then 5188*03a78d15Sespie exit_status=1 5189*03a78d15Sespie fi 5190*03a78d15Sespie done 5191*03a78d15Sespie IFS="$save_ifs" 5192*03a78d15Sespie fi 5193*03a78d15Sespie # FIXME: should reinstall the best remaining shared library. 5194*03a78d15Sespie fi 5195*03a78d15Sespie fi 5196*03a78d15Sespie ;; 5197*03a78d15Sespie 5198*03a78d15Sespie *.lo) 5199*03a78d15Sespie # Possibly a libtool object, so verify it. 5200*03a78d15Sespie if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5201*03a78d15Sespie 5202*03a78d15Sespie # Read the .lo file 5203*03a78d15Sespie . $dir/$name 5204*03a78d15Sespie 5205*03a78d15Sespie # Add PIC object to the list of files to remove. 5206*03a78d15Sespie if test -n "$pic_object" \ 5207*03a78d15Sespie && test "$pic_object" != none; then 5208*03a78d15Sespie rmfiles="$rmfiles $dir/$pic_object" 5209*03a78d15Sespie fi 5210*03a78d15Sespie 5211*03a78d15Sespie # Add non-PIC object to the list of files to remove. 5212*03a78d15Sespie if test -n "$non_pic_object" \ 5213*03a78d15Sespie && test "$non_pic_object" != none; then 5214*03a78d15Sespie rmfiles="$rmfiles $dir/$non_pic_object" 5215*03a78d15Sespie fi 5216*03a78d15Sespie fi 5217*03a78d15Sespie ;; 5218*03a78d15Sespie 5219*03a78d15Sespie *) 5220*03a78d15Sespie # Do a test to see if this is a libtool program. 5221*03a78d15Sespie if test $mode = clean && 5222*03a78d15Sespie (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 5223*03a78d15Sespie relink_command= 5224*03a78d15Sespie . $dir/$file 5225*03a78d15Sespie 5226*03a78d15Sespie rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 5227*03a78d15Sespie if test "$fast_install" = yes && test -n "$relink_command"; then 5228*03a78d15Sespie rmfiles="$rmfiles $objdir/lt-$name" 5229*03a78d15Sespie fi 5230*03a78d15Sespie fi 5231*03a78d15Sespie ;; 5232*03a78d15Sespie esac 5233*03a78d15Sespie $show "$rm $rmfiles" 5234*03a78d15Sespie $run $rm $rmfiles || exit_status=1 5235*03a78d15Sespie done 5236*03a78d15Sespie 5237*03a78d15Sespie # Try to remove the ${objdir}s in the directories where we deleted files 5238*03a78d15Sespie for dir in $rmdirs; do 5239*03a78d15Sespie if test -d "$dir"; then 5240*03a78d15Sespie $show "rmdir $dir" 5241*03a78d15Sespie $run rmdir $dir >/dev/null 2>&1 5242*03a78d15Sespie fi 5243*03a78d15Sespie done 5244*03a78d15Sespie 5245*03a78d15Sespie exit $exit_status 5246*03a78d15Sespie ;; 5247*03a78d15Sespie 5248*03a78d15Sespie "") 5249*03a78d15Sespie $echo "$modename: you must specify a MODE" 1>&2 5250*03a78d15Sespie $echo "$generic_help" 1>&2 5251*03a78d15Sespie exit 1 5252*03a78d15Sespie ;; 5253*03a78d15Sespie esac 5254*03a78d15Sespie 5255*03a78d15Sespie if test -z "$exec_cmd"; then 5256*03a78d15Sespie $echo "$modename: invalid operation mode \`$mode'" 1>&2 5257*03a78d15Sespie $echo "$generic_help" 1>&2 5258*03a78d15Sespie exit 1 5259*03a78d15Sespie fi 5260*03a78d15Sespiefi # test -z "$show_help" 5261*03a78d15Sespie 5262*03a78d15Sespieif test -n "$exec_cmd"; then 5263*03a78d15Sespie eval exec $exec_cmd 5264*03a78d15Sespie exit 1 5265*03a78d15Sespiefi 5266*03a78d15Sespie 5267*03a78d15Sespie# We need to display help for each of the modes. 5268*03a78d15Sespiecase $mode in 5269*03a78d15Sespie"") $echo \ 5270*03a78d15Sespie"Usage: $modename [OPTION]... [MODE-ARG]... 5271*03a78d15Sespie 5272*03a78d15SespieProvide generalized library-building support services. 5273*03a78d15Sespie 5274*03a78d15Sespie --config show all configuration variables 5275*03a78d15Sespie --debug enable verbose shell tracing 5276*03a78d15Sespie-n, --dry-run display commands without modifying any files 5277*03a78d15Sespie --features display basic configuration information and exit 5278*03a78d15Sespie --finish same as \`--mode=finish' 5279*03a78d15Sespie --help display this help message and exit 5280*03a78d15Sespie --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 5281*03a78d15Sespie --quiet same as \`--silent' 5282*03a78d15Sespie --silent don't print informational messages 5283*03a78d15Sespie --tag=TAG use configuration variables from tag TAG 5284*03a78d15Sespie --version print version information 5285*03a78d15Sespie 5286*03a78d15SespieMODE must be one of the following: 5287*03a78d15Sespie 5288*03a78d15Sespie clean remove files from the build directory 5289*03a78d15Sespie compile compile a source file into a libtool object 5290*03a78d15Sespie execute automatically set library path, then run a program 5291*03a78d15Sespie finish complete the installation of libtool libraries 5292*03a78d15Sespie install install libraries or executables 5293*03a78d15Sespie link create a library or an executable 5294*03a78d15Sespie uninstall remove libraries from an installed directory 5295*03a78d15Sespie 5296*03a78d15SespieMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 5297*03a78d15Sespiea more detailed description of MODE." 5298*03a78d15Sespie exit 0 5299*03a78d15Sespie ;; 5300*03a78d15Sespie 5301*03a78d15Sespieclean) 5302*03a78d15Sespie $echo \ 5303*03a78d15Sespie"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 5304*03a78d15Sespie 5305*03a78d15SespieRemove files from the build directory. 5306*03a78d15Sespie 5307*03a78d15SespieRM is the name of the program to use to delete files associated with each FILE 5308*03a78d15Sespie(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 5309*03a78d15Sespieto RM. 5310*03a78d15Sespie 5311*03a78d15SespieIf FILE is a libtool library, object or program, all the files associated 5312*03a78d15Sespiewith it are deleted. Otherwise, only FILE itself is deleted using RM." 5313*03a78d15Sespie ;; 5314*03a78d15Sespie 5315*03a78d15Sespiecompile) 5316*03a78d15Sespie $echo \ 5317*03a78d15Sespie"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 5318*03a78d15Sespie 5319*03a78d15SespieCompile a source file into a libtool library object. 5320*03a78d15Sespie 5321*03a78d15SespieThis mode accepts the following additional options: 5322*03a78d15Sespie 5323*03a78d15Sespie -o OUTPUT-FILE set the output file name to OUTPUT-FILE 5324*03a78d15Sespie -prefer-pic try to building PIC objects only 5325*03a78d15Sespie -prefer-non-pic try to building non-PIC objects only 5326*03a78d15Sespie -static always build a \`.o' file suitable for static linking 5327*03a78d15Sespie 5328*03a78d15SespieCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 5329*03a78d15Sespiefrom the given SOURCEFILE. 5330*03a78d15Sespie 5331*03a78d15SespieThe output file name is determined by removing the directory component from 5332*03a78d15SespieSOURCEFILE, then substituting the C source code suffix \`.c' with the 5333*03a78d15Sespielibrary object suffix, \`.lo'." 5334*03a78d15Sespie ;; 5335*03a78d15Sespie 5336*03a78d15Sespieexecute) 5337*03a78d15Sespie $echo \ 5338*03a78d15Sespie"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 5339*03a78d15Sespie 5340*03a78d15SespieAutomatically set library path, then run a program. 5341*03a78d15Sespie 5342*03a78d15SespieThis mode accepts the following additional options: 5343*03a78d15Sespie 5344*03a78d15Sespie -dlopen FILE add the directory containing FILE to the library path 5345*03a78d15Sespie 5346*03a78d15SespieThis mode sets the library path environment variable according to \`-dlopen' 5347*03a78d15Sespieflags. 5348*03a78d15Sespie 5349*03a78d15SespieIf any of the ARGS are libtool executable wrappers, then they are translated 5350*03a78d15Sespieinto their corresponding uninstalled binary, and any of their required library 5351*03a78d15Sespiedirectories are added to the library path. 5352*03a78d15Sespie 5353*03a78d15SespieThen, COMMAND is executed, with ARGS as arguments." 5354*03a78d15Sespie ;; 5355*03a78d15Sespie 5356*03a78d15Sespiefinish) 5357*03a78d15Sespie $echo \ 5358*03a78d15Sespie"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 5359*03a78d15Sespie 5360*03a78d15SespieComplete the installation of libtool libraries. 5361*03a78d15Sespie 5362*03a78d15SespieEach LIBDIR is a directory that contains libtool libraries. 5363*03a78d15Sespie 5364*03a78d15SespieThe commands that this mode executes may require superuser privileges. Use 5365*03a78d15Sespiethe \`--dry-run' option if you just want to see what would be executed." 5366*03a78d15Sespie ;; 5367*03a78d15Sespie 5368*03a78d15Sespieinstall) 5369*03a78d15Sespie $echo \ 5370*03a78d15Sespie"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 5371*03a78d15Sespie 5372*03a78d15SespieInstall executables or libraries. 5373*03a78d15Sespie 5374*03a78d15SespieINSTALL-COMMAND is the installation command. The first component should be 5375*03a78d15Sespieeither the \`install' or \`cp' program. 5376*03a78d15Sespie 5377*03a78d15SespieThe rest of the components are interpreted as arguments to that command (only 5378*03a78d15SespieBSD-compatible install options are recognized)." 5379*03a78d15Sespie ;; 5380*03a78d15Sespie 5381*03a78d15Sespielink) 5382*03a78d15Sespie $echo \ 5383*03a78d15Sespie"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 5384*03a78d15Sespie 5385*03a78d15SespieLink object files or libraries together to form another library, or to 5386*03a78d15Sespiecreate an executable program. 5387*03a78d15Sespie 5388*03a78d15SespieLINK-COMMAND is a command using the C compiler that you would use to create 5389*03a78d15Sespiea program from several object files. 5390*03a78d15Sespie 5391*03a78d15SespieThe following components of LINK-COMMAND are treated specially: 5392*03a78d15Sespie 5393*03a78d15Sespie -all-static do not do any dynamic linking at all 5394*03a78d15Sespie -avoid-version do not add a version suffix if possible 5395*03a78d15Sespie -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 5396*03a78d15Sespie -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 5397*03a78d15Sespie -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 5398*03a78d15Sespie -export-symbols SYMFILE 5399*03a78d15Sespie try to export only the symbols listed in SYMFILE 5400*03a78d15Sespie -export-symbols-regex REGEX 5401*03a78d15Sespie try to export only the symbols matching REGEX 5402*03a78d15Sespie -LLIBDIR search LIBDIR for required installed libraries 5403*03a78d15Sespie -lNAME OUTPUT-FILE requires the installed library libNAME 5404*03a78d15Sespie -module build a library that can dlopened 5405*03a78d15Sespie -no-fast-install disable the fast-install mode 5406*03a78d15Sespie -no-install link a not-installable executable 5407*03a78d15Sespie -no-undefined declare that a library does not refer to external symbols 5408*03a78d15Sespie -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 5409*03a78d15Sespie -objectlist FILE Use a list of object files found in FILE to specify objects 5410*03a78d15Sespie -release RELEASE specify package release information 5411*03a78d15Sespie -rpath LIBDIR the created library will eventually be installed in LIBDIR 5412*03a78d15Sespie -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 5413*03a78d15Sespie -static do not do any dynamic linking of libtool libraries 5414*03a78d15Sespie -version-info CURRENT[:REVISION[:AGE]] 5415*03a78d15Sespie specify library version info [each variable defaults to 0] 5416*03a78d15Sespie 5417*03a78d15SespieAll other options (arguments beginning with \`-') are ignored. 5418*03a78d15Sespie 5419*03a78d15SespieEvery other argument is treated as a filename. Files ending in \`.la' are 5420*03a78d15Sespietreated as uninstalled libtool libraries, other files are standard or library 5421*03a78d15Sespieobject files. 5422*03a78d15Sespie 5423*03a78d15SespieIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 5424*03a78d15Sespieonly library objects (\`.lo' files) may be specified, and \`-rpath' is 5425*03a78d15Sespierequired, except when creating a convenience library. 5426*03a78d15Sespie 5427*03a78d15SespieIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 5428*03a78d15Sespieusing \`ar' and \`ranlib', or on Windows using \`lib'. 5429*03a78d15Sespie 5430*03a78d15SespieIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 5431*03a78d15Sespieis created, otherwise an executable program is created." 5432*03a78d15Sespie ;; 5433*03a78d15Sespie 5434*03a78d15Sespieuninstall) 5435*03a78d15Sespie $echo \ 5436*03a78d15Sespie"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 5437*03a78d15Sespie 5438*03a78d15SespieRemove libraries from an installation directory. 5439*03a78d15Sespie 5440*03a78d15SespieRM is the name of the program to use to delete files associated with each FILE 5441*03a78d15Sespie(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 5442*03a78d15Sespieto RM. 5443*03a78d15Sespie 5444*03a78d15SespieIf FILE is a libtool library, all the files associated with it are deleted. 5445*03a78d15SespieOtherwise, only FILE itself is deleted using RM." 5446*03a78d15Sespie ;; 5447*03a78d15Sespie 5448*03a78d15Sespie*) 5449*03a78d15Sespie $echo "$modename: invalid operation mode \`$mode'" 1>&2 5450*03a78d15Sespie $echo "$help" 1>&2 5451*03a78d15Sespie exit 1 5452*03a78d15Sespie ;; 5453*03a78d15Sespieesac 5454*03a78d15Sespie 5455*03a78d15Sespieecho 5456*03a78d15Sespie$echo "Try \`$modename --help' for more information about other modes." 5457*03a78d15Sespie 5458*03a78d15Sespieexit 0 5459*03a78d15Sespie 5460*03a78d15Sespie# The TAGs below are defined such that we never get into a situation 5461*03a78d15Sespie# in which we disable both kinds of libraries. Given conflicting 5462*03a78d15Sespie# choices, we go for a static library, that is the most portable, 5463*03a78d15Sespie# since we can't tell whether shared libraries were disabled because 5464*03a78d15Sespie# the user asked for that or because the platform doesn't support 5465*03a78d15Sespie# them. This is particularly important on AIX, because we don't 5466*03a78d15Sespie# support having both static and shared libraries enabled at the same 5467*03a78d15Sespie# time on that platform, so we default to a shared-only configuration. 5468*03a78d15Sespie# If a disable-shared tag is given, we'll fallback to a static-only 5469*03a78d15Sespie# configuration. But we'll never go from static-only to shared-only. 5470*03a78d15Sespie 5471*03a78d15Sespie### BEGIN LIBTOOL TAG CONFIG: disable-shared 5472*03a78d15Sespiebuild_libtool_libs=no 5473*03a78d15Sespiebuild_old_libs=yes 5474*03a78d15Sespie### END LIBTOOL TAG CONFIG: disable-shared 5475*03a78d15Sespie 5476*03a78d15Sespie### BEGIN LIBTOOL TAG CONFIG: disable-static 5477*03a78d15Sespiebuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5478*03a78d15Sespie### END LIBTOOL TAG CONFIG: disable-static 5479*03a78d15Sespie 5480*03a78d15Sespie# Local Variables: 5481*03a78d15Sespie# mode:shell-script 5482*03a78d15Sespie# sh-indentation:2 5483*03a78d15Sespie# End: 5484