annotate kdiff3/admin/ltmain.sh @ 2:53b8ecbce0cb

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