annotate ltmain.sh @ 0:d39e1d0d75b6

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