| 1 | # ltmain.sh - Provide generalized library-building support services. |
| 2 | # NOTE: Changing this file will not affect anything until you rerun ltconfig. |
| 3 | # |
| 4 | # Copyright (C) 1996-1998 Free Software Foundation, Inc. |
| 5 | # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, but |
| 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | # General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | # |
| 21 | # As a special exception to the GNU General Public License, if you |
| 22 | # distribute this file as part of a program that contains a |
| 23 | # configuration script generated by Autoconf, you may include it under |
| 24 | # the same distribution terms that you use for the rest of that program. |
| 25 | |
| 26 | # Check that we have a working $echo. |
| 27 | if test "X$1" = X--no-reexec; then |
| 28 | # Discard the --no-reexec flag, and continue. |
| 29 | shift |
| 30 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
| 31 | # Yippee, $echo works! |
| 32 | : |
| 33 | else |
| 34 | # Restart under the correct shell, and then maybe $echo will work. |
| 35 | exec $SHELL "$0" --no-reexec ${1+"$@"} |
| 36 | fi |
| 37 | |
| 38 | # The name of this program. |
| 39 | progname=`$echo "$0" | sed 's%^.*/%%'` |
| 40 | modename="$progname" |
| 41 | |
| 42 | # Constants. |
| 43 | PROGRAM=ltmain.sh |
| 44 | PACKAGE=libtool |
| 45 | VERSION=1.2b |
| 46 | |
| 47 | default_mode= |
| 48 | help="Try \`$progname --help' for more information." |
| 49 | magic="%%%MAGIC variable%%%" |
| 50 | mkdir="mkdir" |
| 51 | mv="mv -f" |
| 52 | rm="rm -f" |
| 53 | |
| 54 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 55 | # metacharacters that are still active within double-quoted strings. |
| 56 | Xsed='sed -e s/^X//' |
| 57 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
| 58 | |
| 59 | # NLS nuisances. |
| 60 | # Only set LANG and LC_ALL to C if already set. |
| 61 | # These must not be set unconditionally because not all systems understand |
| 62 | # e.g. LANG=C (notably SCO). |
| 63 | # We save the old values to restore during execute mode. |
| 64 | if test "${LC_ALL+set}" = set; then |
| 65 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
| 66 | fi |
| 67 | if test "${LANG+set}" = set; then |
| 68 | save_LANG="$LANG"; LANG=C; export LANG |
| 69 | fi |
| 70 | |
| 71 | if test "$LTCONFIG_VERSION" != "$VERSION"; then |
| 72 | echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 |
| 73 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 74 | exit 1 |
| 75 | fi |
| 76 | |
| 77 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 78 | echo "$modename: not configured to build any kind of library" 1>&2 |
| 79 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 80 | exit 1 |
| 81 | fi |
| 82 | |
| 83 | # Global variables. |
| 84 | mode=$default_mode |
| 85 | nonopt= |
| 86 | prev= |
| 87 | prevopt= |
| 88 | run= |
| 89 | show="$echo" |
| 90 | show_help= |
| 91 | execute_dlfiles= |
| 92 | lo2o="s/\\.lo\$/.${objext}/" |
| 93 | los2o="s/\\.lo /.${objext} /g" |
| 94 | |
| 95 | # Parse our command line options once, thoroughly. |
| 96 | while test $# -gt 0 |
| 97 | do |
| 98 | arg="$1" |
| 99 | shift |
| 100 | |
| 101 | case "$arg" in |
| 102 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| 103 | *) optarg= ;; |
| 104 | esac |
| 105 | |
| 106 | # If the previous option needs an argument, assign it. |
| 107 | if test -n "$prev"; then |
| 108 | case "$prev" in |
| 109 | execute_dlfiles) |
| 110 | eval "$prev=\"\$$prev \$arg\"" |
| 111 | ;; |
| 112 | *) |
| 113 | eval "$prev=\$arg" |
| 114 | ;; |
| 115 | esac |
| 116 | |
| 117 | prev= |
| 118 | prevopt= |
| 119 | continue |
| 120 | fi |
| 121 | |
| 122 | # Have we seen a non-optional argument yet? |
| 123 | case "$arg" in |
| 124 | --help) |
| 125 | show_help=yes |
| 126 | ;; |
| 127 | |
| 128 | --version) |
| 129 | echo "$PROGRAM (GNU $PACKAGE) $VERSION" |
| 130 | exit 0 |
| 131 | ;; |
| 132 | |
| 133 | --config) |
| 134 | sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 |
| 135 | exit 0 |
| 136 | ;; |
| 137 | |
| 138 | --debug) |
| 139 | echo "$progname: enabling shell trace mode" |
| 140 | set -x |
| 141 | ;; |
| 142 | |
| 143 | --dry-run | -n) |
| 144 | run=: |
| 145 | ;; |
| 146 | |
| 147 | --features) |
| 148 | echo "host: $host" |
| 149 | if test "$build_libtool_libs" = yes; then |
| 150 | echo "enable shared libraries" |
| 151 | else |
| 152 | echo "disable shared libraries" |
| 153 | fi |
| 154 | if test "$build_old_libs" = yes; then |
| 155 | echo "enable static libraries" |
| 156 | else |
| 157 | echo "disable static libraries" |
| 158 | fi |
| 159 | exit 0 |
| 160 | ;; |
| 161 | |
| 162 | --finish) mode="finish" ;; |
| 163 | |
| 164 | --mode) prevopt="--mode" prev=mode ;; |
| 165 | --mode=*) mode="$optarg" ;; |
| 166 | |
| 167 | --quiet | --silent) |
| 168 | show=: |
| 169 | ;; |
| 170 | |
| 171 | -dlopen) |
| 172 | prevopt="-dlopen" |
| 173 | prev=execute_dlfiles |
| 174 | ;; |
| 175 | |
| 176 | -*) |
| 177 | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
| 178 | $echo "$help" 1>&2 |
| 179 | exit 1 |
| 180 | ;; |
| 181 | |
| 182 | *) |
| 183 | nonopt="$arg" |
| 184 | break |
| 185 | ;; |
| 186 | esac |
| 187 | done |
| 188 | |
| 189 | if test -n "$prevopt"; then |
| 190 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
| 191 | $echo "$help" 1>&2 |
| 192 | exit 1 |
| 193 | fi |
| 194 | |
| 195 | if test -z "$show_help"; then |
| 196 | |
| 197 | # Infer the operation mode. |
| 198 | if test -z "$mode"; then |
| 199 | case "$nonopt" in |
| 200 | *cc | *++ | gcc* | *-gcc*) |
| 201 | mode=link |
| 202 | for arg |
| 203 | do |
| 204 | case "$arg" in |
| 205 | -c) |
| 206 | mode=compile |
| 207 | break |
| 208 | ;; |
| 209 | esac |
| 210 | done |
| 211 | ;; |
| 212 | *db | *dbx | *strace | *truss) |
| 213 | mode=execute |
| 214 | ;; |
| 215 | *install*|cp|mv) |
| 216 | mode=install |
| 217 | ;; |
| 218 | *rm) |
| 219 | mode=uninstall |
| 220 | ;; |
| 221 | *) |
| 222 | # If we have no mode, but dlfiles were specified, then do execute mode. |
| 223 | test -n "$execute_dlfiles" && mode=execute |
| 224 | |
| 225 | # Just use the default operation mode. |
| 226 | if test -z "$mode"; then |
| 227 | if test -n "$nonopt"; then |
| 228 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
| 229 | else |
| 230 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
| 231 | fi |
| 232 | fi |
| 233 | ;; |
| 234 | esac |
| 235 | fi |
| 236 | |
| 237 | # Only execute mode is allowed to have -dlopen flags. |
| 238 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
| 239 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
| 240 | $echo "$help" 1>&2 |
| 241 | exit 1 |
| 242 | fi |
| 243 | |
| 244 | # Change the help message to a mode-specific one. |
| 245 | generic_help="$help" |
| 246 | help="Try \`$modename --help --mode=$mode' for more information." |
| 247 | |
| 248 | # These modes are in order of execution frequency so that they run quickly. |
| 249 | case "$mode" in |
| 250 | # libtool compile mode |
| 251 | compile) |
| 252 | modename="$modename: compile" |
| 253 | # Get the compilation command and the source file. |
| 254 | base_compile= |
| 255 | lastarg= |
| 256 | srcfile="$nonopt" |
| 257 | suppress_output= |
| 258 | |
| 259 | for arg |
| 260 | do |
| 261 | # Accept any command-line options. |
| 262 | case "$arg" in |
| 263 | -o) |
| 264 | $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2 |
| 265 | $echo "$help" 1>&2 |
| 266 | exit 1 |
| 267 | ;; |
| 268 | |
| 269 | -static) |
| 270 | build_old_libs=yes |
| 271 | continue |
| 272 | ;; |
| 273 | esac |
| 274 | |
| 275 | # Accept the current argument as the source file. |
| 276 | lastarg="$srcfile" |
| 277 | srcfile="$arg" |
| 278 | |
| 279 | # Aesthetically quote the previous argument. |
| 280 | |
| 281 | # Backslashify any backslashes, double quotes, and dollar signs. |
| 282 | # These are the only characters that are still specially |
| 283 | # interpreted inside of double-quoted scrings. |
| 284 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
| 285 | |
| 286 | # Double-quote args containing other shell metacharacters. |
| 287 | # Many Bourne shells cannot handle close brackets correctly in scan |
| 288 | # sets, so we specify it separately. |
| 289 | case "$lastarg" in |
| 290 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 291 | lastarg="\"$lastarg\"" |
| 292 | ;; |
| 293 | esac |
| 294 | |
| 295 | # Add the previous argument to base_compile. |
| 296 | if test -z "$base_compile"; then |
| 297 | base_compile="$lastarg" |
| 298 | else |
| 299 | base_compile="$base_compile $lastarg" |
| 300 | fi |
| 301 | done |
| 302 | |
| 303 | # Get the name of the library object. |
| 304 | libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
| 305 | |
| 306 | # Recognize several different file suffixes. |
| 307 | xform='[cCFSfms]' |
| 308 | case "$libobj" in |
| 309 | *.ada) xform=ada ;; |
| 310 | *.adb) xform=adb ;; |
| 311 | *.ads) xform=ads ;; |
| 312 | *.asm) xform=asm ;; |
| 313 | *.c++) xform=c++ ;; |
| 314 | *.cc) xform=cc ;; |
| 315 | *.cpp) xform=cpp ;; |
| 316 | *.cxx) xform=cxx ;; |
| 317 | *.f90) xform=f90 ;; |
| 318 | *.for) xform=for ;; |
| 319 | esac |
| 320 | |
| 321 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
| 322 | |
| 323 | case "$libobj" in |
| 324 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
| 325 | *) |
| 326 | $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2 |
| 327 | exit 1 |
| 328 | ;; |
| 329 | esac |
| 330 | |
| 331 | if test -z "$base_compile"; then |
| 332 | $echo "$modename: you must specify a compilation command" 1>&2 |
| 333 | $echo "$help" 1>&2 |
| 334 | exit 1 |
| 335 | fi |
| 336 | |
| 337 | # Delete any leftover library objects. |
| 338 | if test "$build_old_libs" = yes; then |
| 339 | $run $rm $obj $libobj |
| 340 | trap "$run $rm $obj $libobj; exit 1" 1 2 15 |
| 341 | else |
| 342 | $run $rm $libobj |
| 343 | trap "$run $rm $libobj; exit 1" 1 2 15 |
| 344 | fi |
| 345 | |
| 346 | if test -n "$fix_srcfile_path"; then |
| 347 | eval srcfile=\"$fix_srcfile_path\" |
| 348 | fi |
| 349 | |
| 350 | # Only build a PIC object if we are building libtool libraries. |
| 351 | if test "$build_libtool_libs" = yes; then |
| 352 | # Without this assignment, base_compile gets emptied. |
| 353 | fbsd_hideous_sh_bug=$base_compile |
| 354 | |
| 355 | # All platforms use -DPIC, to notify preprocessed assembler code. |
| 356 | $show "$base_compile$pic_flag -DPIC $srcfile" |
| 357 | if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then : |
| 358 | else |
| 359 | test -n "$obj" && $run $rm $obj |
| 360 | exit 1 |
| 361 | fi |
| 362 | |
| 363 | # If we have no pic_flag, then copy the object into place and finish. |
| 364 | if test -z "$pic_flag"; then |
| 365 | $show "$LN_S $obj $libobj" |
| 366 | $run $LN_S $obj $libobj |
| 367 | exit $? |
| 368 | fi |
| 369 | |
| 370 | # Just move the object, then go on to compile the next one |
| 371 | $show "$mv $obj $libobj" |
| 372 | $run $mv $obj $libobj || exit $? |
| 373 | |
| 374 | # Allow error messages only from the first compilation. |
| 375 | suppress_output=' >/dev/null 2>&1' |
| 376 | fi |
| 377 | |
| 378 | # Only build a position-dependent object if we build old libraries. |
| 379 | if test "$build_old_libs" = yes; then |
| 380 | # Suppress compiler output if we already did a PIC compilation. |
| 381 | $show "$base_compile $srcfile$suppress_output" |
| 382 | if $run eval "$base_compile \$srcfile$suppress_output"; then : |
| 383 | else |
| 384 | $run $rm $obj $libobj |
| 385 | exit 1 |
| 386 | fi |
| 387 | fi |
| 388 | |
| 389 | # Create an invalid libtool object if no PIC, so that we do not |
| 390 | # accidentally link it into a program. |
| 391 | if test "$build_libtool_libs" != yes; then |
| 392 | $show "echo timestamp > $libobj" |
| 393 | $run eval "echo timestamp > \$libobj" || exit $? |
| 394 | fi |
| 395 | |
| 396 | exit 0 |
| 397 | ;; |
| 398 | |
| 399 | # libtool link mode |
| 400 | link) |
| 401 | modename="$modename: link" |
| 402 | CC="$nonopt" |
| 403 | allow_undefined=yes |
| 404 | compile_command="$CC" |
| 405 | finalize_command="$CC" |
| 406 | |
| 407 | compile_shlibpath= |
| 408 | finalize_shlibpath= |
| 409 | convenience= |
| 410 | old_convenience= |
| 411 | deplibs= |
| 412 | dlfiles= |
| 413 | dlprefiles= |
| 414 | export_dynamic=no |
| 415 | generated= |
| 416 | hardcode_libdirs= |
| 417 | libobjs= |
| 418 | link_against_libtool_libs= |
| 419 | ltlibs= |
| 420 | objs= |
| 421 | prev= |
| 422 | prevarg= |
| 423 | release= |
| 424 | rpath= |
| 425 | perm_rpath= |
| 426 | temp_rpath= |
| 427 | vinfo= |
| 428 | |
| 429 | # We need to know -static, to get the right output filenames. |
| 430 | for arg |
| 431 | do |
| 432 | case "$arg" in |
| 433 | -all-static | -static) |
| 434 | if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
| 435 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
| 436 | fi |
| 437 | build_libtool_libs=no |
| 438 | build_old_libs=yes |
| 439 | break |
| 440 | ;; |
| 441 | esac |
| 442 | done |
| 443 | |
| 444 | # See if our shared archives depend on static archives. |
| 445 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
| 446 | |
| 447 | # Go through the arguments, transforming them on the way. |
| 448 | while test $# -gt 0; do |
| 449 | arg="$1" |
| 450 | shift |
| 451 | |
| 452 | # If the previous option needs an argument, assign it. |
| 453 | if test -n "$prev"; then |
| 454 | case "$prev" in |
| 455 | output) |
| 456 | compile_command="$compile_command @OUTPUT@" |
| 457 | finalize_command="$finalize_command @OUTPUT@" |
| 458 | ;; |
| 459 | esac |
| 460 | |
| 461 | case "$prev" in |
| 462 | dlfiles|dlprefiles) |
| 463 | case "$arg" in |
| 464 | *.la | *.lo) ;; # We handle these cases below. |
| 465 | *) |
| 466 | dlprefiles="$dlprefiles $arg" |
| 467 | test "$prev" = dlfiles && dlfiles="$dlfiles $arg" |
| 468 | prev= |
| 469 | ;; |
| 470 | esac |
| 471 | ;; |
| 472 | release) |
| 473 | release="-$arg" |
| 474 | prev= |
| 475 | continue |
| 476 | ;; |
| 477 | rpath) |
| 478 | rpath="$rpath $arg" |
| 479 | prev= |
| 480 | continue |
| 481 | ;; |
| 482 | *) |
| 483 | eval "$prev=\"\$arg\"" |
| 484 | prev= |
| 485 | continue |
| 486 | ;; |
| 487 | esac |
| 488 | fi |
| 489 | |
| 490 | prevarg="$arg" |
| 491 | |
| 492 | case "$arg" in |
| 493 | -all-static) |
| 494 | if test -n "$link_static_flag"; then |
| 495 | compile_command="$compile_command $link_static_flag" |
| 496 | finalize_command="$finalize_command $link_static_flag" |
| 497 | fi |
| 498 | continue |
| 499 | ;; |
| 500 | |
| 501 | -allow-undefined) |
| 502 | # FIXME: remove this flag sometime in the future. |
| 503 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
| 504 | continue |
| 505 | ;; |
| 506 | |
| 507 | -dlopen) |
| 508 | prev=dlfiles |
| 509 | continue |
| 510 | ;; |
| 511 | |
| 512 | -dlpreopen) |
| 513 | prev=dlprefiles |
| 514 | continue |
| 515 | ;; |
| 516 | |
| 517 | -export-dynamic) |
| 518 | if test "$export_dynamic" != yes; then |
| 519 | export_dynamic=yes |
| 520 | if test -n "$export_dynamic_flag_spec"; then |
| 521 | eval arg=\"$export_dynamic_flag_spec\" |
| 522 | else |
| 523 | arg= |
| 524 | fi |
| 525 | |
| 526 | # Add the symbol object into the linking commands. |
| 527 | compile_command="$compile_command @SYMFILE@" |
| 528 | finalize_command="$finalize_command @SYMFILE@" |
| 529 | fi |
| 530 | ;; |
| 531 | |
| 532 | -L*) |
| 533 | dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` |
| 534 | case "$dir" in |
| 535 | /* | [A-Za-z]:[/\\]*) |
| 536 | # Add the corresponding hardcode_libdir_flag, if it is not identical. |
| 537 | ;; |
| 538 | *) |
| 539 | $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 |
| 540 | exit 1 |
| 541 | ;; |
| 542 | esac |
| 543 | deplibs="$deplibs $arg" |
| 544 | ;; |
| 545 | |
| 546 | -l*) deplibs="$deplibs $arg" ;; |
| 547 | |
| 548 | -no-undefined) |
| 549 | allow_undefined=no |
| 550 | continue |
| 551 | ;; |
| 552 | |
| 553 | -o) prev=output ;; |
| 554 | |
| 555 | -release) |
| 556 | prev=release |
| 557 | continue |
| 558 | ;; |
| 559 | |
| 560 | -rpath) |
| 561 | prev=rpath |
| 562 | continue |
| 563 | ;; |
| 564 | |
| 565 | -static) |
| 566 | # If we have no pic_flag, then this is the same as -all-static. |
| 567 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 568 | compile_command="$compile_command $link_static_flag" |
| 569 | finalize_command="$finalize_command $link_static_flag" |
| 570 | fi |
| 571 | continue |
| 572 | ;; |
| 573 | |
| 574 | -version-info) |
| 575 | prev=vinfo |
| 576 | continue |
| 577 | ;; |
| 578 | |
| 579 | # Some other compiler flag. |
| 580 | -* | +*) |
| 581 | # Unknown arguments in both finalize_command and compile_command need |
| 582 | # to be aesthetically quoted because they are evaled later. |
| 583 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 584 | case "$arg" in |
| 585 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 586 | arg="\"$arg\"" |
| 587 | ;; |
| 588 | esac |
| 589 | ;; |
| 590 | |
| 591 | *.o | *.obj | *.a | *.lib) |
| 592 | # A standard object. |
| 593 | objs="$objs $arg" |
| 594 | ;; |
| 595 | |
| 596 | *.lo) |
| 597 | # A library object. |
| 598 | if test "$prev" = dlfiles; then |
| 599 | dlfiles="$dlfiles $arg" |
| 600 | if test "$build_libtool_libs" = yes; then |
| 601 | prev= |
| 602 | continue |
| 603 | else |
| 604 | # If libtool objects are unsupported, then we need to preload. |
| 605 | prev=dlprefiles |
| 606 | fi |
| 607 | fi |
| 608 | |
| 609 | if test "$prev" = dlprefiles; then |
| 610 | # Preload the old-style object. |
| 611 | dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` |
| 612 | prev= |
| 613 | fi |
| 614 | libobjs="$libobjs $arg" |
| 615 | ;; |
| 616 | |
| 617 | *.la) |
| 618 | # A libtool-controlled library. |
| 619 | |
| 620 | dlname= |
| 621 | libdir= |
| 622 | library_names= |
| 623 | old_library= |
| 624 | |
| 625 | # Check to see that this really is a libtool archive. |
| 626 | if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
| 627 | else |
| 628 | $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 |
| 629 | exit 1 |
| 630 | fi |
| 631 | |
| 632 | # If there is no directory component, then add one. |
| 633 | case "$arg" in |
| 634 | */* | *\\*) . $arg ;; |
| 635 | *) . ./$arg ;; |
| 636 | esac |
| 637 | |
| 638 | # Get the name of the library we link against. |
| 639 | linklib= |
| 640 | for l in $old_library $library_names; do |
| 641 | linklib="$l" |
| 642 | done |
| 643 | |
| 644 | if test -z "$linklib"; then |
| 645 | $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 |
| 646 | exit 1 |
| 647 | fi |
| 648 | |
| 649 | # Find the relevant object directory and library name. |
| 650 | name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` |
| 651 | dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 652 | if test "X$dir" = "X$arg"; then |
| 653 | dir="$objdir" |
| 654 | else |
| 655 | dir="$dir/$objdir" |
| 656 | fi |
| 657 | |
| 658 | if test -z "$libdir"; then |
| 659 | # It is a libtool convenience library, so add in its objects. |
| 660 | convenience="$convenience $dir/$old_library"l |
| 661 | old_convenience="$old_convenience $dir/$old_library" |
| 662 | compile_command="$compile_command $dir/$old_library" |
| 663 | finalize_command="$finalize_command $dir/$old_library" |
| 664 | continue |
| 665 | fi |
| 666 | |
| 667 | # This library was specified with -dlopen. |
| 668 | if test "$prev" = dlfiles; then |
| 669 | dlfiles="$dlfiles $arg" |
| 670 | if test -z "$dlname"; then |
| 671 | # If there is no dlname, we need to preload. |
| 672 | prev=dlprefiles |
| 673 | else |
| 674 | # We should not create a dependency on this library, but we |
| 675 | # may need any libraries it requires. |
| 676 | compile_command="$compile_command$dependency_libs" |
| 677 | finalize_command="$finalize_command$dependency_libs" |
| 678 | prev= |
| 679 | continue |
| 680 | fi |
| 681 | fi |
| 682 | |
| 683 | # The library was specified with -dlpreopen. |
| 684 | if test "$prev" = dlprefiles; then |
| 685 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 686 | # are required to link). |
| 687 | if test -n "$old_library"; then |
| 688 | dlprefiles="$dlprefiles $dir/$old_library" |
| 689 | else |
| 690 | dlprefiles="$dlprefiles $dir/$linklib" |
| 691 | fi |
| 692 | prev= |
| 693 | fi |
| 694 | |
| 695 | if test "$build_libtool_libs" = yes && test -n "$library_names"; then |
| 696 | link_against_libtool_libs="$link_against_libtool_libs $arg" |
| 697 | if test -n "$shlibpath_var"; then |
| 698 | # Make sure the rpath contains only unique directories. |
| 699 | case "$temp_rpath " in |
| 700 | *" $dir "*) ;; |
| 701 | *) temp_rpath="$temp_rpath $dir" ;; |
| 702 | esac |
| 703 | fi |
| 704 | |
| 705 | # This is the magic to use -rpath. |
| 706 | if test -n "$hardcode_libdir_flag_spec"; then |
| 707 | if test -n "$hardcode_libdir_separator"; then |
| 708 | if test -z "$hardcode_libdirs"; then |
| 709 | # Put the magic libdir with the hardcode flag. |
| 710 | hardcode_libdirs="$libdir" |
| 711 | libdir="@HARDCODE_LIBDIRS@" |
| 712 | else |
| 713 | # Just accumulate the unique libdirs. |
| 714 | case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in |
| 715 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 716 | ;; |
| 717 | *) |
| 718 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
| 719 | ;; |
| 720 | esac |
| 721 | libdir= |
| 722 | fi |
| 723 | fi |
| 724 | |
| 725 | if test -n "$libdir"; then |
| 726 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 727 | |
| 728 | compile_command="$compile_command $flag" |
| 729 | finalize_command="$finalize_command $flag" |
| 730 | fi |
| 731 | elif test -n "$runpath_var"; then |
| 732 | # Do the same for the permanent run path. |
| 733 | case "$perm_rpath " in |
| 734 | *" $libdir "*) ;; |
| 735 | *) perm_rpath="$perm_rpath $libdir" ;; |
| 736 | esac |
| 737 | fi |
| 738 | |
| 739 | |
| 740 | lib_linked=yes |
| 741 | case "$hardcode_action" in |
| 742 | immediate | unsupported) |
| 743 | if test "$hardcode_direct" = no; then |
| 744 | compile_command="$compile_command $dir/$linklib" |
| 745 | elif test "$hardcode_minus_L" = no; then |
| 746 | case "$host" in |
| 747 | *-*-sunos*) |
| 748 | compile_shlibpath="$compile_shlibpath$dir:" |
| 749 | ;; |
| 750 | esac |
| 751 | compile_command="$compile_command -L$dir -l$name" |
| 752 | elif test "$hardcode_shlibpath_var" = no; then |
| 753 | compile_shlibpath="$compile_shlibpath$dir:" |
| 754 | compile_command="$compile_command -l$name" |
| 755 | else |
| 756 | lib_linked=no |
| 757 | fi |
| 758 | ;; |
| 759 | |
| 760 | relink) |
| 761 | # We need an absolute path. |
| 762 | case "$dir" in |
| 763 | /* | [A-Za-z]:[/\\]*) ;; |
| 764 | *) |
| 765 | absdir=`cd "$dir" && pwd` |
| 766 | if test -z "$absdir"; then |
| 767 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
| 768 | exit 1 |
| 769 | fi |
| 770 | dir="$absdir" |
| 771 | ;; |
| 772 | esac |
| 773 | |
| 774 | if test "$hardcode_direct" = yes; then |
| 775 | compile_command="$compile_command $dir/$linklib" |
| 776 | elif test "$hardcode_minus_L" = yes; then |
| 777 | compile_command="$compile_command -L$dir -l$name" |
| 778 | elif test "$hardcode_shlibpath_var" = yes; then |
| 779 | compile_shlibpath="$compile_shlibpath$dir:" |
| 780 | compile_command="$compile_command -l$name" |
| 781 | else |
| 782 | lib_linked=no |
| 783 | fi |
| 784 | ;; |
| 785 | |
| 786 | *) |
| 787 | lib_linked=no |
| 788 | ;; |
| 789 | esac |
| 790 | |
| 791 | if test "$lib_linked" != yes; then |
| 792 | $echo "$modename: configuration error: unsupported hardcode properties" |
| 793 | exit 1 |
| 794 | fi |
| 795 | |
| 796 | # Finalize command for both is simple: just hardcode it. |
| 797 | if test "$hardcode_direct" = yes; then |
| 798 | finalize_command="$finalize_command $libdir/$linklib" |
| 799 | elif test "$hardcode_minus_L" = yes; then |
| 800 | finalize_command="$finalize_command -L$libdir -l$name" |
| 801 | elif test "$hardcode_shlibpath_var" = yes; then |
| 802 | finalize_shlibpath="$finalize_shlibpath$libdir:" |
| 803 | finalize_command="$finalize_command -l$name" |
| 804 | else |
| 805 | # We cannot seem to hardcode it, guess we'll fake it. |
| 806 | finalize_command="$finalize_command -L$libdir -l$name" |
| 807 | fi |
| 808 | else |
| 809 | # Transform directly to old archives if we don't build new libraries. |
| 810 | if test -n "$pic_flag" && test -z "$old_library"; then |
| 811 | $echo "$modename: cannot find static library for \`$arg'" 1>&2 |
| 812 | exit 1 |
| 813 | fi |
| 814 | |
| 815 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 816 | # is not unsupported. This is valid on all known static and |
| 817 | # shared platforms. |
| 818 | if test "$hardcode_direct" != unsupported; then |
| 819 | test -n "$old_library" && linklib="$old_library" |
| 820 | compile_command="$compile_command $dir/$linklib" |
| 821 | finalize_command="$finalize_command $dir/$linklib" |
| 822 | else |
| 823 | compile_command="$compile_command -L$dir -l$name" |
| 824 | finalize_command="$finalize_command -L$dir -l$name" |
| 825 | fi |
| 826 | fi |
| 827 | |
| 828 | # Add in any libraries that this one depends upon. |
| 829 | compile_command="$compile_command$dependency_libs" |
| 830 | finalize_command="$finalize_command$dependency_libs" |
| 831 | continue |
| 832 | ;; |
| 833 | |
| 834 | # Some other compiler argument. |
| 835 | *) |
| 836 | # Unknown arguments in both finalize_command and compile_command need |
| 837 | # to be aesthetically quoted because they are evaled later. |
| 838 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 839 | case "$arg" in |
| 840 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 841 | arg="\"$arg\"" |
| 842 | ;; |
| 843 | esac |
| 844 | ;; |
| 845 | esac |
| 846 | |
| 847 | # Now actually substitute the argument into the commands. |
| 848 | if test -n "$arg"; then |
| 849 | compile_command="$compile_command $arg" |
| 850 | finalize_command="$finalize_command $arg" |
| 851 | fi |
| 852 | done |
| 853 | |
| 854 | if test -n "$prev"; then |
| 855 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
| 856 | $echo "$help" 1>&2 |
| 857 | exit 1 |
| 858 | fi |
| 859 | |
| 860 | oldlibs= |
| 861 | case "$output" in |
| 862 | "") |
| 863 | $echo "$modename: you must specify an output file" 1>&2 |
| 864 | $echo "$help" 1>&2 |
| 865 | exit 1 |
| 866 | ;; |
| 867 | |
| 868 | */* | *\\*) |
| 869 | $echo "$modename: output file \`$output' must have no directory components" 1>&2 |
| 870 | $echo "$help" 1>&2 |
| 871 | exit 1 |
| 872 | ;; |
| 873 | |
| 874 | *.a | *.lib) |
| 875 | if test -n "$link_against_libtool_libs"; then |
| 876 | $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 |
| 877 | exit 1 |
| 878 | fi |
| 879 | |
| 880 | if test -n "$deplibs"; then |
| 881 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 |
| 882 | fi |
| 883 | |
| 884 | if test -n "$dlfiles$dlprefiles"; then |
| 885 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
| 886 | fi |
| 887 | |
| 888 | if test -n "$rpath"; then |
| 889 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 |
| 890 | fi |
| 891 | |
| 892 | if test -n "$vinfo"; then |
| 893 | $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 |
| 894 | fi |
| 895 | |
| 896 | if test -n "$release"; then |
| 897 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 |
| 898 | fi |
| 899 | |
| 900 | # Now set the variables for building old libraries. |
| 901 | build_libtool_libs=no |
| 902 | oldlibs="$output" |
| 903 | ;; |
| 904 | |
| 905 | *.la) |
| 906 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 907 | case "$output" in |
| 908 | lib*) ;; |
| 909 | *) |
| 910 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 |
| 911 | $echo "$help" 1>&2 |
| 912 | exit 1 |
| 913 | ;; |
| 914 | esac |
| 915 | |
| 916 | name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
| 917 | eval libname=\"$libname_spec\" |
| 918 | |
| 919 | # All the library-specific variables (install_libdir is set above). |
| 920 | library_names= |
| 921 | old_library= |
| 922 | dlname= |
| 923 | |
| 924 | if test -n "$objs"; then |
| 925 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 |
| 926 | exit 1 |
| 927 | fi |
| 928 | |
| 929 | # How the heck are we supposed to write a wrapper for a shared library? |
| 930 | if test -n "$link_against_libtool_libs"; then |
| 931 | $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 |
| 932 | exit 1 |
| 933 | fi |
| 934 | |
| 935 | if test -n "$dlfiles$dlprefiles"; then |
| 936 | $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 |
| 937 | fi |
| 938 | |
| 939 | set dummy $rpath |
| 940 | if test $# -gt 2; then |
| 941 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
| 942 | fi |
| 943 | install_libdir="$2" |
| 944 | |
| 945 | # Now set the variables for building old libraries. |
| 946 | oldlibs="$objdir/$libname.$libext" |
| 947 | if test -z "$rpath"; then |
| 948 | # Building a libtool convenience library. |
| 949 | oldlibs="$objdir/$libname.al $oldlibs" |
| 950 | build_libtool_libs=convenience |
| 951 | |
| 952 | if test -n "$vinfo"; then |
| 953 | $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 |
| 954 | fi |
| 955 | |
| 956 | if test -n "$release"; then |
| 957 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 |
| 958 | fi |
| 959 | else |
| 960 | |
| 961 | # Parse the version information argument. |
| 962 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' |
| 963 | set dummy $vinfo 0 0 0 |
| 964 | IFS="$save_ifs" |
| 965 | |
| 966 | if test -n "$8"; then |
| 967 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 |
| 968 | $echo "$help" 1>&2 |
| 969 | exit 1 |
| 970 | fi |
| 971 | |
| 972 | current="$2" |
| 973 | revision="$3" |
| 974 | age="$4" |
| 975 | |
| 976 | # Check that each of the things are valid numbers. |
| 977 | case "$current" in |
| 978 | 0 | [1-9] | [1-9][0-9]*) ;; |
| 979 | *) |
| 980 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 |
| 981 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 982 | exit 1 |
| 983 | ;; |
| 984 | esac |
| 985 | |
| 986 | case "$revision" in |
| 987 | 0 | [1-9] | [1-9][0-9]*) ;; |
| 988 | *) |
| 989 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 |
| 990 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 991 | exit 1 |
| 992 | ;; |
| 993 | esac |
| 994 | |
| 995 | case "$age" in |
| 996 | 0 | [1-9] | [1-9][0-9]*) ;; |
| 997 | *) |
| 998 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 |
| 999 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 1000 | exit 1 |
| 1001 | ;; |
| 1002 | esac |
| 1003 | |
| 1004 | if test $age -gt $current; then |
| 1005 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
| 1006 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 1007 | exit 1 |
| 1008 | fi |
| 1009 | |
| 1010 | # Calculate the version variables. |
| 1011 | major= |
| 1012 | versuffix= |
| 1013 | verstring= |
| 1014 | case "$version_type" in |
| 1015 | none) ;; |
| 1016 | |
| 1017 | linux) |
| 1018 | major=.`expr $current - $age` |
| 1019 | versuffix="$major.$age.$revision" |
| 1020 | ;; |
| 1021 | |
| 1022 | osf) |
| 1023 | major=`expr $current - $age` |
| 1024 | versuffix=".$current.$age.$revision" |
| 1025 | verstring="$current.$age.$revision" |
| 1026 | |
| 1027 | # Add in all the interfaces that we are compatible with. |
| 1028 | loop=$age |
| 1029 | while test $loop != 0; do |
| 1030 | iface=`expr $current - $loop` |
| 1031 | loop=`expr $loop - 1` |
| 1032 | verstring="$verstring:${iface}.0" |
| 1033 | done |
| 1034 | |
| 1035 | # Make executables depend on our current version. |
| 1036 | verstring="$verstring:${current}.0" |
| 1037 | ;; |
| 1038 | |
| 1039 | sunos) |
| 1040 | major=".$current" |
| 1041 | versuffix=".$current.$revision" |
| 1042 | ;; |
| 1043 | |
| 1044 | windows) |
| 1045 | # Like Linux, but with '-' rather than '.', since we only |
| 1046 | # want one extension on Windows 95. |
| 1047 | major=`expr $current - $age` |
| 1048 | versuffix="-$major-$age-$revision" |
| 1049 | ;; |
| 1050 | |
| 1051 | *) |
| 1052 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 |
| 1053 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 1054 | exit 1 |
| 1055 | ;; |
| 1056 | esac |
| 1057 | |
| 1058 | # Clear the version info if we defaulted, and they specified a release. |
| 1059 | if test -z "$vinfo" && test -n "$release"; then |
| 1060 | major= |
| 1061 | versuffix= |
| 1062 | verstring="0.0" |
| 1063 | case "$host" in |
| 1064 | *-*-sunos*) |
| 1065 | versuffix=".0.0" |
| 1066 | ;; |
| 1067 | esac |
| 1068 | fi |
| 1069 | |
| 1070 | # Check to see if the archive will have undefined symbols. |
| 1071 | if test "$allow_undefined" = yes; then |
| 1072 | if test "$allow_undefined_flag" = unsupported; then |
| 1073 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 |
| 1074 | build_libtool_libs=no |
| 1075 | build_old_libs=yes |
| 1076 | fi |
| 1077 | else |
| 1078 | # Don't allow undefined symbols. |
| 1079 | allow_undefined_flag="$no_undefined_flag" |
| 1080 | fi |
| 1081 | |
| 1082 | # Add libc to deplibs on all systems. |
| 1083 | dependency_libs="$deplibs" |
| 1084 | deplibs="$deplibs -lc" |
| 1085 | fi |
| 1086 | |
| 1087 | # Create the output directory, or remove our outputs if we need to. |
| 1088 | if test -d $objdir; then |
| 1089 | $show "${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*" |
| 1090 | $run ${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.* |
| 1091 | else |
| 1092 | $show "$mkdir $objdir" |
| 1093 | $run $mkdir $objdir |
| 1094 | status=$? |
| 1095 | if test $status -ne 0 && test ! -d $objdir; then |
| 1096 | exit $status |
| 1097 | fi |
| 1098 | fi |
| 1099 | |
| 1100 | if test "$build_libtool_libs" = yes; then |
| 1101 | # Get the real and link names of the library. |
| 1102 | eval library_names=\"$library_names_spec\" |
| 1103 | set dummy $library_names |
| 1104 | realname="$2" |
| 1105 | shift; shift |
| 1106 | |
| 1107 | if test -n "$soname_spec"; then |
| 1108 | eval soname=\"$soname_spec\" |
| 1109 | else |
| 1110 | soname="$realname" |
| 1111 | fi |
| 1112 | |
| 1113 | lib="$objdir/$realname" |
| 1114 | for link |
| 1115 | do |
| 1116 | linknames="$linknames $link" |
| 1117 | done |
| 1118 | |
| 1119 | # Use standard objects if they are PIC. |
| 1120 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e "$los2o" -e 's/ $//g'` |
| 1121 | |
| 1122 | # Transform .lo files to .o files. |
| 1123 | test "$build_old_libs" = yes && oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'` |
| 1124 | |
| 1125 | if test -n "$whole_archive_flag_spec"; then |
| 1126 | if test -n "$convenience"; then |
| 1127 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 1128 | fi |
| 1129 | else |
| 1130 | for xlib in $convenience; do |
| 1131 | # Extract the objects. |
| 1132 | xdir="$xlib"x |
| 1133 | generated="$generated $xdir" |
| 1134 | xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'` |
| 1135 | |
| 1136 | $show "${rm}r $xdir" |
| 1137 | $run ${rm}r "$xdir" |
| 1138 | $show "mkdir $xdir" |
| 1139 | $run mkdir "$xdir" |
| 1140 | status=$? |
| 1141 | if test $status -ne 0 && test ! -d "$xdir"; then |
| 1142 | exit $status |
| 1143 | fi |
| 1144 | $show "(cd $xdir && $AR x ../$xlib)" |
| 1145 | $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? |
| 1146 | |
| 1147 | libobjs="$libobjs `echo $xdir/*`" |
| 1148 | done |
| 1149 | fi |
| 1150 | |
| 1151 | # Do each of the archive commands. |
| 1152 | eval cmds=\"$archive_cmds\" |
| 1153 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 1154 | for cmd in $cmds; do |
| 1155 | IFS="$save_ifs" |
| 1156 | $show "$cmd" |
| 1157 | $run eval "$cmd" || exit $? |
| 1158 | done |
| 1159 | IFS="$save_ifs" |
| 1160 | |
| 1161 | # Create links to the real library. |
| 1162 | for linkname in $linknames; do |
| 1163 | if test "$realname" != "$linkname"; then |
| 1164 | $show "(cd $objdir && $LN_S $realname $linkname)" |
| 1165 | $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $? |
| 1166 | fi |
| 1167 | done |
| 1168 | |
| 1169 | # If -export-dynamic was specified, set the dlname. |
| 1170 | if test "$export_dynamic" = yes; then |
| 1171 | # On all known operating systems, these are identical. |
| 1172 | dlname="$soname" |
| 1173 | fi |
| 1174 | fi |
| 1175 | ;; |
| 1176 | |
| 1177 | *.lo | *.o | *.obj) |
| 1178 | if test -n "$link_against_libtool_libs"; then |
| 1179 | $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 |
| 1180 | exit 1 |
| 1181 | fi |
| 1182 | |
| 1183 | if test -n "$deplibs"; then |
| 1184 | $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 |
| 1185 | fi |
| 1186 | |
| 1187 | if test -n "$dlfiles$dlprefiles"; then |
| 1188 | $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 |
| 1189 | fi |
| 1190 | |
| 1191 | if test -n "$rpath"; then |
| 1192 | $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 |
| 1193 | fi |
| 1194 | |
| 1195 | if test -n "$vinfo"; then |
| 1196 | $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 |
| 1197 | fi |
| 1198 | |
| 1199 | if test -n "$release"; then |
| 1200 | $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 |
| 1201 | fi |
| 1202 | |
| 1203 | case "$output" in |
| 1204 | *.lo) |
| 1205 | if test -n "$objs"; then |
| 1206 | $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 |
| 1207 | exit 1 |
| 1208 | fi |
| 1209 | libobj="$output" |
| 1210 | obj=`$echo "X$output" | $Xsed -e "$lo2o"` |
| 1211 | ;; |
| 1212 | *) |
| 1213 | libobj= |
| 1214 | obj="$output" |
| 1215 | ;; |
| 1216 | esac |
| 1217 | |
| 1218 | # Delete the old objects. |
| 1219 | $run $rm $obj $libobj |
| 1220 | |
| 1221 | # Create the old-style object. |
| 1222 | reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'` |
| 1223 | |
| 1224 | output="$obj" |
| 1225 | eval cmds=\"$reload_cmds\" |
| 1226 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 1227 | for cmd in $cmds; do |
| 1228 | IFS="$save_ifs" |
| 1229 | $show "$cmd" |
| 1230 | $run eval "$cmd" || exit $? |
| 1231 | done |
| 1232 | IFS="$save_ifs" |
| 1233 | |
| 1234 | # Exit if we aren't doing a library object file. |
| 1235 | test -z "$libobj" && exit 0 |
| 1236 | |
| 1237 | if test "$build_libtool_libs" != yes; then |
| 1238 | # Create an invalid libtool object if no PIC, so that we don't |
| 1239 | # accidentally link it into a program. |
| 1240 | $show "echo timestamp > $libobj" |
| 1241 | $run eval "echo timestamp > $libobj" || exit $? |
| 1242 | exit 0 |
| 1243 | fi |
| 1244 | |
| 1245 | if test -n "$pic_flag"; then |
| 1246 | # Only do commands if we really have different PIC objects. |
| 1247 | reload_objs="$libobjs" |
| 1248 | output="$libobj" |
| 1249 | eval cmds=\"$reload_cmds\" |
| 1250 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 1251 | for cmd in $cmds; do |
| 1252 | IFS="$save_ifs" |
| 1253 | $show "$cmd" |
| 1254 | $run eval "$cmd" || exit $? |
| 1255 | done |
| 1256 | IFS="$save_ifs" |
| 1257 | else |
| 1258 | # Just create a symlink. |
| 1259 | $show "$LN_S $obj $libobj" |
| 1260 | $run $LN_S $obj $libobj || exit $? |
| 1261 | fi |
| 1262 | |
| 1263 | exit 0 |
| 1264 | ;; |
| 1265 | |
| 1266 | *) |
| 1267 | if test -n "$vinfo"; then |
| 1268 | $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 |
| 1269 | fi |
| 1270 | |
| 1271 | if test -n "$release"; then |
| 1272 | $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 |
| 1273 | fi |
| 1274 | |
| 1275 | if test -n "$rpath"; then |
| 1276 | # If the user specified any rpath flags, then add them. |
| 1277 | for libdir in $rpath; do |
| 1278 | if test -n "$hardcode_libdir_flag_spec"; then |
| 1279 | if test -n "$hardcode_libdir_separator"; then |
| 1280 | if test -z "$hardcode_libdirs"; then |
| 1281 | # Put the magic libdir with the hardcode flag. |
| 1282 | hardcode_libdirs="$libdir" |
| 1283 | libdir="@HARDCODE_LIBDIRS@" |
| 1284 | else |
| 1285 | # Just accumulate the unique libdirs. |
| 1286 | case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in |
| 1287 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 1288 | ;; |
| 1289 | *) |
| 1290 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
| 1291 | ;; |
| 1292 | esac |
| 1293 | libdir= |
| 1294 | fi |
| 1295 | fi |
| 1296 | |
| 1297 | if test -n "$libdir"; then |
| 1298 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 1299 | |
| 1300 | compile_command="$compile_command $flag" |
| 1301 | finalize_command="$finalize_command $flag" |
| 1302 | fi |
| 1303 | elif test -n "$runpath_var"; then |
| 1304 | case "$perm_rpath " in |
| 1305 | *" $libdir "*) ;; |
| 1306 | *) perm_rpath="$perm_rpath $libdir" ;; |
| 1307 | esac |
| 1308 | fi |
| 1309 | done |
| 1310 | fi |
| 1311 | |
| 1312 | # Substitute the hardcoded libdirs into the compile commands. |
| 1313 | if test -n "$hardcode_libdir_separator"; then |
| 1314 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` |
| 1315 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` |
| 1316 | fi |
| 1317 | |
| 1318 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
| 1319 | # Transform all the library objects into standard objects. |
| 1320 | compile_command=`$echo "X$compile_command " | $Xsed -e "$los2o" -e 's/ $//'` |
| 1321 | finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'` |
| 1322 | fi |
| 1323 | |
| 1324 | if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then |
| 1325 | dlsyms="${output}S.c" |
| 1326 | else |
| 1327 | dlsyms= |
| 1328 | fi |
| 1329 | |
| 1330 | if test -n "$dlsyms"; then |
| 1331 | # Add our own program objects to the preloaded list. |
| 1332 | dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e "$los2o" -e 's/ $//'` |
| 1333 | |
| 1334 | # Discover the nlist of each of the dlfiles. |
| 1335 | nlist="$objdir/${output}.nm" |
| 1336 | |
| 1337 | if test -d $objdir; then |
| 1338 | $show "$rm $nlist ${nlist}T" |
| 1339 | $run $rm "$nlist" "${nlist}T" |
| 1340 | else |
| 1341 | $show "$mkdir $objdir" |
| 1342 | $run $mkdir $objdir |
| 1343 | status=$? |
| 1344 | if test $status -ne 0 && test ! -d $objdir; then |
| 1345 | exit $status |
| 1346 | fi |
| 1347 | fi |
| 1348 | |
| 1349 | for arg in $dlprefiles; do |
| 1350 | $show "extracting global C symbols from \`$arg'" |
| 1351 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
| 1352 | done |
| 1353 | |
| 1354 | # Parse the name list into a source file. |
| 1355 | $show "creating $objdir/$dlsyms" |
| 1356 | if test -z "$run"; then |
| 1357 | # Make sure we at least have an empty file. |
| 1358 | test -f "$nlist" || : > "$nlist" |
| 1359 | |
| 1360 | # Try sorting and uniquifying the output. |
| 1361 | if sort "$nlist" | uniq > "$nlist"T; then |
| 1362 | mv -f "$nlist"T "$nlist" |
| 1363 | wcout=`wc "$nlist" 2>/dev/null` |
| 1364 | count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` |
| 1365 | (test "$count" -ge 0) 2>/dev/null || count=-1 |
| 1366 | else |
| 1367 | $rm "$nlist"T |
| 1368 | count=-1 |
| 1369 | fi |
| 1370 | |
| 1371 | case "$dlsyms" in |
| 1372 | "") ;; |
| 1373 | *.c) |
| 1374 | $echo > "$objdir/$dlsyms" "\ |
| 1375 | /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */ |
| 1376 | /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */ |
| 1377 | |
| 1378 | #ifdef __cplusplus |
| 1379 | extern \"C\" { |
| 1380 | #endif |
| 1381 | |
| 1382 | /* Prevent the only kind of declaration conflicts we can make. */ |
| 1383 | #define dld_preloaded_symbol_count some_other_symbol |
| 1384 | #define dld_preloaded_symbols some_other_symbol |
| 1385 | |
| 1386 | /* External symbol declarations for the compiler. */\ |
| 1387 | " |
| 1388 | |
| 1389 | if test -f "$nlist"; then |
| 1390 | sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms" |
| 1391 | else |
| 1392 | echo '/* NONE */' >> "$objdir/$dlsyms" |
| 1393 | fi |
| 1394 | |
| 1395 | $echo >> "$objdir/$dlsyms" "\ |
| 1396 | |
| 1397 | #undef dld_preloaded_symbol_count |
| 1398 | #undef dld_preloaded_symbols |
| 1399 | |
| 1400 | #if defined (__STDC__) && __STDC__ |
| 1401 | # define __ptr_t void * |
| 1402 | #else |
| 1403 | # define __ptr_t char * |
| 1404 | #endif |
| 1405 | |
| 1406 | /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ |
| 1407 | int dld_preloaded_symbol_count = $count; |
| 1408 | |
| 1409 | /* The mapping between symbol names and symbols. */ |
| 1410 | struct { |
| 1411 | char *name; |
| 1412 | __ptr_t address; |
| 1413 | } |
| 1414 | dld_preloaded_symbols[] = |
| 1415 | {\ |
| 1416 | " |
| 1417 | |
| 1418 | if test -f "$nlist"; then |
| 1419 | sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms" |
| 1420 | fi |
| 1421 | |
| 1422 | $echo >> "$objdir/$dlsyms" "\ |
| 1423 | {0, (__ptr_t) 0} |
| 1424 | }; |
| 1425 | |
| 1426 | #ifdef __cplusplus |
| 1427 | } |
| 1428 | #endif\ |
| 1429 | " |
| 1430 | ;; |
| 1431 | |
| 1432 | *) |
| 1433 | $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 |
| 1434 | exit 1 |
| 1435 | ;; |
| 1436 | esac |
| 1437 | fi |
| 1438 | |
| 1439 | # Now compile the dynamic symbol file. |
| 1440 | $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")" |
| 1441 | $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $? |
| 1442 | |
| 1443 | # Transform the symbol file into the correct name. |
| 1444 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` |
| 1445 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` |
| 1446 | elif test "$export_dynamic" != yes; then |
| 1447 | test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 |
| 1448 | else |
| 1449 | # We keep going just in case the user didn't refer to |
| 1450 | # dld_preloaded_symbols. The linker will fail if global_symbol_pipe |
| 1451 | # really was required. |
| 1452 | $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 |
| 1453 | |
| 1454 | # Nullify the symbol file. |
| 1455 | compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` |
| 1456 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` |
| 1457 | fi |
| 1458 | |
| 1459 | if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then |
| 1460 | # Replace the output file specification. |
| 1461 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
| 1462 | finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
| 1463 | |
| 1464 | # We have no uninstalled library dependencies, so finalize right now. |
| 1465 | $show "$compile_command" |
| 1466 | $run eval "$compile_command" |
| 1467 | exit $? |
| 1468 | fi |
| 1469 | |
| 1470 | # Replace the output file specification. |
| 1471 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'` |
| 1472 | finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'` |
| 1473 | |
| 1474 | # Create the binary in the object directory, then wrap it. |
| 1475 | if test ! -d $objdir; then |
| 1476 | $show "$mkdir $objdir" |
| 1477 | $run $mkdir $objdir |
| 1478 | status=$? |
| 1479 | if test $status -ne 0 && test ! -d $objdir; then |
| 1480 | exit $status |
| 1481 | fi |
| 1482 | fi |
| 1483 | |
| 1484 | if test -n "$shlibpath_var"; then |
| 1485 | # We should set the shlibpath_var |
| 1486 | rpath= |
| 1487 | for dir in $temp_rpath; do |
| 1488 | case "$dir" in |
| 1489 | /* | [A-Za-z]:[/\\]*) |
| 1490 | # Absolute path. |
| 1491 | rpath="$rpath$dir:" |
| 1492 | ;; |
| 1493 | *) |
| 1494 | # Relative path: add a thisdir entry. |
| 1495 | rpath="$rpath\$thisdir/$dir:" |
| 1496 | ;; |
| 1497 | esac |
| 1498 | done |
| 1499 | temp_rpath="$rpath" |
| 1500 | fi |
| 1501 | |
| 1502 | # Delete the old output file. |
| 1503 | $run $rm $output |
| 1504 | |
| 1505 | if test -n "$compile_shlibpath"; then |
| 1506 | compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" |
| 1507 | fi |
| 1508 | if test -n "$finalize_shlibpath"; then |
| 1509 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
| 1510 | fi |
| 1511 | |
| 1512 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
| 1513 | # We should set the runpath_var. |
| 1514 | rpath= |
| 1515 | for dir in $perm_rpath; do |
| 1516 | rpath="$rpath$dir:" |
| 1517 | done |
| 1518 | compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" |
| 1519 | finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" |
| 1520 | fi |
| 1521 | |
| 1522 | if test "$hardcode_action" = relink; then |
| 1523 | # AGH! Flame the AIX and HP-UX people for me, will ya? |
| 1524 | $echo "$modename: warning: using a buggy system linker" 1>&2 |
| 1525 | $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2 |
| 1526 | fi |
| 1527 | |
| 1528 | $show "$compile_command" |
| 1529 | $run eval "$compile_command" || exit $? |
| 1530 | |
| 1531 | # Now create the wrapper script. |
| 1532 | $show "creating $output" |
| 1533 | |
| 1534 | # Quote the finalize command for shipping. |
| 1535 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"` |
| 1536 | |
| 1537 | # Quote $echo for shipping. |
| 1538 | qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` |
| 1539 | |
| 1540 | # Only actually do things if our run command is non-null. |
| 1541 | if test -z "$run"; then |
| 1542 | $rm $output |
| 1543 | trap "$rm $output; exit 1" 1 2 15 |
| 1544 | |
| 1545 | $echo > $output "\ |
| 1546 | #! $SHELL |
| 1547 | |
| 1548 | # $output - temporary wrapper script for $objdir/$output |
| 1549 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION |
| 1550 | # |
| 1551 | # The $output program cannot be directly executed until all the libtool |
| 1552 | # libraries that it depends on are installed. |
| 1553 | # |
| 1554 | # This wrapper script should never be moved out of \``pwd`'. |
| 1555 | # If it is, it will not operate correctly. |
| 1556 | |
| 1557 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 1558 | # metacharacters that are still active within double-quoted strings. |
| 1559 | Xsed='sed -e s/^X//' |
| 1560 | sed_quote_subst='$sed_quote_subst' |
| 1561 | |
| 1562 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
| 1563 | # if CDPATH is set. |
| 1564 | if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi |
| 1565 | |
| 1566 | # This environment variable determines our operation mode. |
| 1567 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
| 1568 | # install mode needs the following variables: |
| 1569 | link_against_libtool_libs='$link_against_libtool_libs' |
| 1570 | finalize_command=\"$finalize_command\" |
| 1571 | else |
| 1572 | # When we are sourced in execute mode, \$file and \$echo are already set. |
| 1573 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 1574 | echo=\"$qecho\" |
| 1575 | file=\"\$0\" |
| 1576 | # Make sure echo works. |
| 1577 | if test \"X\$1\" = X--no-reexec; then |
| 1578 | # Discard the --no-reexec flag, and continue. |
| 1579 | shift |
| 1580 | elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then |
| 1581 | # Yippee, \$echo works! |
| 1582 | : |
| 1583 | else |
| 1584 | # Restart under the correct shell, and then maybe \$echo will work. |
| 1585 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} |
| 1586 | fi |
| 1587 | fi\ |
| 1588 | " |
| 1589 | $echo >> $output "\ |
| 1590 | |
| 1591 | # Find the directory that this script lives in. |
| 1592 | thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` |
| 1593 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
| 1594 | |
| 1595 | # Follow symbolic links until we get to the real thisdir. |
| 1596 | file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` |
| 1597 | while test -n \"\$file\"; do |
| 1598 | destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` |
| 1599 | |
| 1600 | # If there was a directory component, then change thisdir. |
| 1601 | if test \"x\$destdir\" != \"x\$file\"; then |
| 1602 | case \"\$destdir\" in |
| 1603 | /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;; |
| 1604 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
| 1605 | esac |
| 1606 | fi |
| 1607 | |
| 1608 | file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` |
| 1609 | file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` |
| 1610 | done |
| 1611 | |
| 1612 | # Try to get the absolute directory name. |
| 1613 | absdir=\`cd \"\$thisdir\" && pwd\` |
| 1614 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
| 1615 | |
| 1616 | progdir=\"\$thisdir/$objdir\" |
| 1617 | program='$output' |
| 1618 | |
| 1619 | if test -f \"\$progdir/\$program\"; then" |
| 1620 | |
| 1621 | # Export our shlibpath_var if we have one. |
| 1622 | if test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
| 1623 | $echo >> $output "\ |
| 1624 | # Add our own library path to $shlibpath_var |
| 1625 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
| 1626 | |
| 1627 | # Some systems cannot cope with colon-terminated $shlibpath_var |
| 1628 | $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\` |
| 1629 | |
| 1630 | export $shlibpath_var |
| 1631 | " |
| 1632 | fi |
| 1633 | |
| 1634 | $echo >> $output "\ |
| 1635 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 1636 | # Run the actual program with our arguments. |
| 1637 | |
| 1638 | # Export the path to the program. |
| 1639 | PATH=\"\$progdir:\$PATH\" |
| 1640 | export PATH |
| 1641 | |
| 1642 | exec \$program \${1+\"\$@\"} |
| 1643 | |
| 1644 | \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" |
| 1645 | exit 1 |
| 1646 | fi |
| 1647 | else |
| 1648 | # The program doesn't exist. |
| 1649 | \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 |
| 1650 | \$echo \"This script is just a wrapper for \$program.\" 1>&2 |
| 1651 | echo \"See the $PACKAGE documentation for more information.\" 1>&2 |
| 1652 | exit 1 |
| 1653 | fi |
| 1654 | fi\ |
| 1655 | " |
| 1656 | chmod +x $output |
| 1657 | fi |
| 1658 | exit 0 |
| 1659 | ;; |
| 1660 | esac |
| 1661 | |
| 1662 | # See if we need to build an old-fashioned archive. |
| 1663 | for oldlib in $oldlibs; do |
| 1664 | |
| 1665 | if test "$build_libtool_libs" = convenience; then |
| 1666 | oldobjs="$libobjs" |
| 1667 | addlibs="$convenience" |
| 1668 | build_libtool_libs=no |
| 1669 | else |
| 1670 | oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'` |
| 1671 | addlibs="$old_convenience" |
| 1672 | fi |
| 1673 | |
| 1674 | # Add in members from convenience archives. |
| 1675 | for xlib in $addlibs; do |
| 1676 | # Extract the objects. |
| 1677 | xdir="$xlib"x |
| 1678 | generated="$generated $xdir" |
| 1679 | xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'` |
| 1680 | |
| 1681 | $show "${rm}r $xdir" |
| 1682 | $run ${rm}r "$xdir" |
| 1683 | $show "mkdir $xdir" |
| 1684 | $run mkdir "$xdir" |
| 1685 | status=$? |
| 1686 | if test $status -ne 0 && test ! -d "$xdir"; then |
| 1687 | exit $status |
| 1688 | fi |
| 1689 | $show "(cd $xdir && $AR x ../$xlib)" |
| 1690 | $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? |
| 1691 | |
| 1692 | oldobjs="$oldobjs `echo $xdir/*`" |
| 1693 | done |
| 1694 | |
| 1695 | # Do each command in the archive commands. |
| 1696 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
| 1697 | eval cmds=\"$old_archive_from_new_cmds\" |
| 1698 | else |
| 1699 | eval cmds=\"$old_archive_cmds\" |
| 1700 | fi |
| 1701 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 1702 | for cmd in $cmds; do |
| 1703 | IFS="$save_ifs" |
| 1704 | $show "$cmd" |
| 1705 | $run eval "$cmd" || exit $? |
| 1706 | done |
| 1707 | IFS="$save_ifs" |
| 1708 | done |
| 1709 | |
| 1710 | if test -n "$generated"; then |
| 1711 | $show "${rm}r$generated" |
| 1712 | $run ${rm}r$generated |
| 1713 | fi |
| 1714 | |
| 1715 | # Now create the libtool archive. |
| 1716 | case "$output" in |
| 1717 | *.la) |
| 1718 | old_library= |
| 1719 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
| 1720 | $show "creating $output" |
| 1721 | |
| 1722 | # Only create the output if not a dry run. |
| 1723 | if test -z "$run"; then |
| 1724 | $echo > $output "\ |
| 1725 | # $output - a libtool library file |
| 1726 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION |
| 1727 | |
| 1728 | # The name that we can dlopen(3). |
| 1729 | dlname='$dlname' |
| 1730 | |
| 1731 | # Names of this library. |
| 1732 | library_names='$library_names' |
| 1733 | |
| 1734 | # The name of the static archive. |
| 1735 | old_library='$old_library' |
| 1736 | |
| 1737 | # Libraries that this one depends upon. |
| 1738 | dependency_libs='$dependency_libs' |
| 1739 | |
| 1740 | # Version information for $libname. |
| 1741 | current=$current |
| 1742 | age=$age |
| 1743 | revision=$revision |
| 1744 | |
| 1745 | # Directory that this library needs to be installed in: |
| 1746 | libdir='$install_libdir'\ |
| 1747 | " |
| 1748 | fi |
| 1749 | |
| 1750 | # Do a symbolic link so that the libtool archive can be found in |
| 1751 | # LD_LIBRARY_PATH before the program is installed. |
| 1752 | $show "(cd $objdir && $LN_S ../$output $output)" |
| 1753 | $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $? |
| 1754 | ;; |
| 1755 | esac |
| 1756 | exit 0 |
| 1757 | ;; |
| 1758 | |
| 1759 | # libtool install mode |
| 1760 | install) |
| 1761 | modename="$modename: install" |
| 1762 | |
| 1763 | # There may be an optional sh(1) argument at the beginning of |
| 1764 | # install_prog (especially on Windows NT). |
| 1765 | if test "$nonopt" = "$SHELL" || test "$nonopt" = "/bin/sh"; then |
| 1766 | # Aesthetically quote it. |
| 1767 | arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` |
| 1768 | case "$arg" in |
| 1769 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 1770 | arg="\"$arg\"" |
| 1771 | ;; |
| 1772 | esac |
| 1773 | install_prog="$arg " |
| 1774 | arg="$1" |
| 1775 | shift |
| 1776 | else |
| 1777 | install_prog= |
| 1778 | arg="$nonopt" |
| 1779 | fi |
| 1780 | |
| 1781 | # The real first argument should be the name of the installation program. |
| 1782 | # Aesthetically quote it. |
| 1783 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1784 | case "$arg" in |
| 1785 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 1786 | arg="\"$arg\"" |
| 1787 | ;; |
| 1788 | esac |
| 1789 | install_prog="$install_prog$arg" |
| 1790 | |
| 1791 | # We need to accept at least all the BSD install flags. |
| 1792 | dest= |
| 1793 | files= |
| 1794 | opts= |
| 1795 | prev= |
| 1796 | install_type= |
| 1797 | isdir=no |
| 1798 | stripme= |
| 1799 | for arg |
| 1800 | do |
| 1801 | if test -n "$dest"; then |
| 1802 | files="$files $dest" |
| 1803 | dest="$arg" |
| 1804 | continue |
| 1805 | fi |
| 1806 | |
| 1807 | case "$arg" in |
| 1808 | -d) isdir=yes ;; |
| 1809 | -f) prev="-f" ;; |
| 1810 | -g) prev="-g" ;; |
| 1811 | -m) prev="-m" ;; |
| 1812 | -o) prev="-o" ;; |
| 1813 | -s) |
| 1814 | stripme=" -s" |
| 1815 | continue |
| 1816 | ;; |
| 1817 | -*) ;; |
| 1818 | |
| 1819 | *) |
| 1820 | # If the previous option needed an argument, then skip it. |
| 1821 | if test -n "$prev"; then |
| 1822 | prev= |
| 1823 | else |
| 1824 | dest="$arg" |
| 1825 | continue |
| 1826 | fi |
| 1827 | ;; |
| 1828 | esac |
| 1829 | |
| 1830 | # Aesthetically quote the argument. |
| 1831 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1832 | case "$arg" in |
| 1833 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
| 1834 | arg="\"$arg\"" |
| 1835 | ;; |
| 1836 | esac |
| 1837 | install_prog="$install_prog $arg" |
| 1838 | done |
| 1839 | |
| 1840 | if test -z "$install_prog"; then |
| 1841 | $echo "$modename: you must specify an install program" 1>&2 |
| 1842 | $echo "$help" 1>&2 |
| 1843 | exit 1 |
| 1844 | fi |
| 1845 | |
| 1846 | if test -n "$prev"; then |
| 1847 | $echo "$modename: the \`$prev' option requires an argument" 1>&2 |
| 1848 | $echo "$help" 1>&2 |
| 1849 | exit 1 |
| 1850 | fi |
| 1851 | |
| 1852 | if test -z "$files"; then |
| 1853 | if test -z "$dest"; then |
| 1854 | $echo "$modename: no file or destination specified" 1>&2 |
| 1855 | else |
| 1856 | $echo "$modename: you must specify a destination" 1>&2 |
| 1857 | fi |
| 1858 | $echo "$help" 1>&2 |
| 1859 | exit 1 |
| 1860 | fi |
| 1861 | |
| 1862 | # Strip any trailing slash from the destination. |
| 1863 | dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` |
| 1864 | |
| 1865 | # Check to see that the destination is a directory. |
| 1866 | test -d "$dest" && isdir=yes |
| 1867 | if test "$isdir" = yes; then |
| 1868 | destdir="$dest" |
| 1869 | destname= |
| 1870 | else |
| 1871 | destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` |
| 1872 | test "X$destdir" = "X$dest" && destdir=. |
| 1873 | destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` |
| 1874 | |
| 1875 | # Not a directory, so check to see that there is only one file specified. |
| 1876 | set dummy $files |
| 1877 | if test $# -gt 2; then |
| 1878 | $echo "$modename: \`$dest' is not a directory" 1>&2 |
| 1879 | $echo "$help" 1>&2 |
| 1880 | exit 1 |
| 1881 | fi |
| 1882 | fi |
| 1883 | case "$destdir" in |
| 1884 | /* | [A-Za-z]:[/\\]*) ;; |
| 1885 | *) |
| 1886 | for file in $files; do |
| 1887 | case "$file" in |
| 1888 | *.lo) ;; |
| 1889 | *) |
| 1890 | $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 |
| 1891 | $echo "$help" 1>&2 |
| 1892 | exit 1 |
| 1893 | ;; |
| 1894 | esac |
| 1895 | done |
| 1896 | ;; |
| 1897 | esac |
| 1898 | |
| 1899 | # This variable tells wrapper scripts just to set variables rather |
| 1900 | # than running their programs. |
| 1901 | libtool_install_magic="$magic" |
| 1902 | |
| 1903 | staticlibs= |
| 1904 | future_libdirs= |
| 1905 | current_libdirs= |
| 1906 | for file in $files; do |
| 1907 | |
| 1908 | # Do each installation. |
| 1909 | case "$file" in |
| 1910 | *.a | *.lib) |
| 1911 | # Do the static libraries later. |
| 1912 | staticlibs="$staticlibs $file" |
| 1913 | ;; |
| 1914 | |
| 1915 | *.la) |
| 1916 | # Check to see that this really is a libtool archive. |
| 1917 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
| 1918 | else |
| 1919 | $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 |
| 1920 | $echo "$help" 1>&2 |
| 1921 | exit 1 |
| 1922 | fi |
| 1923 | |
| 1924 | library_names= |
| 1925 | old_library= |
| 1926 | # If there is no directory component, then add one. |
| 1927 | case "$file" in |
| 1928 | */* | *\\*) . $file ;; |
| 1929 | *) . ./$file ;; |
| 1930 | esac |
| 1931 | |
| 1932 | # Add the libdir to current_libdirs if it is the destination. |
| 1933 | if test "X$destdir" = "X$libdir"; then |
| 1934 | case "$current_libdirs " in |
| 1935 | *" $libdir "*) ;; |
| 1936 | *) current_libdirs="$current_libdirs $libdir" ;; |
| 1937 | esac |
| 1938 | else |
| 1939 | # Note the libdir as a future libdir. |
| 1940 | case "$future_libdirs " in |
| 1941 | *" $libdir "*) ;; |
| 1942 | *) future_libdirs="$future_libdirs $libdir" ;; |
| 1943 | esac |
| 1944 | fi |
| 1945 | |
| 1946 | dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" |
| 1947 | test "X$dir" = "X$file/" && dir= |
| 1948 | dir="$dir$objdir" |
| 1949 | |
| 1950 | # See the names of the shared library. |
| 1951 | set dummy $library_names |
| 1952 | if test -n "$2"; then |
| 1953 | realname="$2" |
| 1954 | shift |
| 1955 | shift |
| 1956 | |
| 1957 | # Install the shared library and build the symlinks. |
| 1958 | $show "$install_prog $dir/$realname $destdir/$realname" |
| 1959 | $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? |
| 1960 | test "X$dlname" = "X$realname" && dlname= |
| 1961 | |
| 1962 | if test $# -gt 0; then |
| 1963 | # Delete the old symlinks. |
| 1964 | rmcmd="$rm" |
| 1965 | for linkname |
| 1966 | do |
| 1967 | if test "X$linkname" != "X$realname"; then |
| 1968 | rmcmd="$rmcmd $destdir/$linkname" |
| 1969 | fi |
| 1970 | done |
| 1971 | $show "$rmcmd" |
| 1972 | $run $rmcmd |
| 1973 | |
| 1974 | # ... and create new ones. |
| 1975 | for linkname |
| 1976 | do |
| 1977 | if test "X$linkname" != "X$realname"; then |
| 1978 | test "X$dlname" = "X$linkname" && dlname= |
| 1979 | $show "(cd $destdir && $LN_S $realname $linkname)" |
| 1980 | $run eval "(cd $destdir && $LN_S $realname $linkname)" |
| 1981 | fi |
| 1982 | done |
| 1983 | fi |
| 1984 | |
| 1985 | if test -n "$dlname"; then |
| 1986 | # Install the dynamically-loadable library. |
| 1987 | $show "$install_prog $dir/$dlname $destdir/$dlname" |
| 1988 | $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? |
| 1989 | fi |
| 1990 | |
| 1991 | # Do each command in the postinstall commands. |
| 1992 | lib="$destdir/$realname" |
| 1993 | eval cmds=\"$postinstall_cmds\" |
| 1994 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 1995 | for cmd in $cmds; do |
| 1996 | IFS="$save_ifs" |
| 1997 | $show "$cmd" |
| 1998 | $run eval "$cmd" || exit $? |
| 1999 | done |
| 2000 | IFS="$save_ifs" |
| 2001 | fi |
| 2002 | |
| 2003 | # Install the pseudo-library for information purposes. |
| 2004 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 2005 | $show "$install_prog $file $destdir/$name" |
| 2006 | $run eval "$install_prog $file $destdir/$name" || exit $? |
| 2007 | |
| 2008 | # Maybe install the static library, too. |
| 2009 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
| 2010 | ;; |
| 2011 | |
| 2012 | *.lo) |
| 2013 | # Install (i.e. copy) a libtool object. |
| 2014 | |
| 2015 | # Figure out destination file name, if it wasn't already specified. |
| 2016 | if test -n "$destname"; then |
| 2017 | destfile="$destdir/$destname" |
| 2018 | else |
| 2019 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 2020 | destfile="$destdir/$destfile" |
| 2021 | fi |
| 2022 | |
| 2023 | # Deduce the name of the destination old-style object file. |
| 2024 | case "$destfile" in |
| 2025 | *.lo) |
| 2026 | staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` |
| 2027 | ;; |
| 2028 | *.o | *.obj) |
| 2029 | staticdest="$destfile" |
| 2030 | destfile= |
| 2031 | ;; |
| 2032 | *) |
| 2033 | $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 |
| 2034 | $echo "$help" 1>&2 |
| 2035 | exit 1 |
| 2036 | ;; |
| 2037 | esac |
| 2038 | |
| 2039 | # Install the libtool object if requested. |
| 2040 | if test -n "$destfile"; then |
| 2041 | $show "$install_prog $file $destfile" |
| 2042 | $run eval "$install_prog $file $destfile" || exit $? |
| 2043 | fi |
| 2044 | |
| 2045 | # Install the old object if enabled. |
| 2046 | if test "$build_old_libs" = yes; then |
| 2047 | # Deduce the name of the old-style object file. |
| 2048 | staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` |
| 2049 | |
| 2050 | $show "$install_prog $staticobj $staticdest" |
| 2051 | $run eval "$install_prog \$staticobj \$staticdest" || exit $? |
| 2052 | fi |
| 2053 | exit 0 |
| 2054 | ;; |
| 2055 | |
| 2056 | *) |
| 2057 | # Figure out destination file name, if it wasn't already specified. |
| 2058 | if test -n "$destname"; then |
| 2059 | destfile="$destdir/$destname" |
| 2060 | else |
| 2061 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 2062 | destfile="$destdir/$destfile" |
| 2063 | fi |
| 2064 | |
| 2065 | # Do a test to see if this is really a libtool program. |
| 2066 | if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 2067 | link_against_libtool_libs= |
| 2068 | finalize_command= |
| 2069 | |
| 2070 | # If there is no directory component, then add one. |
| 2071 | case "$file" in |
| 2072 | */* | *\\*) . $file ;; |
| 2073 | *) . ./$file ;; |
| 2074 | esac |
| 2075 | |
| 2076 | # Check the variables that should have been set. |
| 2077 | if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then |
| 2078 | $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 |
| 2079 | exit 1 |
| 2080 | fi |
| 2081 | |
| 2082 | finalize=yes |
| 2083 | for lib in $link_against_libtool_libs; do |
| 2084 | # Check to see that each library is installed. |
| 2085 | libdir= |
| 2086 | if test -f "$lib"; then |
| 2087 | # If there is no directory component, then add one. |
| 2088 | case "$lib" in |
| 2089 | */* | *\\*) . $lib ;; |
| 2090 | *) . ./$lib ;; |
| 2091 | esac |
| 2092 | fi |
| 2093 | libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" |
| 2094 | if test -n "$libdir" && test ! -f "$libfile"; then |
| 2095 | $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 |
| 2096 | finalize=no |
| 2097 | fi |
| 2098 | done |
| 2099 | |
| 2100 | if test "$hardcode_action" = relink; then |
| 2101 | if test "$finalize" = yes; then |
| 2102 | $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 |
| 2103 | $show "$finalize_command" |
| 2104 | if $run eval "$finalize_command"; then : |
| 2105 | else |
| 2106 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
| 2107 | continue |
| 2108 | fi |
| 2109 | file="$objdir/$file"T |
| 2110 | else |
| 2111 | $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 |
| 2112 | fi |
| 2113 | else |
| 2114 | # Install the binary that we compiled earlier. |
| 2115 | file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` |
| 2116 | fi |
| 2117 | fi |
| 2118 | |
| 2119 | $show "$install_prog$stripme $file $destfile" |
| 2120 | $run eval "$install_prog\$stripme \$file \$destfile" || exit $? |
| 2121 | ;; |
| 2122 | esac |
| 2123 | done |
| 2124 | |
| 2125 | for file in $staticlibs; do |
| 2126 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 2127 | |
| 2128 | # Set up the ranlib parameters. |
| 2129 | oldlib="$destdir/$name" |
| 2130 | |
| 2131 | $show "$install_prog $file $oldlib" |
| 2132 | $run eval "$install_prog \$file \$oldlib" || exit $? |
| 2133 | |
| 2134 | # Do each command in the postinstall commands. |
| 2135 | eval cmds=\"$old_postinstall_cmds\" |
| 2136 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 2137 | for cmd in $cmds; do |
| 2138 | IFS="$save_ifs" |
| 2139 | $show "$cmd" |
| 2140 | $run eval "$cmd" || exit $? |
| 2141 | done |
| 2142 | IFS="$save_ifs" |
| 2143 | done |
| 2144 | |
| 2145 | if test -n "$future_libdirs"; then |
| 2146 | $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 |
| 2147 | fi |
| 2148 | |
| 2149 | if test -n "$current_libdirs"; then |
| 2150 | # Maybe just do a dry run. |
| 2151 | test -n "$run" && current_libdirs=" -n$current_libdirs" |
| 2152 | exec $SHELL $0 --finish$current_libdirs |
| 2153 | exit 1 |
| 2154 | fi |
| 2155 | |
| 2156 | exit 0 |
| 2157 | ;; |
| 2158 | |
| 2159 | # libtool finish mode |
| 2160 | finish) |
| 2161 | modename="$modename: finish" |
| 2162 | libdirs="$nonopt" |
| 2163 | admincmds= |
| 2164 | |
| 2165 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
| 2166 | for dir |
| 2167 | do |
| 2168 | libdirs="$libdirs $dir" |
| 2169 | done |
| 2170 | |
| 2171 | for libdir in $libdirs; do |
| 2172 | if test -n "$finish_cmds"; then |
| 2173 | # Do each command in the finish commands. |
| 2174 | eval cmds=\"$finish_cmds\" |
| 2175 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 2176 | for cmd in $cmds; do |
| 2177 | IFS="$save_ifs" |
| 2178 | $show "$cmd" |
| 2179 | $run eval "$cmd" || admincmds="$admincmds |
| 2180 | $cmd" |
| 2181 | done |
| 2182 | IFS="$save_ifs" |
| 2183 | fi |
| 2184 | if test -n "$finish_eval"; then |
| 2185 | # Do the single finish_eval. |
| 2186 | eval cmds=\"$finish_eval\" |
| 2187 | $run eval "$cmds" || admincmds="$admincmds |
| 2188 | $cmds" |
| 2189 | fi |
| 2190 | done |
| 2191 | fi |
| 2192 | |
| 2193 | echo "----------------------------------------------------------------------" |
| 2194 | echo "Libraries have been installed in:" |
| 2195 | for libdir in $libdirs; do |
| 2196 | echo " $libdir" |
| 2197 | done |
| 2198 | echo |
| 2199 | echo "To link against installed libraries in a given directory, LIBDIR," |
| 2200 | echo "you must use the \`-LLIBDIR' flag during linking." |
| 2201 | echo |
| 2202 | echo " You will also need to do at least one of the following:" |
| 2203 | if test -n "$shlibpath_var"; then |
| 2204 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
| 2205 | echo " during execution" |
| 2206 | fi |
| 2207 | if test -n "$runpath_var"; then |
| 2208 | echo " - add LIBDIR to the \`$runpath_var' environment variable" |
| 2209 | echo " during linking" |
| 2210 | fi |
| 2211 | if test -n "$hardcode_libdir_flag_spec"; then |
| 2212 | libdir=LIBDIR |
| 2213 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 2214 | |
| 2215 | echo " - use the \`$flag' linker flag" |
| 2216 | fi |
| 2217 | if test -n "$admincmds"; then |
| 2218 | echo " - have your system administrator run these commands:$admincmds" |
| 2219 | fi |
| 2220 | if test -f /etc/ld.so.conf; then |
| 2221 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
| 2222 | fi |
| 2223 | echo |
| 2224 | echo "See any operating system documentation about shared libraries for" |
| 2225 | echo "more information, such as the ld(1) and ld.so(8) manual pages." |
| 2226 | echo "----------------------------------------------------------------------" |
| 2227 | exit 0 |
| 2228 | ;; |
| 2229 | |
| 2230 | # libtool execute mode |
| 2231 | execute) |
| 2232 | modename="$modename: execute" |
| 2233 | |
| 2234 | # The first argument is the command name. |
| 2235 | cmd="$nonopt" |
| 2236 | if test -z "$cmd"; then |
| 2237 | $echo "$modename: you must specify a COMMAND" 1>&2 |
| 2238 | $echo "$help" |
| 2239 | exit 1 |
| 2240 | fi |
| 2241 | |
| 2242 | # Handle -dlopen flags immediately. |
| 2243 | for file in $execute_dlfiles; do |
| 2244 | if test ! -f "$file"; then |
| 2245 | $echo "$modename: \`$file' is not a file" 1>&2 |
| 2246 | $echo "$help" 1>&2 |
| 2247 | exit 1 |
| 2248 | fi |
| 2249 | |
| 2250 | dir= |
| 2251 | case "$file" in |
| 2252 | *.la) |
| 2253 | # Check to see that this really is a libtool archive. |
| 2254 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
| 2255 | else |
| 2256 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
| 2257 | $echo "$help" 1>&2 |
| 2258 | exit 1 |
| 2259 | fi |
| 2260 | |
| 2261 | # Read the libtool library. |
| 2262 | dlname= |
| 2263 | library_names= |
| 2264 | |
| 2265 | # If there is no directory component, then add one. |
| 2266 | case "$file" in |
| 2267 | */* | *\\*) . $file ;; |
| 2268 | *) . ./$file ;; |
| 2269 | esac |
| 2270 | |
| 2271 | # Skip this library if it cannot be dlopened. |
| 2272 | if test -z "$dlname"; then |
| 2273 | # Warn if it was a shared library. |
| 2274 | test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" |
| 2275 | continue |
| 2276 | fi |
| 2277 | |
| 2278 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 2279 | test "X$dir" = "X$file" && dir=. |
| 2280 | |
| 2281 | if test -f "$dir/$objdir/$dlname"; then |
| 2282 | dir="$dir/$objdir" |
| 2283 | else |
| 2284 | $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 |
| 2285 | exit 1 |
| 2286 | fi |
| 2287 | ;; |
| 2288 | |
| 2289 | *.lo) |
| 2290 | # Just add the directory containing the .lo file. |
| 2291 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 2292 | test "X$dir" = "X$file" && dir=. |
| 2293 | ;; |
| 2294 | |
| 2295 | *) |
| 2296 | $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 |
| 2297 | continue |
| 2298 | ;; |
| 2299 | esac |
| 2300 | |
| 2301 | # Get the absolute pathname. |
| 2302 | absdir=`cd "$dir" && pwd` |
| 2303 | test -n "$absdir" && dir="$absdir" |
| 2304 | |
| 2305 | # Now add the directory to shlibpath_var. |
| 2306 | if eval "test -z \"\$$shlibpath_var\""; then |
| 2307 | eval "$shlibpath_var=\"\$dir\"" |
| 2308 | else |
| 2309 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
| 2310 | fi |
| 2311 | done |
| 2312 | |
| 2313 | # This variable tells wrapper scripts just to set shlibpath_var |
| 2314 | # rather than running their programs. |
| 2315 | libtool_execute_magic="$magic" |
| 2316 | |
| 2317 | # Check if any of the arguments is a wrapper script. |
| 2318 | args= |
| 2319 | for file |
| 2320 | do |
| 2321 | case "$file" in |
| 2322 | -*) ;; |
| 2323 | *) |
| 2324 | # Do a test to see if this is really a libtool program. |
| 2325 | if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 2326 | # If there is no directory component, then add one. |
| 2327 | case "$file" in |
| 2328 | */* | *\\*) . $file ;; |
| 2329 | *) . ./$file ;; |
| 2330 | esac |
| 2331 | |
| 2332 | # Transform arg to wrapped name. |
| 2333 | file="$progdir/$program" |
| 2334 | fi |
| 2335 | ;; |
| 2336 | esac |
| 2337 | # Quote arguments (to preserve shell metacharacters). |
| 2338 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
| 2339 | args="$args \"$file\"" |
| 2340 | done |
| 2341 | |
| 2342 | if test -z "$run"; then |
| 2343 | # Export the shlibpath_var. |
| 2344 | eval "export $shlibpath_var" |
| 2345 | |
| 2346 | # Restore saved enviroment variables |
| 2347 | if test "${save_LC_ALL+set}" = set; then |
| 2348 | LC_ALL="$save_LC_ALL"; export LC_ALL |
| 2349 | fi |
| 2350 | if test "${save_LANG+set}" = set; then |
| 2351 | LANG="$save_LANG"; export LANG |
| 2352 | fi |
| 2353 | |
| 2354 | # Now actually exec the command. |
| 2355 | eval "exec \$cmd$args" |
| 2356 | |
| 2357 | $echo "$modename: cannot exec \$cmd$args" |
| 2358 | exit 1 |
| 2359 | else |
| 2360 | # Display what would be done. |
| 2361 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
| 2362 | $echo "export $shlibpath_var" |
| 2363 | $echo "$cmd$args" |
| 2364 | exit 0 |
| 2365 | fi |
| 2366 | ;; |
| 2367 | |
| 2368 | # libtool uninstall mode |
| 2369 | uninstall) |
| 2370 | modename="$modename: uninstall" |
| 2371 | rm="$nonopt" |
| 2372 | files= |
| 2373 | |
| 2374 | for arg |
| 2375 | do |
| 2376 | case "$arg" in |
| 2377 | -*) rm="$rm $arg" ;; |
| 2378 | *) files="$files $arg" ;; |
| 2379 | esac |
| 2380 | done |
| 2381 | |
| 2382 | if test -z "$rm"; then |
| 2383 | $echo "$modename: you must specify an RM program" 1>&2 |
| 2384 | $echo "$help" 1>&2 |
| 2385 | exit 1 |
| 2386 | fi |
| 2387 | |
| 2388 | for file in $files; do |
| 2389 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 2390 | test "X$dir" = "X$file" && dir=. |
| 2391 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 2392 | |
| 2393 | rmfiles="$file" |
| 2394 | |
| 2395 | case "$name" in |
| 2396 | *.la) |
| 2397 | # Possibly a libtool archive, so verify it. |
| 2398 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 2399 | . $dir/$name |
| 2400 | |
| 2401 | # Delete the libtool libraries and symlinks. |
| 2402 | for n in $library_names; do |
| 2403 | rmfiles="$rmfiles $dir/$n" |
| 2404 | test "X$n" = "X$dlname" && dlname= |
| 2405 | done |
| 2406 | test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" |
| 2407 | test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" |
| 2408 | |
| 2409 | $show "$rm $rmfiles" |
| 2410 | $run $rm $rmfiles |
| 2411 | |
| 2412 | if test -n "$library_names"; then |
| 2413 | # Do each command in the postuninstall commands. |
| 2414 | eval cmds=\"$postuninstall_cmds\" |
| 2415 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 2416 | for cmd in $cmds; do |
| 2417 | IFS="$save_ifs" |
| 2418 | $show "$cmd" |
| 2419 | $run eval "$cmd" |
| 2420 | done |
| 2421 | IFS="$save_ifs" |
| 2422 | fi |
| 2423 | |
| 2424 | if test -n "$old_library"; then |
| 2425 | # Do each command in the old_postuninstall commands. |
| 2426 | eval cmds=\"$old_postuninstall_cmds\" |
| 2427 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' |
| 2428 | for cmd in $cmds; do |
| 2429 | IFS="$save_ifs" |
| 2430 | $show "$cmd" |
| 2431 | $run eval "$cmd" |
| 2432 | done |
| 2433 | IFS="$save_ifs" |
| 2434 | fi |
| 2435 | |
| 2436 | # FIXME: should reinstall the best remaining shared library. |
| 2437 | fi |
| 2438 | ;; |
| 2439 | |
| 2440 | *.lo) |
| 2441 | if test "$build_old_libs" = yes; then |
| 2442 | oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` |
| 2443 | rmfiles="$rmfiles $dir/$oldobj" |
| 2444 | fi |
| 2445 | $show "$rm $rmfiles" |
| 2446 | $run $rm $rmfiles |
| 2447 | ;; |
| 2448 | |
| 2449 | *) |
| 2450 | $show "$rm $rmfiles" |
| 2451 | $run $rm $rmfiles |
| 2452 | ;; |
| 2453 | esac |
| 2454 | done |
| 2455 | exit 0 |
| 2456 | ;; |
| 2457 | |
| 2458 | "") |
| 2459 | $echo "$modename: you must specify a MODE" 1>&2 |
| 2460 | $echo "$generic_help" 1>&2 |
| 2461 | exit 1 |
| 2462 | ;; |
| 2463 | esac |
| 2464 | |
| 2465 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
| 2466 | $echo "$generic_help" 1>&2 |
| 2467 | exit 1 |
| 2468 | fi # test -z "$show_help" |
| 2469 | |
| 2470 | # We need to display help for each of the modes. |
| 2471 | case "$mode" in |
| 2472 | "") $echo \ |
| 2473 | "Usage: $modename [OPTION]... [MODE-ARG]... |
| 2474 | |
| 2475 | Provide generalized library-building support services. |
| 2476 | |
| 2477 | --config show all configuration variables |
| 2478 | --debug enable verbose shell tracing |
| 2479 | -n, --dry-run display commands without modifying any files |
| 2480 | --features display basic configuration information and exit |
| 2481 | --finish same as \`--mode=finish' |
| 2482 | --help display this help message and exit |
| 2483 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] |
| 2484 | --quiet same as \`--silent' |
| 2485 | --silent don't print informational messages |
| 2486 | --version print version information |
| 2487 | |
| 2488 | MODE must be one of the following: |
| 2489 | |
| 2490 | compile compile a source file into a libtool object |
| 2491 | execute automatically set library path, then run a program |
| 2492 | finish complete the installation of libtool libraries |
| 2493 | install install libraries or executables |
| 2494 | link create a library or an executable |
| 2495 | uninstall remove libraries from an installed directory |
| 2496 | |
| 2497 | MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for |
| 2498 | a more detailed description of MODE." |
| 2499 | exit 0 |
| 2500 | ;; |
| 2501 | |
| 2502 | compile) |
| 2503 | $echo \ |
| 2504 | "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
| 2505 | |
| 2506 | Compile a source file into a libtool library object. |
| 2507 | |
| 2508 | This mode accepts the following additional options: |
| 2509 | |
| 2510 | -static always build a \`.o' file suitable for static linking |
| 2511 | |
| 2512 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
| 2513 | from the given SOURCEFILE. |
| 2514 | |
| 2515 | The output file name is determined by removing the directory component from |
| 2516 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
| 2517 | library object suffix, \`.lo'." |
| 2518 | ;; |
| 2519 | |
| 2520 | execute) |
| 2521 | $echo \ |
| 2522 | "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... |
| 2523 | |
| 2524 | Automatically set library path, then run a program. |
| 2525 | |
| 2526 | This mode accepts the following additional options: |
| 2527 | |
| 2528 | -dlopen FILE add the directory containing FILE to the library path |
| 2529 | |
| 2530 | This mode sets the library path environment variable according to \`-dlopen' |
| 2531 | flags. |
| 2532 | |
| 2533 | If any of the ARGS are libtool executable wrappers, then they are translated |
| 2534 | into their corresponding uninstalled binary, and any of their required library |
| 2535 | directories are added to the library path. |
| 2536 | |
| 2537 | Then, COMMAND is executed, with ARGS as arguments." |
| 2538 | ;; |
| 2539 | |
| 2540 | finish) |
| 2541 | $echo \ |
| 2542 | "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... |
| 2543 | |
| 2544 | Complete the installation of libtool libraries. |
| 2545 | |
| 2546 | Each LIBDIR is a directory that contains libtool libraries. |
| 2547 | |
| 2548 | The commands that this mode executes may require superuser privileges. Use |
| 2549 | the \`--dry-run' option if you just want to see what would be executed." |
| 2550 | ;; |
| 2551 | |
| 2552 | install) |
| 2553 | $echo \ |
| 2554 | "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... |
| 2555 | |
| 2556 | Install executables or libraries. |
| 2557 | |
| 2558 | INSTALL-COMMAND is the installation command. The first component should be |
| 2559 | either the \`install' or \`cp' program. |
| 2560 | |
| 2561 | The rest of the components are interpreted as arguments to that command (only |
| 2562 | BSD-compatible install options are recognized)." |
| 2563 | ;; |
| 2564 | |
| 2565 | link) |
| 2566 | $echo \ |
| 2567 | "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... |
| 2568 | |
| 2569 | Link object files or libraries together to form another library, or to |
| 2570 | create an executable program. |
| 2571 | |
| 2572 | LINK-COMMAND is a command using the C compiler that you would use to create |
| 2573 | a program from several object files. |
| 2574 | |
| 2575 | The following components of LINK-COMMAND are treated specially: |
| 2576 | |
| 2577 | -all-static do not do any dynamic linking at all |
| 2578 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
| 2579 | -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols |
| 2580 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
| 2581 | -LLIBDIR search LIBDIR for required installed libraries |
| 2582 | -lNAME OUTPUT-FILE requires the installed library libNAME |
| 2583 | -no-undefined declare that a library does not refer to external symbols |
| 2584 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
| 2585 | -release RELEASE specify package release information |
| 2586 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
| 2587 | -static do not do any dynamic linking of libtool libraries |
| 2588 | -version-info CURRENT[:REVISION[:AGE]] |
| 2589 | specify library version info [each variable defaults to 0] |
| 2590 | |
| 2591 | All other options (arguments beginning with \`-') are ignored. |
| 2592 | |
| 2593 | Every other argument is treated as a filename. Files ending in \`.la' are |
| 2594 | treated as uninstalled libtool libraries, other files are standard or library |
| 2595 | object files. |
| 2596 | |
| 2597 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only |
| 2598 | library objects (\`.lo' files) may be specified, and \`-rpath' is required. |
| 2599 | |
| 2600 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
| 2601 | using \`ar' and \`ranlib', or on WIndows using \`lib'. |
| 2602 | |
| 2603 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
| 2604 | is created, otherwise an executable program is created." |
| 2605 | ;; |
| 2606 | |
| 2607 | uninstall) |
| 2608 | $echo |
| 2609 | "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
| 2610 | |
| 2611 | Remove libraries from an installation directory. |
| 2612 | |
| 2613 | RM is the name of the program to use to delete files associated with each FILE |
| 2614 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 2615 | to RM. |
| 2616 | |
| 2617 | If FILE is a libtool library, all the files associated with it are deleted. |
| 2618 | Otherwise, only FILE itself is deleted using RM." |
| 2619 | ;; |
| 2620 | |
| 2621 | *) |
| 2622 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
| 2623 | $echo "$help" 1>&2 |
| 2624 | exit 1 |
| 2625 | ;; |
| 2626 | esac |
| 2627 | |
| 2628 | echo |
| 2629 | $echo "Try \`$modename --help' for more information about other modes." |
| 2630 | |
| 2631 | exit 0 |
| 2632 | |
| 2633 | # Local Variables: |
| 2634 | # mode:shell-script |
| 2635 | # sh-indentation:2 |
| 2636 | # End: |