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