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