annotate src/libmad-0.15.1b/ltmain.sh @ 169:223a55898ab9 tip default

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