Parent Directory
|
Revision Log
Load pcre-6.3 into code/trunk.
| 1 | nigel | 41 | # ltmain.sh - Provide generalized library-building support services. |
| 2 | nigel | 53 | # NOTE: Changing this file will not affect anything until you rerun configure. |
| 3 | nigel | 41 | # |
| 4 | nigel | 83 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 |
| 5 | nigel | 53 | # Free Software Foundation, Inc. |
| 6 | nigel | 41 | # 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 | nigel | 83 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 21 | nigel | 41 | # |
| 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 | nigel | 75 | 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 | nigel | 83 | # define SED for historic ltconfig's generated by Libtool 1.3 |
| 37 | test -z "$SED" && SED=sed | ||
| 38 | nigel | 75 | |
| 39 | # The name of this program: | ||
| 40 | progname=`echo "$progpath" | $SED $basename` | ||
| 41 | modename="$progname" | ||
| 42 | |||
| 43 | # Global variables: | ||
| 44 | EXIT_SUCCESS=0 | ||
| 45 | EXIT_FAILURE=1 | ||
| 46 | |||
| 47 | PROGRAM=ltmain.sh | ||
| 48 | PACKAGE=libtool | ||
| 49 | nigel | 83 | VERSION=1.5.18 |
| 50 | TIMESTAMP=" (1.1220.2.246 2005/05/16 10:00:18)" | ||
| 51 | nigel | 75 | |
| 52 | # See if we are running on zsh, and set the options which allow our | ||
| 53 | # commands through without removal of \ escapes. | ||
| 54 | if test -n "${ZSH_VERSION+set}" ; then | ||
| 55 | setopt NO_GLOB_SUBST | ||
| 56 | fi | ||
| 57 | nigel | 83 | # Same for EGREP, and just to be sure, do LTCC as well |
| 58 | if test "X$EGREP" = X ; then | ||
| 59 | EGREP=egrep | ||
| 60 | fi | ||
| 61 | if test "X$LTCC" = X ; then | ||
| 62 | LTCC=${CC-gcc} | ||
| 63 | fi | ||
| 64 | nigel | 75 | |
| 65 | nigel | 41 | # Check that we have a working $echo. |
| 66 | if test "X$1" = X--no-reexec; then | ||
| 67 | # Discard the --no-reexec flag, and continue. | ||
| 68 | shift | ||
| 69 | elif test "X$1" = X--fallback-echo; then | ||
| 70 | # Avoid inline document here, it may be left over | ||
| 71 | : | ||
| 72 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then | ||
| 73 | # Yippee, $echo works! | ||
| 74 | : | ||
| 75 | else | ||
| 76 | # Restart under the correct shell, and then maybe $echo will work. | ||
| 77 | nigel | 75 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
| 78 | nigel | 41 | fi |
| 79 | |||
| 80 | if test "X$1" = X--fallback-echo; then | ||
| 81 | # used as fallback echo | ||
| 82 | shift | ||
| 83 | cat <<EOF | ||
| 84 | $* | ||
| 85 | EOF | ||
| 86 | nigel | 75 | exit $EXIT_SUCCESS |
| 87 | nigel | 41 | fi |
| 88 | |||
| 89 | default_mode= | ||
| 90 | help="Try \`$progname --help' for more information." | ||
| 91 | magic="%%%MAGIC variable%%%" | ||
| 92 | mkdir="mkdir" | ||
| 93 | mv="mv -f" | ||
| 94 | rm="rm -f" | ||
| 95 | |||
| 96 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
| 97 | # metacharacters that are still active within double-quoted strings. | ||
| 98 | nigel | 63 | Xsed="${SED}"' -e 1s/^X//' |
| 99 | nigel | 41 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
| 100 | nigel | 75 | # test EBCDIC or ASCII |
| 101 | case `echo A|tr A '\301'` in | ||
| 102 | A) # EBCDIC based system | ||
| 103 | SP2NL="tr '\100' '\n'" | ||
| 104 | NL2SP="tr '\r\n' '\100\100'" | ||
| 105 | ;; | ||
| 106 | *) # Assume ASCII based system | ||
| 107 | SP2NL="tr '\040' '\012'" | ||
| 108 | NL2SP="tr '\015\012' '\040\040'" | ||
| 109 | ;; | ||
| 110 | esac | ||
| 111 | nigel | 41 | |
| 112 | # NLS nuisances. | ||
| 113 | # Only set LANG and LC_ALL to C if already set. | ||
| 114 | # These must not be set unconditionally because not all systems understand | ||
| 115 | # e.g. LANG=C (notably SCO). | ||
| 116 | # We save the old values to restore during execute mode. | ||
| 117 | if test "${LC_ALL+set}" = set; then | ||
| 118 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL | ||
| 119 | fi | ||
| 120 | if test "${LANG+set}" = set; then | ||
| 121 | save_LANG="$LANG"; LANG=C; export LANG | ||
| 122 | fi | ||
| 123 | |||
| 124 | nigel | 63 | # Make sure IFS has a sensible default |
| 125 | nigel | 83 | lt_nl=' |
| 126 | ' | ||
| 127 | IFS=" $lt_nl" | ||
| 128 | nigel | 63 | |
| 129 | nigel | 41 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 130 | nigel | 75 | $echo "$modename: not configured to build any kind of library" 1>&2 |
| 131 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | ||
| 132 | exit $EXIT_FAILURE | ||
| 133 | nigel | 41 | fi |
| 134 | |||
| 135 | # Global variables. | ||
| 136 | mode=$default_mode | ||
| 137 | nonopt= | ||
| 138 | prev= | ||
| 139 | prevopt= | ||
| 140 | run= | ||
| 141 | show="$echo" | ||
| 142 | show_help= | ||
| 143 | execute_dlfiles= | ||
| 144 | lo2o="s/\\.lo\$/.${objext}/" | ||
| 145 | o2lo="s/\\.${objext}\$/.lo/" | ||
| 146 | nigel | 83 | quote_scanset='[[~#^*{};<>?'"'"' ]' |
| 147 | nigel | 41 | |
| 148 | nigel | 83 | if test -z "$max_cmd_len"; then |
| 149 | i=0 | ||
| 150 | testring="ABCD" | ||
| 151 | new_result= | ||
| 152 | |||
| 153 | # If test is not a shell built-in, we'll probably end up computing a | ||
| 154 | # maximum length that is only half of the actual maximum length, but | ||
| 155 | # we can't tell. | ||
| 156 | while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ | ||
| 157 | = "XX$testring") >/dev/null 2>&1 && | ||
| 158 | new_result=`expr "X$testring" : ".*" 2>&1` && | ||
| 159 | max_cmd_len="$new_result" && | ||
| 160 | test "$i" != 17 # 1/2 MB should be enough | ||
| 161 | do | ||
| 162 | i=`expr $i + 1` | ||
| 163 | testring="$testring$testring" | ||
| 164 | done | ||
| 165 | testring= | ||
| 166 | # Add a significant safety factor because C++ compilers can tack on massive | ||
| 167 | # amounts of additional arguments before passing them to the linker. | ||
| 168 | # It appears as though 1/2 is a usable value. | ||
| 169 | max_cmd_len=`expr $max_cmd_len \/ 2` | ||
| 170 | fi | ||
| 171 | |||
| 172 | nigel | 75 | ##################################### |
| 173 | # Shell function definitions: | ||
| 174 | # This seems to be the best place for them | ||
| 175 | |||
| 176 | # func_win32_libid arg | ||
| 177 | # return the library type of file 'arg' | ||
| 178 | # | ||
| 179 | # Need a lot of goo to handle *both* DLLs and import libs | ||
| 180 | # Has to be a shell function in order to 'eat' the argument | ||
| 181 | # that is supplied when $file_magic_command is called. | ||
| 182 | nigel | 83 | func_win32_libid () |
| 183 | { | ||
| 184 | nigel | 75 | win32_libid_type="unknown" |
| 185 | win32_fileres=`file -L $1 2>/dev/null` | ||
| 186 | case $win32_fileres in | ||
| 187 | *ar\ archive\ import\ library*) # definitely import | ||
| 188 | win32_libid_type="x86 archive import" | ||
| 189 | ;; | ||
| 190 | *ar\ archive*) # could be an import, or static | ||
| 191 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ | ||
| 192 | $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then | ||
| 193 | win32_nmres=`eval $NM -f posix -A $1 | \ | ||
| 194 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` | ||
| 195 | if test "X$win32_nmres" = "Ximport" ; then | ||
| 196 | win32_libid_type="x86 archive import" | ||
| 197 | else | ||
| 198 | win32_libid_type="x86 archive static" | ||
| 199 | fi | ||
| 200 | fi | ||
| 201 | ;; | ||
| 202 | *DLL*) | ||
| 203 | win32_libid_type="x86 DLL" | ||
| 204 | ;; | ||
| 205 | *executable*) # but shell scripts are "executable" too... | ||
| 206 | case $win32_fileres in | ||
| 207 | *MS\ Windows\ PE\ Intel*) | ||
| 208 | win32_libid_type="x86 DLL" | ||
| 209 | ;; | ||
| 210 | esac | ||
| 211 | ;; | ||
| 212 | esac | ||
| 213 | $echo $win32_libid_type | ||
| 214 | } | ||
| 215 | |||
| 216 | |||
| 217 | # func_infer_tag arg | ||
| 218 | # Infer tagged configuration to use if any are available and | ||
| 219 | # if one wasn't chosen via the "--tag" command line option. | ||
| 220 | # Only attempt this if the compiler in the base compile | ||
| 221 | # command doesn't match the default compiler. | ||
| 222 | # arg is usually of the form 'gcc ...' | ||
| 223 | nigel | 83 | func_infer_tag () |
| 224 | { | ||
| 225 | nigel | 75 | if test -n "$available_tags" && test -z "$tagname"; then |
| 226 | CC_quoted= | ||
| 227 | for arg in $CC; do | ||
| 228 | case $arg in | ||
| 229 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 230 | nigel | 75 | arg="\"$arg\"" |
| 231 | ;; | ||
| 232 | esac | ||
| 233 | CC_quoted="$CC_quoted $arg" | ||
| 234 | done | ||
| 235 | case $@ in | ||
| 236 | # Blanks in the command may have been stripped by the calling shell, | ||
| 237 | # but not from the CC environment variable when configure was run. | ||
| 238 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; | ||
| 239 | # Blanks at the start of $base_compile will cause this to fail | ||
| 240 | # if we don't check for them as well. | ||
| 241 | *) | ||
| 242 | for z in $available_tags; do | ||
| 243 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | ||
| 244 | # Evaluate the configuration. | ||
| 245 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | ||
| 246 | CC_quoted= | ||
| 247 | for arg in $CC; do | ||
| 248 | # Double-quote args containing other shell metacharacters. | ||
| 249 | case $arg in | ||
| 250 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 251 | nigel | 75 | arg="\"$arg\"" |
| 252 | ;; | ||
| 253 | esac | ||
| 254 | CC_quoted="$CC_quoted $arg" | ||
| 255 | done | ||
| 256 | nigel | 83 | # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc' |
| 257 | trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"` | ||
| 258 | # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc | ||
| 259 | extendcc=${host}-${CC} | ||
| 260 | nigel | 75 | case "$@ " in |
| 261 | nigel | 83 | "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\ |
| 262 | "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*) | ||
| 263 | tagname=CC | ||
| 264 | break ;; | ||
| 265 | "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\ | ||
| 266 | "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\ | ||
| 267 | nigel | 75 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) |
| 268 | # The compiler in the base compile command matches | ||
| 269 | # the one in the tagged configuration. | ||
| 270 | # Assume this is the tagged configuration we want. | ||
| 271 | tagname=$z | ||
| 272 | break | ||
| 273 | ;; | ||
| 274 | esac | ||
| 275 | fi | ||
| 276 | done | ||
| 277 | # If $tagname still isn't set, then no tagged configuration | ||
| 278 | # was found and let the user know that the "--tag" command | ||
| 279 | # line option must be used. | ||
| 280 | if test -z "$tagname"; then | ||
| 281 | $echo "$modename: unable to infer tagged configuration" | ||
| 282 | $echo "$modename: specify a tag with \`--tag'" 1>&2 | ||
| 283 | exit $EXIT_FAILURE | ||
| 284 | # else | ||
| 285 | # $echo "$modename: using $tagname tagged configuration" | ||
| 286 | fi | ||
| 287 | ;; | ||
| 288 | esac | ||
| 289 | fi | ||
| 290 | } | ||
| 291 | |||
| 292 | |||
| 293 | nigel | 83 | # func_extract_an_archive dir oldlib |
| 294 | func_extract_an_archive () | ||
| 295 | { | ||
| 296 | f_ex_an_ar_dir="$1"; shift | ||
| 297 | f_ex_an_ar_oldlib="$1" | ||
| 298 | |||
| 299 | $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" | ||
| 300 | $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? | ||
| 301 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then | ||
| 302 | : | ||
| 303 | else | ||
| 304 | $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 | ||
| 305 | exit $EXIT_FAILURE | ||
| 306 | fi | ||
| 307 | } | ||
| 308 | |||
| 309 | nigel | 75 | # func_extract_archives gentop oldlib ... |
| 310 | nigel | 83 | func_extract_archives () |
| 311 | { | ||
| 312 | nigel | 75 | my_gentop="$1"; shift |
| 313 | my_oldlibs=${1+"$@"} | ||
| 314 | my_oldobjs="" | ||
| 315 | my_xlib="" | ||
| 316 | my_xabs="" | ||
| 317 | my_xdir="" | ||
| 318 | my_status="" | ||
| 319 | |||
| 320 | $show "${rm}r $my_gentop" | ||
| 321 | $run ${rm}r "$my_gentop" | ||
| 322 | $show "$mkdir $my_gentop" | ||
| 323 | $run $mkdir "$my_gentop" | ||
| 324 | my_status=$? | ||
| 325 | if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then | ||
| 326 | exit $my_status | ||
| 327 | fi | ||
| 328 | |||
| 329 | for my_xlib in $my_oldlibs; do | ||
| 330 | # Extract the objects. | ||
| 331 | case $my_xlib in | ||
| 332 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | ||
| 333 | *) my_xabs=`pwd`"/$my_xlib" ;; | ||
| 334 | esac | ||
| 335 | my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` | ||
| 336 | my_xdir="$my_gentop/$my_xlib" | ||
| 337 | |||
| 338 | $show "${rm}r $my_xdir" | ||
| 339 | $run ${rm}r "$my_xdir" | ||
| 340 | $show "$mkdir $my_xdir" | ||
| 341 | $run $mkdir "$my_xdir" | ||
| 342 | status=$? | ||
| 343 | if test "$status" -ne 0 && test ! -d "$my_xdir"; then | ||
| 344 | exit $status | ||
| 345 | fi | ||
| 346 | case $host in | ||
| 347 | *-darwin*) | ||
| 348 | $show "Extracting $my_xabs" | ||
| 349 | # Do not bother doing anything if just a dry run | ||
| 350 | if test -z "$run"; then | ||
| 351 | darwin_orig_dir=`pwd` | ||
| 352 | cd $my_xdir || exit $? | ||
| 353 | darwin_archive=$my_xabs | ||
| 354 | darwin_curdir=`pwd` | ||
| 355 | nigel | 83 | darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` |
| 356 | nigel | 75 | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` |
| 357 | if test -n "$darwin_arches"; then | ||
| 358 | darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` | ||
| 359 | darwin_arch= | ||
| 360 | $show "$darwin_base_archive has multiple architectures $darwin_arches" | ||
| 361 | nigel | 83 | for darwin_arch in $darwin_arches ; do |
| 362 | nigel | 75 | mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 363 | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | ||
| 364 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
| 365 | nigel | 83 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
| 366 | nigel | 75 | cd "$darwin_curdir" |
| 367 | nigel | 83 | $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
| 368 | nigel | 75 | done # $darwin_arches |
| 369 | ## Okay now we have a bunch of thin objects, gotta fatten them up :) | ||
| 370 | nigel | 83 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` |
| 371 | nigel | 75 | darwin_file= |
| 372 | darwin_files= | ||
| 373 | for darwin_file in $darwin_filelist; do | ||
| 374 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` | ||
| 375 | lipo -create -output "$darwin_file" $darwin_files | ||
| 376 | done # $darwin_filelist | ||
| 377 | nigel | 83 | ${rm}r unfat-$$ |
| 378 | nigel | 75 | cd "$darwin_orig_dir" |
| 379 | else | ||
| 380 | nigel | 83 | cd "$darwin_orig_dir" |
| 381 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
| 382 | nigel | 75 | fi # $darwin_arches |
| 383 | fi # $run | ||
| 384 | ;; | ||
| 385 | *) | ||
| 386 | nigel | 83 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 387 | ;; | ||
| 388 | nigel | 75 | esac |
| 389 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` | ||
| 390 | done | ||
| 391 | func_extract_archives_result="$my_oldobjs" | ||
| 392 | } | ||
| 393 | # End of Shell function definitions | ||
| 394 | ##################################### | ||
| 395 | |||
| 396 | # Darwin sucks | ||
| 397 | eval std_shrext=\"$shrext_cmds\" | ||
| 398 | |||
| 399 | nigel | 41 | # Parse our command line options once, thoroughly. |
| 400 | nigel | 75 | while test "$#" -gt 0 |
| 401 | nigel | 41 | do |
| 402 | arg="$1" | ||
| 403 | shift | ||
| 404 | |||
| 405 | nigel | 53 | case $arg in |
| 406 | nigel | 41 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| 407 | *) optarg= ;; | ||
| 408 | esac | ||
| 409 | |||
| 410 | # If the previous option needs an argument, assign it. | ||
| 411 | if test -n "$prev"; then | ||
| 412 | nigel | 53 | case $prev in |
| 413 | nigel | 41 | execute_dlfiles) |
| 414 | nigel | 53 | execute_dlfiles="$execute_dlfiles $arg" |
| 415 | nigel | 41 | ;; |
| 416 | nigel | 75 | tag) |
| 417 | tagname="$arg" | ||
| 418 | preserve_args="${preserve_args}=$arg" | ||
| 419 | |||
| 420 | # Check whether tagname contains only valid characters | ||
| 421 | case $tagname in | ||
| 422 | *[!-_A-Za-z0-9,/]*) | ||
| 423 | $echo "$progname: invalid tag name: $tagname" 1>&2 | ||
| 424 | exit $EXIT_FAILURE | ||
| 425 | ;; | ||
| 426 | esac | ||
| 427 | |||
| 428 | case $tagname in | ||
| 429 | CC) | ||
| 430 | # Don't test for the "default" C tag, as we know, it's there, but | ||
| 431 | # not specially marked. | ||
| 432 | ;; | ||
| 433 | *) | ||
| 434 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then | ||
| 435 | taglist="$taglist $tagname" | ||
| 436 | # Evaluate the configuration. | ||
| 437 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" | ||
| 438 | else | ||
| 439 | $echo "$progname: ignoring unknown tag $tagname" 1>&2 | ||
| 440 | fi | ||
| 441 | ;; | ||
| 442 | esac | ||
| 443 | ;; | ||
| 444 | nigel | 41 | *) |
| 445 | eval "$prev=\$arg" | ||
| 446 | ;; | ||
| 447 | esac | ||
| 448 | |||
| 449 | prev= | ||
| 450 | prevopt= | ||
| 451 | continue | ||
| 452 | fi | ||
| 453 | |||
| 454 | # Have we seen a non-optional argument yet? | ||
| 455 | nigel | 53 | case $arg in |
| 456 | nigel | 41 | --help) |
| 457 | show_help=yes | ||
| 458 | ;; | ||
| 459 | |||
| 460 | --version) | ||
| 461 | nigel | 75 | $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
| 462 | $echo | ||
| 463 | nigel | 83 | $echo "Copyright (C) 2005 Free Software Foundation, Inc." |
| 464 | nigel | 75 | $echo "This is free software; see the source for copying conditions. There is NO" |
| 465 | $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." | ||
| 466 | nigel | 83 | exit $? |
| 467 | nigel | 41 | ;; |
| 468 | |||
| 469 | --config) | ||
| 470 | nigel | 75 | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath |
| 471 | # Now print the configurations for the tags. | ||
| 472 | for tagname in $taglist; do | ||
| 473 | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" | ||
| 474 | done | ||
| 475 | nigel | 83 | exit $? |
| 476 | nigel | 41 | ;; |
| 477 | |||
| 478 | --debug) | ||
| 479 | nigel | 75 | $echo "$progname: enabling shell trace mode" |
| 480 | nigel | 41 | set -x |
| 481 | nigel | 75 | preserve_args="$preserve_args $arg" |
| 482 | nigel | 41 | ;; |
| 483 | |||
| 484 | --dry-run | -n) | ||
| 485 | run=: | ||
| 486 | ;; | ||
| 487 | |||
| 488 | --features) | ||
| 489 | nigel | 75 | $echo "host: $host" |
| 490 | nigel | 41 | if test "$build_libtool_libs" = yes; then |
| 491 | nigel | 75 | $echo "enable shared libraries" |
| 492 | nigel | 41 | else |
| 493 | nigel | 75 | $echo "disable shared libraries" |
| 494 | nigel | 41 | fi |
| 495 | if test "$build_old_libs" = yes; then | ||
| 496 | nigel | 75 | $echo "enable static libraries" |
| 497 | nigel | 41 | else |
| 498 | nigel | 75 | $echo "disable static libraries" |
| 499 | nigel | 41 | fi |
| 500 | nigel | 83 | exit $? |
| 501 | nigel | 41 | ;; |
| 502 | |||
| 503 | --finish) mode="finish" ;; | ||
| 504 | |||
| 505 | --mode) prevopt="--mode" prev=mode ;; | ||
| 506 | --mode=*) mode="$optarg" ;; | ||
| 507 | |||
| 508 | nigel | 63 | --preserve-dup-deps) duplicate_deps="yes" ;; |
| 509 | |||
| 510 | nigel | 41 | --quiet | --silent) |
| 511 | show=: | ||
| 512 | nigel | 75 | preserve_args="$preserve_args $arg" |
| 513 | nigel | 41 | ;; |
| 514 | |||
| 515 | nigel | 75 | --tag) prevopt="--tag" prev=tag ;; |
| 516 | --tag=*) | ||
| 517 | set tag "$optarg" ${1+"$@"} | ||
| 518 | shift | ||
| 519 | prev=tag | ||
| 520 | preserve_args="$preserve_args --tag" | ||
| 521 | ;; | ||
| 522 | |||
| 523 | nigel | 41 | -dlopen) |
| 524 | prevopt="-dlopen" | ||
| 525 | prev=execute_dlfiles | ||
| 526 | ;; | ||
| 527 | |||
| 528 | -*) | ||
| 529 | $echo "$modename: unrecognized option \`$arg'" 1>&2 | ||
| 530 | $echo "$help" 1>&2 | ||
| 531 | nigel | 75 | exit $EXIT_FAILURE |
| 532 | nigel | 41 | ;; |
| 533 | |||
| 534 | *) | ||
| 535 | nonopt="$arg" | ||
| 536 | break | ||
| 537 | ;; | ||
| 538 | esac | ||
| 539 | done | ||
| 540 | |||
| 541 | if test -n "$prevopt"; then | ||
| 542 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 | ||
| 543 | $echo "$help" 1>&2 | ||
| 544 | nigel | 75 | exit $EXIT_FAILURE |
| 545 | nigel | 41 | fi |
| 546 | |||
| 547 | nigel | 63 | # If this variable is set in any of the actions, the command in it |
| 548 | # will be execed at the end. This prevents here-documents from being | ||
| 549 | # left over by shells. | ||
| 550 | exec_cmd= | ||
| 551 | |||
| 552 | nigel | 41 | if test -z "$show_help"; then |
| 553 | |||
| 554 | # Infer the operation mode. | ||
| 555 | if test -z "$mode"; then | ||
| 556 | nigel | 75 | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
| 557 | nigel | 83 | $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 |
| 558 | nigel | 53 | case $nonopt in |
| 559 | nigel | 75 | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
| 560 | nigel | 41 | mode=link |
| 561 | for arg | ||
| 562 | do | ||
| 563 | nigel | 53 | case $arg in |
| 564 | nigel | 41 | -c) |
| 565 | mode=compile | ||
| 566 | break | ||
| 567 | ;; | ||
| 568 | esac | ||
| 569 | done | ||
| 570 | ;; | ||
| 571 | *db | *dbx | *strace | *truss) | ||
| 572 | mode=execute | ||
| 573 | ;; | ||
| 574 | *install*|cp|mv) | ||
| 575 | mode=install | ||
| 576 | ;; | ||
| 577 | *rm) | ||
| 578 | mode=uninstall | ||
| 579 | ;; | ||
| 580 | *) | ||
| 581 | # If we have no mode, but dlfiles were specified, then do execute mode. | ||
| 582 | test -n "$execute_dlfiles" && mode=execute | ||
| 583 | |||
| 584 | # Just use the default operation mode. | ||
| 585 | if test -z "$mode"; then | ||
| 586 | if test -n "$nonopt"; then | ||
| 587 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 | ||
| 588 | else | ||
| 589 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 | ||
| 590 | fi | ||
| 591 | fi | ||
| 592 | ;; | ||
| 593 | esac | ||
| 594 | fi | ||
| 595 | |||
| 596 | # Only execute mode is allowed to have -dlopen flags. | ||
| 597 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | ||
| 598 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 | ||
| 599 | $echo "$help" 1>&2 | ||
| 600 | nigel | 75 | exit $EXIT_FAILURE |
| 601 | nigel | 41 | fi |
| 602 | |||
| 603 | # Change the help message to a mode-specific one. | ||
| 604 | generic_help="$help" | ||
| 605 | help="Try \`$modename --help --mode=$mode' for more information." | ||
| 606 | |||
| 607 | # These modes are in order of execution frequency so that they run quickly. | ||
| 608 | nigel | 53 | case $mode in |
| 609 | nigel | 41 | # libtool compile mode |
| 610 | compile) | ||
| 611 | modename="$modename: compile" | ||
| 612 | # Get the compilation command and the source file. | ||
| 613 | base_compile= | ||
| 614 | nigel | 75 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 615 | suppress_opt=yes | ||
| 616 | nigel | 41 | suppress_output= |
| 617 | nigel | 75 | arg_mode=normal |
| 618 | libobj= | ||
| 619 | later= | ||
| 620 | nigel | 41 | |
| 621 | for arg | ||
| 622 | do | ||
| 623 | nigel | 75 | case "$arg_mode" in |
| 624 | arg ) | ||
| 625 | # do not "continue". Instead, add this to base_compile | ||
| 626 | lastarg="$arg" | ||
| 627 | arg_mode=normal | ||
| 628 | ;; | ||
| 629 | nigel | 53 | |
| 630 | nigel | 75 | target ) |
| 631 | libobj="$arg" | ||
| 632 | arg_mode=normal | ||
| 633 | nigel | 53 | continue |
| 634 | ;; | ||
| 635 | |||
| 636 | nigel | 75 | normal ) |
| 637 | # Accept any command-line options. | ||
| 638 | case $arg in | ||
| 639 | -o) | ||
| 640 | if test -n "$libobj" ; then | ||
| 641 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 | ||
| 642 | exit $EXIT_FAILURE | ||
| 643 | fi | ||
| 644 | arg_mode=target | ||
| 645 | continue | ||
| 646 | ;; | ||
| 647 | nigel | 41 | |
| 648 | nigel | 75 | -static | -prefer-pic | -prefer-non-pic) |
| 649 | later="$later $arg" | ||
| 650 | continue | ||
| 651 | ;; | ||
| 652 | nigel | 53 | |
| 653 | nigel | 75 | -no-suppress) |
| 654 | suppress_opt=no | ||
| 655 | continue | ||
| 656 | ;; | ||
| 657 | nigel | 53 | |
| 658 | nigel | 75 | -Xcompiler) |
| 659 | nigel | 83 | arg_mode=arg # the next one goes into the "base_compile" arg list |
| 660 | continue # The current "srcfile" will either be retained or | ||
| 661 | ;; # replaced later. I would guess that would be a bug. | ||
| 662 | nigel | 53 | |
| 663 | nigel | 75 | -Wc,*) |
| 664 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` | ||
| 665 | lastarg= | ||
| 666 | save_ifs="$IFS"; IFS=',' | ||
| 667 | nigel | 83 | for arg in $args; do |
| 668 | nigel | 75 | IFS="$save_ifs" |
| 669 | nigel | 53 | |
| 670 | nigel | 75 | # Double-quote args containing other shell metacharacters. |
| 671 | # Many Bourne shells cannot handle close brackets correctly | ||
| 672 | # in scan sets, so we specify it separately. | ||
| 673 | case $arg in | ||
| 674 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 675 | nigel | 75 | arg="\"$arg\"" |
| 676 | ;; | ||
| 677 | esac | ||
| 678 | lastarg="$lastarg $arg" | ||
| 679 | done | ||
| 680 | nigel | 53 | IFS="$save_ifs" |
| 681 | nigel | 75 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
| 682 | nigel | 53 | |
| 683 | nigel | 75 | # Add the arguments to base_compile. |
| 684 | nigel | 53 | base_compile="$base_compile $lastarg" |
| 685 | nigel | 75 | continue |
| 686 | ;; | ||
| 687 | nigel | 41 | |
| 688 | nigel | 75 | * ) |
| 689 | # Accept the current argument as the source file. | ||
| 690 | # The previous "srcfile" becomes the current argument. | ||
| 691 | # | ||
| 692 | lastarg="$srcfile" | ||
| 693 | srcfile="$arg" | ||
| 694 | ;; | ||
| 695 | esac # case $arg | ||
| 696 | nigel | 41 | ;; |
| 697 | nigel | 75 | esac # case $arg_mode |
| 698 | nigel | 41 | |
| 699 | # Aesthetically quote the previous argument. | ||
| 700 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` | ||
| 701 | |||
| 702 | nigel | 75 | case $lastarg in |
| 703 | nigel | 41 | # Double-quote args containing other shell metacharacters. |
| 704 | nigel | 53 | # Many Bourne shells cannot handle close brackets correctly |
| 705 | nigel | 83 | # in scan sets, and some SunOS ksh mistreat backslash-escaping |
| 706 | # in scan sets (worked around with variable expansion), | ||
| 707 | # and furthermore cannot handle '|' '&' '(' ')' in scan sets | ||
| 708 | # at all, so we specify them separately. | ||
| 709 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") | ||
| 710 | nigel | 41 | lastarg="\"$lastarg\"" |
| 711 | ;; | ||
| 712 | esac | ||
| 713 | |||
| 714 | nigel | 75 | base_compile="$base_compile $lastarg" |
| 715 | done # for arg | ||
| 716 | nigel | 41 | |
| 717 | nigel | 75 | case $arg_mode in |
| 718 | arg) | ||
| 719 | $echo "$modename: you must specify an argument for -Xcompile" | ||
| 720 | exit $EXIT_FAILURE | ||
| 721 | nigel | 41 | ;; |
| 722 | nigel | 75 | target) |
| 723 | $echo "$modename: you must specify a target with \`-o'" 1>&2 | ||
| 724 | exit $EXIT_FAILURE | ||
| 725 | nigel | 41 | ;; |
| 726 | *) | ||
| 727 | nigel | 75 | # Get the name of the library object. |
| 728 | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` | ||
| 729 | nigel | 41 | ;; |
| 730 | esac | ||
| 731 | |||
| 732 | # Recognize several different file suffixes. | ||
| 733 | # If the user specifies -o file.o, it is replaced with file.lo | ||
| 734 | nigel | 75 | xform='[cCFSifmso]' |
| 735 | nigel | 53 | case $libobj in |
| 736 | nigel | 41 | *.ada) xform=ada ;; |
| 737 | *.adb) xform=adb ;; | ||
| 738 | *.ads) xform=ads ;; | ||
| 739 | *.asm) xform=asm ;; | ||
| 740 | *.c++) xform=c++ ;; | ||
| 741 | *.cc) xform=cc ;; | ||
| 742 | nigel | 75 | *.ii) xform=ii ;; |
| 743 | *.class) xform=class ;; | ||
| 744 | nigel | 41 | *.cpp) xform=cpp ;; |
| 745 | *.cxx) xform=cxx ;; | ||
| 746 | *.f90) xform=f90 ;; | ||
| 747 | *.for) xform=for ;; | ||
| 748 | nigel | 75 | *.java) xform=java ;; |
| 749 | nigel | 41 | esac |
| 750 | |||
| 751 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` | ||
| 752 | |||
| 753 | nigel | 53 | case $libobj in |
| 754 | nigel | 41 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
| 755 | *) | ||
| 756 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 | ||
| 757 | nigel | 75 | exit $EXIT_FAILURE |
| 758 | nigel | 41 | ;; |
| 759 | esac | ||
| 760 | |||
| 761 | nigel | 75 | func_infer_tag $base_compile |
| 762 | |||
| 763 | for arg in $later; do | ||
| 764 | case $arg in | ||
| 765 | -static) | ||
| 766 | build_old_libs=yes | ||
| 767 | continue | ||
| 768 | ;; | ||
| 769 | |||
| 770 | -prefer-pic) | ||
| 771 | pic_mode=yes | ||
| 772 | continue | ||
| 773 | ;; | ||
| 774 | |||
| 775 | -prefer-non-pic) | ||
| 776 | pic_mode=no | ||
| 777 | continue | ||
| 778 | ;; | ||
| 779 | esac | ||
| 780 | done | ||
| 781 | |||
| 782 | nigel | 83 | qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` |
| 783 | case $qlibobj in | ||
| 784 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") | ||
| 785 | qlibobj="\"$qlibobj\"" ;; | ||
| 786 | esac | ||
| 787 | if test "X$libobj" != "X$qlibobj"; then | ||
| 788 | $echo "$modename: libobj name \`$libobj' may not contain shell special characters." | ||
| 789 | exit $EXIT_FAILURE | ||
| 790 | fi | ||
| 791 | nigel | 75 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
| 792 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` | ||
| 793 | if test "X$xdir" = "X$obj"; then | ||
| 794 | xdir= | ||
| 795 | else | ||
| 796 | xdir=$xdir/ | ||
| 797 | fi | ||
| 798 | lobj=${xdir}$objdir/$objname | ||
| 799 | |||
| 800 | nigel | 41 | if test -z "$base_compile"; then |
| 801 | $echo "$modename: you must specify a compilation command" 1>&2 | ||
| 802 | $echo "$help" 1>&2 | ||
| 803 | nigel | 75 | exit $EXIT_FAILURE |
| 804 | nigel | 41 | fi |
| 805 | |||
| 806 | # Delete any leftover library objects. | ||
| 807 | if test "$build_old_libs" = yes; then | ||
| 808 | nigel | 75 | removelist="$obj $lobj $libobj ${libobj}T" |
| 809 | nigel | 41 | else |
| 810 | nigel | 75 | removelist="$lobj $libobj ${libobj}T" |
| 811 | nigel | 41 | fi |
| 812 | |||
| 813 | $run $rm $removelist | ||
| 814 | nigel | 75 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 815 | nigel | 41 | |
| 816 | nigel | 53 | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 817 | case $host_os in | ||
| 818 | cygwin* | mingw* | pw32* | os2*) | ||
| 819 | pic_mode=default | ||
| 820 | ;; | ||
| 821 | esac | ||
| 822 | nigel | 63 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 823 | nigel | 53 | # non-PIC code in shared libraries is not supported |
| 824 | pic_mode=default | ||
| 825 | fi | ||
| 826 | |||
| 827 | nigel | 41 | # Calculate the filename of the output object if compiler does |
| 828 | # not support -o with -c | ||
| 829 | if test "$compiler_c_o" = no; then | ||
| 830 | nigel | 53 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
| 831 | nigel | 41 | lockfile="$output_obj.lock" |
| 832 | removelist="$removelist $output_obj $lockfile" | ||
| 833 | nigel | 75 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 834 | nigel | 41 | else |
| 835 | nigel | 75 | output_obj= |
| 836 | nigel | 41 | need_locks=no |
| 837 | lockfile= | ||
| 838 | fi | ||
| 839 | |||
| 840 | # Lock this critical section if it is needed | ||
| 841 | # We use this script file to make the link, it avoids creating a new file | ||
| 842 | if test "$need_locks" = yes; then | ||
| 843 | nigel | 83 | until $run ln "$srcfile" "$lockfile" 2>/dev/null; do |
| 844 | nigel | 41 | $show "Waiting for $lockfile to be removed" |
| 845 | sleep 2 | ||
| 846 | done | ||
| 847 | elif test "$need_locks" = warn; then | ||
| 848 | if test -f "$lockfile"; then | ||
| 849 | nigel | 75 | $echo "\ |
| 850 | nigel | 41 | *** ERROR, $lockfile exists and contains: |
| 851 | `cat $lockfile 2>/dev/null` | ||
| 852 | |||
| 853 | This indicates that another process is trying to use the same | ||
| 854 | temporary object file, and libtool could not work around it because | ||
| 855 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 856 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 857 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 858 | compiler." | ||
| 859 | |||
| 860 | $run $rm $removelist | ||
| 861 | nigel | 75 | exit $EXIT_FAILURE |
| 862 | nigel | 41 | fi |
| 863 | nigel | 83 | $echo "$srcfile" > "$lockfile" |
| 864 | nigel | 41 | fi |
| 865 | |||
| 866 | if test -n "$fix_srcfile_path"; then | ||
| 867 | eval srcfile=\"$fix_srcfile_path\" | ||
| 868 | fi | ||
| 869 | nigel | 83 | qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` |
| 870 | case $qsrcfile in | ||
| 871 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") | ||
| 872 | qsrcfile="\"$qsrcfile\"" ;; | ||
| 873 | esac | ||
| 874 | nigel | 41 | |
| 875 | nigel | 75 | $run $rm "$libobj" "${libobj}T" |
| 876 | |||
| 877 | # Create a libtool object file (analogous to a ".la" file), | ||
| 878 | # but don't create it if we're doing a dry run. | ||
| 879 | test -z "$run" && cat > ${libobj}T <<EOF | ||
| 880 | # $libobj - a libtool object file | ||
| 881 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | ||
| 882 | # | ||
| 883 | # Please DO NOT delete this file! | ||
| 884 | # It is necessary for linking the library. | ||
| 885 | |||
| 886 | # Name of the PIC object. | ||
| 887 | EOF | ||
| 888 | |||
| 889 | nigel | 41 | # Only build a PIC object if we are building libtool libraries. |
| 890 | if test "$build_libtool_libs" = yes; then | ||
| 891 | # Without this assignment, base_compile gets emptied. | ||
| 892 | fbsd_hideous_sh_bug=$base_compile | ||
| 893 | |||
| 894 | nigel | 53 | if test "$pic_mode" != no; then |
| 895 | nigel | 83 | command="$base_compile $qsrcfile $pic_flag" |
| 896 | nigel | 53 | else |
| 897 | # Don't build PIC code | ||
| 898 | nigel | 83 | command="$base_compile $qsrcfile" |
| 899 | nigel | 53 | fi |
| 900 | nigel | 41 | |
| 901 | nigel | 75 | if test ! -d "${xdir}$objdir"; then |
| 902 | $show "$mkdir ${xdir}$objdir" | ||
| 903 | $run $mkdir ${xdir}$objdir | ||
| 904 | status=$? | ||
| 905 | if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then | ||
| 906 | exit $status | ||
| 907 | nigel | 41 | fi |
| 908 | fi | ||
| 909 | nigel | 75 | |
| 910 | if test -z "$output_obj"; then | ||
| 911 | # Place PIC objects in $objdir | ||
| 912 | command="$command -o $lobj" | ||
| 913 | nigel | 41 | fi |
| 914 | |||
| 915 | nigel | 75 | $run $rm "$lobj" "$output_obj" |
| 916 | |||
| 917 | nigel | 41 | $show "$command" |
| 918 | if $run eval "$command"; then : | ||
| 919 | else | ||
| 920 | test -n "$output_obj" && $run $rm $removelist | ||
| 921 | nigel | 75 | exit $EXIT_FAILURE |
| 922 | nigel | 41 | fi |
| 923 | |||
| 924 | if test "$need_locks" = warn && | ||
| 925 | nigel | 75 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 926 | $echo "\ | ||
| 927 | nigel | 41 | *** ERROR, $lockfile contains: |
| 928 | `cat $lockfile 2>/dev/null` | ||
| 929 | |||
| 930 | but it should contain: | ||
| 931 | $srcfile | ||
| 932 | |||
| 933 | This indicates that another process is trying to use the same | ||
| 934 | temporary object file, and libtool could not work around it because | ||
| 935 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 936 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 937 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 938 | compiler." | ||
| 939 | |||
| 940 | $run $rm $removelist | ||
| 941 | nigel | 75 | exit $EXIT_FAILURE |
| 942 | nigel | 41 | fi |
| 943 | |||
| 944 | # Just move the object if needed, then go on to compile the next one | ||
| 945 | nigel | 75 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 946 | $show "$mv $output_obj $lobj" | ||
| 947 | if $run $mv $output_obj $lobj; then : | ||
| 948 | nigel | 41 | else |
| 949 | error=$? | ||
| 950 | $run $rm $removelist | ||
| 951 | exit $error | ||
| 952 | fi | ||
| 953 | fi | ||
| 954 | |||
| 955 | nigel | 75 | # Append the name of the PIC object to the libtool object file. |
| 956 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 957 | pic_object='$objdir/$objname' | ||
| 958 | nigel | 41 | |
| 959 | nigel | 75 | EOF |
| 960 | nigel | 41 | |
| 961 | nigel | 75 | # Allow error messages only from the first compilation. |
| 962 | if test "$suppress_opt" = yes; then | ||
| 963 | suppress_output=' >/dev/null 2>&1' | ||
| 964 | nigel | 41 | fi |
| 965 | nigel | 75 | else |
| 966 | # No PIC object so indicate it doesn't exist in the libtool | ||
| 967 | # object file. | ||
| 968 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 969 | pic_object=none | ||
| 970 | nigel | 41 | |
| 971 | nigel | 75 | EOF |
| 972 | nigel | 41 | fi |
| 973 | |||
| 974 | # Only build a position-dependent object if we build old libraries. | ||
| 975 | if test "$build_old_libs" = yes; then | ||
| 976 | nigel | 53 | if test "$pic_mode" != yes; then |
| 977 | # Don't build PIC code | ||
| 978 | nigel | 83 | command="$base_compile $qsrcfile" |
| 979 | nigel | 53 | else |
| 980 | nigel | 83 | command="$base_compile $qsrcfile $pic_flag" |
| 981 | nigel | 53 | fi |
| 982 | nigel | 41 | if test "$compiler_c_o" = yes; then |
| 983 | command="$command -o $obj" | ||
| 984 | fi | ||
| 985 | |||
| 986 | # Suppress compiler output if we already did a PIC compilation. | ||
| 987 | command="$command$suppress_output" | ||
| 988 | nigel | 75 | $run $rm "$obj" "$output_obj" |
| 989 | nigel | 41 | $show "$command" |
| 990 | if $run eval "$command"; then : | ||
| 991 | else | ||
| 992 | $run $rm $removelist | ||
| 993 | nigel | 75 | exit $EXIT_FAILURE |
| 994 | nigel | 41 | fi |
| 995 | |||
| 996 | if test "$need_locks" = warn && | ||
| 997 | nigel | 75 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 998 | $echo "\ | ||
| 999 | nigel | 41 | *** ERROR, $lockfile contains: |
| 1000 | `cat $lockfile 2>/dev/null` | ||
| 1001 | |||
| 1002 | but it should contain: | ||
| 1003 | $srcfile | ||
| 1004 | |||
| 1005 | This indicates that another process is trying to use the same | ||
| 1006 | temporary object file, and libtool could not work around it because | ||
| 1007 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 1008 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 1009 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 1010 | compiler." | ||
| 1011 | |||
| 1012 | $run $rm $removelist | ||
| 1013 | nigel | 75 | exit $EXIT_FAILURE |
| 1014 | nigel | 41 | fi |
| 1015 | |||
| 1016 | # Just move the object if needed | ||
| 1017 | nigel | 75 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
| 1018 | nigel | 41 | $show "$mv $output_obj $obj" |
| 1019 | if $run $mv $output_obj $obj; then : | ||
| 1020 | else | ||
| 1021 | error=$? | ||
| 1022 | $run $rm $removelist | ||
| 1023 | exit $error | ||
| 1024 | fi | ||
| 1025 | fi | ||
| 1026 | |||
| 1027 | nigel | 75 | # Append the name of the non-PIC object the libtool object file. |
| 1028 | # Only append if the libtool object file exists. | ||
| 1029 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 1030 | # Name of the non-PIC object. | ||
| 1031 | non_pic_object='$objname' | ||
| 1032 | |||
| 1033 | EOF | ||
| 1034 | else | ||
| 1035 | # Append the name of the non-PIC object the libtool object file. | ||
| 1036 | # Only append if the libtool object file exists. | ||
| 1037 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 1038 | # Name of the non-PIC object. | ||
| 1039 | non_pic_object=none | ||
| 1040 | |||
| 1041 | EOF | ||
| 1042 | nigel | 41 | fi |
| 1043 | |||
| 1044 | nigel | 75 | $run $mv "${libobj}T" "${libobj}" |
| 1045 | |||
| 1046 | nigel | 41 | # Unlock the critical section if it was locked |
| 1047 | if test "$need_locks" != no; then | ||
| 1048 | nigel | 53 | $run $rm "$lockfile" |
| 1049 | nigel | 41 | fi |
| 1050 | |||
| 1051 | nigel | 75 | exit $EXIT_SUCCESS |
| 1052 | nigel | 41 | ;; |
| 1053 | |||
| 1054 | # libtool link mode | ||
| 1055 | nigel | 53 | link | relink) |
| 1056 | nigel | 41 | modename="$modename: link" |
| 1057 | nigel | 53 | case $host in |
| 1058 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1059 | nigel | 41 | # It is impossible to link a dll without this setting, and |
| 1060 | # we shouldn't force the makefile maintainer to figure out | ||
| 1061 | # which system we are compiling for in order to pass an extra | ||
| 1062 | nigel | 75 | # flag for every libtool invocation. |
| 1063 | nigel | 41 | # allow_undefined=no |
| 1064 | |||
| 1065 | # FIXME: Unfortunately, there are problems with the above when trying | ||
| 1066 | # to make a dll which has undefined symbols, in which case not | ||
| 1067 | # even a static library is built. For now, we need to specify | ||
| 1068 | # -no-undefined on the libtool link line when we can be certain | ||
| 1069 | # that all symbols are satisfied, otherwise we get a static library. | ||
| 1070 | allow_undefined=yes | ||
| 1071 | ;; | ||
| 1072 | *) | ||
| 1073 | allow_undefined=yes | ||
| 1074 | ;; | ||
| 1075 | esac | ||
| 1076 | nigel | 53 | libtool_args="$nonopt" |
| 1077 | nigel | 75 | base_compile="$nonopt $@" |
| 1078 | nigel | 41 | compile_command="$nonopt" |
| 1079 | finalize_command="$nonopt" | ||
| 1080 | |||
| 1081 | compile_rpath= | ||
| 1082 | finalize_rpath= | ||
| 1083 | compile_shlibpath= | ||
| 1084 | finalize_shlibpath= | ||
| 1085 | convenience= | ||
| 1086 | old_convenience= | ||
| 1087 | deplibs= | ||
| 1088 | nigel | 53 | old_deplibs= |
| 1089 | compiler_flags= | ||
| 1090 | linker_flags= | ||
| 1091 | dllsearchpath= | ||
| 1092 | lib_search_path=`pwd` | ||
| 1093 | nigel | 75 | inst_prefix_dir= |
| 1094 | nigel | 41 | |
| 1095 | avoid_version=no | ||
| 1096 | dlfiles= | ||
| 1097 | dlprefiles= | ||
| 1098 | dlself=no | ||
| 1099 | export_dynamic=no | ||
| 1100 | export_symbols= | ||
| 1101 | export_symbols_regex= | ||
| 1102 | generated= | ||
| 1103 | libobjs= | ||
| 1104 | ltlibs= | ||
| 1105 | module=no | ||
| 1106 | nigel | 53 | no_install=no |
| 1107 | nigel | 41 | objs= |
| 1108 | nigel | 75 | non_pic_objects= |
| 1109 | precious_files_regex= | ||
| 1110 | nigel | 41 | prefer_static_libs=no |
| 1111 | preload=no | ||
| 1112 | prev= | ||
| 1113 | prevarg= | ||
| 1114 | release= | ||
| 1115 | rpath= | ||
| 1116 | xrpath= | ||
| 1117 | perm_rpath= | ||
| 1118 | temp_rpath= | ||
| 1119 | thread_safe=no | ||
| 1120 | vinfo= | ||
| 1121 | nigel | 75 | vinfo_number=no |
| 1122 | nigel | 41 | |
| 1123 | nigel | 75 | func_infer_tag $base_compile |
| 1124 | |||
| 1125 | nigel | 41 | # We need to know -static, to get the right output filenames. |
| 1126 | for arg | ||
| 1127 | do | ||
| 1128 | nigel | 53 | case $arg in |
| 1129 | nigel | 41 | -all-static | -static) |
| 1130 | if test "X$arg" = "X-all-static"; then | ||
| 1131 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | ||
| 1132 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 | ||
| 1133 | fi | ||
| 1134 | if test -n "$link_static_flag"; then | ||
| 1135 | dlopen_self=$dlopen_self_static | ||
| 1136 | fi | ||
| 1137 | else | ||
| 1138 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
| 1139 | dlopen_self=$dlopen_self_static | ||
| 1140 | fi | ||
| 1141 | fi | ||
| 1142 | build_libtool_libs=no | ||
| 1143 | build_old_libs=yes | ||
| 1144 | prefer_static_libs=yes | ||
| 1145 | break | ||
| 1146 | ;; | ||
| 1147 | esac | ||
| 1148 | done | ||
| 1149 | |||
| 1150 | # See if our shared archives depend on static archives. | ||
| 1151 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | ||
| 1152 | |||
| 1153 | # Go through the arguments, transforming them on the way. | ||
| 1154 | nigel | 75 | while test "$#" -gt 0; do |
| 1155 | nigel | 41 | arg="$1" |
| 1156 | shift | ||
| 1157 | nigel | 53 | case $arg in |
| 1158 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1159 | nigel | 53 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
| 1160 | ;; | ||
| 1161 | *) qarg=$arg ;; | ||
| 1162 | esac | ||
| 1163 | libtool_args="$libtool_args $qarg" | ||
| 1164 | nigel | 41 | |
| 1165 | # If the previous option needs an argument, assign it. | ||
| 1166 | if test -n "$prev"; then | ||
| 1167 | nigel | 53 | case $prev in |
| 1168 | nigel | 41 | output) |
| 1169 | compile_command="$compile_command @OUTPUT@" | ||
| 1170 | finalize_command="$finalize_command @OUTPUT@" | ||
| 1171 | ;; | ||
| 1172 | esac | ||
| 1173 | |||
| 1174 | nigel | 53 | case $prev in |
| 1175 | nigel | 41 | dlfiles|dlprefiles) |
| 1176 | if test "$preload" = no; then | ||
| 1177 | # Add the symbol object into the linking commands. | ||
| 1178 | compile_command="$compile_command @SYMFILE@" | ||
| 1179 | finalize_command="$finalize_command @SYMFILE@" | ||
| 1180 | preload=yes | ||
| 1181 | fi | ||
| 1182 | nigel | 53 | case $arg in |
| 1183 | nigel | 41 | *.la | *.lo) ;; # We handle these cases below. |
| 1184 | force) | ||
| 1185 | if test "$dlself" = no; then | ||
| 1186 | dlself=needless | ||
| 1187 | export_dynamic=yes | ||
| 1188 | fi | ||
| 1189 | prev= | ||
| 1190 | continue | ||
| 1191 | ;; | ||
| 1192 | self) | ||
| 1193 | if test "$prev" = dlprefiles; then | ||
| 1194 | dlself=yes | ||
| 1195 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | ||
| 1196 | dlself=yes | ||
| 1197 | else | ||
| 1198 | dlself=needless | ||
| 1199 | export_dynamic=yes | ||
| 1200 | fi | ||
| 1201 | prev= | ||
| 1202 | continue | ||
| 1203 | ;; | ||
| 1204 | *) | ||
| 1205 | if test "$prev" = dlfiles; then | ||
| 1206 | dlfiles="$dlfiles $arg" | ||
| 1207 | else | ||
| 1208 | dlprefiles="$dlprefiles $arg" | ||
| 1209 | fi | ||
| 1210 | prev= | ||
| 1211 | nigel | 53 | continue |
| 1212 | nigel | 41 | ;; |
| 1213 | esac | ||
| 1214 | ;; | ||
| 1215 | expsyms) | ||
| 1216 | export_symbols="$arg" | ||
| 1217 | if test ! -f "$arg"; then | ||
| 1218 | $echo "$modename: symbol file \`$arg' does not exist" | ||
| 1219 | nigel | 75 | exit $EXIT_FAILURE |
| 1220 | nigel | 41 | fi |
| 1221 | prev= | ||
| 1222 | continue | ||
| 1223 | ;; | ||
| 1224 | expsyms_regex) | ||
| 1225 | export_symbols_regex="$arg" | ||
| 1226 | prev= | ||
| 1227 | continue | ||
| 1228 | ;; | ||
| 1229 | nigel | 75 | inst_prefix) |
| 1230 | inst_prefix_dir="$arg" | ||
| 1231 | prev= | ||
| 1232 | continue | ||
| 1233 | ;; | ||
| 1234 | precious_regex) | ||
| 1235 | precious_files_regex="$arg" | ||
| 1236 | prev= | ||
| 1237 | continue | ||
| 1238 | ;; | ||
| 1239 | nigel | 41 | release) |
| 1240 | release="-$arg" | ||
| 1241 | prev= | ||
| 1242 | continue | ||
| 1243 | ;; | ||
| 1244 | nigel | 75 | objectlist) |
| 1245 | if test -f "$arg"; then | ||
| 1246 | save_arg=$arg | ||
| 1247 | moreargs= | ||
| 1248 | for fil in `cat $save_arg` | ||
| 1249 | do | ||
| 1250 | # moreargs="$moreargs $fil" | ||
| 1251 | arg=$fil | ||
| 1252 | # A libtool-controlled object. | ||
| 1253 | |||
| 1254 | # Check to see that this really is a libtool object. | ||
| 1255 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 1256 | pic_object= | ||
| 1257 | non_pic_object= | ||
| 1258 | |||
| 1259 | # Read the .lo file | ||
| 1260 | # If there is no directory component, then add one. | ||
| 1261 | case $arg in | ||
| 1262 | */* | *\\*) . $arg ;; | ||
| 1263 | *) . ./$arg ;; | ||
| 1264 | esac | ||
| 1265 | |||
| 1266 | if test -z "$pic_object" || \ | ||
| 1267 | test -z "$non_pic_object" || | ||
| 1268 | test "$pic_object" = none && \ | ||
| 1269 | test "$non_pic_object" = none; then | ||
| 1270 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 | ||
| 1271 | exit $EXIT_FAILURE | ||
| 1272 | fi | ||
| 1273 | |||
| 1274 | # Extract subdirectory from the argument. | ||
| 1275 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1276 | if test "X$xdir" = "X$arg"; then | ||
| 1277 | xdir= | ||
| 1278 | else | ||
| 1279 | xdir="$xdir/" | ||
| 1280 | fi | ||
| 1281 | |||
| 1282 | if test "$pic_object" != none; then | ||
| 1283 | # Prepend the subdirectory the object is found in. | ||
| 1284 | pic_object="$xdir$pic_object" | ||
| 1285 | |||
| 1286 | if test "$prev" = dlfiles; then | ||
| 1287 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
| 1288 | dlfiles="$dlfiles $pic_object" | ||
| 1289 | prev= | ||
| 1290 | continue | ||
| 1291 | else | ||
| 1292 | # If libtool objects are unsupported, then we need to preload. | ||
| 1293 | prev=dlprefiles | ||
| 1294 | fi | ||
| 1295 | fi | ||
| 1296 | |||
| 1297 | # CHECK ME: I think I busted this. -Ossama | ||
| 1298 | if test "$prev" = dlprefiles; then | ||
| 1299 | # Preload the old-style object. | ||
| 1300 | dlprefiles="$dlprefiles $pic_object" | ||
| 1301 | prev= | ||
| 1302 | fi | ||
| 1303 | |||
| 1304 | # A PIC object. | ||
| 1305 | libobjs="$libobjs $pic_object" | ||
| 1306 | arg="$pic_object" | ||
| 1307 | fi | ||
| 1308 | |||
| 1309 | # Non-PIC object. | ||
| 1310 | if test "$non_pic_object" != none; then | ||
| 1311 | # Prepend the subdirectory the object is found in. | ||
| 1312 | non_pic_object="$xdir$non_pic_object" | ||
| 1313 | |||
| 1314 | # A standard non-PIC object | ||
| 1315 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1316 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
| 1317 | arg="$non_pic_object" | ||
| 1318 | fi | ||
| 1319 | fi | ||
| 1320 | else | ||
| 1321 | # Only an error if not doing a dry-run. | ||
| 1322 | if test -z "$run"; then | ||
| 1323 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 | ||
| 1324 | exit $EXIT_FAILURE | ||
| 1325 | else | ||
| 1326 | # Dry-run case. | ||
| 1327 | |||
| 1328 | # Extract subdirectory from the argument. | ||
| 1329 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1330 | if test "X$xdir" = "X$arg"; then | ||
| 1331 | xdir= | ||
| 1332 | else | ||
| 1333 | xdir="$xdir/" | ||
| 1334 | fi | ||
| 1335 | |||
| 1336 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | ||
| 1337 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` | ||
| 1338 | libobjs="$libobjs $pic_object" | ||
| 1339 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1340 | fi | ||
| 1341 | fi | ||
| 1342 | done | ||
| 1343 | else | ||
| 1344 | $echo "$modename: link input file \`$save_arg' does not exist" | ||
| 1345 | exit $EXIT_FAILURE | ||
| 1346 | fi | ||
| 1347 | arg=$save_arg | ||
| 1348 | prev= | ||
| 1349 | continue | ||
| 1350 | ;; | ||
| 1351 | nigel | 41 | rpath | xrpath) |
| 1352 | # We need an absolute path. | ||
| 1353 | nigel | 53 | case $arg in |
| 1354 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1355 | *) | ||
| 1356 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | ||
| 1357 | nigel | 75 | exit $EXIT_FAILURE |
| 1358 | nigel | 41 | ;; |
| 1359 | esac | ||
| 1360 | if test "$prev" = rpath; then | ||
| 1361 | case "$rpath " in | ||
| 1362 | *" $arg "*) ;; | ||
| 1363 | *) rpath="$rpath $arg" ;; | ||
| 1364 | esac | ||
| 1365 | else | ||
| 1366 | case "$xrpath " in | ||
| 1367 | *" $arg "*) ;; | ||
| 1368 | *) xrpath="$xrpath $arg" ;; | ||
| 1369 | esac | ||
| 1370 | fi | ||
| 1371 | prev= | ||
| 1372 | continue | ||
| 1373 | ;; | ||
| 1374 | nigel | 53 | xcompiler) |
| 1375 | compiler_flags="$compiler_flags $qarg" | ||
| 1376 | prev= | ||
| 1377 | compile_command="$compile_command $qarg" | ||
| 1378 | finalize_command="$finalize_command $qarg" | ||
| 1379 | continue | ||
| 1380 | ;; | ||
| 1381 | xlinker) | ||
| 1382 | linker_flags="$linker_flags $qarg" | ||
| 1383 | compiler_flags="$compiler_flags $wl$qarg" | ||
| 1384 | prev= | ||
| 1385 | compile_command="$compile_command $wl$qarg" | ||
| 1386 | finalize_command="$finalize_command $wl$qarg" | ||
| 1387 | continue | ||
| 1388 | ;; | ||
| 1389 | nigel | 75 | xcclinker) |
| 1390 | linker_flags="$linker_flags $qarg" | ||
| 1391 | compiler_flags="$compiler_flags $qarg" | ||
| 1392 | prev= | ||
| 1393 | compile_command="$compile_command $qarg" | ||
| 1394 | finalize_command="$finalize_command $qarg" | ||
| 1395 | continue | ||
| 1396 | ;; | ||
| 1397 | shrext) | ||
| 1398 | nigel | 83 | shrext_cmds="$arg" |
| 1399 | nigel | 75 | prev= |
| 1400 | continue | ||
| 1401 | ;; | ||
| 1402 | nigel | 83 | darwin_framework) |
| 1403 | compiler_flags="$compiler_flags $arg" | ||
| 1404 | compile_command="$compile_command $arg" | ||
| 1405 | finalize_command="$finalize_command $arg" | ||
| 1406 | prev= | ||
| 1407 | continue | ||
| 1408 | ;; | ||
| 1409 | nigel | 41 | *) |
| 1410 | eval "$prev=\"\$arg\"" | ||
| 1411 | prev= | ||
| 1412 | continue | ||
| 1413 | ;; | ||
| 1414 | esac | ||
| 1415 | nigel | 75 | fi # test -n "$prev" |
| 1416 | nigel | 41 | |
| 1417 | prevarg="$arg" | ||
| 1418 | |||
| 1419 | nigel | 53 | case $arg in |
| 1420 | nigel | 41 | -all-static) |
| 1421 | if test -n "$link_static_flag"; then | ||
| 1422 | compile_command="$compile_command $link_static_flag" | ||
| 1423 | finalize_command="$finalize_command $link_static_flag" | ||
| 1424 | fi | ||
| 1425 | continue | ||
| 1426 | ;; | ||
| 1427 | |||
| 1428 | -allow-undefined) | ||
| 1429 | # FIXME: remove this flag sometime in the future. | ||
| 1430 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 | ||
| 1431 | continue | ||
| 1432 | ;; | ||
| 1433 | |||
| 1434 | -avoid-version) | ||
| 1435 | avoid_version=yes | ||
| 1436 | continue | ||
| 1437 | ;; | ||
| 1438 | |||
| 1439 | -dlopen) | ||
| 1440 | prev=dlfiles | ||
| 1441 | continue | ||
| 1442 | ;; | ||
| 1443 | |||
| 1444 | -dlpreopen) | ||
| 1445 | prev=dlprefiles | ||
| 1446 | continue | ||
| 1447 | ;; | ||
| 1448 | |||
| 1449 | -export-dynamic) | ||
| 1450 | export_dynamic=yes | ||
| 1451 | continue | ||
| 1452 | ;; | ||
| 1453 | |||
| 1454 | -export-symbols | -export-symbols-regex) | ||
| 1455 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
| 1456 | nigel | 53 | $echo "$modename: more than one -exported-symbols argument is not allowed" |
| 1457 | nigel | 75 | exit $EXIT_FAILURE |
| 1458 | nigel | 41 | fi |
| 1459 | if test "X$arg" = "X-export-symbols"; then | ||
| 1460 | prev=expsyms | ||
| 1461 | else | ||
| 1462 | prev=expsyms_regex | ||
| 1463 | fi | ||
| 1464 | continue | ||
| 1465 | ;; | ||
| 1466 | |||
| 1467 | nigel | 83 | -framework) |
| 1468 | prev=darwin_framework | ||
| 1469 | compiler_flags="$compiler_flags $arg" | ||
| 1470 | compile_command="$compile_command $arg" | ||
| 1471 | finalize_command="$finalize_command $arg" | ||
| 1472 | continue | ||
| 1473 | ;; | ||
| 1474 | |||
| 1475 | nigel | 75 | -inst-prefix-dir) |
| 1476 | prev=inst_prefix | ||
| 1477 | continue | ||
| 1478 | ;; | ||
| 1479 | |||
| 1480 | nigel | 53 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 1481 | # so, if we see these flags be careful not to treat them like -L | ||
| 1482 | -L[A-Z][A-Z]*:*) | ||
| 1483 | case $with_gcc/$host in | ||
| 1484 | nigel | 75 | no/*-*-irix* | /*-*-irix*) |
| 1485 | nigel | 53 | compile_command="$compile_command $arg" |
| 1486 | finalize_command="$finalize_command $arg" | ||
| 1487 | ;; | ||
| 1488 | esac | ||
| 1489 | continue | ||
| 1490 | ;; | ||
| 1491 | |||
| 1492 | nigel | 41 | -L*) |
| 1493 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` | ||
| 1494 | # We need an absolute path. | ||
| 1495 | nigel | 53 | case $dir in |
| 1496 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1497 | *) | ||
| 1498 | absdir=`cd "$dir" && pwd` | ||
| 1499 | if test -z "$absdir"; then | ||
| 1500 | nigel | 53 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
| 1501 | nigel | 75 | exit $EXIT_FAILURE |
| 1502 | nigel | 41 | fi |
| 1503 | dir="$absdir" | ||
| 1504 | ;; | ||
| 1505 | esac | ||
| 1506 | nigel | 53 | case "$deplibs " in |
| 1507 | *" -L$dir "*) ;; | ||
| 1508 | *) | ||
| 1509 | deplibs="$deplibs -L$dir" | ||
| 1510 | lib_search_path="$lib_search_path $dir" | ||
| 1511 | ;; | ||
| 1512 | nigel | 41 | esac |
| 1513 | nigel | 53 | case $host in |
| 1514 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1515 | case :$dllsearchpath: in | ||
| 1516 | *":$dir:"*) ;; | ||
| 1517 | *) dllsearchpath="$dllsearchpath:$dir";; | ||
| 1518 | nigel | 41 | esac |
| 1519 | ;; | ||
| 1520 | esac | ||
| 1521 | nigel | 53 | continue |
| 1522 | nigel | 41 | ;; |
| 1523 | |||
| 1524 | -l*) | ||
| 1525 | nigel | 53 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 1526 | case $host in | ||
| 1527 | *-*-cygwin* | *-*-pw32* | *-*-beos*) | ||
| 1528 | # These systems don't actually have a C or math library (as such) | ||
| 1529 | nigel | 41 | continue |
| 1530 | ;; | ||
| 1531 | nigel | 53 | *-*-mingw* | *-*-os2*) |
| 1532 | # These systems don't actually have a C library (as such) | ||
| 1533 | test "X$arg" = "X-lc" && continue | ||
| 1534 | nigel | 41 | ;; |
| 1535 | nigel | 83 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 1536 | nigel | 63 | # Do not include libc due to us having libc/libc_r. |
| 1537 | test "X$arg" = "X-lc" && continue | ||
| 1538 | ;; | ||
| 1539 | nigel | 75 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 1540 | # Rhapsody C and math libraries are in the System framework | ||
| 1541 | deplibs="$deplibs -framework System" | ||
| 1542 | continue | ||
| 1543 | nigel | 41 | esac |
| 1544 | nigel | 75 | elif test "X$arg" = "X-lc_r"; then |
| 1545 | case $host in | ||
| 1546 | nigel | 83 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 1547 | nigel | 75 | # Do not include libc_r directly, use -pthread flag. |
| 1548 | continue | ||
| 1549 | ;; | ||
| 1550 | esac | ||
| 1551 | nigel | 41 | fi |
| 1552 | deplibs="$deplibs $arg" | ||
| 1553 | nigel | 53 | continue |
| 1554 | nigel | 41 | ;; |
| 1555 | |||
| 1556 | nigel | 83 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
| 1557 | # classes, name mangling, and exception handling. | ||
| 1558 | -model) | ||
| 1559 | compile_command="$compile_command $arg" | ||
| 1560 | compiler_flags="$compiler_flags $arg" | ||
| 1561 | finalize_command="$finalize_command $arg" | ||
| 1562 | prev=xcompiler | ||
| 1563 | continue | ||
| 1564 | ;; | ||
| 1565 | |||
| 1566 | nigel | 75 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 1567 | nigel | 83 | compiler_flags="$compiler_flags $arg" |
| 1568 | compile_command="$compile_command $arg" | ||
| 1569 | finalize_command="$finalize_command $arg" | ||
| 1570 | nigel | 75 | continue |
| 1571 | ;; | ||
| 1572 | |||
| 1573 | nigel | 41 | -module) |
| 1574 | module=yes | ||
| 1575 | continue | ||
| 1576 | ;; | ||
| 1577 | |||
| 1578 | nigel | 83 | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler |
| 1579 | # -r[0-9][0-9]* specifies the processor on the SGI compiler | ||
| 1580 | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler | ||
| 1581 | # +DA*, +DD* enable 64-bit mode on the HP compiler | ||
| 1582 | # -q* pass through compiler args for the IBM compiler | ||
| 1583 | # -m* pass through architecture-specific compiler args for GCC | ||
| 1584 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) | ||
| 1585 | |||
| 1586 | nigel | 75 | # Unknown arguments in both finalize_command and compile_command need |
| 1587 | # to be aesthetically quoted because they are evaled later. | ||
| 1588 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1589 | case $arg in | ||
| 1590 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1591 | nigel | 75 | arg="\"$arg\"" |
| 1592 | ;; | ||
| 1593 | esac | ||
| 1594 | compile_command="$compile_command $arg" | ||
| 1595 | finalize_command="$finalize_command $arg" | ||
| 1596 | if test "$with_gcc" = "yes" ; then | ||
| 1597 | compiler_flags="$compiler_flags $arg" | ||
| 1598 | fi | ||
| 1599 | continue | ||
| 1600 | ;; | ||
| 1601 | |||
| 1602 | -shrext) | ||
| 1603 | prev=shrext | ||
| 1604 | continue | ||
| 1605 | ;; | ||
| 1606 | |||
| 1607 | nigel | 53 | -no-fast-install) |
| 1608 | fast_install=no | ||
| 1609 | continue | ||
| 1610 | ;; | ||
| 1611 | |||
| 1612 | -no-install) | ||
| 1613 | case $host in | ||
| 1614 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1615 | # The PATH hackery in wrapper scripts is required on Windows | ||
| 1616 | # in order for the loader to find any dlls it needs. | ||
| 1617 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 | ||
| 1618 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 | ||
| 1619 | fast_install=no | ||
| 1620 | ;; | ||
| 1621 | *) no_install=yes ;; | ||
| 1622 | esac | ||
| 1623 | continue | ||
| 1624 | ;; | ||
| 1625 | |||
| 1626 | nigel | 41 | -no-undefined) |
| 1627 | allow_undefined=no | ||
| 1628 | continue | ||
| 1629 | ;; | ||
| 1630 | |||
| 1631 | nigel | 75 | -objectlist) |
| 1632 | prev=objectlist | ||
| 1633 | continue | ||
| 1634 | ;; | ||
| 1635 | |||
| 1636 | nigel | 41 | -o) prev=output ;; |
| 1637 | |||
| 1638 | nigel | 75 | -precious-files-regex) |
| 1639 | prev=precious_regex | ||
| 1640 | continue | ||
| 1641 | ;; | ||
| 1642 | |||
| 1643 | nigel | 41 | -release) |
| 1644 | prev=release | ||
| 1645 | continue | ||
| 1646 | ;; | ||
| 1647 | |||
| 1648 | -rpath) | ||
| 1649 | prev=rpath | ||
| 1650 | continue | ||
| 1651 | ;; | ||
| 1652 | |||
| 1653 | -R) | ||
| 1654 | prev=xrpath | ||
| 1655 | continue | ||
| 1656 | ;; | ||
| 1657 | |||
| 1658 | -R*) | ||
| 1659 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` | ||
| 1660 | # We need an absolute path. | ||
| 1661 | nigel | 53 | case $dir in |
| 1662 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1663 | *) | ||
| 1664 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | ||
| 1665 | nigel | 75 | exit $EXIT_FAILURE |
| 1666 | nigel | 41 | ;; |
| 1667 | esac | ||
| 1668 | case "$xrpath " in | ||
| 1669 | *" $dir "*) ;; | ||
| 1670 | *) xrpath="$xrpath $dir" ;; | ||
| 1671 | esac | ||
| 1672 | continue | ||
| 1673 | ;; | ||
| 1674 | |||
| 1675 | -static) | ||
| 1676 | nigel | 53 | # The effects of -static are defined in a previous loop. |
| 1677 | # We used to do the same as -all-static on platforms that | ||
| 1678 | # didn't have a PIC flag, but the assumption that the effects | ||
| 1679 | # would be equivalent was wrong. It would break on at least | ||
| 1680 | # Digital Unix and AIX. | ||
| 1681 | nigel | 41 | continue |
| 1682 | ;; | ||
| 1683 | |||
| 1684 | -thread-safe) | ||
| 1685 | thread_safe=yes | ||
| 1686 | continue | ||
| 1687 | ;; | ||
| 1688 | |||
| 1689 | -version-info) | ||
| 1690 | prev=vinfo | ||
| 1691 | continue | ||
| 1692 | ;; | ||
| 1693 | nigel | 75 | -version-number) |
| 1694 | prev=vinfo | ||
| 1695 | vinfo_number=yes | ||
| 1696 | continue | ||
| 1697 | ;; | ||
| 1698 | nigel | 41 | |
| 1699 | nigel | 53 | -Wc,*) |
| 1700 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` | ||
| 1701 | arg= | ||
| 1702 | nigel | 63 | save_ifs="$IFS"; IFS=',' |
| 1703 | nigel | 53 | for flag in $args; do |
| 1704 | IFS="$save_ifs" | ||
| 1705 | case $flag in | ||
| 1706 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1707 | nigel | 53 | flag="\"$flag\"" |
| 1708 | ;; | ||
| 1709 | esac | ||
| 1710 | arg="$arg $wl$flag" | ||
| 1711 | compiler_flags="$compiler_flags $flag" | ||
| 1712 | done | ||
| 1713 | IFS="$save_ifs" | ||
| 1714 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | ||
| 1715 | ;; | ||
| 1716 | |||
| 1717 | -Wl,*) | ||
| 1718 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` | ||
| 1719 | arg= | ||
| 1720 | nigel | 63 | save_ifs="$IFS"; IFS=',' |
| 1721 | nigel | 53 | for flag in $args; do |
| 1722 | IFS="$save_ifs" | ||
| 1723 | case $flag in | ||
| 1724 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1725 | nigel | 53 | flag="\"$flag\"" |
| 1726 | ;; | ||
| 1727 | esac | ||
| 1728 | arg="$arg $wl$flag" | ||
| 1729 | compiler_flags="$compiler_flags $wl$flag" | ||
| 1730 | linker_flags="$linker_flags $flag" | ||
| 1731 | done | ||
| 1732 | IFS="$save_ifs" | ||
| 1733 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | ||
| 1734 | ;; | ||
| 1735 | |||
| 1736 | -Xcompiler) | ||
| 1737 | prev=xcompiler | ||
| 1738 | continue | ||
| 1739 | ;; | ||
| 1740 | |||
| 1741 | -Xlinker) | ||
| 1742 | prev=xlinker | ||
| 1743 | continue | ||
| 1744 | ;; | ||
| 1745 | |||
| 1746 | nigel | 75 | -XCClinker) |
| 1747 | prev=xcclinker | ||
| 1748 | continue | ||
| 1749 | ;; | ||
| 1750 | |||
| 1751 | nigel | 83 | -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread ) |
| 1752 | compiler_flags="$compiler_flags $arg" | ||
| 1753 | continue | ||
| 1754 | ;; | ||
| 1755 | |||
| 1756 | nigel | 41 | # Some other compiler flag. |
| 1757 | -* | +*) | ||
| 1758 | # Unknown arguments in both finalize_command and compile_command need | ||
| 1759 | # to be aesthetically quoted because they are evaled later. | ||
| 1760 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1761 | nigel | 53 | case $arg in |
| 1762 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1763 | nigel | 41 | arg="\"$arg\"" |
| 1764 | ;; | ||
| 1765 | esac | ||
| 1766 | ;; | ||
| 1767 | |||
| 1768 | nigel | 75 | *.$objext) |
| 1769 | # A standard object. | ||
| 1770 | objs="$objs $arg" | ||
| 1771 | ;; | ||
| 1772 | |||
| 1773 | *.lo) | ||
| 1774 | # A libtool-controlled object. | ||
| 1775 | |||
| 1776 | # Check to see that this really is a libtool object. | ||
| 1777 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 1778 | pic_object= | ||
| 1779 | non_pic_object= | ||
| 1780 | |||
| 1781 | # Read the .lo file | ||
| 1782 | # If there is no directory component, then add one. | ||
| 1783 | case $arg in | ||
| 1784 | */* | *\\*) . $arg ;; | ||
| 1785 | *) . ./$arg ;; | ||
| 1786 | esac | ||
| 1787 | |||
| 1788 | if test -z "$pic_object" || \ | ||
| 1789 | test -z "$non_pic_object" || | ||
| 1790 | test "$pic_object" = none && \ | ||
| 1791 | test "$non_pic_object" = none; then | ||
| 1792 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 | ||
| 1793 | exit $EXIT_FAILURE | ||
| 1794 | fi | ||
| 1795 | |||
| 1796 | # Extract subdirectory from the argument. | ||
| 1797 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1798 | if test "X$xdir" = "X$arg"; then | ||
| 1799 | xdir= | ||
| 1800 | nigel | 83 | else |
| 1801 | nigel | 75 | xdir="$xdir/" |
| 1802 | nigel | 41 | fi |
| 1803 | |||
| 1804 | nigel | 75 | if test "$pic_object" != none; then |
| 1805 | # Prepend the subdirectory the object is found in. | ||
| 1806 | pic_object="$xdir$pic_object" | ||
| 1807 | |||
| 1808 | if test "$prev" = dlfiles; then | ||
| 1809 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
| 1810 | dlfiles="$dlfiles $pic_object" | ||
| 1811 | prev= | ||
| 1812 | continue | ||
| 1813 | else | ||
| 1814 | # If libtool objects are unsupported, then we need to preload. | ||
| 1815 | prev=dlprefiles | ||
| 1816 | fi | ||
| 1817 | fi | ||
| 1818 | |||
| 1819 | # CHECK ME: I think I busted this. -Ossama | ||
| 1820 | if test "$prev" = dlprefiles; then | ||
| 1821 | # Preload the old-style object. | ||
| 1822 | dlprefiles="$dlprefiles $pic_object" | ||
| 1823 | prev= | ||
| 1824 | fi | ||
| 1825 | |||
| 1826 | # A PIC object. | ||
| 1827 | libobjs="$libobjs $pic_object" | ||
| 1828 | arg="$pic_object" | ||
| 1829 | fi | ||
| 1830 | |||
| 1831 | # Non-PIC object. | ||
| 1832 | if test "$non_pic_object" != none; then | ||
| 1833 | # Prepend the subdirectory the object is found in. | ||
| 1834 | non_pic_object="$xdir$non_pic_object" | ||
| 1835 | |||
| 1836 | # A standard non-PIC object | ||
| 1837 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1838 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
| 1839 | arg="$non_pic_object" | ||
| 1840 | fi | ||
| 1841 | fi | ||
| 1842 | nigel | 53 | else |
| 1843 | nigel | 75 | # Only an error if not doing a dry-run. |
| 1844 | if test -z "$run"; then | ||
| 1845 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 | ||
| 1846 | exit $EXIT_FAILURE | ||
| 1847 | else | ||
| 1848 | # Dry-run case. | ||
| 1849 | |||
| 1850 | # Extract subdirectory from the argument. | ||
| 1851 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1852 | if test "X$xdir" = "X$arg"; then | ||
| 1853 | xdir= | ||
| 1854 | else | ||
| 1855 | xdir="$xdir/" | ||
| 1856 | fi | ||
| 1857 | |||
| 1858 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | ||
| 1859 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` | ||
| 1860 | libobjs="$libobjs $pic_object" | ||
| 1861 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1862 | fi | ||
| 1863 | nigel | 41 | fi |
| 1864 | ;; | ||
| 1865 | |||
| 1866 | nigel | 53 | *.$libext) |
| 1867 | # An archive. | ||
| 1868 | deplibs="$deplibs $arg" | ||
| 1869 | old_deplibs="$old_deplibs $arg" | ||
| 1870 | continue | ||
| 1871 | ;; | ||
| 1872 | |||
| 1873 | nigel | 41 | *.la) |
| 1874 | # A libtool-controlled library. | ||
| 1875 | |||
| 1876 | nigel | 53 | if test "$prev" = dlfiles; then |
| 1877 | # This library was specified with -dlopen. | ||
| 1878 | dlfiles="$dlfiles $arg" | ||
| 1879 | prev= | ||
| 1880 | elif test "$prev" = dlprefiles; then | ||
| 1881 | # The library was specified with -dlpreopen. | ||
| 1882 | dlprefiles="$dlprefiles $arg" | ||
| 1883 | prev= | ||
| 1884 | else | ||
| 1885 | deplibs="$deplibs $arg" | ||
| 1886 | fi | ||
| 1887 | continue | ||
| 1888 | ;; | ||
| 1889 | nigel | 41 | |
| 1890 | nigel | 53 | # Some other compiler argument. |
| 1891 | *) | ||
| 1892 | # Unknown arguments in both finalize_command and compile_command need | ||
| 1893 | # to be aesthetically quoted because they are evaled later. | ||
| 1894 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1895 | case $arg in | ||
| 1896 | nigel | 83 | *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") |
| 1897 | nigel | 53 | arg="\"$arg\"" |
| 1898 | ;; | ||
| 1899 | esac | ||
| 1900 | ;; | ||
| 1901 | esac # arg | ||
| 1902 | |||
| 1903 | # Now actually substitute the argument into the commands. | ||
| 1904 | if test -n "$arg"; then | ||
| 1905 | compile_command="$compile_command $arg" | ||
| 1906 | finalize_command="$finalize_command $arg" | ||
| 1907 | fi | ||
| 1908 | done # argument parsing loop | ||
| 1909 | |||
| 1910 | if test -n "$prev"; then | ||
| 1911 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 | ||
| 1912 | $echo "$help" 1>&2 | ||
| 1913 | nigel | 75 | exit $EXIT_FAILURE |
| 1914 | nigel | 53 | fi |
| 1915 | |||
| 1916 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | ||
| 1917 | eval arg=\"$export_dynamic_flag_spec\" | ||
| 1918 | compile_command="$compile_command $arg" | ||
| 1919 | finalize_command="$finalize_command $arg" | ||
| 1920 | fi | ||
| 1921 | |||
| 1922 | nigel | 75 | oldlibs= |
| 1923 | nigel | 53 | # calculate the name of the file, without its directory |
| 1924 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` | ||
| 1925 | libobjs_save="$libobjs" | ||
| 1926 | |||
| 1927 | if test -n "$shlibpath_var"; then | ||
| 1928 | # get the directories listed in $shlibpath_var | ||
| 1929 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` | ||
| 1930 | else | ||
| 1931 | shlib_search_path= | ||
| 1932 | fi | ||
| 1933 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" | ||
| 1934 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" | ||
| 1935 | |||
| 1936 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1937 | if test "X$output_objdir" = "X$output"; then | ||
| 1938 | output_objdir="$objdir" | ||
| 1939 | else | ||
| 1940 | output_objdir="$output_objdir/$objdir" | ||
| 1941 | fi | ||
| 1942 | # Create the object directory. | ||
| 1943 | nigel | 75 | if test ! -d "$output_objdir"; then |
| 1944 | nigel | 53 | $show "$mkdir $output_objdir" |
| 1945 | $run $mkdir $output_objdir | ||
| 1946 | status=$? | ||
| 1947 | nigel | 75 | if test "$status" -ne 0 && test ! -d "$output_objdir"; then |
| 1948 | nigel | 53 | exit $status |
| 1949 | fi | ||
| 1950 | fi | ||
| 1951 | |||
| 1952 | # Determine the type of output | ||
| 1953 | case $output in | ||
| 1954 | "") | ||
| 1955 | $echo "$modename: you must specify an output file" 1>&2 | ||
| 1956 | $echo "$help" 1>&2 | ||
| 1957 | nigel | 75 | exit $EXIT_FAILURE |
| 1958 | nigel | 53 | ;; |
| 1959 | *.$libext) linkmode=oldlib ;; | ||
| 1960 | *.lo | *.$objext) linkmode=obj ;; | ||
| 1961 | *.la) linkmode=lib ;; | ||
| 1962 | *) linkmode=prog ;; # Anything else should be a program. | ||
| 1963 | esac | ||
| 1964 | |||
| 1965 | nigel | 75 | case $host in |
| 1966 | *cygwin* | *mingw* | *pw32*) | ||
| 1967 | # don't eliminate duplications in $postdeps and $predeps | ||
| 1968 | duplicate_compiler_generated_deps=yes | ||
| 1969 | ;; | ||
| 1970 | *) | ||
| 1971 | duplicate_compiler_generated_deps=$duplicate_deps | ||
| 1972 | ;; | ||
| 1973 | esac | ||
| 1974 | nigel | 53 | specialdeplibs= |
| 1975 | nigel | 75 | |
| 1976 | nigel | 53 | libs= |
| 1977 | # Find all interdependent deplibs by searching for libraries | ||
| 1978 | # that are linked more than once (e.g. -la -lb -la) | ||
| 1979 | for deplib in $deplibs; do | ||
| 1980 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 1981 | case "$libs " in | ||
| 1982 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 1983 | esac | ||
| 1984 | fi | ||
| 1985 | nigel | 53 | libs="$libs $deplib" |
| 1986 | done | ||
| 1987 | nigel | 75 | |
| 1988 | if test "$linkmode" = lib; then | ||
| 1989 | libs="$predeps $libs $compiler_lib_search_path $postdeps" | ||
| 1990 | |||
| 1991 | # Compute libraries that are listed more than once in $predeps | ||
| 1992 | # $postdeps and mark them as special (i.e., whose duplicates are | ||
| 1993 | # not to be eliminated). | ||
| 1994 | pre_post_deps= | ||
| 1995 | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then | ||
| 1996 | for pre_post_dep in $predeps $postdeps; do | ||
| 1997 | case "$pre_post_deps " in | ||
| 1998 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; | ||
| 1999 | esac | ||
| 2000 | pre_post_deps="$pre_post_deps $pre_post_dep" | ||
| 2001 | done | ||
| 2002 | fi | ||
| 2003 | pre_post_deps= | ||
| 2004 | fi | ||
| 2005 | |||
| 2006 | nigel | 53 | deplibs= |
| 2007 | newdependency_libs= | ||
| 2008 | newlib_search_path= | ||
| 2009 | need_relink=no # whether we're linking any uninstalled libtool libraries | ||
| 2010 | notinst_deplibs= # not-installed libtool libraries | ||
| 2011 | notinst_path= # paths that contain not-installed libtool libraries | ||
| 2012 | case $linkmode in | ||
| 2013 | lib) | ||
| 2014 | passes="conv link" | ||
| 2015 | for file in $dlfiles $dlprefiles; do | ||
| 2016 | case $file in | ||
| 2017 | *.la) ;; | ||
| 2018 | *) | ||
| 2019 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 | ||
| 2020 | nigel | 75 | exit $EXIT_FAILURE |
| 2021 | nigel | 53 | ;; |
| 2022 | esac | ||
| 2023 | done | ||
| 2024 | ;; | ||
| 2025 | prog) | ||
| 2026 | compile_deplibs= | ||
| 2027 | finalize_deplibs= | ||
| 2028 | alldeplibs=no | ||
| 2029 | newdlfiles= | ||
| 2030 | newdlprefiles= | ||
| 2031 | passes="conv scan dlopen dlpreopen link" | ||
| 2032 | ;; | ||
| 2033 | *) passes="conv" | ||
| 2034 | ;; | ||
| 2035 | esac | ||
| 2036 | for pass in $passes; do | ||
| 2037 | nigel | 75 | if test "$linkmode,$pass" = "lib,link" || |
| 2038 | test "$linkmode,$pass" = "prog,scan"; then | ||
| 2039 | libs="$deplibs" | ||
| 2040 | deplibs= | ||
| 2041 | fi | ||
| 2042 | if test "$linkmode" = prog; then | ||
| 2043 | nigel | 53 | case $pass in |
| 2044 | nigel | 75 | dlopen) libs="$dlfiles" ;; |
| 2045 | nigel | 53 | dlpreopen) libs="$dlprefiles" ;; |
| 2046 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; | ||
| 2047 | esac | ||
| 2048 | fi | ||
| 2049 | nigel | 75 | if test "$pass" = dlopen; then |
| 2050 | # Collect dlpreopened libraries | ||
| 2051 | save_deplibs="$deplibs" | ||
| 2052 | deplibs= | ||
| 2053 | fi | ||
| 2054 | nigel | 53 | for deplib in $libs; do |
| 2055 | lib= | ||
| 2056 | found=no | ||
| 2057 | case $deplib in | ||
| 2058 | nigel | 75 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 2059 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 2060 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2061 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2062 | else | ||
| 2063 | nigel | 83 | compiler_flags="$compiler_flags $deplib" |
| 2064 | nigel | 75 | fi |
| 2065 | continue | ||
| 2066 | ;; | ||
| 2067 | nigel | 53 | -l*) |
| 2068 | nigel | 75 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 2069 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 | ||
| 2070 | nigel | 53 | continue |
| 2071 | fi | ||
| 2072 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` | ||
| 2073 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 2074 | nigel | 75 | for search_ext in .la $std_shrext .so .a; do |
| 2075 | # Search the libtool library | ||
| 2076 | lib="$searchdir/lib${name}${search_ext}" | ||
| 2077 | if test -f "$lib"; then | ||
| 2078 | if test "$search_ext" = ".la"; then | ||
| 2079 | found=yes | ||
| 2080 | else | ||
| 2081 | found=no | ||
| 2082 | fi | ||
| 2083 | break 2 | ||
| 2084 | fi | ||
| 2085 | done | ||
| 2086 | nigel | 53 | done |
| 2087 | if test "$found" != yes; then | ||
| 2088 | # deplib doesn't seem to be a libtool library | ||
| 2089 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 2090 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2091 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2092 | else | ||
| 2093 | deplibs="$deplib $deplibs" | ||
| 2094 | nigel | 75 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 2095 | nigel | 53 | fi |
| 2096 | continue | ||
| 2097 | nigel | 75 | else # deplib is a libtool library |
| 2098 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, | ||
| 2099 | # We need to do some special things here, and not later. | ||
| 2100 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 2101 | case " $predeps $postdeps " in | ||
| 2102 | *" $deplib "*) | ||
| 2103 | if (${SED} -e '2q' $lib | | ||
| 2104 | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 2105 | library_names= | ||
| 2106 | old_library= | ||
| 2107 | case $lib in | ||
| 2108 | */* | *\\*) . $lib ;; | ||
| 2109 | *) . ./$lib ;; | ||
| 2110 | esac | ||
| 2111 | for l in $old_library $library_names; do | ||
| 2112 | ll="$l" | ||
| 2113 | done | ||
| 2114 | if test "X$ll" = "X$old_library" ; then # only static version available | ||
| 2115 | found=no | ||
| 2116 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` | ||
| 2117 | test "X$ladir" = "X$lib" && ladir="." | ||
| 2118 | lib=$ladir/$old_library | ||
| 2119 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 2120 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2121 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2122 | else | ||
| 2123 | deplibs="$deplib $deplibs" | ||
| 2124 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" | ||
| 2125 | fi | ||
| 2126 | continue | ||
| 2127 | fi | ||
| 2128 | fi | ||
| 2129 | nigel | 83 | ;; |
| 2130 | nigel | 75 | *) ;; |
| 2131 | esac | ||
| 2132 | fi | ||
| 2133 | nigel | 53 | fi |
| 2134 | ;; # -l | ||
| 2135 | -L*) | ||
| 2136 | case $linkmode in | ||
| 2137 | lib) | ||
| 2138 | deplibs="$deplib $deplibs" | ||
| 2139 | nigel | 75 | test "$pass" = conv && continue |
| 2140 | nigel | 53 | newdependency_libs="$deplib $newdependency_libs" |
| 2141 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` | ||
| 2142 | ;; | ||
| 2143 | prog) | ||
| 2144 | nigel | 75 | if test "$pass" = conv; then |
| 2145 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2146 | continue | ||
| 2147 | fi | ||
| 2148 | nigel | 75 | if test "$pass" = scan; then |
| 2149 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2150 | else | ||
| 2151 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2152 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2153 | fi | ||
| 2154 | nigel | 75 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
| 2155 | nigel | 53 | ;; |
| 2156 | *) | ||
| 2157 | nigel | 75 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
| 2158 | nigel | 53 | ;; |
| 2159 | esac # linkmode | ||
| 2160 | continue | ||
| 2161 | ;; # -L | ||
| 2162 | -R*) | ||
| 2163 | nigel | 75 | if test "$pass" = link; then |
| 2164 | nigel | 53 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
| 2165 | # Make sure the xrpath contains only unique directories. | ||
| 2166 | case "$xrpath " in | ||
| 2167 | *" $dir "*) ;; | ||
| 2168 | *) xrpath="$xrpath $dir" ;; | ||
| 2169 | esac | ||
| 2170 | fi | ||
| 2171 | deplibs="$deplib $deplibs" | ||
| 2172 | continue | ||
| 2173 | ;; | ||
| 2174 | *.la) lib="$deplib" ;; | ||
| 2175 | *.$libext) | ||
| 2176 | nigel | 75 | if test "$pass" = conv; then |
| 2177 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2178 | continue | ||
| 2179 | fi | ||
| 2180 | case $linkmode in | ||
| 2181 | lib) | ||
| 2182 | nigel | 75 | valid_a_lib=no |
| 2183 | case $deplibs_check_method in | ||
| 2184 | match_pattern*) | ||
| 2185 | set dummy $deplibs_check_method | ||
| 2186 | nigel | 83 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 2187 | nigel | 75 | if eval $echo \"$deplib\" 2>/dev/null \ |
| 2188 | | $SED 10q \ | ||
| 2189 | | $EGREP "$match_pattern_regex" > /dev/null; then | ||
| 2190 | valid_a_lib=yes | ||
| 2191 | fi | ||
| 2192 | ;; | ||
| 2193 | pass_all) | ||
| 2194 | valid_a_lib=yes | ||
| 2195 | ;; | ||
| 2196 | esac | ||
| 2197 | if test "$valid_a_lib" != yes; then | ||
| 2198 | $echo | ||
| 2199 | $echo "*** Warning: Trying to link with static lib archive $deplib." | ||
| 2200 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 2201 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 2202 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 2203 | $echo "*** because the file extensions .$libext of this argument makes me believe" | ||
| 2204 | $echo "*** that it is just a static archive that I should not used here." | ||
| 2205 | nigel | 53 | else |
| 2206 | nigel | 75 | $echo |
| 2207 | $echo "*** Warning: Linking the shared library $output against the" | ||
| 2208 | $echo "*** static library $deplib is not portable!" | ||
| 2209 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2210 | fi | ||
| 2211 | continue | ||
| 2212 | ;; | ||
| 2213 | prog) | ||
| 2214 | nigel | 75 | if test "$pass" != link; then |
| 2215 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2216 | else | ||
| 2217 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2218 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2219 | fi | ||
| 2220 | continue | ||
| 2221 | ;; | ||
| 2222 | esac # linkmode | ||
| 2223 | ;; # *.$libext | ||
| 2224 | *.lo | *.$objext) | ||
| 2225 | nigel | 75 | if test "$pass" = conv; then |
| 2226 | deplibs="$deplib $deplibs" | ||
| 2227 | elif test "$linkmode" = prog; then | ||
| 2228 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then | ||
| 2229 | # If there is no dlopen support or we're linking statically, | ||
| 2230 | # we need to preload. | ||
| 2231 | newdlprefiles="$newdlprefiles $deplib" | ||
| 2232 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2233 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2234 | else | ||
| 2235 | newdlfiles="$newdlfiles $deplib" | ||
| 2236 | fi | ||
| 2237 | nigel | 53 | fi |
| 2238 | continue | ||
| 2239 | ;; | ||
| 2240 | %DEPLIBS%) | ||
| 2241 | alldeplibs=yes | ||
| 2242 | continue | ||
| 2243 | ;; | ||
| 2244 | esac # case $deplib | ||
| 2245 | nigel | 75 | if test "$found" = yes || test -f "$lib"; then : |
| 2246 | nigel | 53 | else |
| 2247 | $echo "$modename: cannot find the library \`$lib'" 1>&2 | ||
| 2248 | nigel | 75 | exit $EXIT_FAILURE |
| 2249 | nigel | 53 | fi |
| 2250 | |||
| 2251 | nigel | 41 | # Check to see that this really is a libtool archive. |
| 2252 | nigel | 75 | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
| 2253 | nigel | 41 | else |
| 2254 | nigel | 53 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
| 2255 | nigel | 75 | exit $EXIT_FAILURE |
| 2256 | nigel | 41 | fi |
| 2257 | |||
| 2258 | nigel | 53 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2259 | test "X$ladir" = "X$lib" && ladir="." | ||
| 2260 | |||
| 2261 | dlname= | ||
| 2262 | dlopen= | ||
| 2263 | dlpreopen= | ||
| 2264 | libdir= | ||
| 2265 | library_names= | ||
| 2266 | old_library= | ||
| 2267 | nigel | 41 | # If the library was installed with an old release of libtool, |
| 2268 | nigel | 75 | # it will not redefine variables installed, or shouldnotlink |
| 2269 | nigel | 41 | installed=yes |
| 2270 | nigel | 75 | shouldnotlink=no |
| 2271 | nigel | 83 | avoidtemprpath= |
| 2272 | nigel | 41 | |
| 2273 | nigel | 83 | |
| 2274 | nigel | 41 | # Read the .la file |
| 2275 | nigel | 53 | case $lib in |
| 2276 | */* | *\\*) . $lib ;; | ||
| 2277 | *) . ./$lib ;; | ||
| 2278 | nigel | 41 | esac |
| 2279 | |||
| 2280 | nigel | 53 | if test "$linkmode,$pass" = "lib,link" || |
| 2281 | test "$linkmode,$pass" = "prog,scan" || | ||
| 2282 | nigel | 75 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
| 2283 | nigel | 53 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
| 2284 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" | ||
| 2285 | fi | ||
| 2286 | |||
| 2287 | nigel | 75 | if test "$pass" = conv; then |
| 2288 | nigel | 53 | # Only check for convenience libraries |
| 2289 | deplibs="$lib $deplibs" | ||
| 2290 | if test -z "$libdir"; then | ||
| 2291 | if test -z "$old_library"; then | ||
| 2292 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 | ||
| 2293 | nigel | 75 | exit $EXIT_FAILURE |
| 2294 | nigel | 53 | fi |
| 2295 | # It is a libtool convenience library, so add in its objects. | ||
| 2296 | convenience="$convenience $ladir/$objdir/$old_library" | ||
| 2297 | old_convenience="$old_convenience $ladir/$objdir/$old_library" | ||
| 2298 | tmp_libs= | ||
| 2299 | for deplib in $dependency_libs; do | ||
| 2300 | deplibs="$deplib $deplibs" | ||
| 2301 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2302 | nigel | 83 | case "$tmp_libs " in |
| 2303 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2304 | esac | ||
| 2305 | nigel | 63 | fi |
| 2306 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2307 | done | ||
| 2308 | nigel | 75 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
| 2309 | nigel | 53 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
| 2310 | nigel | 75 | exit $EXIT_FAILURE |
| 2311 | nigel | 53 | fi |
| 2312 | continue | ||
| 2313 | fi # $pass = conv | ||
| 2314 | |||
| 2315 | nigel | 75 | |
| 2316 | nigel | 41 | # Get the name of the library we link against. |
| 2317 | linklib= | ||
| 2318 | for l in $old_library $library_names; do | ||
| 2319 | linklib="$l" | ||
| 2320 | done | ||
| 2321 | if test -z "$linklib"; then | ||
| 2322 | nigel | 53 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
| 2323 | nigel | 75 | exit $EXIT_FAILURE |
| 2324 | nigel | 41 | fi |
| 2325 | |||
| 2326 | nigel | 53 | # This library was specified with -dlopen. |
| 2327 | nigel | 75 | if test "$pass" = dlopen; then |
| 2328 | nigel | 53 | if test -z "$libdir"; then |
| 2329 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 | ||
| 2330 | nigel | 75 | exit $EXIT_FAILURE |
| 2331 | nigel | 53 | fi |
| 2332 | nigel | 75 | if test -z "$dlname" || |
| 2333 | test "$dlopen_support" != yes || | ||
| 2334 | test "$build_libtool_libs" = no; then | ||
| 2335 | nigel | 53 | # If there is no dlname, no dlopen support or we're linking |
| 2336 | nigel | 75 | # statically, we need to preload. We also need to preload any |
| 2337 | # dependent libraries so libltdl's deplib preloader doesn't | ||
| 2338 | # bomb out in the load deplibs phase. | ||
| 2339 | dlprefiles="$dlprefiles $lib $dependency_libs" | ||
| 2340 | nigel | 41 | else |
| 2341 | nigel | 53 | newdlfiles="$newdlfiles $lib" |
| 2342 | nigel | 41 | fi |
| 2343 | nigel | 53 | continue |
| 2344 | fi # $pass = dlopen | ||
| 2345 | nigel | 41 | |
| 2346 | nigel | 53 | # We need an absolute path. |
| 2347 | case $ladir in | ||
| 2348 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; | ||
| 2349 | *) | ||
| 2350 | abs_ladir=`cd "$ladir" && pwd` | ||
| 2351 | if test -z "$abs_ladir"; then | ||
| 2352 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 | ||
| 2353 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 | ||
| 2354 | abs_ladir="$ladir" | ||
| 2355 | fi | ||
| 2356 | ;; | ||
| 2357 | esac | ||
| 2358 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` | ||
| 2359 | nigel | 41 | |
| 2360 | nigel | 53 | # Find the relevant object directory and library name. |
| 2361 | if test "X$installed" = Xyes; then | ||
| 2362 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then | ||
| 2363 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 | ||
| 2364 | dir="$ladir" | ||
| 2365 | absdir="$abs_ladir" | ||
| 2366 | libdir="$abs_ladir" | ||
| 2367 | nigel | 41 | else |
| 2368 | nigel | 53 | dir="$libdir" |
| 2369 | absdir="$libdir" | ||
| 2370 | nigel | 41 | fi |
| 2371 | nigel | 83 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
| 2372 | nigel | 53 | else |
| 2373 | nigel | 75 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2374 | dir="$ladir" | ||
| 2375 | absdir="$abs_ladir" | ||
| 2376 | # Remove this search path later | ||
| 2377 | notinst_path="$notinst_path $abs_ladir" | ||
| 2378 | else | ||
| 2379 | dir="$ladir/$objdir" | ||
| 2380 | absdir="$abs_ladir/$objdir" | ||
| 2381 | # Remove this search path later | ||
| 2382 | notinst_path="$notinst_path $abs_ladir" | ||
| 2383 | fi | ||
| 2384 | nigel | 53 | fi # $installed = yes |
| 2385 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | ||
| 2386 | nigel | 41 | |
| 2387 | nigel | 53 | # This library was specified with -dlpreopen. |
| 2388 | nigel | 75 | if test "$pass" = dlpreopen; then |
| 2389 | nigel | 53 | if test -z "$libdir"; then |
| 2390 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 | ||
| 2391 | nigel | 75 | exit $EXIT_FAILURE |
| 2392 | nigel | 53 | fi |
| 2393 | nigel | 41 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 2394 | # are required to link). | ||
| 2395 | if test -n "$old_library"; then | ||
| 2396 | nigel | 53 | newdlprefiles="$newdlprefiles $dir/$old_library" |
| 2397 | # Otherwise, use the dlname, so that lt_dlopen finds it. | ||
| 2398 | elif test -n "$dlname"; then | ||
| 2399 | newdlprefiles="$newdlprefiles $dir/$dlname" | ||
| 2400 | nigel | 41 | else |
| 2401 | nigel | 53 | newdlprefiles="$newdlprefiles $dir/$linklib" |
| 2402 | nigel | 41 | fi |
| 2403 | nigel | 53 | fi # $pass = dlpreopen |
| 2404 | |||
| 2405 | if test -z "$libdir"; then | ||
| 2406 | # Link the convenience library | ||
| 2407 | nigel | 75 | if test "$linkmode" = lib; then |
| 2408 | nigel | 53 | deplibs="$dir/$old_library $deplibs" |
| 2409 | elif test "$linkmode,$pass" = "prog,link"; then | ||
| 2410 | compile_deplibs="$dir/$old_library $compile_deplibs" | ||
| 2411 | finalize_deplibs="$dir/$old_library $finalize_deplibs" | ||
| 2412 | else | ||
| 2413 | nigel | 75 | deplibs="$lib $deplibs" # used for prog,scan pass |
| 2414 | nigel | 53 | fi |
| 2415 | continue | ||
| 2416 | nigel | 41 | fi |
| 2417 | |||
| 2418 | nigel | 75 | |
| 2419 | if test "$linkmode" = prog && test "$pass" != link; then | ||
| 2420 | nigel | 53 | newlib_search_path="$newlib_search_path $ladir" |
| 2421 | deplibs="$lib $deplibs" | ||
| 2422 | |||
| 2423 | linkalldeplibs=no | ||
| 2424 | if test "$link_all_deplibs" != no || test -z "$library_names" || | ||
| 2425 | test "$build_libtool_libs" = no; then | ||
| 2426 | linkalldeplibs=yes | ||
| 2427 | fi | ||
| 2428 | |||
| 2429 | tmp_libs= | ||
| 2430 | for deplib in $dependency_libs; do | ||
| 2431 | case $deplib in | ||
| 2432 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test | ||
| 2433 | esac | ||
| 2434 | # Need to link against all dependency_libs? | ||
| 2435 | nigel | 75 | if test "$linkalldeplibs" = yes; then |
| 2436 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2437 | else | ||
| 2438 | # Need to hardcode shared library paths | ||
| 2439 | # or/and link against static libraries | ||
| 2440 | newdependency_libs="$deplib $newdependency_libs" | ||
| 2441 | fi | ||
| 2442 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2443 | case "$tmp_libs " in | ||
| 2444 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2445 | esac | ||
| 2446 | fi | ||
| 2447 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2448 | done # for deplib | ||
| 2449 | continue | ||
| 2450 | fi # $linkmode = prog... | ||
| 2451 | |||
| 2452 | nigel | 75 | if test "$linkmode,$pass" = "prog,link"; then |
| 2453 | if test -n "$library_names" && | ||
| 2454 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | ||
| 2455 | # We need to hardcode the library path | ||
| 2456 | nigel | 83 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
| 2457 | nigel | 75 | # Make sure the rpath contains only unique directories. |
| 2458 | case "$temp_rpath " in | ||
| 2459 | *" $dir "*) ;; | ||
| 2460 | *" $absdir "*) ;; | ||
| 2461 | *) temp_rpath="$temp_rpath $dir" ;; | ||
| 2462 | esac | ||
| 2463 | fi | ||
| 2464 | nigel | 41 | |
| 2465 | nigel | 53 | # Hardcode the library path. |
| 2466 | # Skip directories that are in the system default run-time | ||
| 2467 | # search path. | ||
| 2468 | case " $sys_lib_dlsearch_path " in | ||
| 2469 | nigel | 41 | *" $absdir "*) ;; |
| 2470 | nigel | 53 | *) |
| 2471 | case "$compile_rpath " in | ||
| 2472 | *" $absdir "*) ;; | ||
| 2473 | *) compile_rpath="$compile_rpath $absdir" | ||
| 2474 | esac | ||
| 2475 | ;; | ||
| 2476 | nigel | 41 | esac |
| 2477 | nigel | 53 | case " $sys_lib_dlsearch_path " in |
| 2478 | nigel | 41 | *" $libdir "*) ;; |
| 2479 | nigel | 53 | *) |
| 2480 | case "$finalize_rpath " in | ||
| 2481 | *" $libdir "*) ;; | ||
| 2482 | *) finalize_rpath="$finalize_rpath $libdir" | ||
| 2483 | esac | ||
| 2484 | ;; | ||
| 2485 | nigel | 41 | esac |
| 2486 | nigel | 53 | fi # $linkmode,$pass = prog,link... |
| 2487 | nigel | 41 | |
| 2488 | nigel | 53 | if test "$alldeplibs" = yes && |
| 2489 | { test "$deplibs_check_method" = pass_all || | ||
| 2490 | { test "$build_libtool_libs" = yes && | ||
| 2491 | test -n "$library_names"; }; }; then | ||
| 2492 | # We only need to search for static libraries | ||
| 2493 | continue | ||
| 2494 | fi | ||
| 2495 | nigel | 75 | fi |
| 2496 | nigel | 53 | |
| 2497 | nigel | 75 | link_static=no # Whether the deplib will be linked statically |
| 2498 | if test -n "$library_names" && | ||
| 2499 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | ||
| 2500 | nigel | 53 | if test "$installed" = no; then |
| 2501 | notinst_deplibs="$notinst_deplibs $lib" | ||
| 2502 | need_relink=yes | ||
| 2503 | fi | ||
| 2504 | nigel | 75 | # This is a shared library |
| 2505 | nigel | 53 | |
| 2506 | nigel | 75 | # Warn about portability, can't link against -module's on |
| 2507 | # some systems (darwin) | ||
| 2508 | if test "$shouldnotlink" = yes && test "$pass" = link ; then | ||
| 2509 | $echo | ||
| 2510 | if test "$linkmode" = prog; then | ||
| 2511 | $echo "*** Warning: Linking the executable $output against the loadable module" | ||
| 2512 | else | ||
| 2513 | $echo "*** Warning: Linking the shared library $output against the loadable module" | ||
| 2514 | fi | ||
| 2515 | $echo "*** $linklib is not portable!" | ||
| 2516 | fi | ||
| 2517 | if test "$linkmode" = lib && | ||
| 2518 | test "$hardcode_into_libs" = yes; then | ||
| 2519 | # Hardcode the library path. | ||
| 2520 | # Skip directories that are in the system default run-time | ||
| 2521 | # search path. | ||
| 2522 | case " $sys_lib_dlsearch_path " in | ||
| 2523 | *" $absdir "*) ;; | ||
| 2524 | *) | ||
| 2525 | case "$compile_rpath " in | ||
| 2526 | *" $absdir "*) ;; | ||
| 2527 | *) compile_rpath="$compile_rpath $absdir" | ||
| 2528 | esac | ||
| 2529 | ;; | ||
| 2530 | esac | ||
| 2531 | case " $sys_lib_dlsearch_path " in | ||
| 2532 | *" $libdir "*) ;; | ||
| 2533 | *) | ||
| 2534 | case "$finalize_rpath " in | ||
| 2535 | *" $libdir "*) ;; | ||
| 2536 | *) finalize_rpath="$finalize_rpath $libdir" | ||
| 2537 | esac | ||
| 2538 | ;; | ||
| 2539 | esac | ||
| 2540 | fi | ||
| 2541 | |||
| 2542 | nigel | 53 | if test -n "$old_archive_from_expsyms_cmds"; then |
| 2543 | # figure out the soname | ||
| 2544 | set dummy $library_names | ||
| 2545 | realname="$2" | ||
| 2546 | shift; shift | ||
| 2547 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 2548 | # use dlname if we got it. it's perfectly good, no? | ||
| 2549 | if test -n "$dlname"; then | ||
| 2550 | soname="$dlname" | ||
| 2551 | elif test -n "$soname_spec"; then | ||
| 2552 | # bleh windows | ||
| 2553 | case $host in | ||
| 2554 | nigel | 75 | *cygwin* | mingw*) |
| 2555 | nigel | 53 | major=`expr $current - $age` |
| 2556 | versuffix="-$major" | ||
| 2557 | nigel | 41 | ;; |
| 2558 | esac | ||
| 2559 | nigel | 53 | eval soname=\"$soname_spec\" |
| 2560 | else | ||
| 2561 | soname="$realname" | ||
| 2562 | fi | ||
| 2563 | |||
| 2564 | # Make a new name for the extract_expsyms_cmds to use | ||
| 2565 | soroot="$soname" | ||
| 2566 | nigel | 75 | soname=`$echo $soroot | ${SED} -e 's/^.*\///'` |
| 2567 | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" | ||
| 2568 | nigel | 53 | |
| 2569 | # If the library has no export list, then create one now | ||
| 2570 | if test -f "$output_objdir/$soname-def"; then : | ||
| 2571 | else | ||
| 2572 | $show "extracting exported symbol list from \`$soname'" | ||
| 2573 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 2574 | nigel | 75 | cmds=$extract_expsyms_cmds |
| 2575 | nigel | 53 | for cmd in $cmds; do |
| 2576 | IFS="$save_ifs" | ||
| 2577 | nigel | 75 | eval cmd=\"$cmd\" |
| 2578 | nigel | 53 | $show "$cmd" |
| 2579 | $run eval "$cmd" || exit $? | ||
| 2580 | done | ||
| 2581 | IFS="$save_ifs" | ||
| 2582 | fi | ||
| 2583 | |||
| 2584 | # Create $newlib | ||
| 2585 | if test -f "$output_objdir/$newlib"; then :; else | ||
| 2586 | $show "generating import library for \`$soname'" | ||
| 2587 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 2588 | nigel | 75 | cmds=$old_archive_from_expsyms_cmds |
| 2589 | nigel | 53 | for cmd in $cmds; do |
| 2590 | IFS="$save_ifs" | ||
| 2591 | nigel | 75 | eval cmd=\"$cmd\" |
| 2592 | nigel | 53 | $show "$cmd" |
| 2593 | $run eval "$cmd" || exit $? | ||
| 2594 | done | ||
| 2595 | IFS="$save_ifs" | ||
| 2596 | fi | ||
| 2597 | # make sure the library variables are pointing to the new library | ||
| 2598 | dir=$output_objdir | ||
| 2599 | linklib=$newlib | ||
| 2600 | nigel | 75 | fi # test -n "$old_archive_from_expsyms_cmds" |
| 2601 | nigel | 53 | |
| 2602 | nigel | 75 | if test "$linkmode" = prog || test "$mode" != relink; then |
| 2603 | nigel | 53 | add_shlibpath= |
| 2604 | add_dir= | ||
| 2605 | add= | ||
| 2606 | lib_linked=yes | ||
| 2607 | case $hardcode_action in | ||
| 2608 | immediate | unsupported) | ||
| 2609 | if test "$hardcode_direct" = no; then | ||
| 2610 | add="$dir/$linklib" | ||
| 2611 | nigel | 75 | case $host in |
| 2612 | *-*-sco3.2v5* ) add_dir="-L$dir" ;; | ||
| 2613 | *-*-darwin* ) | ||
| 2614 | # if the lib is a module then we can not link against | ||
| 2615 | # it, someone is ignoring the new warnings I added | ||
| 2616 | if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then | ||
| 2617 | $echo "** Warning, lib $linklib is a module, not a shared library" | ||
| 2618 | if test -z "$old_library" ; then | ||
| 2619 | nigel | 83 | $echo |
| 2620 | $echo "** And there doesn't seem to be a static archive available" | ||
| 2621 | $echo "** The link will probably fail, sorry" | ||
| 2622 | nigel | 75 | else |
| 2623 | nigel | 83 | add="$dir/$old_library" |
| 2624 | nigel | 75 | fi |
| 2625 | fi | ||
| 2626 | esac | ||
| 2627 | nigel | 53 | elif test "$hardcode_minus_L" = no; then |
| 2628 | case $host in | ||
| 2629 | *-*-sunos*) add_shlibpath="$dir" ;; | ||
| 2630 | esac | ||
| 2631 | add_dir="-L$dir" | ||
| 2632 | add="-l$name" | ||
| 2633 | elif test "$hardcode_shlibpath_var" = no; then | ||
| 2634 | add_shlibpath="$dir" | ||
| 2635 | add="-l$name" | ||
| 2636 | else | ||
| 2637 | lib_linked=no | ||
| 2638 | fi | ||
| 2639 | ;; | ||
| 2640 | relink) | ||
| 2641 | if test "$hardcode_direct" = yes; then | ||
| 2642 | add="$dir/$linklib" | ||
| 2643 | elif test "$hardcode_minus_L" = yes; then | ||
| 2644 | add_dir="-L$dir" | ||
| 2645 | nigel | 75 | # Try looking first in the location we're being installed to. |
| 2646 | if test -n "$inst_prefix_dir"; then | ||
| 2647 | case "$libdir" in | ||
| 2648 | [\\/]*) | ||
| 2649 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
| 2650 | ;; | ||
| 2651 | esac | ||
| 2652 | fi | ||
| 2653 | nigel | 53 | add="-l$name" |
| 2654 | elif test "$hardcode_shlibpath_var" = yes; then | ||
| 2655 | add_shlibpath="$dir" | ||
| 2656 | add="-l$name" | ||
| 2657 | else | ||
| 2658 | lib_linked=no | ||
| 2659 | fi | ||
| 2660 | ;; | ||
| 2661 | *) lib_linked=no ;; | ||
| 2662 | esac | ||
| 2663 | |||
| 2664 | if test "$lib_linked" != yes; then | ||
| 2665 | $echo "$modename: configuration error: unsupported hardcode properties" | ||
| 2666 | nigel | 75 | exit $EXIT_FAILURE |
| 2667 | nigel | 53 | fi |
| 2668 | |||
| 2669 | if test -n "$add_shlibpath"; then | ||
| 2670 | case :$compile_shlibpath: in | ||
| 2671 | *":$add_shlibpath:"*) ;; | ||
| 2672 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; | ||
| 2673 | nigel | 41 | esac |
| 2674 | nigel | 53 | fi |
| 2675 | nigel | 75 | if test "$linkmode" = prog; then |
| 2676 | nigel | 53 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 2677 | test -n "$add" && compile_deplibs="$add $compile_deplibs" | ||
| 2678 | nigel | 41 | else |
| 2679 | nigel | 53 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2680 | test -n "$add" && deplibs="$add $deplibs" | ||
| 2681 | if test "$hardcode_direct" != yes && \ | ||
| 2682 | test "$hardcode_minus_L" != yes && \ | ||
| 2683 | test "$hardcode_shlibpath_var" = yes; then | ||
| 2684 | case :$finalize_shlibpath: in | ||
| 2685 | *":$libdir:"*) ;; | ||
| 2686 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | ||
| 2687 | esac | ||
| 2688 | fi | ||
| 2689 | nigel | 41 | fi |
| 2690 | nigel | 53 | fi |
| 2691 | nigel | 41 | |
| 2692 | nigel | 75 | if test "$linkmode" = prog || test "$mode" = relink; then |
| 2693 | nigel | 53 | add_shlibpath= |
| 2694 | add_dir= | ||
| 2695 | add= | ||
| 2696 | # Finalize command for both is simple: just hardcode it. | ||
| 2697 | nigel | 41 | if test "$hardcode_direct" = yes; then |
| 2698 | nigel | 53 | add="$libdir/$linklib" |
| 2699 | nigel | 41 | elif test "$hardcode_minus_L" = yes; then |
| 2700 | nigel | 53 | add_dir="-L$libdir" |
| 2701 | add="-l$name" | ||
| 2702 | nigel | 41 | elif test "$hardcode_shlibpath_var" = yes; then |
| 2703 | nigel | 53 | case :$finalize_shlibpath: in |
| 2704 | *":$libdir:"*) ;; | ||
| 2705 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | ||
| 2706 | nigel | 41 | esac |
| 2707 | nigel | 53 | add="-l$name" |
| 2708 | nigel | 75 | elif test "$hardcode_automatic" = yes; then |
| 2709 | if test -n "$inst_prefix_dir" && | ||
| 2710 | test -f "$inst_prefix_dir$libdir/$linklib" ; then | ||
| 2711 | nigel | 83 | add="$inst_prefix_dir$libdir/$linklib" |
| 2712 | nigel | 75 | else |
| 2713 | nigel | 83 | add="$libdir/$linklib" |
| 2714 | nigel | 75 | fi |
| 2715 | nigel | 41 | else |
| 2716 | nigel | 53 | # We cannot seem to hardcode it, guess we'll fake it. |
| 2717 | add_dir="-L$libdir" | ||
| 2718 | nigel | 75 | # Try looking first in the location we're being installed to. |
| 2719 | if test -n "$inst_prefix_dir"; then | ||
| 2720 | case "$libdir" in | ||
| 2721 | [\\/]*) | ||
| 2722 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
| 2723 | ;; | ||
| 2724 | esac | ||
| 2725 | fi | ||
| 2726 | nigel | 53 | add="-l$name" |
| 2727 | nigel | 41 | fi |
| 2728 | |||
| 2729 | nigel | 75 | if test "$linkmode" = prog; then |
| 2730 | nigel | 53 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 2731 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" | ||
| 2732 | else | ||
| 2733 | test -n "$add_dir" && deplibs="$add_dir $deplibs" | ||
| 2734 | test -n "$add" && deplibs="$add $deplibs" | ||
| 2735 | fi | ||
| 2736 | nigel | 41 | fi |
| 2737 | nigel | 75 | elif test "$linkmode" = prog; then |
| 2738 | nigel | 41 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 2739 | # is not unsupported. This is valid on all known static and | ||
| 2740 | # shared platforms. | ||
| 2741 | if test "$hardcode_direct" != unsupported; then | ||
| 2742 | test -n "$old_library" && linklib="$old_library" | ||
| 2743 | nigel | 53 | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 2744 | finalize_deplibs="$dir/$linklib $finalize_deplibs" | ||
| 2745 | nigel | 41 | else |
| 2746 | nigel | 53 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 2747 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" | ||
| 2748 | nigel | 41 | fi |
| 2749 | nigel | 53 | elif test "$build_libtool_libs" = yes; then |
| 2750 | # Not a shared library | ||
| 2751 | if test "$deplibs_check_method" != pass_all; then | ||
| 2752 | # We're trying link a shared library against a static one | ||
| 2753 | # but the system doesn't support it. | ||
| 2754 | nigel | 41 | |
| 2755 | nigel | 53 | # Just print a warning and add the library to dependency_libs so |
| 2756 | # that the program can be linked against the static library. | ||
| 2757 | nigel | 75 | $echo |
| 2758 | $echo "*** Warning: This system can not link to static lib archive $lib." | ||
| 2759 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 2760 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 2761 | $echo "*** shared version of the library, which you do not appear to have." | ||
| 2762 | nigel | 53 | if test "$module" = yes; then |
| 2763 | nigel | 75 | $echo "*** But as you try to build a module library, libtool will still create " |
| 2764 | $echo "*** a static module, that should work as long as the dlopening application" | ||
| 2765 | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." | ||
| 2766 | nigel | 53 | if test -z "$global_symbol_pipe"; then |
| 2767 | nigel | 75 | $echo |
| 2768 | $echo "*** However, this would only work if libtool was able to extract symbol" | ||
| 2769 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | ||
| 2770 | $echo "*** not find such a program. So, this module is probably useless." | ||
| 2771 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." | ||
| 2772 | nigel | 53 | fi |
| 2773 | if test "$build_old_libs" = no; then | ||
| 2774 | nigel | 63 | build_libtool_libs=module |
| 2775 | build_old_libs=yes | ||
| 2776 | nigel | 53 | else |
| 2777 | nigel | 63 | build_libtool_libs=no |
| 2778 | nigel | 53 | fi |
| 2779 | fi | ||
| 2780 | else | ||
| 2781 | convenience="$convenience $dir/$old_library" | ||
| 2782 | old_convenience="$old_convenience $dir/$old_library" | ||
| 2783 | deplibs="$dir/$old_library $deplibs" | ||
| 2784 | link_static=yes | ||
| 2785 | fi | ||
| 2786 | fi # link shared/static library? | ||
| 2787 | nigel | 41 | |
| 2788 | nigel | 75 | if test "$linkmode" = lib; then |
| 2789 | nigel | 53 | if test -n "$dependency_libs" && |
| 2790 | nigel | 75 | { test "$hardcode_into_libs" != yes || |
| 2791 | test "$build_old_libs" = yes || | ||
| 2792 | test "$link_static" = yes; }; then | ||
| 2793 | nigel | 53 | # Extract -R from dependency_libs |
| 2794 | temp_deplibs= | ||
| 2795 | for libdir in $dependency_libs; do | ||
| 2796 | case $libdir in | ||
| 2797 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` | ||
| 2798 | case " $xrpath " in | ||
| 2799 | *" $temp_xrpath "*) ;; | ||
| 2800 | *) xrpath="$xrpath $temp_xrpath";; | ||
| 2801 | esac;; | ||
| 2802 | *) temp_deplibs="$temp_deplibs $libdir";; | ||
| 2803 | esac | ||
| 2804 | done | ||
| 2805 | dependency_libs="$temp_deplibs" | ||
| 2806 | fi | ||
| 2807 | nigel | 41 | |
| 2808 | nigel | 53 | newlib_search_path="$newlib_search_path $absdir" |
| 2809 | # Link against this library | ||
| 2810 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" | ||
| 2811 | # ... and its dependency_libs | ||
| 2812 | tmp_libs= | ||
| 2813 | for deplib in $dependency_libs; do | ||
| 2814 | newdependency_libs="$deplib $newdependency_libs" | ||
| 2815 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2816 | case "$tmp_libs " in | ||
| 2817 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2818 | esac | ||
| 2819 | fi | ||
| 2820 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2821 | done | ||
| 2822 | nigel | 41 | |
| 2823 | nigel | 75 | if test "$link_all_deplibs" != no; then |
| 2824 | nigel | 53 | # Add the search paths of all dependency libraries |
| 2825 | for deplib in $dependency_libs; do | ||
| 2826 | case $deplib in | ||
| 2827 | -L*) path="$deplib" ;; | ||
| 2828 | *.la) | ||
| 2829 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` | ||
| 2830 | test "X$dir" = "X$deplib" && dir="." | ||
| 2831 | # We need an absolute path. | ||
| 2832 | case $dir in | ||
| 2833 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; | ||
| 2834 | *) | ||
| 2835 | absdir=`cd "$dir" && pwd` | ||
| 2836 | if test -z "$absdir"; then | ||
| 2837 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 | ||
| 2838 | absdir="$dir" | ||
| 2839 | fi | ||
| 2840 | ;; | ||
| 2841 | esac | ||
| 2842 | if grep "^installed=no" $deplib > /dev/null; then | ||
| 2843 | nigel | 75 | path="$absdir/$objdir" |
| 2844 | nigel | 53 | else |
| 2845 | nigel | 63 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 2846 | nigel | 53 | if test -z "$libdir"; then |
| 2847 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 | ||
| 2848 | nigel | 75 | exit $EXIT_FAILURE |
| 2849 | nigel | 53 | fi |
| 2850 | if test "$absdir" != "$libdir"; then | ||
| 2851 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 | ||
| 2852 | fi | ||
| 2853 | nigel | 75 | path="$absdir" |
| 2854 | nigel | 53 | fi |
| 2855 | nigel | 75 | depdepl= |
| 2856 | case $host in | ||
| 2857 | *-*-darwin*) | ||
| 2858 | # we do not want to link against static libs, | ||
| 2859 | # but need to link against shared | ||
| 2860 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` | ||
| 2861 | if test -n "$deplibrary_names" ; then | ||
| 2862 | for tmp in $deplibrary_names ; do | ||
| 2863 | depdepl=$tmp | ||
| 2864 | done | ||
| 2865 | if test -f "$path/$depdepl" ; then | ||
| 2866 | depdepl="$path/$depdepl" | ||
| 2867 | fi | ||
| 2868 | # do not add paths which are already there | ||
| 2869 | case " $newlib_search_path " in | ||
| 2870 | *" $path "*) ;; | ||
| 2871 | *) newlib_search_path="$newlib_search_path $path";; | ||
| 2872 | esac | ||
| 2873 | fi | ||
| 2874 | path="" | ||
| 2875 | ;; | ||
| 2876 | *) | ||
| 2877 | path="-L$path" | ||
| 2878 | ;; | ||
| 2879 | esac | ||
| 2880 | nigel | 53 | ;; |
| 2881 | nigel | 75 | -l*) |
| 2882 | case $host in | ||
| 2883 | *-*-darwin*) | ||
| 2884 | # Again, we only want to link against shared libraries | ||
| 2885 | eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` | ||
| 2886 | for tmp in $newlib_search_path ; do | ||
| 2887 | if test -f "$tmp/lib$tmp_libs.dylib" ; then | ||
| 2888 | eval depdepl="$tmp/lib$tmp_libs.dylib" | ||
| 2889 | break | ||
| 2890 | fi | ||
| 2891 | done | ||
| 2892 | path="" | ||
| 2893 | ;; | ||
| 2894 | *) continue ;; | ||
| 2895 | esac | ||
| 2896 | ;; | ||
| 2897 | nigel | 53 | *) continue ;; |
| 2898 | esac | ||
| 2899 | case " $deplibs " in | ||
| 2900 | nigel | 83 | *" $path "*) ;; |
| 2901 | *) deplibs="$path $deplibs" ;; | ||
| 2902 | esac | ||
| 2903 | case " $deplibs " in | ||
| 2904 | nigel | 75 | *" $depdepl "*) ;; |
| 2905 | *) deplibs="$depdepl $deplibs" ;; | ||
| 2906 | esac | ||
| 2907 | nigel | 53 | done |
| 2908 | fi # link_all_deplibs != no | ||
| 2909 | fi # linkmode = lib | ||
| 2910 | done # for deplib in $libs | ||
| 2911 | nigel | 75 | dependency_libs="$newdependency_libs" |
| 2912 | if test "$pass" = dlpreopen; then | ||
| 2913 | nigel | 53 | # Link the dlpreopened libraries before other libraries |
| 2914 | for deplib in $save_deplibs; do | ||
| 2915 | deplibs="$deplib $deplibs" | ||
| 2916 | done | ||
| 2917 | nigel | 41 | fi |
| 2918 | nigel | 75 | if test "$pass" != dlopen; then |
| 2919 | if test "$pass" != conv; then | ||
| 2920 | nigel | 53 | # Make sure lib_search_path contains only unique directories. |
| 2921 | lib_search_path= | ||
| 2922 | for dir in $newlib_search_path; do | ||
| 2923 | case "$lib_search_path " in | ||
| 2924 | *" $dir "*) ;; | ||
| 2925 | *) lib_search_path="$lib_search_path $dir" ;; | ||
| 2926 | esac | ||
| 2927 | done | ||
| 2928 | newlib_search_path= | ||
| 2929 | fi | ||
| 2930 | nigel | 41 | |
| 2931 | nigel | 53 | if test "$linkmode,$pass" != "prog,link"; then |
| 2932 | vars="deplibs" | ||
| 2933 | else | ||
| 2934 | vars="compile_deplibs finalize_deplibs" | ||
| 2935 | fi | ||
| 2936 | for var in $vars dependency_libs; do | ||
| 2937 | # Add libraries to $var in reverse order | ||
| 2938 | eval tmp_libs=\"\$$var\" | ||
| 2939 | new_libs= | ||
| 2940 | for deplib in $tmp_libs; do | ||
| 2941 | nigel | 75 | # FIXME: Pedantically, this is the right thing to do, so |
| 2942 | nigel | 83 | # that some nasty dependency loop isn't accidentally |
| 2943 | # broken: | ||
| 2944 | nigel | 75 | #new_libs="$deplib $new_libs" |
| 2945 | # Pragmatically, this seems to cause very few problems in | ||
| 2946 | # practice: | ||
| 2947 | nigel | 53 | case $deplib in |
| 2948 | -L*) new_libs="$deplib $new_libs" ;; | ||
| 2949 | nigel | 75 | -R*) ;; |
| 2950 | nigel | 53 | *) |
| 2951 | nigel | 75 | # And here is the reason: when a library appears more |
| 2952 | # than once as an explicit dependence of a library, or | ||
| 2953 | # is implicitly linked in more than once by the | ||
| 2954 | # compiler, it is considered special, and multiple | ||
| 2955 | # occurrences thereof are not removed. Compare this | ||
| 2956 | # with having the same library being listed as a | ||
| 2957 | # dependency of multiple other libraries: in this case, | ||
| 2958 | # we know (pedantically, we assume) the library does not | ||
| 2959 | # need to be listed more than once, so we keep only the | ||
| 2960 | # last copy. This is not always right, but it is rare | ||
| 2961 | # enough that we require users that really mean to play | ||
| 2962 | # such unportable linking tricks to link the library | ||
| 2963 | # using -Wl,-lname, so that libtool does not consider it | ||
| 2964 | # for duplicate removal. | ||
| 2965 | nigel | 53 | case " $specialdeplibs " in |
| 2966 | *" $deplib "*) new_libs="$deplib $new_libs" ;; | ||
| 2967 | *) | ||
| 2968 | case " $new_libs " in | ||
| 2969 | *" $deplib "*) ;; | ||
| 2970 | *) new_libs="$deplib $new_libs" ;; | ||
| 2971 | esac | ||
| 2972 | ;; | ||
| 2973 | esac | ||
| 2974 | ;; | ||
| 2975 | esac | ||
| 2976 | done | ||
| 2977 | tmp_libs= | ||
| 2978 | for deplib in $new_libs; do | ||
| 2979 | case $deplib in | ||
| 2980 | -L*) | ||
| 2981 | case " $tmp_libs " in | ||
| 2982 | *" $deplib "*) ;; | ||
| 2983 | *) tmp_libs="$tmp_libs $deplib" ;; | ||
| 2984 | esac | ||
| 2985 | ;; | ||
| 2986 | *) tmp_libs="$tmp_libs $deplib" ;; | ||
| 2987 | esac | ||
| 2988 | done | ||
| 2989 | eval $var=\"$tmp_libs\" | ||
| 2990 | done # for var | ||
| 2991 | nigel | 41 | fi |
| 2992 | nigel | 75 | # Last step: remove runtime libs from dependency_libs |
| 2993 | # (they stay in deplibs) | ||
| 2994 | tmp_libs= | ||
| 2995 | for i in $dependency_libs ; do | ||
| 2996 | case " $predeps $postdeps $compiler_lib_search_path " in | ||
| 2997 | *" $i "*) | ||
| 2998 | i="" | ||
| 2999 | ;; | ||
| 3000 | esac | ||
| 3001 | if test -n "$i" ; then | ||
| 3002 | tmp_libs="$tmp_libs $i" | ||
| 3003 | fi | ||
| 3004 | done | ||
| 3005 | dependency_libs=$tmp_libs | ||
| 3006 | nigel | 53 | done # for pass |
| 3007 | nigel | 75 | if test "$linkmode" = prog; then |
| 3008 | nigel | 53 | dlfiles="$newdlfiles" |
| 3009 | dlprefiles="$newdlprefiles" | ||
| 3010 | fi | ||
| 3011 | nigel | 41 | |
| 3012 | nigel | 53 | case $linkmode in |
| 3013 | oldlib) | ||
| 3014 | nigel | 75 | if test -n "$deplibs"; then |
| 3015 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 | ||
| 3016 | fi | ||
| 3017 | |||
| 3018 | nigel | 41 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 3019 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 | ||
| 3020 | fi | ||
| 3021 | |||
| 3022 | if test -n "$rpath"; then | ||
| 3023 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 | ||
| 3024 | fi | ||
| 3025 | |||
| 3026 | if test -n "$xrpath"; then | ||
| 3027 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 | ||
| 3028 | fi | ||
| 3029 | |||
| 3030 | if test -n "$vinfo"; then | ||
| 3031 | nigel | 75 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 |
| 3032 | nigel | 41 | fi |
| 3033 | |||
| 3034 | if test -n "$release"; then | ||
| 3035 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 | ||
| 3036 | fi | ||
| 3037 | |||
| 3038 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
| 3039 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 | ||
| 3040 | fi | ||
| 3041 | |||
| 3042 | # Now set the variables for building old libraries. | ||
| 3043 | build_libtool_libs=no | ||
| 3044 | oldlibs="$output" | ||
| 3045 | nigel | 53 | objs="$objs$old_deplibs" |
| 3046 | nigel | 41 | ;; |
| 3047 | |||
| 3048 | nigel | 53 | lib) |
| 3049 | nigel | 41 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 3050 | nigel | 53 | case $outputname in |
| 3051 | nigel | 41 | lib*) |
| 3052 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | ||
| 3053 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 3054 | nigel | 41 | eval libname=\"$libname_spec\" |
| 3055 | ;; | ||
| 3056 | *) | ||
| 3057 | if test "$module" = no; then | ||
| 3058 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 | ||
| 3059 | $echo "$help" 1>&2 | ||
| 3060 | nigel | 75 | exit $EXIT_FAILURE |
| 3061 | nigel | 41 | fi |
| 3062 | if test "$need_lib_prefix" != no; then | ||
| 3063 | # Add the "lib" prefix for modules if required | ||
| 3064 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | ||
| 3065 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 3066 | nigel | 41 | eval libname=\"$libname_spec\" |
| 3067 | else | ||
| 3068 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | ||
| 3069 | fi | ||
| 3070 | ;; | ||
| 3071 | esac | ||
| 3072 | |||
| 3073 | if test -n "$objs"; then | ||
| 3074 | nigel | 53 | if test "$deplibs_check_method" != pass_all; then |
| 3075 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 | ||
| 3076 | nigel | 75 | exit $EXIT_FAILURE |
| 3077 | nigel | 53 | else |
| 3078 | nigel | 75 | $echo |
| 3079 | $echo "*** Warning: Linking the shared library $output against the non-libtool" | ||
| 3080 | $echo "*** objects $objs is not portable!" | ||
| 3081 | nigel | 53 | libobjs="$libobjs $objs" |
| 3082 | fi | ||
| 3083 | nigel | 41 | fi |
| 3084 | |||
| 3085 | nigel | 53 | if test "$dlself" != no; then |
| 3086 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 | ||
| 3087 | nigel | 41 | fi |
| 3088 | |||
| 3089 | set dummy $rpath | ||
| 3090 | nigel | 75 | if test "$#" -gt 2; then |
| 3091 | nigel | 41 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
| 3092 | fi | ||
| 3093 | install_libdir="$2" | ||
| 3094 | |||
| 3095 | oldlibs= | ||
| 3096 | if test -z "$rpath"; then | ||
| 3097 | if test "$build_libtool_libs" = yes; then | ||
| 3098 | # Building a libtool convenience library. | ||
| 3099 | nigel | 75 | # Some compilers have problems with a `.al' extension so |
| 3100 | # convenience libraries should have the same extension an | ||
| 3101 | # archive normally would. | ||
| 3102 | nigel | 41 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
| 3103 | build_libtool_libs=convenience | ||
| 3104 | build_old_libs=yes | ||
| 3105 | fi | ||
| 3106 | |||
| 3107 | if test -n "$vinfo"; then | ||
| 3108 | nigel | 75 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 |
| 3109 | nigel | 41 | fi |
| 3110 | |||
| 3111 | if test -n "$release"; then | ||
| 3112 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 | ||
| 3113 | fi | ||
| 3114 | else | ||
| 3115 | |||
| 3116 | # Parse the version information argument. | ||
| 3117 | nigel | 63 | save_ifs="$IFS"; IFS=':' |
| 3118 | nigel | 41 | set dummy $vinfo 0 0 0 |
| 3119 | IFS="$save_ifs" | ||
| 3120 | |||
| 3121 | if test -n "$8"; then | ||
| 3122 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 | ||
| 3123 | $echo "$help" 1>&2 | ||
| 3124 | nigel | 75 | exit $EXIT_FAILURE |
| 3125 | nigel | 41 | fi |
| 3126 | |||
| 3127 | nigel | 75 | # convert absolute version numbers to libtool ages |
| 3128 | # this retains compatibility with .la files and attempts | ||
| 3129 | # to make the code below a bit more comprehensible | ||
| 3130 | nigel | 41 | |
| 3131 | nigel | 75 | case $vinfo_number in |
| 3132 | yes) | ||
| 3133 | number_major="$2" | ||
| 3134 | number_minor="$3" | ||
| 3135 | number_revision="$4" | ||
| 3136 | # | ||
| 3137 | # There are really only two kinds -- those that | ||
| 3138 | # use the current revision as the major version | ||
| 3139 | # and those that subtract age and use age as | ||
| 3140 | # a minor version. But, then there is irix | ||
| 3141 | # which has an extra 1 added just for fun | ||
| 3142 | # | ||
| 3143 | case $version_type in | ||
| 3144 | darwin|linux|osf|windows) | ||
| 3145 | current=`expr $number_major + $number_minor` | ||
| 3146 | age="$number_minor" | ||
| 3147 | revision="$number_revision" | ||
| 3148 | ;; | ||
| 3149 | freebsd-aout|freebsd-elf|sunos) | ||
| 3150 | current="$number_major" | ||
| 3151 | revision="$number_minor" | ||
| 3152 | age="0" | ||
| 3153 | ;; | ||
| 3154 | irix|nonstopux) | ||
| 3155 | current=`expr $number_major + $number_minor - 1` | ||
| 3156 | age="$number_minor" | ||
| 3157 | revision="$number_minor" | ||
| 3158 | ;; | ||
| 3159 | esac | ||
| 3160 | ;; | ||
| 3161 | no) | ||
| 3162 | current="$2" | ||
| 3163 | revision="$3" | ||
| 3164 | age="$4" | ||
| 3165 | ;; | ||
| 3166 | esac | ||
| 3167 | |||
| 3168 | nigel | 41 | # Check that each of the things are valid numbers. |
| 3169 | nigel | 53 | case $current in |
| 3170 | nigel | 83 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; |
| 3171 | nigel | 41 | *) |
| 3172 | nigel | 83 | $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 |
| 3173 | nigel | 41 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 3174 | nigel | 75 | exit $EXIT_FAILURE |
| 3175 | nigel | 41 | ;; |
| 3176 | esac | ||
| 3177 | |||
| 3178 | nigel | 53 | case $revision in |
| 3179 | nigel | 83 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; |
| 3180 | nigel | 41 | *) |
| 3181 | nigel | 83 | $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 |
| 3182 | nigel | 41 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 3183 | nigel | 75 | exit $EXIT_FAILURE |
| 3184 | nigel | 41 | ;; |
| 3185 | esac | ||
| 3186 | |||
| 3187 | nigel | 53 | case $age in |
| 3188 | nigel | 83 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; |
| 3189 | nigel | 41 | *) |
| 3190 | nigel | 83 | $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 |
| 3191 | nigel | 41 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
| 3192 | nigel | 75 | exit $EXIT_FAILURE |
| 3193 | nigel | 41 | ;; |
| 3194 | esac | ||
| 3195 | |||
| 3196 | nigel | 75 | if test "$age" -gt "$current"; then |
| 3197 | nigel | 41 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
| 3198 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | ||
| 3199 | nigel | 75 | exit $EXIT_FAILURE |
| 3200 | nigel | 41 | fi |
| 3201 | |||
| 3202 | # Calculate the version variables. | ||
| 3203 | major= | ||
| 3204 | versuffix= | ||
| 3205 | verstring= | ||
| 3206 | nigel | 53 | case $version_type in |
| 3207 | nigel | 41 | none) ;; |
| 3208 | |||
| 3209 | nigel | 53 | darwin) |
| 3210 | # Like Linux, but with the current version available in | ||
| 3211 | # verstring for coding it into the library header | ||
| 3212 | major=.`expr $current - $age` | ||
| 3213 | versuffix="$major.$age.$revision" | ||
| 3214 | # Darwin ld doesn't like 0 for these options... | ||
| 3215 | minor_current=`expr $current + 1` | ||
| 3216 | nigel | 75 | verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
| 3217 | nigel | 53 | ;; |
| 3218 | |||
| 3219 | freebsd-aout) | ||
| 3220 | major=".$current" | ||
| 3221 | versuffix=".$current.$revision"; | ||
| 3222 | ;; | ||
| 3223 | |||
| 3224 | freebsd-elf) | ||
| 3225 | major=".$current" | ||
| 3226 | versuffix=".$current"; | ||
| 3227 | ;; | ||
| 3228 | |||
| 3229 | nigel | 63 | irix | nonstopux) |
| 3230 | nigel | 41 | major=`expr $current - $age + 1` |
| 3231 | |||
| 3232 | nigel | 63 | case $version_type in |
| 3233 | nonstopux) verstring_prefix=nonstopux ;; | ||
| 3234 | nigel | 83 | *) verstring_prefix=sgi ;; |
| 3235 | nigel | 63 | esac |
| 3236 | verstring="$verstring_prefix$major.$revision" | ||
| 3237 | |||
| 3238 | nigel | 41 | # Add in all the interfaces that we are compatible with. |
| 3239 | loop=$revision | ||
| 3240 | nigel | 75 | while test "$loop" -ne 0; do |
| 3241 | nigel | 41 | iface=`expr $revision - $loop` |
| 3242 | loop=`expr $loop - 1` | ||
| 3243 | nigel | 63 | verstring="$verstring_prefix$major.$iface:$verstring" |
| 3244 | nigel | 41 | done |
| 3245 | nigel | 53 | |
| 3246 | # Before this point, $major must not contain `.'. | ||
| 3247 | major=.$major | ||
| 3248 | versuffix="$major.$revision" | ||
| 3249 | nigel | 41 | ;; |
| 3250 | |||
| 3251 | linux) | ||
| 3252 | major=.`expr $current - $age` | ||
| 3253 | versuffix="$major.$age.$revision" | ||
| 3254 | ;; | ||
| 3255 | |||
| 3256 | osf) | ||
| 3257 | nigel | 63 | major=.`expr $current - $age` |
| 3258 | nigel | 41 | versuffix=".$current.$age.$revision" |
| 3259 | verstring="$current.$age.$revision" | ||
| 3260 | |||
| 3261 | # Add in all the interfaces that we are compatible with. | ||
| 3262 | loop=$age | ||
| 3263 | nigel | 75 | while test "$loop" -ne 0; do |
| 3264 | nigel | 41 | iface=`expr $current - $loop` |
| 3265 | loop=`expr $loop - 1` | ||
| 3266 | verstring="$verstring:${iface}.0" | ||
| 3267 | done | ||
| 3268 | |||
| 3269 | # Make executables depend on our current version. | ||
| 3270 | verstring="$verstring:${current}.0" | ||
| 3271 | ;; | ||
| 3272 | |||
| 3273 | sunos) | ||
| 3274 | major=".$current" | ||
| 3275 | versuffix=".$current.$revision" | ||
| 3276 | ;; | ||
| 3277 | |||
| 3278 | windows) | ||
| 3279 | nigel | 53 | # Use '-' rather than '.', since we only want one |
| 3280 | # extension on DOS 8.3 filesystems. | ||
| 3281 | nigel | 41 | major=`expr $current - $age` |
| 3282 | nigel | 53 | versuffix="-$major" |
| 3283 | nigel | 41 | ;; |
| 3284 | |||
| 3285 | *) | ||
| 3286 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 | ||
| 3287 | nigel | 75 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 3288 | exit $EXIT_FAILURE | ||
| 3289 | nigel | 41 | ;; |
| 3290 | esac | ||
| 3291 | |||
| 3292 | # Clear the version info if we defaulted, and they specified a release. | ||
| 3293 | if test -z "$vinfo" && test -n "$release"; then | ||
| 3294 | major= | ||
| 3295 | nigel | 63 | case $version_type in |
| 3296 | darwin) | ||
| 3297 | # we can't check for "0.0" in archive_cmds due to quoting | ||
| 3298 | # problems, so we reset it completely | ||
| 3299 | nigel | 75 | verstring= |
| 3300 | nigel | 63 | ;; |
| 3301 | *) | ||
| 3302 | verstring="0.0" | ||
| 3303 | ;; | ||
| 3304 | esac | ||
| 3305 | nigel | 41 | if test "$need_version" = no; then |
| 3306 | versuffix= | ||
| 3307 | else | ||
| 3308 | versuffix=".0.0" | ||
| 3309 | fi | ||
| 3310 | fi | ||
| 3311 | |||
| 3312 | # Remove version info from name if versioning should be avoided | ||
| 3313 | if test "$avoid_version" = yes && test "$need_version" = no; then | ||
| 3314 | major= | ||
| 3315 | versuffix= | ||
| 3316 | verstring="" | ||
| 3317 | fi | ||
| 3318 | nigel | 53 | |
| 3319 | nigel | 41 | # Check to see if the archive will have undefined symbols. |
| 3320 | if test "$allow_undefined" = yes; then | ||
| 3321 | if test "$allow_undefined_flag" = unsupported; then | ||
| 3322 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 | ||
| 3323 | build_libtool_libs=no | ||
| 3324 | build_old_libs=yes | ||
| 3325 | fi | ||
| 3326 | else | ||
| 3327 | # Don't allow undefined symbols. | ||
| 3328 | allow_undefined_flag="$no_undefined_flag" | ||
| 3329 | fi | ||
| 3330 | fi | ||
| 3331 | |||
| 3332 | nigel | 53 | if test "$mode" != relink; then |
| 3333 | nigel | 75 | # Remove our outputs, but don't remove object files since they |
| 3334 | # may have been created when compiling PIC objects. | ||
| 3335 | removelist= | ||
| 3336 | tempremovelist=`$echo "$output_objdir/*"` | ||
| 3337 | for p in $tempremovelist; do | ||
| 3338 | case $p in | ||
| 3339 | *.$objext) | ||
| 3340 | ;; | ||
| 3341 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) | ||
| 3342 | if test "X$precious_files_regex" != "X"; then | ||
| 3343 | nigel | 83 | if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
| 3344 | then | ||
| 3345 | nigel | 75 | continue |
| 3346 | fi | ||
| 3347 | fi | ||
| 3348 | removelist="$removelist $p" | ||
| 3349 | ;; | ||
| 3350 | *) ;; | ||
| 3351 | esac | ||
| 3352 | done | ||
| 3353 | if test -n "$removelist"; then | ||
| 3354 | $show "${rm}r $removelist" | ||
| 3355 | $run ${rm}r $removelist | ||
| 3356 | fi | ||
| 3357 | nigel | 41 | fi |
| 3358 | |||
| 3359 | # Now set the variables for building old libraries. | ||
| 3360 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then | ||
| 3361 | oldlibs="$oldlibs $output_objdir/$libname.$libext" | ||
| 3362 | |||
| 3363 | # Transform .lo files to .o files. | ||
| 3364 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` | ||
| 3365 | fi | ||
| 3366 | |||
| 3367 | nigel | 53 | # Eliminate all temporary directories. |
| 3368 | for path in $notinst_path; do | ||
| 3369 | nigel | 75 | lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` |
| 3370 | deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` | ||
| 3371 | dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` | ||
| 3372 | nigel | 53 | done |
| 3373 | |||
| 3374 | if test -n "$xrpath"; then | ||
| 3375 | # If the user specified any rpath flags, then add them. | ||
| 3376 | temp_xrpath= | ||
| 3377 | for libdir in $xrpath; do | ||
| 3378 | temp_xrpath="$temp_xrpath -R$libdir" | ||
| 3379 | case "$finalize_rpath " in | ||
| 3380 | *" $libdir "*) ;; | ||
| 3381 | *) finalize_rpath="$finalize_rpath $libdir" ;; | ||
| 3382 | esac | ||
| 3383 | done | ||
| 3384 | nigel | 75 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
| 3385 | nigel | 53 | dependency_libs="$temp_xrpath $dependency_libs" |
| 3386 | fi | ||
| 3387 | fi | ||
| 3388 | |||
| 3389 | # Make sure dlfiles contains only unique files that won't be dlpreopened | ||
| 3390 | old_dlfiles="$dlfiles" | ||
| 3391 | dlfiles= | ||
| 3392 | for lib in $old_dlfiles; do | ||
| 3393 | case " $dlprefiles $dlfiles " in | ||
| 3394 | *" $lib "*) ;; | ||
| 3395 | *) dlfiles="$dlfiles $lib" ;; | ||
| 3396 | esac | ||
| 3397 | done | ||
| 3398 | |||
| 3399 | # Make sure dlprefiles contains only unique files | ||
| 3400 | old_dlprefiles="$dlprefiles" | ||
| 3401 | dlprefiles= | ||
| 3402 | for lib in $old_dlprefiles; do | ||
| 3403 | case "$dlprefiles " in | ||
| 3404 | *" $lib "*) ;; | ||
| 3405 | *) dlprefiles="$dlprefiles $lib" ;; | ||
| 3406 | esac | ||
| 3407 | done | ||
| 3408 | |||
| 3409 | nigel | 41 | if test "$build_libtool_libs" = yes; then |
| 3410 | nigel | 53 | if test -n "$rpath"; then |
| 3411 | case $host in | ||
| 3412 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) | ||
| 3413 | # these systems don't actually have a c library (as such)! | ||
| 3414 | ;; | ||
| 3415 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
| 3416 | # Rhapsody C library is in the System framework | ||
| 3417 | deplibs="$deplibs -framework System" | ||
| 3418 | ;; | ||
| 3419 | *-*-netbsd*) | ||
| 3420 | # Don't link with libc until the a.out ld.so is fixed. | ||
| 3421 | ;; | ||
| 3422 | nigel | 83 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 3423 | nigel | 63 | # Do not include libc due to us having libc/libc_r. |
| 3424 | nigel | 75 | test "X$arg" = "X-lc" && continue |
| 3425 | nigel | 63 | ;; |
| 3426 | nigel | 83 | *) |
| 3427 | nigel | 53 | # Add libc to deplibs on all other systems if necessary. |
| 3428 | nigel | 75 | if test "$build_libtool_need_lc" = "yes"; then |
| 3429 | nigel | 53 | deplibs="$deplibs -lc" |
| 3430 | fi | ||
| 3431 | ;; | ||
| 3432 | esac | ||
| 3433 | fi | ||
| 3434 | |||
| 3435 | nigel | 41 | # Transform deplibs into only deplibs that can be linked in shared. |
| 3436 | name_save=$name | ||
| 3437 | libname_save=$libname | ||
| 3438 | release_save=$release | ||
| 3439 | versuffix_save=$versuffix | ||
| 3440 | major_save=$major | ||
| 3441 | # I'm not sure if I'm treating the release correctly. I think | ||
| 3442 | # release should show up in the -l (ie -lgmp5) so we don't want to | ||
| 3443 | # add it in twice. Is that correct? | ||
| 3444 | release="" | ||
| 3445 | versuffix="" | ||
| 3446 | major="" | ||
| 3447 | newdeplibs= | ||
| 3448 | droppeddeps=no | ||
| 3449 | nigel | 53 | case $deplibs_check_method in |
| 3450 | nigel | 41 | pass_all) |
| 3451 | # Don't check for shared/static. Everything works. | ||
| 3452 | # This might be a little naive. We might want to check | ||
| 3453 | nigel | 83 | # whether the library exists or not. But this is on |
| 3454 | nigel | 41 | # osf3 & osf4 and I'm not really sure... Just |
| 3455 | nigel | 75 | # implementing what was already the behavior. |
| 3456 | nigel | 41 | newdeplibs=$deplibs |
| 3457 | ;; | ||
| 3458 | test_compile) | ||
| 3459 | # This code stresses the "libraries are programs" paradigm to its | ||
| 3460 | # limits. Maybe even breaks it. We compile a program, linking it | ||
| 3461 | # against the deplibs as a proxy for the library. Then we can check | ||
| 3462 | # whether they linked in statically or dynamically with ldd. | ||
| 3463 | $rm conftest.c | ||
| 3464 | cat > conftest.c <<EOF | ||
| 3465 | int main() { return 0; } | ||
| 3466 | EOF | ||
| 3467 | $rm conftest | ||
| 3468 | nigel | 75 | $LTCC -o conftest conftest.c $deplibs |
| 3469 | if test "$?" -eq 0 ; then | ||
| 3470 | nigel | 41 | ldd_output=`ldd conftest` |
| 3471 | for i in $deplibs; do | ||
| 3472 | name="`expr $i : '-l\(.*\)'`" | ||
| 3473 | # If $name is empty we are operating on a -L argument. | ||
| 3474 | nigel | 75 | if test "$name" != "" && test "$name" -ne "0"; then |
| 3475 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3476 | case " $predeps $postdeps " in | ||
| 3477 | *" $i "*) | ||
| 3478 | newdeplibs="$newdeplibs $i" | ||
| 3479 | i="" | ||
| 3480 | ;; | ||
| 3481 | esac | ||
| 3482 | nigel | 83 | fi |
| 3483 | nigel | 75 | if test -n "$i" ; then |
| 3484 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3485 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | ||
| 3486 | set dummy $deplib_matches | ||
| 3487 | deplib_match=$2 | ||
| 3488 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | ||
| 3489 | newdeplibs="$newdeplibs $i" | ||
| 3490 | else | ||
| 3491 | droppeddeps=yes | ||
| 3492 | $echo | ||
| 3493 | $echo "*** Warning: dynamic linker does not accept needed library $i." | ||
| 3494 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3495 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3496 | $echo "*** shared version of the library, which I believe you do not have" | ||
| 3497 | $echo "*** because a test_compile did reveal that the linker did not use it for" | ||
| 3498 | $echo "*** its dynamic dependency list that programs get resolved with at runtime." | ||
| 3499 | fi | ||
| 3500 | fi | ||
| 3501 | nigel | 41 | else |
| 3502 | newdeplibs="$newdeplibs $i" | ||
| 3503 | fi | ||
| 3504 | done | ||
| 3505 | else | ||
| 3506 | nigel | 75 | # Error occurred in the first compile. Let's try to salvage |
| 3507 | nigel | 63 | # the situation: Compile a separate program for each library. |
| 3508 | nigel | 41 | for i in $deplibs; do |
| 3509 | name="`expr $i : '-l\(.*\)'`" | ||
| 3510 | nigel | 75 | # If $name is empty we are operating on a -L argument. |
| 3511 | if test "$name" != "" && test "$name" != "0"; then | ||
| 3512 | nigel | 41 | $rm conftest |
| 3513 | nigel | 75 | $LTCC -o conftest conftest.c $i |
| 3514 | nigel | 41 | # Did it work? |
| 3515 | nigel | 75 | if test "$?" -eq 0 ; then |
| 3516 | nigel | 41 | ldd_output=`ldd conftest` |
| 3517 | nigel | 75 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3518 | case " $predeps $postdeps " in | ||
| 3519 | *" $i "*) | ||
| 3520 | newdeplibs="$newdeplibs $i" | ||
| 3521 | i="" | ||
| 3522 | ;; | ||
| 3523 | esac | ||
| 3524 | nigel | 41 | fi |
| 3525 | nigel | 75 | if test -n "$i" ; then |
| 3526 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3527 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | ||
| 3528 | set dummy $deplib_matches | ||
| 3529 | deplib_match=$2 | ||
| 3530 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | ||
| 3531 | newdeplibs="$newdeplibs $i" | ||
| 3532 | else | ||
| 3533 | droppeddeps=yes | ||
| 3534 | $echo | ||
| 3535 | $echo "*** Warning: dynamic linker does not accept needed library $i." | ||
| 3536 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3537 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3538 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3539 | $echo "*** because a test_compile did reveal that the linker did not use this one" | ||
| 3540 | $echo "*** as a dynamic dependency that programs can get resolved with at runtime." | ||
| 3541 | fi | ||
| 3542 | fi | ||
| 3543 | nigel | 41 | else |
| 3544 | droppeddeps=yes | ||
| 3545 | nigel | 75 | $echo |
| 3546 | $echo "*** Warning! Library $i is needed by this library but I was not able to" | ||
| 3547 | nigel | 83 | $echo "*** make it link in! You will probably need to install it or some" |
| 3548 | nigel | 75 | $echo "*** library that it depends on before this library will be fully" |
| 3549 | $echo "*** functional. Installing it before continuing would be even better." | ||
| 3550 | nigel | 41 | fi |
| 3551 | else | ||
| 3552 | newdeplibs="$newdeplibs $i" | ||
| 3553 | fi | ||
| 3554 | done | ||
| 3555 | fi | ||
| 3556 | ;; | ||
| 3557 | file_magic*) | ||
| 3558 | set dummy $deplibs_check_method | ||
| 3559 | nigel | 53 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 3560 | nigel | 41 | for a_deplib in $deplibs; do |
| 3561 | name="`expr $a_deplib : '-l\(.*\)'`" | ||
| 3562 | # If $name is empty we are operating on a -L argument. | ||
| 3563 | nigel | 75 | if test "$name" != "" && test "$name" != "0"; then |
| 3564 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3565 | case " $predeps $postdeps " in | ||
| 3566 | *" $a_deplib "*) | ||
| 3567 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3568 | a_deplib="" | ||
| 3569 | ;; | ||
| 3570 | esac | ||
| 3571 | fi | ||
| 3572 | if test -n "$a_deplib" ; then | ||
| 3573 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3574 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 3575 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | ||
| 3576 | for potent_lib in $potential_libs; do | ||
| 3577 | nigel | 41 | # Follow soft links. |
| 3578 | if ls -lLd "$potent_lib" 2>/dev/null \ | ||
| 3579 | | grep " -> " >/dev/null; then | ||
| 3580 | nigel | 53 | continue |
| 3581 | nigel | 41 | fi |
| 3582 | # The statement above tries to avoid entering an | ||
| 3583 | # endless loop below, in case of cyclic links. | ||
| 3584 | # We might still enter an endless loop, since a link | ||
| 3585 | # loop can be closed while we follow links, | ||
| 3586 | # but so what? | ||
| 3587 | potlib="$potent_lib" | ||
| 3588 | while test -h "$potlib" 2>/dev/null; do | ||
| 3589 | nigel | 63 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
| 3590 | nigel | 53 | case $potliblink in |
| 3591 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
| 3592 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; | ||
| 3593 | esac | ||
| 3594 | done | ||
| 3595 | nigel | 83 | # It is ok to link against an archive when |
| 3596 | # building a shared library. | ||
| 3597 | if $AR -t $potlib > /dev/null 2>&1; then | ||
| 3598 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3599 | a_deplib="" | ||
| 3600 | break 2 | ||
| 3601 | fi | ||
| 3602 | nigel | 41 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
| 3603 | nigel | 63 | | ${SED} 10q \ |
| 3604 | nigel | 75 | | $EGREP "$file_magic_regex" > /dev/null; then |
| 3605 | nigel | 41 | newdeplibs="$newdeplibs $a_deplib" |
| 3606 | a_deplib="" | ||
| 3607 | break 2 | ||
| 3608 | fi | ||
| 3609 | nigel | 75 | done |
| 3610 | done | ||
| 3611 | fi | ||
| 3612 | nigel | 41 | if test -n "$a_deplib" ; then |
| 3613 | droppeddeps=yes | ||
| 3614 | nigel | 75 | $echo |
| 3615 | $echo "*** Warning: linker path does not have real file for library $a_deplib." | ||
| 3616 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3617 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3618 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3619 | $echo "*** because I did check the linker path looking for a file starting" | ||
| 3620 | nigel | 63 | if test -z "$potlib" ; then |
| 3621 | nigel | 75 | $echo "*** with $libname but no candidates were found. (...for file magic test)" |
| 3622 | nigel | 63 | else |
| 3623 | nigel | 75 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3624 | $echo "*** using a file magic. Last file checked: $potlib" | ||
| 3625 | nigel | 63 | fi |
| 3626 | nigel | 41 | fi |
| 3627 | else | ||
| 3628 | # Add a -L argument. | ||
| 3629 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3630 | fi | ||
| 3631 | done # Gone through all deplibs. | ||
| 3632 | ;; | ||
| 3633 | nigel | 53 | match_pattern*) |
| 3634 | set dummy $deplibs_check_method | ||
| 3635 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` | ||
| 3636 | for a_deplib in $deplibs; do | ||
| 3637 | name="`expr $a_deplib : '-l\(.*\)'`" | ||
| 3638 | # If $name is empty we are operating on a -L argument. | ||
| 3639 | if test -n "$name" && test "$name" != "0"; then | ||
| 3640 | nigel | 75 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3641 | case " $predeps $postdeps " in | ||
| 3642 | *" $a_deplib "*) | ||
| 3643 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3644 | a_deplib="" | ||
| 3645 | ;; | ||
| 3646 | esac | ||
| 3647 | fi | ||
| 3648 | if test -n "$a_deplib" ; then | ||
| 3649 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3650 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 3651 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | ||
| 3652 | for potent_lib in $potential_libs; do | ||
| 3653 | potlib="$potent_lib" # see symlink-check above in file_magic test | ||
| 3654 | if eval $echo \"$potent_lib\" 2>/dev/null \ | ||
| 3655 | nigel | 83 | | ${SED} 10q \ |
| 3656 | | $EGREP "$match_pattern_regex" > /dev/null; then | ||
| 3657 | nigel | 75 | newdeplibs="$newdeplibs $a_deplib" |
| 3658 | a_deplib="" | ||
| 3659 | break 2 | ||
| 3660 | fi | ||
| 3661 | done | ||
| 3662 | nigel | 53 | done |
| 3663 | nigel | 75 | fi |
| 3664 | nigel | 53 | if test -n "$a_deplib" ; then |
| 3665 | droppeddeps=yes | ||
| 3666 | nigel | 75 | $echo |
| 3667 | $echo "*** Warning: linker path does not have real file for library $a_deplib." | ||
| 3668 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3669 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3670 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3671 | $echo "*** because I did check the linker path looking for a file starting" | ||
| 3672 | nigel | 63 | if test -z "$potlib" ; then |
| 3673 | nigel | 75 | $echo "*** with $libname but no candidates were found. (...for regex pattern test)" |
| 3674 | nigel | 63 | else |
| 3675 | nigel | 75 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3676 | $echo "*** using a regex pattern. Last file checked: $potlib" | ||
| 3677 | nigel | 63 | fi |
| 3678 | nigel | 53 | fi |
| 3679 | else | ||
| 3680 | # Add a -L argument. | ||
| 3681 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3682 | fi | ||
| 3683 | done # Gone through all deplibs. | ||
| 3684 | ;; | ||
| 3685 | nigel | 41 | none | unknown | *) |
| 3686 | newdeplibs="" | ||
| 3687 | nigel | 75 | tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
| 3688 | -e 's/ -[LR][^ ]*//g'` | ||
| 3689 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3690 | for i in $predeps $postdeps ; do | ||
| 3691 | # can't use Xsed below, because $i might contain '/' | ||
| 3692 | tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` | ||
| 3693 | done | ||
| 3694 | fi | ||
| 3695 | nigel | 83 | if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ |
| 3696 | nigel | 75 | | grep . >/dev/null; then |
| 3697 | $echo | ||
| 3698 | nigel | 41 | if test "X$deplibs_check_method" = "Xnone"; then |
| 3699 | nigel | 75 | $echo "*** Warning: inter-library dependencies are not supported in this platform." |
| 3700 | nigel | 41 | else |
| 3701 | nigel | 75 | $echo "*** Warning: inter-library dependencies are not known to be supported." |
| 3702 | nigel | 41 | fi |
| 3703 | nigel | 75 | $echo "*** All declared inter-library dependencies are being dropped." |
| 3704 | nigel | 41 | droppeddeps=yes |
| 3705 | fi | ||
| 3706 | ;; | ||
| 3707 | esac | ||
| 3708 | versuffix=$versuffix_save | ||
| 3709 | major=$major_save | ||
| 3710 | release=$release_save | ||
| 3711 | libname=$libname_save | ||
| 3712 | name=$name_save | ||
| 3713 | |||
| 3714 | nigel | 53 | case $host in |
| 3715 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
| 3716 | # On Rhapsody replace the C library is the System framework | ||
| 3717 | newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` | ||
| 3718 | ;; | ||
| 3719 | esac | ||
| 3720 | |||
| 3721 | nigel | 41 | if test "$droppeddeps" = yes; then |
| 3722 | if test "$module" = yes; then | ||
| 3723 | nigel | 75 | $echo |
| 3724 | $echo "*** Warning: libtool could not satisfy all declared inter-library" | ||
| 3725 | $echo "*** dependencies of module $libname. Therefore, libtool will create" | ||
| 3726 | $echo "*** a static module, that should work as long as the dlopening" | ||
| 3727 | $echo "*** application is linked with the -dlopen flag." | ||
| 3728 | nigel | 41 | if test -z "$global_symbol_pipe"; then |
| 3729 | nigel | 75 | $echo |
| 3730 | $echo "*** However, this would only work if libtool was able to extract symbol" | ||
| 3731 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | ||
| 3732 | $echo "*** not find such a program. So, this module is probably useless." | ||
| 3733 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." | ||
| 3734 | nigel | 41 | fi |
| 3735 | if test "$build_old_libs" = no; then | ||
| 3736 | oldlibs="$output_objdir/$libname.$libext" | ||
| 3737 | build_libtool_libs=module | ||
| 3738 | build_old_libs=yes | ||
| 3739 | else | ||
| 3740 | build_libtool_libs=no | ||
| 3741 | fi | ||
| 3742 | else | ||
| 3743 | nigel | 75 | $echo "*** The inter-library dependencies that have been dropped here will be" |
| 3744 | $echo "*** automatically added whenever a program is linked with this library" | ||
| 3745 | $echo "*** or is declared to -dlopen it." | ||
| 3746 | nigel | 53 | |
| 3747 | nigel | 75 | if test "$allow_undefined" = no; then |
| 3748 | $echo | ||
| 3749 | $echo "*** Since this library must not contain undefined symbols," | ||
| 3750 | $echo "*** because either the platform does not support them or" | ||
| 3751 | $echo "*** it was explicitly requested with -no-undefined," | ||
| 3752 | $echo "*** libtool will only create a static version of it." | ||
| 3753 | nigel | 53 | if test "$build_old_libs" = no; then |
| 3754 | oldlibs="$output_objdir/$libname.$libext" | ||
| 3755 | build_libtool_libs=module | ||
| 3756 | build_old_libs=yes | ||
| 3757 | else | ||
| 3758 | build_libtool_libs=no | ||
| 3759 | fi | ||
| 3760 | fi | ||
| 3761 | nigel | 41 | fi |
| 3762 | fi | ||
| 3763 | # Done checking deplibs! | ||
| 3764 | deplibs=$newdeplibs | ||
| 3765 | fi | ||
| 3766 | |||
| 3767 | # All the library-specific variables (install_libdir is set above). | ||
| 3768 | library_names= | ||
| 3769 | old_library= | ||
| 3770 | dlname= | ||
| 3771 | nigel | 53 | |
| 3772 | nigel | 41 | # Test again, we may have decided not to build it any more |
| 3773 | if test "$build_libtool_libs" = yes; then | ||
| 3774 | nigel | 75 | if test "$hardcode_into_libs" = yes; then |
| 3775 | nigel | 53 | # Hardcode the library paths |
| 3776 | hardcode_libdirs= | ||
| 3777 | dep_rpath= | ||
| 3778 | rpath="$finalize_rpath" | ||
| 3779 | test "$mode" != relink && rpath="$compile_rpath$rpath" | ||
| 3780 | for libdir in $rpath; do | ||
| 3781 | if test -n "$hardcode_libdir_flag_spec"; then | ||
| 3782 | if test -n "$hardcode_libdir_separator"; then | ||
| 3783 | if test -z "$hardcode_libdirs"; then | ||
| 3784 | hardcode_libdirs="$libdir" | ||
| 3785 | else | ||
| 3786 | # Just accumulate the unique libdirs. | ||
| 3787 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in | ||
| 3788 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | ||
| 3789 | ;; | ||
| 3790 | *) | ||
| 3791 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | ||
| 3792 | ;; | ||
| 3793 | esac | ||
| 3794 | fi | ||
| 3795 | else | ||
| 3796 | eval flag=\"$hardcode_libdir_flag_spec\" | ||
| 3797 | dep_rpath="$dep_rpath $flag" | ||
| 3798 | fi | ||
| 3799 | elif test -n "$runpath_var"; then | ||
| 3800 | case "$perm_rpath " in | ||
| 3801 | *" $libdir "*) ;; | ||
| 3802 | *) perm_rpath="$perm_rpath $libdir" ;; | ||
| 3803 | esac | ||
| 3804 | fi | ||
| 3805 | done | ||
| 3806 | # Substitute the hardcoded libdirs into the rpath. | ||
| 3807 | if test -n "$hardcode_libdir_separator" && | ||
| 3808 | test -n "$hardcode_libdirs"; then | ||
| 3809 | libdir="$hardcode_libdirs" | ||
| 3810 | nigel | 75 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
| 3811 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" | ||
| 3812 | else | ||
| 3813 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" | ||
| 3814 | fi | ||
| 3815 | nigel | 53 | fi |
| 3816 | if test -n "$runpath_var" && test -n "$perm_rpath"; then | ||
| 3817 | # We should set the runpath_var. | ||
| 3818 | rpath= | ||
| 3819 | for dir in $perm_rpath; do | ||
| 3820 | rpath="$rpath$dir:" | ||
| 3821 | done | ||
| 3822 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" | ||
| 3823 | fi | ||
| 3824 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" | ||
| 3825 | fi | ||
| 3826 | |||
| 3827 | shlibpath="$finalize_shlibpath" | ||
| 3828 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" | ||
| 3829 | if test -n "$shlibpath"; then | ||
| 3830 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" | ||
| 3831 | fi | ||
| 3832 | |||
| 3833 | nigel | 41 | # Get the real and link names of the library. |
| 3834 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 3835 | nigel | 41 | eval library_names=\"$library_names_spec\" |
| 3836 | set dummy $library_names | ||
| 3837 | realname="$2" | ||
| 3838 | shift; shift | ||
| 3839 | |||
| 3840 | if test -n "$soname_spec"; then | ||
| 3841 | eval soname=\"$soname_spec\" | ||
| 3842 | else | ||
| 3843 | soname="$realname" | ||
| 3844 | fi | ||
| 3845 | nigel | 75 | if test -z "$dlname"; then |
| 3846 | dlname=$soname | ||
| 3847 | fi | ||
| 3848 | nigel | 41 | |
| 3849 | lib="$output_objdir/$realname" | ||
| 3850 | for link | ||
| 3851 | do | ||
| 3852 | linknames="$linknames $link" | ||
| 3853 | done | ||
| 3854 | |||
| 3855 | # Use standard objects if they are pic | ||
| 3856 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | ||
| 3857 | |||
| 3858 | # Prepare the list of exported symbols | ||
| 3859 | if test -z "$export_symbols"; then | ||
| 3860 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then | ||
| 3861 | $show "generating symbol list for \`$libname.la'" | ||
| 3862 | export_symbols="$output_objdir/$libname.exp" | ||
| 3863 | $run $rm $export_symbols | ||
| 3864 | nigel | 75 | cmds=$export_symbols_cmds |
| 3865 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 3866 | nigel | 41 | for cmd in $cmds; do |
| 3867 | IFS="$save_ifs" | ||
| 3868 | nigel | 75 | eval cmd=\"$cmd\" |
| 3869 | if len=`expr "X$cmd" : ".*"` && | ||
| 3870 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | ||
| 3871 | nigel | 83 | $show "$cmd" |
| 3872 | $run eval "$cmd" || exit $? | ||
| 3873 | skipped_export=false | ||
| 3874 | nigel | 75 | else |
| 3875 | nigel | 83 | # The command line is too long to execute in one step. |
| 3876 | $show "using reloadable object file for export list..." | ||
| 3877 | skipped_export=: | ||
| 3878 | nigel | 75 | fi |
| 3879 | nigel | 41 | done |
| 3880 | IFS="$save_ifs" | ||
| 3881 | if test -n "$export_symbols_regex"; then | ||
| 3882 | nigel | 75 | $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
| 3883 | $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' | ||
| 3884 | nigel | 41 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
| 3885 | $run eval '$mv "${export_symbols}T" "$export_symbols"' | ||
| 3886 | fi | ||
| 3887 | fi | ||
| 3888 | fi | ||
| 3889 | |||
| 3890 | if test -n "$export_symbols" && test -n "$include_expsyms"; then | ||
| 3891 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' | ||
| 3892 | fi | ||
| 3893 | |||
| 3894 | nigel | 75 | tmp_deplibs= |
| 3895 | for test_deplib in $deplibs; do | ||
| 3896 | case " $convenience " in | ||
| 3897 | *" $test_deplib "*) ;; | ||
| 3898 | *) | ||
| 3899 | tmp_deplibs="$tmp_deplibs $test_deplib" | ||
| 3900 | ;; | ||
| 3901 | esac | ||
| 3902 | done | ||
| 3903 | deplibs="$tmp_deplibs" | ||
| 3904 | |||
| 3905 | nigel | 41 | if test -n "$convenience"; then |
| 3906 | if test -n "$whole_archive_flag_spec"; then | ||
| 3907 | nigel | 75 | save_libobjs=$libobjs |
| 3908 | nigel | 41 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 3909 | else | ||
| 3910 | gentop="$output_objdir/${outputname}x" | ||
| 3911 | generated="$generated $gentop" | ||
| 3912 | |||
| 3913 | nigel | 75 | func_extract_archives $gentop $convenience |
| 3914 | libobjs="$libobjs $func_extract_archives_result" | ||
| 3915 | nigel | 41 | fi |
| 3916 | fi | ||
| 3917 | nigel | 75 | |
| 3918 | nigel | 41 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
| 3919 | eval flag=\"$thread_safe_flag_spec\" | ||
| 3920 | nigel | 53 | linker_flags="$linker_flags $flag" |
| 3921 | nigel | 41 | fi |
| 3922 | |||
| 3923 | nigel | 53 | # Make a backup of the uninstalled library when relinking |
| 3924 | if test "$mode" = relink; then | ||
| 3925 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? | ||
| 3926 | fi | ||
| 3927 | |||
| 3928 | nigel | 41 | # Do each of the archive commands. |
| 3929 | nigel | 75 | if test "$module" |