annotate src/flac-1.2.1/ltmain.sh @ 83:ae30d91d2ffe

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