annotate kdiff3/admin/ltmain.sh @ 60:4732f709a8cb

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