annotate src/libmad-0.15.1b/ltmain.sh @ 71:388bd4da45bf

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