Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1 | # ltmain.sh - Provide generalized library-building support services. |
| 2 | # NOTE: Changing this file will not affect anything until you rerun configure. |
| 3 | # |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5 | # Free Software Foundation, Inc. |
| 6 | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 2 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, but |
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | # General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program; if not, write to the Free Software |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 21 | # |
| 22 | # As a special exception to the GNU General Public License, if you |
| 23 | # distribute this file as part of a program that contains a |
| 24 | # configuration script generated by Autoconf, you may include it under |
| 25 | # the same distribution terms that you use for the rest of that program. |
| 26 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 27 | basename="s,^.*/,,g" |
| 28 | |
| 29 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
| 30 | # is ksh but when the shell is invoked as "sh" and the current value of |
| 31 | # the _XPG environment variable is not equal to 1 (one), the special |
| 32 | # positional parameter $0, within a function call, is the name of the |
| 33 | # function. |
| 34 | progpath="$0" |
| 35 | |
| 36 | # define SED for historic ltconfig's generated by Libtool 1.3 |
| 37 | test -z "$SED" && SED=sed |
| 38 | |
| 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 | VERSION=1.5.22 |
| 50 | TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" |
| 51 | |
| 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 | # 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 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 65 | # 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. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 77 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 78 | fi |
| 79 | |
| 80 | if test "X$1" = X--fallback-echo; then |
| 81 | # used as fallback echo |
| 82 | shift |
| 83 | cat <<EOF |
| 84 | $* |
| 85 | EOF |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 86 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 87 | fi |
| 88 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 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 | Xsed="${SED}"' -e 1s/^X//' |
| 99 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 100 | # test EBCDIC or ASCII |
| 101 | case `echo X|tr X '\101'` in |
| 102 | A) # ASCII based system |
| 103 | # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr |
| 104 | SP2NL='tr \040 \012' |
| 105 | NL2SP='tr \015\012 \040\040' |
| 106 | ;; |
| 107 | *) # EBCDIC based system |
| 108 | SP2NL='tr \100 \n' |
| 109 | NL2SP='tr \r\n \100\100' |
| 110 | ;; |
| 111 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 112 | |
| 113 | # NLS nuisances. |
| 114 | # Only set LANG and LC_ALL to C if already set. |
| 115 | # These must not be set unconditionally because not all systems understand |
| 116 | # e.g. LANG=C (notably SCO). |
| 117 | # We save the old values to restore during execute mode. |
| 118 | if test "${LC_ALL+set}" = set; then |
| 119 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
| 120 | fi |
| 121 | if test "${LANG+set}" = set; then |
| 122 | save_LANG="$LANG"; LANG=C; export LANG |
| 123 | fi |
| 124 | |
| 125 | # Make sure IFS has a sensible default |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 126 | lt_nl=' |
| 127 | ' |
| 128 | IFS=" $lt_nl" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 129 | |
| 130 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 131 | $echo "$modename: not configured to build any kind of library" 1>&2 |
| 132 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 133 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 134 | fi |
| 135 | |
| 136 | # Global variables. |
| 137 | mode=$default_mode |
| 138 | nonopt= |
| 139 | prev= |
| 140 | prevopt= |
| 141 | run= |
| 142 | show="$echo" |
| 143 | show_help= |
| 144 | execute_dlfiles= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 145 | duplicate_deps=no |
| 146 | preserve_args= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 147 | lo2o="s/\\.lo\$/.${objext}/" |
| 148 | o2lo="s/\\.${objext}\$/.lo/" |
| 149 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 150 | if test -z "$max_cmd_len"; then |
| 151 | i=0 |
| 152 | testring="ABCD" |
| 153 | new_result= |
| 154 | |
| 155 | # If test is not a shell built-in, we'll probably end up computing a |
| 156 | # maximum length that is only half of the actual maximum length, but |
| 157 | # we can't tell. |
| 158 | while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ |
| 159 | = "XX$testring") >/dev/null 2>&1 && |
| 160 | new_result=`expr "X$testring" : ".*" 2>&1` && |
| 161 | max_cmd_len="$new_result" && |
| 162 | test "$i" != 17 # 1/2 MB should be enough |
| 163 | do |
| 164 | i=`expr $i + 1` |
| 165 | testring="$testring$testring" |
| 166 | done |
| 167 | testring= |
| 168 | # Add a significant safety factor because C++ compilers can tack on massive |
| 169 | # amounts of additional arguments before passing them to the linker. |
| 170 | # It appears as though 1/2 is a usable value. |
| 171 | max_cmd_len=`expr $max_cmd_len \/ 2` |
| 172 | fi |
| 173 | |
| 174 | ##################################### |
| 175 | # Shell function definitions: |
| 176 | # This seems to be the best place for them |
| 177 | |
| 178 | # func_mktempdir [string] |
| 179 | # Make a temporary directory that won't clash with other running |
| 180 | # libtool processes, and avoids race conditions if possible. If |
| 181 | # given, STRING is the basename for that directory. |
| 182 | func_mktempdir () |
| 183 | { |
| 184 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
| 185 | |
| 186 | if test "$run" = ":"; then |
| 187 | # Return a directory name, but don't create it in dry-run mode |
| 188 | my_tmpdir="${my_template}-$$" |
| 189 | else |
| 190 | |
| 191 | # If mktemp works, use that first and foremost |
| 192 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
| 193 | |
| 194 | if test ! -d "$my_tmpdir"; then |
| 195 | # Failing that, at least try and use $RANDOM to avoid a race |
| 196 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
| 197 | |
| 198 | save_mktempdir_umask=`umask` |
| 199 | umask 0077 |
| 200 | $mkdir "$my_tmpdir" |
| 201 | umask $save_mktempdir_umask |
| 202 | fi |
| 203 | |
| 204 | # If we're not in dry-run mode, bomb out on failure |
| 205 | test -d "$my_tmpdir" || { |
| 206 | $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 |
| 207 | exit $EXIT_FAILURE |
| 208 | } |
| 209 | fi |
| 210 | |
| 211 | $echo "X$my_tmpdir" | $Xsed |
| 212 | } |
| 213 | |
| 214 | |
| 215 | # func_win32_libid arg |
| 216 | # return the library type of file 'arg' |
| 217 | # |
| 218 | # Need a lot of goo to handle *both* DLLs and import libs |
| 219 | # Has to be a shell function in order to 'eat' the argument |
| 220 | # that is supplied when $file_magic_command is called. |
| 221 | func_win32_libid () |
| 222 | { |
| 223 | win32_libid_type="unknown" |
| 224 | win32_fileres=`file -L $1 2>/dev/null` |
| 225 | case $win32_fileres in |
| 226 | *ar\ archive\ import\ library*) # definitely import |
| 227 | win32_libid_type="x86 archive import" |
| 228 | ;; |
| 229 | *ar\ archive*) # could be an import, or static |
| 230 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ |
| 231 | $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
| 232 | win32_nmres=`eval $NM -f posix -A $1 | \ |
| 233 | $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` |
| 234 | case $win32_nmres in |
| 235 | import*) win32_libid_type="x86 archive import";; |
| 236 | *) win32_libid_type="x86 archive static";; |
| 237 | esac |
| 238 | fi |
| 239 | ;; |
| 240 | *DLL*) |
| 241 | win32_libid_type="x86 DLL" |
| 242 | ;; |
| 243 | *executable*) # but shell scripts are "executable" too... |
| 244 | case $win32_fileres in |
| 245 | *MS\ Windows\ PE\ Intel*) |
| 246 | win32_libid_type="x86 DLL" |
| 247 | ;; |
| 248 | esac |
| 249 | ;; |
| 250 | esac |
| 251 | $echo $win32_libid_type |
| 252 | } |
| 253 | |
| 254 | |
| 255 | # func_infer_tag arg |
| 256 | # Infer tagged configuration to use if any are available and |
| 257 | # if one wasn't chosen via the "--tag" command line option. |
| 258 | # Only attempt this if the compiler in the base compile |
| 259 | # command doesn't match the default compiler. |
| 260 | # arg is usually of the form 'gcc ...' |
| 261 | func_infer_tag () |
| 262 | { |
| 263 | if test -n "$available_tags" && test -z "$tagname"; then |
| 264 | CC_quoted= |
| 265 | for arg in $CC; do |
| 266 | case $arg in |
| 267 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 268 | arg="\"$arg\"" |
| 269 | ;; |
| 270 | esac |
| 271 | CC_quoted="$CC_quoted $arg" |
| 272 | done |
| 273 | case $@ in |
| 274 | # Blanks in the command may have been stripped by the calling shell, |
| 275 | # but not from the CC environment variable when configure was run. |
| 276 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; |
| 277 | # Blanks at the start of $base_compile will cause this to fail |
| 278 | # if we don't check for them as well. |
| 279 | *) |
| 280 | for z in $available_tags; do |
| 281 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
| 282 | # Evaluate the configuration. |
| 283 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
| 284 | CC_quoted= |
| 285 | for arg in $CC; do |
| 286 | # Double-quote args containing other shell metacharacters. |
| 287 | case $arg in |
| 288 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 289 | arg="\"$arg\"" |
| 290 | ;; |
| 291 | esac |
| 292 | CC_quoted="$CC_quoted $arg" |
| 293 | done |
| 294 | # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc' |
| 295 | trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"` |
| 296 | # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc |
| 297 | extendcc=${host}-${CC} |
| 298 | # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc |
| 299 | # (Gentoo-specific hack because we always export $CHOST) |
| 300 | mungedcc=${CHOST-${host}}-${trimedcc} |
| 301 | case "$@ " in |
| 302 | "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\ |
| 303 | "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*) |
| 304 | tagname=CC |
| 305 | break ;; |
| 306 | "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\ |
| 307 | "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\ |
| 308 | "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\ |
| 309 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) |
| 310 | # The compiler in the base compile command matches |
| 311 | # the one in the tagged configuration. |
| 312 | # Assume this is the tagged configuration we want. |
| 313 | tagname=$z |
| 314 | break |
| 315 | ;; |
| 316 | esac |
| 317 | fi |
| 318 | done |
| 319 | # If $tagname still isn't set, then no tagged configuration |
| 320 | # was found and let the user know that the "--tag" command |
| 321 | # line option must be used. |
| 322 | if test -z "$tagname"; then |
| 323 | $echo "$modename: unable to infer tagged configuration" |
| 324 | $echo "$modename: specify a tag with \`--tag'" 1>&2 |
| 325 | exit $EXIT_FAILURE |
| 326 | # else |
| 327 | # $echo "$modename: using $tagname tagged configuration" |
| 328 | fi |
| 329 | ;; |
| 330 | esac |
| 331 | fi |
| 332 | } |
| 333 | |
| 334 | |
| 335 | # func_extract_an_archive dir oldlib |
| 336 | func_extract_an_archive () |
| 337 | { |
| 338 | f_ex_an_ar_dir="$1"; shift |
| 339 | f_ex_an_ar_oldlib="$1" |
| 340 | |
| 341 | $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" |
| 342 | $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? |
| 343 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
| 344 | : |
| 345 | else |
| 346 | $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 |
| 347 | exit $EXIT_FAILURE |
| 348 | fi |
| 349 | } |
| 350 | |
| 351 | # func_extract_archives gentop oldlib ... |
| 352 | func_extract_archives () |
| 353 | { |
| 354 | my_gentop="$1"; shift |
| 355 | my_oldlibs=${1+"$@"} |
| 356 | my_oldobjs="" |
| 357 | my_xlib="" |
| 358 | my_xabs="" |
| 359 | my_xdir="" |
| 360 | my_status="" |
| 361 | |
| 362 | $show "${rm}r $my_gentop" |
| 363 | $run ${rm}r "$my_gentop" |
| 364 | $show "$mkdir $my_gentop" |
| 365 | $run $mkdir "$my_gentop" |
| 366 | my_status=$? |
| 367 | if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then |
| 368 | exit $my_status |
| 369 | fi |
| 370 | |
| 371 | for my_xlib in $my_oldlibs; do |
| 372 | # Extract the objects. |
| 373 | case $my_xlib in |
| 374 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
| 375 | *) my_xabs=`pwd`"/$my_xlib" ;; |
| 376 | esac |
| 377 | my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` |
| 378 | my_xdir="$my_gentop/$my_xlib" |
| 379 | |
| 380 | $show "${rm}r $my_xdir" |
| 381 | $run ${rm}r "$my_xdir" |
| 382 | $show "$mkdir $my_xdir" |
| 383 | $run $mkdir "$my_xdir" |
| 384 | exit_status=$? |
| 385 | if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then |
| 386 | exit $exit_status |
| 387 | fi |
| 388 | case $host in |
| 389 | *-darwin*) |
| 390 | $show "Extracting $my_xabs" |
| 391 | # Do not bother doing anything if just a dry run |
| 392 | if test -z "$run"; then |
| 393 | darwin_orig_dir=`pwd` |
| 394 | cd $my_xdir || exit $? |
| 395 | darwin_archive=$my_xabs |
| 396 | darwin_curdir=`pwd` |
| 397 | darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` |
| 398 | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` |
| 399 | if test -n "$darwin_arches"; then |
| 400 | darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` |
| 401 | darwin_arch= |
| 402 | $show "$darwin_base_archive has multiple architectures $darwin_arches" |
| 403 | for darwin_arch in $darwin_arches ; do |
| 404 | mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 405 | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
| 406 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 407 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
| 408 | cd "$darwin_curdir" |
| 409 | $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
| 410 | done # $darwin_arches |
| 411 | ## Okay now we have a bunch of thin objects, gotta fatten them up :) |
| 412 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` |
| 413 | darwin_file= |
| 414 | darwin_files= |
| 415 | for darwin_file in $darwin_filelist; do |
| 416 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` |
| 417 | lipo -create -output "$darwin_file" $darwin_files |
| 418 | done # $darwin_filelist |
| 419 | ${rm}r unfat-$$ |
| 420 | cd "$darwin_orig_dir" |
| 421 | else |
| 422 | cd "$darwin_orig_dir" |
| 423 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 424 | fi # $darwin_arches |
| 425 | fi # $run |
| 426 | ;; |
| 427 | *) |
| 428 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 429 | ;; |
| 430 | esac |
| 431 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
| 432 | done |
| 433 | func_extract_archives_result="$my_oldobjs" |
| 434 | } |
| 435 | # End of Shell function definitions |
| 436 | ##################################### |
| 437 | |
| 438 | # Darwin sucks |
| 439 | eval std_shrext=\"$shrext_cmds\" |
| 440 | |
| 441 | disable_libs=no |
| 442 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 443 | # Parse our command line options once, thoroughly. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 444 | while test "$#" -gt 0 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 445 | do |
| 446 | arg="$1" |
| 447 | shift |
| 448 | |
| 449 | case $arg in |
| 450 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| 451 | *) optarg= ;; |
| 452 | esac |
| 453 | |
| 454 | # If the previous option needs an argument, assign it. |
| 455 | if test -n "$prev"; then |
| 456 | case $prev in |
| 457 | execute_dlfiles) |
| 458 | execute_dlfiles="$execute_dlfiles $arg" |
| 459 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 460 | tag) |
| 461 | tagname="$arg" |
| 462 | preserve_args="${preserve_args}=$arg" |
| 463 | |
| 464 | # Check whether tagname contains only valid characters |
| 465 | case $tagname in |
| 466 | *[!-_A-Za-z0-9,/]*) |
| 467 | $echo "$progname: invalid tag name: $tagname" 1>&2 |
| 468 | exit $EXIT_FAILURE |
| 469 | ;; |
| 470 | esac |
| 471 | |
| 472 | case $tagname in |
| 473 | CC) |
| 474 | # Don't test for the "default" C tag, as we know, it's there, but |
| 475 | # not specially marked. |
| 476 | ;; |
| 477 | *) |
| 478 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then |
| 479 | taglist="$taglist $tagname" |
| 480 | # Evaluate the configuration. |
| 481 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" |
| 482 | else |
| 483 | $echo "$progname: ignoring unknown tag $tagname" 1>&2 |
| 484 | fi |
| 485 | ;; |
| 486 | esac |
| 487 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 488 | *) |
| 489 | eval "$prev=\$arg" |
| 490 | ;; |
| 491 | esac |
| 492 | |
| 493 | prev= |
| 494 | prevopt= |
| 495 | continue |
| 496 | fi |
| 497 | |
| 498 | # Have we seen a non-optional argument yet? |
| 499 | case $arg in |
| 500 | --help) |
| 501 | show_help=yes |
| 502 | ;; |
| 503 | |
| 504 | --version) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 505 | $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
| 506 | $echo |
| 507 | $echo "Copyright (C) 2005 Free Software Foundation, Inc." |
| 508 | $echo "This is free software; see the source for copying conditions. There is NO" |
| 509 | $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
| 510 | exit $? |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 511 | ;; |
| 512 | |
| 513 | --config) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 514 | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath |
| 515 | # Now print the configurations for the tags. |
| 516 | for tagname in $taglist; do |
| 517 | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" |
| 518 | done |
| 519 | exit $? |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 520 | ;; |
| 521 | |
| 522 | --debug) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 523 | $echo "$progname: enabling shell trace mode" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 524 | set -x |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 525 | preserve_args="$preserve_args $arg" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 526 | ;; |
| 527 | |
| 528 | --dry-run | -n) |
| 529 | run=: |
| 530 | ;; |
| 531 | |
| 532 | --features) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 533 | $echo "host: $host" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 534 | if test "$build_libtool_libs" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 535 | $echo "enable shared libraries" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 536 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 537 | $echo "disable shared libraries" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 538 | fi |
| 539 | if test "$build_old_libs" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 540 | $echo "enable static libraries" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 541 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 542 | $echo "disable static libraries" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 543 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 544 | exit $? |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 545 | ;; |
| 546 | |
| 547 | --finish) mode="finish" ;; |
| 548 | |
| 549 | --mode) prevopt="--mode" prev=mode ;; |
| 550 | --mode=*) mode="$optarg" ;; |
| 551 | |
| 552 | --preserve-dup-deps) duplicate_deps="yes" ;; |
| 553 | |
| 554 | --quiet | --silent) |
| 555 | show=: |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 556 | preserve_args="$preserve_args $arg" |
| 557 | ;; |
| 558 | |
| 559 | --tag) |
| 560 | prevopt="--tag" |
| 561 | prev=tag |
| 562 | preserve_args="$preserve_args --tag" |
| 563 | ;; |
| 564 | --tag=*) |
| 565 | set tag "$optarg" ${1+"$@"} |
| 566 | shift |
| 567 | prev=tag |
| 568 | preserve_args="$preserve_args --tag" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 569 | ;; |
| 570 | |
| 571 | -dlopen) |
| 572 | prevopt="-dlopen" |
| 573 | prev=execute_dlfiles |
| 574 | ;; |
| 575 | |
| 576 | -*) |
| 577 | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
| 578 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 579 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 580 | ;; |
| 581 | |
| 582 | *) |
| 583 | nonopt="$arg" |
| 584 | break |
| 585 | ;; |
| 586 | esac |
| 587 | done |
| 588 | |
| 589 | if test -n "$prevopt"; then |
| 590 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
| 591 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 592 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 593 | fi |
| 594 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 595 | case $disable_libs in |
| 596 | no) |
| 597 | ;; |
| 598 | shared) |
| 599 | build_libtool_libs=no |
| 600 | build_old_libs=yes |
| 601 | ;; |
| 602 | static) |
| 603 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
| 604 | ;; |
| 605 | esac |
| 606 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 607 | # If this variable is set in any of the actions, the command in it |
| 608 | # will be execed at the end. This prevents here-documents from being |
| 609 | # left over by shells. |
| 610 | exec_cmd= |
| 611 | |
| 612 | if test -z "$show_help"; then |
| 613 | |
| 614 | # Infer the operation mode. |
| 615 | if test -z "$mode"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 616 | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
| 617 | $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 618 | case $nonopt in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 619 | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 620 | mode=link |
| 621 | for arg |
| 622 | do |
| 623 | case $arg in |
| 624 | -c) |
| 625 | mode=compile |
| 626 | break |
| 627 | ;; |
| 628 | esac |
| 629 | done |
| 630 | ;; |
| 631 | *db | *dbx | *strace | *truss) |
| 632 | mode=execute |
| 633 | ;; |
| 634 | *install*|cp|mv) |
| 635 | mode=install |
| 636 | ;; |
| 637 | *rm) |
| 638 | mode=uninstall |
| 639 | ;; |
| 640 | *) |
| 641 | # If we have no mode, but dlfiles were specified, then do execute mode. |
| 642 | test -n "$execute_dlfiles" && mode=execute |
| 643 | |
| 644 | # Just use the default operation mode. |
| 645 | if test -z "$mode"; then |
| 646 | if test -n "$nonopt"; then |
| 647 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
| 648 | else |
| 649 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
| 650 | fi |
| 651 | fi |
| 652 | ;; |
| 653 | esac |
| 654 | fi |
| 655 | |
| 656 | # Only execute mode is allowed to have -dlopen flags. |
| 657 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
| 658 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
| 659 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 660 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 661 | fi |
| 662 | |
| 663 | # Change the help message to a mode-specific one. |
| 664 | generic_help="$help" |
| 665 | help="Try \`$modename --help --mode=$mode' for more information." |
| 666 | |
| 667 | # These modes are in order of execution frequency so that they run quickly. |
| 668 | case $mode in |
| 669 | # libtool compile mode |
| 670 | compile) |
| 671 | modename="$modename: compile" |
| 672 | # Get the compilation command and the source file. |
| 673 | base_compile= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 674 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 675 | suppress_opt=yes |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 676 | suppress_output= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 677 | arg_mode=normal |
| 678 | libobj= |
| 679 | later= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 680 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 681 | for arg |
| 682 | do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 683 | case $arg_mode in |
| 684 | arg ) |
| 685 | # do not "continue". Instead, add this to base_compile |
| 686 | lastarg="$arg" |
| 687 | arg_mode=normal |
| 688 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 689 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 690 | target ) |
| 691 | libobj="$arg" |
| 692 | arg_mode=normal |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 693 | continue |
| 694 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 695 | |
| 696 | normal ) |
| 697 | # Accept any command-line options. |
| 698 | case $arg in |
| 699 | -o) |
| 700 | if test -n "$libobj" ; then |
| 701 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
| 702 | exit $EXIT_FAILURE |
| 703 | fi |
| 704 | arg_mode=target |
| 705 | continue |
| 706 | ;; |
| 707 | |
| 708 | -static | -prefer-pic | -prefer-non-pic) |
| 709 | later="$later $arg" |
| 710 | continue |
| 711 | ;; |
| 712 | |
| 713 | -no-suppress) |
| 714 | suppress_opt=no |
| 715 | continue |
| 716 | ;; |
| 717 | |
| 718 | -Xcompiler) |
| 719 | arg_mode=arg # the next one goes into the "base_compile" arg list |
| 720 | continue # The current "srcfile" will either be retained or |
| 721 | ;; # replaced later. I would guess that would be a bug. |
| 722 | |
| 723 | -Wc,*) |
| 724 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
| 725 | lastarg= |
| 726 | save_ifs="$IFS"; IFS=',' |
| 727 | for arg in $args; do |
| 728 | IFS="$save_ifs" |
| 729 | |
| 730 | # Double-quote args containing other shell metacharacters. |
| 731 | # Many Bourne shells cannot handle close brackets correctly |
| 732 | # in scan sets, so we specify it separately. |
| 733 | case $arg in |
| 734 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 735 | arg="\"$arg\"" |
| 736 | ;; |
| 737 | esac |
| 738 | lastarg="$lastarg $arg" |
| 739 | done |
| 740 | IFS="$save_ifs" |
| 741 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
| 742 | |
| 743 | # Add the arguments to base_compile. |
| 744 | base_compile="$base_compile $lastarg" |
| 745 | continue |
| 746 | ;; |
| 747 | |
| 748 | * ) |
| 749 | # Accept the current argument as the source file. |
| 750 | # The previous "srcfile" becomes the current argument. |
| 751 | # |
| 752 | lastarg="$srcfile" |
| 753 | srcfile="$arg" |
| 754 | ;; |
| 755 | esac # case $arg |
| 756 | ;; |
| 757 | esac # case $arg_mode |
| 758 | |
| 759 | # Aesthetically quote the previous argument. |
| 760 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
| 761 | |
| 762 | case $lastarg in |
| 763 | # Double-quote args containing other shell metacharacters. |
| 764 | # Many Bourne shells cannot handle close brackets correctly |
| 765 | # in scan sets, and some SunOS ksh mistreat backslash-escaping |
| 766 | # in scan sets (worked around with variable expansion), |
| 767 | # and furthermore cannot handle '|' '&' '(' ')' in scan sets |
| 768 | # at all, so we specify them separately. |
| 769 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 770 | lastarg="\"$lastarg\"" |
| 771 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 772 | esac |
| 773 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 774 | base_compile="$base_compile $lastarg" |
| 775 | done # for arg |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 776 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 777 | case $arg_mode in |
| 778 | arg) |
| 779 | $echo "$modename: you must specify an argument for -Xcompile" |
| 780 | exit $EXIT_FAILURE |
| 781 | ;; |
| 782 | target) |
| 783 | $echo "$modename: you must specify a target with \`-o'" 1>&2 |
| 784 | exit $EXIT_FAILURE |
| 785 | ;; |
| 786 | *) |
| 787 | # Get the name of the library object. |
| 788 | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
| 789 | ;; |
| 790 | esac |
| 791 | |
| 792 | # Recognize several different file suffixes. |
| 793 | # If the user specifies -o file.o, it is replaced with file.lo |
| 794 | xform='[cCFSifmso]' |
| 795 | case $libobj in |
| 796 | *.ada) xform=ada ;; |
| 797 | *.adb) xform=adb ;; |
| 798 | *.ads) xform=ads ;; |
| 799 | *.asm) xform=asm ;; |
| 800 | *.c++) xform=c++ ;; |
| 801 | *.cc) xform=cc ;; |
| 802 | *.ii) xform=ii ;; |
| 803 | *.class) xform=class ;; |
| 804 | *.cpp) xform=cpp ;; |
| 805 | *.cxx) xform=cxx ;; |
| 806 | *.f90) xform=f90 ;; |
| 807 | *.for) xform=for ;; |
| 808 | *.java) xform=java ;; |
| 809 | esac |
| 810 | |
| 811 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
| 812 | |
| 813 | case $libobj in |
| 814 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
| 815 | *) |
| 816 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
| 817 | exit $EXIT_FAILURE |
| 818 | ;; |
| 819 | esac |
| 820 | |
| 821 | func_infer_tag $base_compile |
| 822 | |
| 823 | for arg in $later; do |
| 824 | case $arg in |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 825 | -static) |
| 826 | build_old_libs=yes |
| 827 | continue |
| 828 | ;; |
| 829 | |
| 830 | -prefer-pic) |
| 831 | pic_mode=yes |
| 832 | continue |
| 833 | ;; |
| 834 | |
| 835 | -prefer-non-pic) |
| 836 | pic_mode=no |
| 837 | continue |
| 838 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 839 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 840 | done |
| 841 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 842 | qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` |
| 843 | case $qlibobj in |
| 844 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 845 | qlibobj="\"$qlibobj\"" ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 846 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 847 | test "X$libobj" != "X$qlibobj" \ |
| 848 | && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
| 849 | && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." |
| 850 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
| 851 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
| 852 | if test "X$xdir" = "X$obj"; then |
| 853 | xdir= |
| 854 | else |
| 855 | xdir=$xdir/ |
| 856 | fi |
| 857 | lobj=${xdir}$objdir/$objname |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 858 | |
| 859 | if test -z "$base_compile"; then |
| 860 | $echo "$modename: you must specify a compilation command" 1>&2 |
| 861 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 862 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 863 | fi |
| 864 | |
| 865 | # Delete any leftover library objects. |
| 866 | if test "$build_old_libs" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 867 | removelist="$obj $lobj $libobj ${libobj}T" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 868 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 869 | removelist="$lobj $libobj ${libobj}T" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 870 | fi |
| 871 | |
| 872 | $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 873 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 874 | |
| 875 | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 876 | case $host_os in |
| 877 | cygwin* | mingw* | pw32* | os2*) |
| 878 | pic_mode=default |
| 879 | ;; |
| 880 | esac |
| 881 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 882 | # non-PIC code in shared libraries is not supported |
| 883 | pic_mode=default |
| 884 | fi |
| 885 | |
| 886 | # Calculate the filename of the output object if compiler does |
| 887 | # not support -o with -c |
| 888 | if test "$compiler_c_o" = no; then |
| 889 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
| 890 | lockfile="$output_obj.lock" |
| 891 | removelist="$removelist $output_obj $lockfile" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 892 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 893 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 894 | output_obj= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 895 | need_locks=no |
| 896 | lockfile= |
| 897 | fi |
| 898 | |
| 899 | # Lock this critical section if it is needed |
| 900 | # We use this script file to make the link, it avoids creating a new file |
| 901 | if test "$need_locks" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 902 | until $run ln "$srcfile" "$lockfile" 2>/dev/null; do |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 903 | $show "Waiting for $lockfile to be removed" |
| 904 | sleep 2 |
| 905 | done |
| 906 | elif test "$need_locks" = warn; then |
| 907 | if test -f "$lockfile"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 908 | $echo "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 909 | *** ERROR, $lockfile exists and contains: |
| 910 | `cat $lockfile 2>/dev/null` |
| 911 | |
| 912 | This indicates that another process is trying to use the same |
| 913 | temporary object file, and libtool could not work around it because |
| 914 | your compiler does not support \`-c' and \`-o' together. If you |
| 915 | repeat this compilation, it may succeed, by chance, but you had better |
| 916 | avoid parallel builds (make -j) in this platform, or get a better |
| 917 | compiler." |
| 918 | |
| 919 | $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 920 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 921 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 922 | $echo "$srcfile" > "$lockfile" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 923 | fi |
| 924 | |
| 925 | if test -n "$fix_srcfile_path"; then |
| 926 | eval srcfile=\"$fix_srcfile_path\" |
| 927 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 928 | qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` |
| 929 | case $qsrcfile in |
| 930 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 931 | qsrcfile="\"$qsrcfile\"" ;; |
| 932 | esac |
| 933 | |
| 934 | $run $rm "$libobj" "${libobj}T" |
| 935 | |
| 936 | # Create a libtool object file (analogous to a ".la" file), |
| 937 | # but don't create it if we're doing a dry run. |
| 938 | test -z "$run" && cat > ${libobj}T <<EOF |
| 939 | # $libobj - a libtool object file |
| 940 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 941 | # |
| 942 | # Please DO NOT delete this file! |
| 943 | # It is necessary for linking the library. |
| 944 | |
| 945 | # Name of the PIC object. |
| 946 | EOF |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 947 | |
| 948 | # Only build a PIC object if we are building libtool libraries. |
| 949 | if test "$build_libtool_libs" = yes; then |
| 950 | # Without this assignment, base_compile gets emptied. |
| 951 | fbsd_hideous_sh_bug=$base_compile |
| 952 | |
| 953 | if test "$pic_mode" != no; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 954 | command="$base_compile $qsrcfile $pic_flag" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 955 | else |
| 956 | # Don't build PIC code |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 957 | command="$base_compile $qsrcfile" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 958 | fi |
| 959 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 960 | if test ! -d "${xdir}$objdir"; then |
| 961 | $show "$mkdir ${xdir}$objdir" |
| 962 | $run $mkdir ${xdir}$objdir |
| 963 | exit_status=$? |
| 964 | if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then |
| 965 | exit $exit_status |
| 966 | fi |
| 967 | fi |
| 968 | |
| 969 | if test -z "$output_obj"; then |
| 970 | # Place PIC objects in $objdir |
| 971 | command="$command -o $lobj" |
| 972 | fi |
| 973 | |
| 974 | $run $rm "$lobj" "$output_obj" |
| 975 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 976 | $show "$command" |
| 977 | if $run eval "$command"; then : |
| 978 | else |
| 979 | test -n "$output_obj" && $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 980 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 981 | fi |
| 982 | |
| 983 | if test "$need_locks" = warn && |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 984 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 985 | $echo "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 986 | *** ERROR, $lockfile contains: |
| 987 | `cat $lockfile 2>/dev/null` |
| 988 | |
| 989 | but it should contain: |
| 990 | $srcfile |
| 991 | |
| 992 | This indicates that another process is trying to use the same |
| 993 | temporary object file, and libtool could not work around it because |
| 994 | your compiler does not support \`-c' and \`-o' together. If you |
| 995 | repeat this compilation, it may succeed, by chance, but you had better |
| 996 | avoid parallel builds (make -j) in this platform, or get a better |
| 997 | compiler." |
| 998 | |
| 999 | $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1000 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1001 | fi |
| 1002 | |
| 1003 | # Just move the object if needed, then go on to compile the next one |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1004 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 1005 | $show "$mv $output_obj $lobj" |
| 1006 | if $run $mv $output_obj $lobj; then : |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1007 | else |
| 1008 | error=$? |
| 1009 | $run $rm $removelist |
| 1010 | exit $error |
| 1011 | fi |
| 1012 | fi |
| 1013 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1014 | # Append the name of the PIC object to the libtool object file. |
| 1015 | test -z "$run" && cat >> ${libobj}T <<EOF |
| 1016 | pic_object='$objdir/$objname' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1017 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1018 | EOF |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1019 | |
| 1020 | # Allow error messages only from the first compilation. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1021 | if test "$suppress_opt" = yes; then |
| 1022 | suppress_output=' >/dev/null 2>&1' |
| 1023 | fi |
| 1024 | else |
| 1025 | # No PIC object so indicate it doesn't exist in the libtool |
| 1026 | # object file. |
| 1027 | test -z "$run" && cat >> ${libobj}T <<EOF |
| 1028 | pic_object=none |
| 1029 | |
| 1030 | EOF |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1031 | fi |
| 1032 | |
| 1033 | # Only build a position-dependent object if we build old libraries. |
| 1034 | if test "$build_old_libs" = yes; then |
| 1035 | if test "$pic_mode" != yes; then |
| 1036 | # Don't build PIC code |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1037 | command="$base_compile $qsrcfile" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1038 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1039 | command="$base_compile $qsrcfile $pic_flag" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1040 | fi |
| 1041 | if test "$compiler_c_o" = yes; then |
| 1042 | command="$command -o $obj" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1043 | fi |
| 1044 | |
| 1045 | # Suppress compiler output if we already did a PIC compilation. |
| 1046 | command="$command$suppress_output" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1047 | $run $rm "$obj" "$output_obj" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1048 | $show "$command" |
| 1049 | if $run eval "$command"; then : |
| 1050 | else |
| 1051 | $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1052 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1053 | fi |
| 1054 | |
| 1055 | if test "$need_locks" = warn && |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1056 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 1057 | $echo "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1058 | *** ERROR, $lockfile contains: |
| 1059 | `cat $lockfile 2>/dev/null` |
| 1060 | |
| 1061 | but it should contain: |
| 1062 | $srcfile |
| 1063 | |
| 1064 | This indicates that another process is trying to use the same |
| 1065 | temporary object file, and libtool could not work around it because |
| 1066 | your compiler does not support \`-c' and \`-o' together. If you |
| 1067 | repeat this compilation, it may succeed, by chance, but you had better |
| 1068 | avoid parallel builds (make -j) in this platform, or get a better |
| 1069 | compiler." |
| 1070 | |
| 1071 | $run $rm $removelist |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1072 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1073 | fi |
| 1074 | |
| 1075 | # Just move the object if needed |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1076 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1077 | $show "$mv $output_obj $obj" |
| 1078 | if $run $mv $output_obj $obj; then : |
| 1079 | else |
| 1080 | error=$? |
| 1081 | $run $rm $removelist |
| 1082 | exit $error |
| 1083 | fi |
| 1084 | fi |
| 1085 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1086 | # Append the name of the non-PIC object the libtool object file. |
| 1087 | # Only append if the libtool object file exists. |
| 1088 | test -z "$run" && cat >> ${libobj}T <<EOF |
| 1089 | # Name of the non-PIC object. |
| 1090 | non_pic_object='$objname' |
| 1091 | |
| 1092 | EOF |
| 1093 | else |
| 1094 | # Append the name of the non-PIC object the libtool object file. |
| 1095 | # Only append if the libtool object file exists. |
| 1096 | test -z "$run" && cat >> ${libobj}T <<EOF |
| 1097 | # Name of the non-PIC object. |
| 1098 | non_pic_object=none |
| 1099 | |
| 1100 | EOF |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1101 | fi |
| 1102 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1103 | $run $mv "${libobj}T" "${libobj}" |
| 1104 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1105 | # Unlock the critical section if it was locked |
| 1106 | if test "$need_locks" != no; then |
| 1107 | $run $rm "$lockfile" |
| 1108 | fi |
| 1109 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1110 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1111 | ;; |
| 1112 | |
| 1113 | # libtool link mode |
| 1114 | link | relink) |
| 1115 | modename="$modename: link" |
| 1116 | case $host in |
| 1117 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
| 1118 | # It is impossible to link a dll without this setting, and |
| 1119 | # we shouldn't force the makefile maintainer to figure out |
| 1120 | # which system we are compiling for in order to pass an extra |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1121 | # flag for every libtool invocation. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1122 | # allow_undefined=no |
| 1123 | |
| 1124 | # FIXME: Unfortunately, there are problems with the above when trying |
| 1125 | # to make a dll which has undefined symbols, in which case not |
| 1126 | # even a static library is built. For now, we need to specify |
| 1127 | # -no-undefined on the libtool link line when we can be certain |
| 1128 | # that all symbols are satisfied, otherwise we get a static library. |
| 1129 | allow_undefined=yes |
| 1130 | ;; |
| 1131 | *) |
| 1132 | allow_undefined=yes |
| 1133 | ;; |
| 1134 | esac |
| 1135 | libtool_args="$nonopt" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1136 | base_compile="$nonopt $@" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1137 | compile_command="$nonopt" |
| 1138 | finalize_command="$nonopt" |
| 1139 | |
| 1140 | compile_rpath= |
| 1141 | finalize_rpath= |
| 1142 | compile_shlibpath= |
| 1143 | finalize_shlibpath= |
| 1144 | convenience= |
| 1145 | old_convenience= |
| 1146 | deplibs= |
| 1147 | old_deplibs= |
| 1148 | compiler_flags= |
| 1149 | linker_flags= |
| 1150 | dllsearchpath= |
| 1151 | lib_search_path=`pwd` |
| 1152 | inst_prefix_dir= |
| 1153 | |
| 1154 | avoid_version=no |
| 1155 | dlfiles= |
| 1156 | dlprefiles= |
| 1157 | dlself=no |
| 1158 | export_dynamic=no |
| 1159 | export_symbols= |
| 1160 | export_symbols_regex= |
| 1161 | generated= |
| 1162 | libobjs= |
| 1163 | ltlibs= |
| 1164 | module=no |
| 1165 | no_install=no |
| 1166 | objs= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1167 | non_pic_objects= |
| 1168 | notinst_path= # paths that contain not-installed libtool libraries |
| 1169 | precious_files_regex= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1170 | prefer_static_libs=no |
| 1171 | preload=no |
| 1172 | prev= |
| 1173 | prevarg= |
| 1174 | release= |
| 1175 | rpath= |
| 1176 | xrpath= |
| 1177 | perm_rpath= |
| 1178 | temp_rpath= |
| 1179 | thread_safe=no |
| 1180 | vinfo= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1181 | vinfo_number=no |
| 1182 | |
| 1183 | func_infer_tag $base_compile |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1184 | |
| 1185 | # We need to know -static, to get the right output filenames. |
| 1186 | for arg |
| 1187 | do |
| 1188 | case $arg in |
| 1189 | -all-static | -static) |
| 1190 | if test "X$arg" = "X-all-static"; then |
| 1191 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
| 1192 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
| 1193 | fi |
| 1194 | if test -n "$link_static_flag"; then |
| 1195 | dlopen_self=$dlopen_self_static |
| 1196 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1197 | prefer_static_libs=yes |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1198 | else |
| 1199 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 1200 | dlopen_self=$dlopen_self_static |
| 1201 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1202 | prefer_static_libs=built |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1203 | fi |
| 1204 | build_libtool_libs=no |
| 1205 | build_old_libs=yes |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1206 | break |
| 1207 | ;; |
| 1208 | esac |
| 1209 | done |
| 1210 | |
| 1211 | # See if our shared archives depend on static archives. |
| 1212 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
| 1213 | |
| 1214 | # Go through the arguments, transforming them on the way. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1215 | while test "$#" -gt 0; do |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1216 | arg="$1" |
| 1217 | shift |
| 1218 | case $arg in |
| 1219 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1220 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
| 1221 | ;; |
| 1222 | *) qarg=$arg ;; |
| 1223 | esac |
| 1224 | libtool_args="$libtool_args $qarg" |
| 1225 | |
| 1226 | # If the previous option needs an argument, assign it. |
| 1227 | if test -n "$prev"; then |
| 1228 | case $prev in |
| 1229 | output) |
| 1230 | compile_command="$compile_command @OUTPUT@" |
| 1231 | finalize_command="$finalize_command @OUTPUT@" |
| 1232 | ;; |
| 1233 | esac |
| 1234 | |
| 1235 | case $prev in |
| 1236 | dlfiles|dlprefiles) |
| 1237 | if test "$preload" = no; then |
| 1238 | # Add the symbol object into the linking commands. |
| 1239 | compile_command="$compile_command @SYMFILE@" |
| 1240 | finalize_command="$finalize_command @SYMFILE@" |
| 1241 | preload=yes |
| 1242 | fi |
| 1243 | case $arg in |
| 1244 | *.la | *.lo) ;; # We handle these cases below. |
| 1245 | force) |
| 1246 | if test "$dlself" = no; then |
| 1247 | dlself=needless |
| 1248 | export_dynamic=yes |
| 1249 | fi |
| 1250 | prev= |
| 1251 | continue |
| 1252 | ;; |
| 1253 | self) |
| 1254 | if test "$prev" = dlprefiles; then |
| 1255 | dlself=yes |
| 1256 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
| 1257 | dlself=yes |
| 1258 | else |
| 1259 | dlself=needless |
| 1260 | export_dynamic=yes |
| 1261 | fi |
| 1262 | prev= |
| 1263 | continue |
| 1264 | ;; |
| 1265 | *) |
| 1266 | if test "$prev" = dlfiles; then |
| 1267 | dlfiles="$dlfiles $arg" |
| 1268 | else |
| 1269 | dlprefiles="$dlprefiles $arg" |
| 1270 | fi |
| 1271 | prev= |
| 1272 | continue |
| 1273 | ;; |
| 1274 | esac |
| 1275 | ;; |
| 1276 | expsyms) |
| 1277 | export_symbols="$arg" |
| 1278 | if test ! -f "$arg"; then |
| 1279 | $echo "$modename: symbol file \`$arg' does not exist" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1280 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1281 | fi |
| 1282 | prev= |
| 1283 | continue |
| 1284 | ;; |
| 1285 | expsyms_regex) |
| 1286 | export_symbols_regex="$arg" |
| 1287 | prev= |
| 1288 | continue |
| 1289 | ;; |
| 1290 | inst_prefix) |
| 1291 | inst_prefix_dir="$arg" |
| 1292 | prev= |
| 1293 | continue |
| 1294 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1295 | precious_regex) |
| 1296 | precious_files_regex="$arg" |
| 1297 | prev= |
| 1298 | continue |
| 1299 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1300 | release) |
| 1301 | release="-$arg" |
| 1302 | prev= |
| 1303 | continue |
| 1304 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1305 | objectlist) |
| 1306 | if test -f "$arg"; then |
| 1307 | save_arg=$arg |
| 1308 | moreargs= |
| 1309 | for fil in `cat $save_arg` |
| 1310 | do |
| 1311 | # moreargs="$moreargs $fil" |
| 1312 | arg=$fil |
| 1313 | # A libtool-controlled object. |
| 1314 | |
| 1315 | # Check to see that this really is a libtool object. |
| 1316 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 1317 | pic_object= |
| 1318 | non_pic_object= |
| 1319 | |
| 1320 | # Read the .lo file |
| 1321 | # If there is no directory component, then add one. |
| 1322 | case $arg in |
| 1323 | */* | *\\*) . $arg ;; |
| 1324 | *) . ./$arg ;; |
| 1325 | esac |
| 1326 | |
| 1327 | if test -z "$pic_object" || \ |
| 1328 | test -z "$non_pic_object" || |
| 1329 | test "$pic_object" = none && \ |
| 1330 | test "$non_pic_object" = none; then |
| 1331 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
| 1332 | exit $EXIT_FAILURE |
| 1333 | fi |
| 1334 | |
| 1335 | # Extract subdirectory from the argument. |
| 1336 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1337 | if test "X$xdir" = "X$arg"; then |
| 1338 | xdir= |
| 1339 | else |
| 1340 | xdir="$xdir/" |
| 1341 | fi |
| 1342 | |
| 1343 | if test "$pic_object" != none; then |
| 1344 | # Prepend the subdirectory the object is found in. |
| 1345 | pic_object="$xdir$pic_object" |
| 1346 | |
| 1347 | if test "$prev" = dlfiles; then |
| 1348 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 1349 | dlfiles="$dlfiles $pic_object" |
| 1350 | prev= |
| 1351 | continue |
| 1352 | else |
| 1353 | # If libtool objects are unsupported, then we need to preload. |
| 1354 | prev=dlprefiles |
| 1355 | fi |
| 1356 | fi |
| 1357 | |
| 1358 | # CHECK ME: I think I busted this. -Ossama |
| 1359 | if test "$prev" = dlprefiles; then |
| 1360 | # Preload the old-style object. |
| 1361 | dlprefiles="$dlprefiles $pic_object" |
| 1362 | prev= |
| 1363 | fi |
| 1364 | |
| 1365 | # A PIC object. |
| 1366 | libobjs="$libobjs $pic_object" |
| 1367 | arg="$pic_object" |
| 1368 | fi |
| 1369 | |
| 1370 | # Non-PIC object. |
| 1371 | if test "$non_pic_object" != none; then |
| 1372 | # Prepend the subdirectory the object is found in. |
| 1373 | non_pic_object="$xdir$non_pic_object" |
| 1374 | |
| 1375 | # A standard non-PIC object |
| 1376 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1377 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 1378 | arg="$non_pic_object" |
| 1379 | fi |
| 1380 | else |
| 1381 | # If the PIC object exists, use it instead. |
| 1382 | # $xdir was prepended to $pic_object above. |
| 1383 | non_pic_object="$pic_object" |
| 1384 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1385 | fi |
| 1386 | else |
| 1387 | # Only an error if not doing a dry-run. |
| 1388 | if test -z "$run"; then |
| 1389 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
| 1390 | exit $EXIT_FAILURE |
| 1391 | else |
| 1392 | # Dry-run case. |
| 1393 | |
| 1394 | # Extract subdirectory from the argument. |
| 1395 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1396 | if test "X$xdir" = "X$arg"; then |
| 1397 | xdir= |
| 1398 | else |
| 1399 | xdir="$xdir/" |
| 1400 | fi |
| 1401 | |
| 1402 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
| 1403 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
| 1404 | libobjs="$libobjs $pic_object" |
| 1405 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1406 | fi |
| 1407 | fi |
| 1408 | done |
| 1409 | else |
| 1410 | $echo "$modename: link input file \`$save_arg' does not exist" |
| 1411 | exit $EXIT_FAILURE |
| 1412 | fi |
| 1413 | arg=$save_arg |
| 1414 | prev= |
| 1415 | continue |
| 1416 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1417 | rpath | xrpath) |
| 1418 | # We need an absolute path. |
| 1419 | case $arg in |
| 1420 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1421 | *) |
| 1422 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1423 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1424 | ;; |
| 1425 | esac |
| 1426 | if test "$prev" = rpath; then |
| 1427 | case "$rpath " in |
| 1428 | *" $arg "*) ;; |
| 1429 | *) rpath="$rpath $arg" ;; |
| 1430 | esac |
| 1431 | else |
| 1432 | case "$xrpath " in |
| 1433 | *" $arg "*) ;; |
| 1434 | *) xrpath="$xrpath $arg" ;; |
| 1435 | esac |
| 1436 | fi |
| 1437 | prev= |
| 1438 | continue |
| 1439 | ;; |
| 1440 | xcompiler) |
| 1441 | compiler_flags="$compiler_flags $qarg" |
| 1442 | prev= |
| 1443 | compile_command="$compile_command $qarg" |
| 1444 | finalize_command="$finalize_command $qarg" |
| 1445 | continue |
| 1446 | ;; |
| 1447 | xlinker) |
| 1448 | linker_flags="$linker_flags $qarg" |
| 1449 | compiler_flags="$compiler_flags $wl$qarg" |
| 1450 | prev= |
| 1451 | compile_command="$compile_command $wl$qarg" |
| 1452 | finalize_command="$finalize_command $wl$qarg" |
| 1453 | continue |
| 1454 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1455 | xcclinker) |
| 1456 | linker_flags="$linker_flags $qarg" |
| 1457 | compiler_flags="$compiler_flags $qarg" |
| 1458 | prev= |
| 1459 | compile_command="$compile_command $qarg" |
| 1460 | finalize_command="$finalize_command $qarg" |
| 1461 | continue |
| 1462 | ;; |
| 1463 | shrext) |
| 1464 | shrext_cmds="$arg" |
| 1465 | prev= |
| 1466 | continue |
| 1467 | ;; |
| 1468 | darwin_framework|darwin_framework_skip) |
| 1469 | test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" |
| 1470 | compile_command="$compile_command $arg" |
| 1471 | finalize_command="$finalize_command $arg" |
| 1472 | prev= |
| 1473 | continue |
| 1474 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1475 | *) |
| 1476 | eval "$prev=\"\$arg\"" |
| 1477 | prev= |
| 1478 | continue |
| 1479 | ;; |
| 1480 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1481 | fi # test -n "$prev" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1482 | |
| 1483 | prevarg="$arg" |
| 1484 | |
| 1485 | case $arg in |
| 1486 | -all-static) |
| 1487 | if test -n "$link_static_flag"; then |
| 1488 | compile_command="$compile_command $link_static_flag" |
| 1489 | finalize_command="$finalize_command $link_static_flag" |
| 1490 | fi |
| 1491 | continue |
| 1492 | ;; |
| 1493 | |
| 1494 | -allow-undefined) |
| 1495 | # FIXME: remove this flag sometime in the future. |
| 1496 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
| 1497 | continue |
| 1498 | ;; |
| 1499 | |
| 1500 | -avoid-version) |
| 1501 | avoid_version=yes |
| 1502 | continue |
| 1503 | ;; |
| 1504 | |
| 1505 | -dlopen) |
| 1506 | prev=dlfiles |
| 1507 | continue |
| 1508 | ;; |
| 1509 | |
| 1510 | -dlpreopen) |
| 1511 | prev=dlprefiles |
| 1512 | continue |
| 1513 | ;; |
| 1514 | |
| 1515 | -export-dynamic) |
| 1516 | export_dynamic=yes |
| 1517 | continue |
| 1518 | ;; |
| 1519 | |
| 1520 | -export-symbols | -export-symbols-regex) |
| 1521 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
| 1522 | $echo "$modename: more than one -exported-symbols argument is not allowed" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1523 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1524 | fi |
| 1525 | if test "X$arg" = "X-export-symbols"; then |
| 1526 | prev=expsyms |
| 1527 | else |
| 1528 | prev=expsyms_regex |
| 1529 | fi |
| 1530 | continue |
| 1531 | ;; |
| 1532 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1533 | -framework|-arch|-isysroot) |
| 1534 | case " $CC " in |
| 1535 | *" ${arg} ${1} "* | *" ${arg} ${1} "*) |
| 1536 | prev=darwin_framework_skip ;; |
| 1537 | *) compiler_flags="$compiler_flags $arg" |
| 1538 | prev=darwin_framework ;; |
| 1539 | esac |
| 1540 | compile_command="$compile_command $arg" |
| 1541 | finalize_command="$finalize_command $arg" |
| 1542 | continue |
| 1543 | ;; |
| 1544 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1545 | -inst-prefix-dir) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1546 | prev=inst_prefix |
| 1547 | continue |
| 1548 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1549 | |
| 1550 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 1551 | # so, if we see these flags be careful not to treat them like -L |
| 1552 | -L[A-Z][A-Z]*:*) |
| 1553 | case $with_gcc/$host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1554 | no/*-*-irix* | /*-*-irix*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1555 | compile_command="$compile_command $arg" |
| 1556 | finalize_command="$finalize_command $arg" |
| 1557 | ;; |
| 1558 | esac |
| 1559 | continue |
| 1560 | ;; |
| 1561 | |
| 1562 | -L*) |
| 1563 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
| 1564 | # We need an absolute path. |
| 1565 | case $dir in |
| 1566 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1567 | *) |
| 1568 | absdir=`cd "$dir" && pwd` |
| 1569 | if test -z "$absdir"; then |
| 1570 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1571 | absdir="$dir" |
| 1572 | notinst_path="$notinst_path $dir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1573 | fi |
| 1574 | dir="$absdir" |
| 1575 | ;; |
| 1576 | esac |
| 1577 | case "$deplibs " in |
| 1578 | *" -L$dir "*) ;; |
| 1579 | *) |
| 1580 | deplibs="$deplibs -L$dir" |
| 1581 | lib_search_path="$lib_search_path $dir" |
| 1582 | ;; |
| 1583 | esac |
| 1584 | case $host in |
| 1585 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1586 | testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1587 | case :$dllsearchpath: in |
| 1588 | *":$dir:"*) ;; |
| 1589 | *) dllsearchpath="$dllsearchpath:$dir";; |
| 1590 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1591 | case :$dllsearchpath: in |
| 1592 | *":$testbindir:"*) ;; |
| 1593 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
| 1594 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1595 | ;; |
| 1596 | esac |
| 1597 | continue |
| 1598 | ;; |
| 1599 | |
| 1600 | -l*) |
| 1601 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 1602 | case $host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1603 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1604 | # These systems don't actually have a C or math library (as such) |
| 1605 | continue |
| 1606 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1607 | *-*-os2*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1608 | # These systems don't actually have a C library (as such) |
| 1609 | test "X$arg" = "X-lc" && continue |
| 1610 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1611 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1612 | # Do not include libc due to us having libc/libc_r. |
| 1613 | test "X$arg" = "X-lc" && continue |
| 1614 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1615 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 1616 | # Rhapsody C and math libraries are in the System framework |
| 1617 | deplibs="$deplibs -framework System" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1618 | continue |
| 1619 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1620 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 1621 | # Causes problems with __ctype |
| 1622 | test "X$arg" = "X-lc" && continue |
| 1623 | ;; |
| 1624 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 1625 | # Compiler inserts libc in the correct place for threads to work |
| 1626 | test "X$arg" = "X-lc" && continue |
| 1627 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1628 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1629 | elif test "X$arg" = "X-lc_r"; then |
| 1630 | case $host in |
| 1631 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 1632 | # Do not include libc_r directly, use -pthread flag. |
| 1633 | continue |
| 1634 | ;; |
| 1635 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1636 | fi |
| 1637 | deplibs="$deplibs $arg" |
| 1638 | continue |
| 1639 | ;; |
| 1640 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1641 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
| 1642 | # classes, name mangling, and exception handling. |
| 1643 | -model) |
| 1644 | compile_command="$compile_command $arg" |
| 1645 | compiler_flags="$compiler_flags $arg" |
| 1646 | finalize_command="$finalize_command $arg" |
| 1647 | prev=xcompiler |
| 1648 | continue |
| 1649 | ;; |
| 1650 | |
| 1651 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 1652 | compiler_flags="$compiler_flags $arg" |
| 1653 | compile_command="$compile_command $arg" |
| 1654 | finalize_command="$finalize_command $arg" |
| 1655 | continue |
| 1656 | ;; |
| 1657 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1658 | -module) |
| 1659 | module=yes |
| 1660 | continue |
| 1661 | ;; |
| 1662 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1663 | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler |
| 1664 | # -r[0-9][0-9]* specifies the processor on the SGI compiler |
| 1665 | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler |
| 1666 | # +DA*, +DD* enable 64-bit mode on the HP compiler |
| 1667 | # -q* pass through compiler args for the IBM compiler |
| 1668 | # -m* pass through architecture-specific compiler args for GCC |
| 1669 | # -m*, -t[45]*, -txscale* pass through architecture-specific |
| 1670 | # compiler args for GCC |
| 1671 | # -pg pass through profiling flag for GCC |
| 1672 | # @file GCC response files |
| 1673 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ |
| 1674 | -t[45]*|-txscale*|@*) |
| 1675 | |
| 1676 | # Unknown arguments in both finalize_command and compile_command need |
| 1677 | # to be aesthetically quoted because they are evaled later. |
| 1678 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1679 | case $arg in |
| 1680 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1681 | arg="\"$arg\"" |
| 1682 | ;; |
| 1683 | esac |
| 1684 | compile_command="$compile_command $arg" |
| 1685 | finalize_command="$finalize_command $arg" |
| 1686 | compiler_flags="$compiler_flags $arg" |
| 1687 | continue |
| 1688 | ;; |
| 1689 | |
| 1690 | -shrext) |
| 1691 | prev=shrext |
| 1692 | continue |
| 1693 | ;; |
| 1694 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1695 | -no-fast-install) |
| 1696 | fast_install=no |
| 1697 | continue |
| 1698 | ;; |
| 1699 | |
| 1700 | -no-install) |
| 1701 | case $host in |
| 1702 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
| 1703 | # The PATH hackery in wrapper scripts is required on Windows |
| 1704 | # in order for the loader to find any dlls it needs. |
| 1705 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 |
| 1706 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 |
| 1707 | fast_install=no |
| 1708 | ;; |
| 1709 | *) no_install=yes ;; |
| 1710 | esac |
| 1711 | continue |
| 1712 | ;; |
| 1713 | |
| 1714 | -no-undefined) |
| 1715 | allow_undefined=no |
| 1716 | continue |
| 1717 | ;; |
| 1718 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1719 | -objectlist) |
| 1720 | prev=objectlist |
| 1721 | continue |
| 1722 | ;; |
| 1723 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1724 | -o) prev=output ;; |
| 1725 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1726 | -precious-files-regex) |
| 1727 | prev=precious_regex |
| 1728 | continue |
| 1729 | ;; |
| 1730 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1731 | -release) |
| 1732 | prev=release |
| 1733 | continue |
| 1734 | ;; |
| 1735 | |
| 1736 | -rpath) |
| 1737 | prev=rpath |
| 1738 | continue |
| 1739 | ;; |
| 1740 | |
| 1741 | -R) |
| 1742 | prev=xrpath |
| 1743 | continue |
| 1744 | ;; |
| 1745 | |
| 1746 | -R*) |
| 1747 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
| 1748 | # We need an absolute path. |
| 1749 | case $dir in |
| 1750 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1751 | *) |
| 1752 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1753 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1754 | ;; |
| 1755 | esac |
| 1756 | case "$xrpath " in |
| 1757 | *" $dir "*) ;; |
| 1758 | *) xrpath="$xrpath $dir" ;; |
| 1759 | esac |
| 1760 | continue |
| 1761 | ;; |
| 1762 | |
| 1763 | -static) |
| 1764 | # The effects of -static are defined in a previous loop. |
| 1765 | # We used to do the same as -all-static on platforms that |
| 1766 | # didn't have a PIC flag, but the assumption that the effects |
| 1767 | # would be equivalent was wrong. It would break on at least |
| 1768 | # Digital Unix and AIX. |
| 1769 | continue |
| 1770 | ;; |
| 1771 | |
| 1772 | -thread-safe) |
| 1773 | thread_safe=yes |
| 1774 | continue |
| 1775 | ;; |
| 1776 | |
| 1777 | -version-info) |
| 1778 | prev=vinfo |
| 1779 | continue |
| 1780 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1781 | -version-number) |
| 1782 | prev=vinfo |
| 1783 | vinfo_number=yes |
| 1784 | continue |
| 1785 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1786 | |
| 1787 | -Wc,*) |
| 1788 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` |
| 1789 | arg= |
| 1790 | save_ifs="$IFS"; IFS=',' |
| 1791 | for flag in $args; do |
| 1792 | IFS="$save_ifs" |
| 1793 | case $flag in |
| 1794 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1795 | flag="\"$flag\"" |
| 1796 | ;; |
| 1797 | esac |
| 1798 | arg="$arg $wl$flag" |
| 1799 | compiler_flags="$compiler_flags $flag" |
| 1800 | done |
| 1801 | IFS="$save_ifs" |
| 1802 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
| 1803 | ;; |
| 1804 | |
| 1805 | -Wl,*) |
| 1806 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` |
| 1807 | arg= |
| 1808 | save_ifs="$IFS"; IFS=',' |
| 1809 | for flag in $args; do |
| 1810 | IFS="$save_ifs" |
| 1811 | case $flag in |
| 1812 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1813 | flag="\"$flag\"" |
| 1814 | ;; |
| 1815 | esac |
| 1816 | arg="$arg $wl$flag" |
| 1817 | compiler_flags="$compiler_flags $wl$flag" |
| 1818 | linker_flags="$linker_flags $flag" |
| 1819 | done |
| 1820 | IFS="$save_ifs" |
| 1821 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
| 1822 | ;; |
| 1823 | |
| 1824 | -Xcompiler) |
| 1825 | prev=xcompiler |
| 1826 | continue |
| 1827 | ;; |
| 1828 | |
| 1829 | -Xlinker) |
| 1830 | prev=xlinker |
| 1831 | continue |
| 1832 | ;; |
| 1833 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1834 | -XCClinker) |
| 1835 | prev=xcclinker |
| 1836 | continue |
| 1837 | ;; |
| 1838 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1839 | # Some other compiler flag. |
| 1840 | -* | +*) |
| 1841 | # Unknown arguments in both finalize_command and compile_command need |
| 1842 | # to be aesthetically quoted because they are evaled later. |
| 1843 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1844 | case $arg in |
| 1845 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1846 | arg="\"$arg\"" |
| 1847 | ;; |
| 1848 | esac |
| 1849 | ;; |
| 1850 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1851 | *.$objext) |
| 1852 | # A standard object. |
| 1853 | objs="$objs $arg" |
| 1854 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1855 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1856 | *.lo) |
| 1857 | # A libtool-controlled object. |
| 1858 | |
| 1859 | # Check to see that this really is a libtool object. |
| 1860 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 1861 | pic_object= |
| 1862 | non_pic_object= |
| 1863 | |
| 1864 | # Read the .lo file |
| 1865 | # If there is no directory component, then add one. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1866 | case $arg in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1867 | */* | *\\*) . $arg ;; |
| 1868 | *) . ./$arg ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1869 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1870 | |
| 1871 | if test -z "$pic_object" || \ |
| 1872 | test -z "$non_pic_object" || |
| 1873 | test "$pic_object" = none && \ |
| 1874 | test "$non_pic_object" = none; then |
| 1875 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
| 1876 | exit $EXIT_FAILURE |
| 1877 | fi |
| 1878 | |
| 1879 | # Extract subdirectory from the argument. |
| 1880 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1881 | if test "X$xdir" = "X$arg"; then |
| 1882 | xdir= |
| 1883 | else |
| 1884 | xdir="$xdir/" |
| 1885 | fi |
| 1886 | |
| 1887 | if test "$pic_object" != none; then |
| 1888 | # Prepend the subdirectory the object is found in. |
| 1889 | pic_object="$xdir$pic_object" |
| 1890 | |
| 1891 | if test "$prev" = dlfiles; then |
| 1892 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 1893 | dlfiles="$dlfiles $pic_object" |
| 1894 | prev= |
| 1895 | continue |
| 1896 | else |
| 1897 | # If libtool objects are unsupported, then we need to preload. |
| 1898 | prev=dlprefiles |
| 1899 | fi |
| 1900 | fi |
| 1901 | |
| 1902 | # CHECK ME: I think I busted this. -Ossama |
| 1903 | if test "$prev" = dlprefiles; then |
| 1904 | # Preload the old-style object. |
| 1905 | dlprefiles="$dlprefiles $pic_object" |
| 1906 | prev= |
| 1907 | fi |
| 1908 | |
| 1909 | # A PIC object. |
| 1910 | libobjs="$libobjs $pic_object" |
| 1911 | arg="$pic_object" |
| 1912 | fi |
| 1913 | |
| 1914 | # Non-PIC object. |
| 1915 | if test "$non_pic_object" != none; then |
| 1916 | # Prepend the subdirectory the object is found in. |
| 1917 | non_pic_object="$xdir$non_pic_object" |
| 1918 | |
| 1919 | # A standard non-PIC object |
| 1920 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1921 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 1922 | arg="$non_pic_object" |
| 1923 | fi |
| 1924 | else |
| 1925 | # If the PIC object exists, use it instead. |
| 1926 | # $xdir was prepended to $pic_object above. |
| 1927 | non_pic_object="$pic_object" |
| 1928 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1929 | fi |
| 1930 | else |
| 1931 | # Only an error if not doing a dry-run. |
| 1932 | if test -z "$run"; then |
| 1933 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
| 1934 | exit $EXIT_FAILURE |
| 1935 | else |
| 1936 | # Dry-run case. |
| 1937 | |
| 1938 | # Extract subdirectory from the argument. |
| 1939 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1940 | if test "X$xdir" = "X$arg"; then |
| 1941 | xdir= |
| 1942 | else |
| 1943 | xdir="$xdir/" |
| 1944 | fi |
| 1945 | |
| 1946 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
| 1947 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
| 1948 | libobjs="$libobjs $pic_object" |
| 1949 | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1950 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 1951 | fi |
| 1952 | ;; |
| 1953 | |
| 1954 | *.$libext) |
| 1955 | # An archive. |
| 1956 | deplibs="$deplibs $arg" |
| 1957 | old_deplibs="$old_deplibs $arg" |
| 1958 | continue |
| 1959 | ;; |
| 1960 | |
| 1961 | *.la) |
| 1962 | # A libtool-controlled library. |
| 1963 | |
| 1964 | if test "$prev" = dlfiles; then |
| 1965 | # This library was specified with -dlopen. |
| 1966 | dlfiles="$dlfiles $arg" |
| 1967 | prev= |
| 1968 | elif test "$prev" = dlprefiles; then |
| 1969 | # The library was specified with -dlpreopen. |
| 1970 | dlprefiles="$dlprefiles $arg" |
| 1971 | prev= |
| 1972 | else |
| 1973 | deplibs="$deplibs $arg" |
| 1974 | fi |
| 1975 | continue |
| 1976 | ;; |
| 1977 | |
| 1978 | # Some other compiler argument. |
| 1979 | *) |
| 1980 | # Unknown arguments in both finalize_command and compile_command need |
| 1981 | # to be aesthetically quoted because they are evaled later. |
| 1982 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1983 | case $arg in |
| 1984 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1985 | arg="\"$arg\"" |
| 1986 | ;; |
| 1987 | esac |
| 1988 | ;; |
| 1989 | esac # arg |
| 1990 | |
| 1991 | # Now actually substitute the argument into the commands. |
| 1992 | if test -n "$arg"; then |
| 1993 | compile_command="$compile_command $arg" |
| 1994 | finalize_command="$finalize_command $arg" |
| 1995 | fi |
| 1996 | done # argument parsing loop |
| 1997 | |
| 1998 | if test -n "$prev"; then |
| 1999 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
| 2000 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2001 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2002 | fi |
| 2003 | |
| 2004 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
| 2005 | eval arg=\"$export_dynamic_flag_spec\" |
| 2006 | compile_command="$compile_command $arg" |
| 2007 | finalize_command="$finalize_command $arg" |
| 2008 | fi |
| 2009 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2010 | oldlibs= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2011 | # calculate the name of the file, without its directory |
| 2012 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` |
| 2013 | libobjs_save="$libobjs" |
| 2014 | |
| 2015 | if test -n "$shlibpath_var"; then |
| 2016 | # get the directories listed in $shlibpath_var |
| 2017 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
| 2018 | else |
| 2019 | shlib_search_path= |
| 2020 | fi |
| 2021 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
| 2022 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
| 2023 | |
| 2024 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` |
| 2025 | if test "X$output_objdir" = "X$output"; then |
| 2026 | output_objdir="$objdir" |
| 2027 | else |
| 2028 | output_objdir="$output_objdir/$objdir" |
| 2029 | fi |
| 2030 | # Create the object directory. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2031 | if test ! -d "$output_objdir"; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2032 | $show "$mkdir $output_objdir" |
| 2033 | $run $mkdir $output_objdir |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2034 | exit_status=$? |
| 2035 | if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then |
| 2036 | exit $exit_status |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2037 | fi |
| 2038 | fi |
| 2039 | |
| 2040 | # Determine the type of output |
| 2041 | case $output in |
| 2042 | "") |
| 2043 | $echo "$modename: you must specify an output file" 1>&2 |
| 2044 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2045 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2046 | ;; |
| 2047 | *.$libext) linkmode=oldlib ;; |
| 2048 | *.lo | *.$objext) linkmode=obj ;; |
| 2049 | *.la) linkmode=lib ;; |
| 2050 | *) linkmode=prog ;; # Anything else should be a program. |
| 2051 | esac |
| 2052 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2053 | case $host in |
| 2054 | *cygwin* | *mingw* | *pw32*) |
| 2055 | # don't eliminate duplications in $postdeps and $predeps |
| 2056 | duplicate_compiler_generated_deps=yes |
| 2057 | ;; |
| 2058 | *) |
| 2059 | duplicate_compiler_generated_deps=$duplicate_deps |
| 2060 | ;; |
| 2061 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2062 | specialdeplibs= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2063 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2064 | libs= |
| 2065 | # Find all interdependent deplibs by searching for libraries |
| 2066 | # that are linked more than once (e.g. -la -lb -la) |
| 2067 | for deplib in $deplibs; do |
| 2068 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2069 | case "$libs " in |
| 2070 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2071 | esac |
| 2072 | fi |
| 2073 | libs="$libs $deplib" |
| 2074 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2075 | |
| 2076 | if test "$linkmode" = lib; then |
| 2077 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
| 2078 | |
| 2079 | # Compute libraries that are listed more than once in $predeps |
| 2080 | # $postdeps and mark them as special (i.e., whose duplicates are |
| 2081 | # not to be eliminated). |
| 2082 | pre_post_deps= |
| 2083 | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then |
| 2084 | for pre_post_dep in $predeps $postdeps; do |
| 2085 | case "$pre_post_deps " in |
| 2086 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
| 2087 | esac |
| 2088 | pre_post_deps="$pre_post_deps $pre_post_dep" |
| 2089 | done |
| 2090 | fi |
| 2091 | pre_post_deps= |
| 2092 | fi |
| 2093 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2094 | deplibs= |
| 2095 | newdependency_libs= |
| 2096 | newlib_search_path= |
| 2097 | need_relink=no # whether we're linking any uninstalled libtool libraries |
| 2098 | notinst_deplibs= # not-installed libtool libraries |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2099 | case $linkmode in |
| 2100 | lib) |
| 2101 | passes="conv link" |
| 2102 | for file in $dlfiles $dlprefiles; do |
| 2103 | case $file in |
| 2104 | *.la) ;; |
| 2105 | *) |
| 2106 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2107 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2108 | ;; |
| 2109 | esac |
| 2110 | done |
| 2111 | ;; |
| 2112 | prog) |
| 2113 | compile_deplibs= |
| 2114 | finalize_deplibs= |
| 2115 | alldeplibs=no |
| 2116 | newdlfiles= |
| 2117 | newdlprefiles= |
| 2118 | passes="conv scan dlopen dlpreopen link" |
| 2119 | ;; |
| 2120 | *) passes="conv" |
| 2121 | ;; |
| 2122 | esac |
| 2123 | for pass in $passes; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2124 | if test "$linkmode,$pass" = "lib,link" || |
| 2125 | test "$linkmode,$pass" = "prog,scan"; then |
| 2126 | libs="$deplibs" |
| 2127 | deplibs= |
| 2128 | fi |
| 2129 | if test "$linkmode" = prog; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2130 | case $pass in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2131 | dlopen) libs="$dlfiles" ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2132 | dlpreopen) libs="$dlprefiles" ;; |
| 2133 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
| 2134 | esac |
| 2135 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2136 | if test "$pass" = dlopen; then |
| 2137 | # Collect dlpreopened libraries |
| 2138 | save_deplibs="$deplibs" |
| 2139 | deplibs= |
| 2140 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2141 | for deplib in $libs; do |
| 2142 | lib= |
| 2143 | found=no |
| 2144 | case $deplib in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2145 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 2146 | if test "$linkmode,$pass" = "prog,link"; then |
| 2147 | compile_deplibs="$deplib $compile_deplibs" |
| 2148 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2149 | else |
| 2150 | compiler_flags="$compiler_flags $deplib" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2151 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2152 | continue |
| 2153 | ;; |
| 2154 | -l*) |
| 2155 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 2156 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2157 | continue |
| 2158 | fi |
| 2159 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` |
| 2160 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2161 | for search_ext in .la $std_shrext .so .a; do |
| 2162 | # Search the libtool library |
| 2163 | lib="$searchdir/lib${name}${search_ext}" |
| 2164 | if test -f "$lib"; then |
| 2165 | if test "$search_ext" = ".la"; then |
| 2166 | found=yes |
| 2167 | else |
| 2168 | found=no |
| 2169 | fi |
| 2170 | break 2 |
| 2171 | fi |
| 2172 | done |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2173 | done |
| 2174 | if test "$found" != yes; then |
| 2175 | # deplib doesn't seem to be a libtool library |
| 2176 | if test "$linkmode,$pass" = "prog,link"; then |
| 2177 | compile_deplibs="$deplib $compile_deplibs" |
| 2178 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2179 | else |
| 2180 | deplibs="$deplib $deplibs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2181 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2182 | fi |
| 2183 | continue |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2184 | else # deplib is a libtool library |
| 2185 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
| 2186 | # We need to do some special things here, and not later. |
| 2187 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 2188 | case " $predeps $postdeps " in |
| 2189 | *" $deplib "*) |
| 2190 | if (${SED} -e '2q' $lib | |
| 2191 | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 2192 | library_names= |
| 2193 | old_library= |
| 2194 | case $lib in |
| 2195 | */* | *\\*) . $lib ;; |
| 2196 | *) . ./$lib ;; |
| 2197 | esac |
| 2198 | for l in $old_library $library_names; do |
| 2199 | ll="$l" |
| 2200 | done |
| 2201 | if test "X$ll" = "X$old_library" ; then # only static version available |
| 2202 | found=no |
| 2203 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2204 | test "X$ladir" = "X$lib" && ladir="." |
| 2205 | lib=$ladir/$old_library |
| 2206 | if test "$linkmode,$pass" = "prog,link"; then |
| 2207 | compile_deplibs="$deplib $compile_deplibs" |
| 2208 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2209 | else |
| 2210 | deplibs="$deplib $deplibs" |
| 2211 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 2212 | fi |
| 2213 | continue |
| 2214 | fi |
| 2215 | fi |
| 2216 | ;; |
| 2217 | *) ;; |
| 2218 | esac |
| 2219 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2220 | fi |
| 2221 | ;; # -l |
| 2222 | -L*) |
| 2223 | case $linkmode in |
| 2224 | lib) |
| 2225 | deplibs="$deplib $deplibs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2226 | test "$pass" = conv && continue |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2227 | newdependency_libs="$deplib $newdependency_libs" |
| 2228 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
| 2229 | ;; |
| 2230 | prog) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2231 | if test "$pass" = conv; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2232 | deplibs="$deplib $deplibs" |
| 2233 | continue |
| 2234 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2235 | if test "$pass" = scan; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2236 | deplibs="$deplib $deplibs" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2237 | else |
| 2238 | compile_deplibs="$deplib $compile_deplibs" |
| 2239 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2240 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2241 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2242 | ;; |
| 2243 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2244 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2245 | ;; |
| 2246 | esac # linkmode |
| 2247 | continue |
| 2248 | ;; # -L |
| 2249 | -R*) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2250 | if test "$pass" = link; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2251 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
| 2252 | # Make sure the xrpath contains only unique directories. |
| 2253 | case "$xrpath " in |
| 2254 | *" $dir "*) ;; |
| 2255 | *) xrpath="$xrpath $dir" ;; |
| 2256 | esac |
| 2257 | fi |
| 2258 | deplibs="$deplib $deplibs" |
| 2259 | continue |
| 2260 | ;; |
| 2261 | *.la) lib="$deplib" ;; |
| 2262 | *.$libext) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2263 | if test "$pass" = conv; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2264 | deplibs="$deplib $deplibs" |
| 2265 | continue |
| 2266 | fi |
| 2267 | case $linkmode in |
| 2268 | lib) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2269 | valid_a_lib=no |
| 2270 | case $deplibs_check_method in |
| 2271 | match_pattern*) |
| 2272 | set dummy $deplibs_check_method |
| 2273 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 2274 | if eval $echo \"$deplib\" 2>/dev/null \ |
| 2275 | | $SED 10q \ |
| 2276 | | $EGREP "$match_pattern_regex" > /dev/null; then |
| 2277 | valid_a_lib=yes |
| 2278 | fi |
| 2279 | ;; |
| 2280 | pass_all) |
| 2281 | valid_a_lib=yes |
| 2282 | ;; |
| 2283 | esac |
| 2284 | if test "$valid_a_lib" != yes; then |
| 2285 | $echo |
| 2286 | $echo "*** Warning: Trying to link with static lib archive $deplib." |
| 2287 | $echo "*** I have the capability to make that library automatically link in when" |
| 2288 | $echo "*** you link to this library. But I can only do this if you have a" |
| 2289 | $echo "*** shared version of the library, which you do not appear to have" |
| 2290 | $echo "*** because the file extensions .$libext of this argument makes me believe" |
| 2291 | $echo "*** that it is just a static archive that I should not used here." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2292 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2293 | $echo |
| 2294 | $echo "*** Warning: Linking the shared library $output against the" |
| 2295 | $echo "*** static library $deplib is not portable!" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2296 | deplibs="$deplib $deplibs" |
| 2297 | fi |
| 2298 | continue |
| 2299 | ;; |
| 2300 | prog) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2301 | if test "$pass" != link; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2302 | deplibs="$deplib $deplibs" |
| 2303 | else |
| 2304 | compile_deplibs="$deplib $compile_deplibs" |
| 2305 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2306 | fi |
| 2307 | continue |
| 2308 | ;; |
| 2309 | esac # linkmode |
| 2310 | ;; # *.$libext |
| 2311 | *.lo | *.$objext) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2312 | if test "$pass" = conv; then |
| 2313 | deplibs="$deplib $deplibs" |
| 2314 | elif test "$linkmode" = prog; then |
| 2315 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
| 2316 | # If there is no dlopen support or we're linking statically, |
| 2317 | # we need to preload. |
| 2318 | newdlprefiles="$newdlprefiles $deplib" |
| 2319 | compile_deplibs="$deplib $compile_deplibs" |
| 2320 | finalize_deplibs="$deplib $finalize_deplibs" |
| 2321 | else |
| 2322 | newdlfiles="$newdlfiles $deplib" |
| 2323 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2324 | fi |
| 2325 | continue |
| 2326 | ;; |
| 2327 | %DEPLIBS%) |
| 2328 | alldeplibs=yes |
| 2329 | continue |
| 2330 | ;; |
| 2331 | esac # case $deplib |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2332 | if test "$found" = yes || test -f "$lib"; then : |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2333 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2334 | $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 |
| 2335 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2336 | fi |
| 2337 | |
| 2338 | # Check to see that this really is a libtool archive. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2339 | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2340 | else |
| 2341 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2342 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2343 | fi |
| 2344 | |
| 2345 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2346 | test "X$ladir" = "X$lib" && ladir="." |
| 2347 | |
| 2348 | dlname= |
| 2349 | dlopen= |
| 2350 | dlpreopen= |
| 2351 | libdir= |
| 2352 | library_names= |
| 2353 | old_library= |
| 2354 | # If the library was installed with an old release of libtool, |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2355 | # it will not redefine variables installed, or shouldnotlink |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2356 | installed=yes |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2357 | shouldnotlink=no |
| 2358 | avoidtemprpath= |
| 2359 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2360 | |
| 2361 | # Read the .la file |
| 2362 | case $lib in |
| 2363 | */* | *\\*) . $lib ;; |
| 2364 | *) . ./$lib ;; |
| 2365 | esac |
| 2366 | |
| 2367 | if test "$linkmode,$pass" = "lib,link" || |
| 2368 | test "$linkmode,$pass" = "prog,scan" || |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2369 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2370 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
| 2371 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
| 2372 | fi |
| 2373 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2374 | if test "$pass" = conv; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2375 | # Only check for convenience libraries |
| 2376 | deplibs="$lib $deplibs" |
| 2377 | if test -z "$libdir"; then |
| 2378 | if test -z "$old_library"; then |
| 2379 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2380 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2381 | fi |
| 2382 | # It is a libtool convenience library, so add in its objects. |
| 2383 | convenience="$convenience $ladir/$objdir/$old_library" |
| 2384 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
| 2385 | tmp_libs= |
| 2386 | for deplib in $dependency_libs; do |
| 2387 | deplibs="$deplib $deplibs" |
| 2388 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2389 | case "$tmp_libs " in |
| 2390 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2391 | esac |
| 2392 | fi |
| 2393 | tmp_libs="$tmp_libs $deplib" |
| 2394 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2395 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2396 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2397 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2398 | fi |
| 2399 | continue |
| 2400 | fi # $pass = conv |
| 2401 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2402 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2403 | # Get the name of the library we link against. |
| 2404 | linklib= |
| 2405 | for l in $old_library $library_names; do |
| 2406 | linklib="$l" |
| 2407 | done |
| 2408 | if test -z "$linklib"; then |
| 2409 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2410 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2411 | fi |
| 2412 | |
| 2413 | # This library was specified with -dlopen. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2414 | if test "$pass" = dlopen; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2415 | if test -z "$libdir"; then |
| 2416 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2417 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2418 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2419 | if test -z "$dlname" || |
| 2420 | test "$dlopen_support" != yes || |
| 2421 | test "$build_libtool_libs" = no; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2422 | # If there is no dlname, no dlopen support or we're linking |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2423 | # statically, we need to preload. We also need to preload any |
| 2424 | # dependent libraries so libltdl's deplib preloader doesn't |
| 2425 | # bomb out in the load deplibs phase. |
| 2426 | dlprefiles="$dlprefiles $lib $dependency_libs" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2427 | else |
| 2428 | newdlfiles="$newdlfiles $lib" |
| 2429 | fi |
| 2430 | continue |
| 2431 | fi # $pass = dlopen |
| 2432 | |
| 2433 | # We need an absolute path. |
| 2434 | case $ladir in |
| 2435 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
| 2436 | *) |
| 2437 | abs_ladir=`cd "$ladir" && pwd` |
| 2438 | if test -z "$abs_ladir"; then |
| 2439 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 |
| 2440 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
| 2441 | abs_ladir="$ladir" |
| 2442 | fi |
| 2443 | ;; |
| 2444 | esac |
| 2445 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
| 2446 | |
| 2447 | # Find the relevant object directory and library name. |
| 2448 | if test "X$installed" = Xyes; then |
| 2449 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2450 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 |
| 2451 | dir="$ladir" |
| 2452 | absdir="$abs_ladir" |
| 2453 | libdir="$abs_ladir" |
| 2454 | else |
| 2455 | dir="$libdir" |
| 2456 | absdir="$libdir" |
| 2457 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2458 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2459 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2460 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2461 | dir="$ladir" |
| 2462 | absdir="$abs_ladir" |
| 2463 | # Remove this search path later |
| 2464 | notinst_path="$notinst_path $abs_ladir" |
| 2465 | else |
| 2466 | dir="$ladir/$objdir" |
| 2467 | absdir="$abs_ladir/$objdir" |
| 2468 | # Remove this search path later |
| 2469 | notinst_path="$notinst_path $abs_ladir" |
| 2470 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2471 | fi # $installed = yes |
| 2472 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
| 2473 | |
| 2474 | # This library was specified with -dlpreopen. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2475 | if test "$pass" = dlpreopen; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2476 | if test -z "$libdir"; then |
| 2477 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2478 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2479 | fi |
| 2480 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 2481 | # are required to link). |
| 2482 | if test -n "$old_library"; then |
| 2483 | newdlprefiles="$newdlprefiles $dir/$old_library" |
| 2484 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
| 2485 | elif test -n "$dlname"; then |
| 2486 | newdlprefiles="$newdlprefiles $dir/$dlname" |
| 2487 | else |
| 2488 | newdlprefiles="$newdlprefiles $dir/$linklib" |
| 2489 | fi |
| 2490 | fi # $pass = dlpreopen |
| 2491 | |
| 2492 | if test -z "$libdir"; then |
| 2493 | # Link the convenience library |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2494 | if test "$linkmode" = lib; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2495 | deplibs="$dir/$old_library $deplibs" |
| 2496 | elif test "$linkmode,$pass" = "prog,link"; then |
| 2497 | compile_deplibs="$dir/$old_library $compile_deplibs" |
| 2498 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
| 2499 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2500 | deplibs="$lib $deplibs" # used for prog,scan pass |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2501 | fi |
| 2502 | continue |
| 2503 | fi |
| 2504 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2505 | |
| 2506 | if test "$linkmode" = prog && test "$pass" != link; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2507 | newlib_search_path="$newlib_search_path $ladir" |
| 2508 | deplibs="$lib $deplibs" |
| 2509 | |
| 2510 | linkalldeplibs=no |
| 2511 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
| 2512 | test "$build_libtool_libs" = no; then |
| 2513 | linkalldeplibs=yes |
| 2514 | fi |
| 2515 | |
| 2516 | tmp_libs= |
| 2517 | for deplib in $dependency_libs; do |
| 2518 | case $deplib in |
| 2519 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
| 2520 | esac |
| 2521 | # Need to link against all dependency_libs? |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2522 | if test "$linkalldeplibs" = yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2523 | deplibs="$deplib $deplibs" |
| 2524 | else |
| 2525 | # Need to hardcode shared library paths |
| 2526 | # or/and link against static libraries |
| 2527 | newdependency_libs="$deplib $newdependency_libs" |
| 2528 | fi |
| 2529 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2530 | case "$tmp_libs " in |
| 2531 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2532 | esac |
| 2533 | fi |
| 2534 | tmp_libs="$tmp_libs $deplib" |
| 2535 | done # for deplib |
| 2536 | continue |
| 2537 | fi # $linkmode = prog... |
| 2538 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2539 | if test "$linkmode,$pass" = "prog,link"; then |
| 2540 | if test -n "$library_names" && |
| 2541 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
| 2542 | # We need to hardcode the library path |
| 2543 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
| 2544 | # Make sure the rpath contains only unique directories. |
| 2545 | case "$temp_rpath " in |
| 2546 | *" $dir "*) ;; |
| 2547 | *" $absdir "*) ;; |
| 2548 | *) temp_rpath="$temp_rpath $absdir" ;; |
| 2549 | esac |
| 2550 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2551 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2552 | # Hardcode the library path. |
| 2553 | # Skip directories that are in the system default run-time |
| 2554 | # search path. |
| 2555 | case " $sys_lib_dlsearch_path " in |
| 2556 | *" $absdir "*) ;; |
| 2557 | *) |
| 2558 | case "$compile_rpath " in |
| 2559 | *" $absdir "*) ;; |
| 2560 | *) compile_rpath="$compile_rpath $absdir" |
| 2561 | esac |
| 2562 | ;; |
| 2563 | esac |
| 2564 | case " $sys_lib_dlsearch_path " in |
| 2565 | *" $libdir "*) ;; |
| 2566 | *) |
| 2567 | case "$finalize_rpath " in |
| 2568 | *" $libdir "*) ;; |
| 2569 | *) finalize_rpath="$finalize_rpath $libdir" |
| 2570 | esac |
| 2571 | ;; |
| 2572 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2573 | fi # $linkmode,$pass = prog,link... |
| 2574 | |
| 2575 | if test "$alldeplibs" = yes && |
| 2576 | { test "$deplibs_check_method" = pass_all || |
| 2577 | { test "$build_libtool_libs" = yes && |
| 2578 | test -n "$library_names"; }; }; then |
| 2579 | # We only need to search for static libraries |
| 2580 | continue |
| 2581 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2582 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2583 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2584 | link_static=no # Whether the deplib will be linked statically |
| 2585 | use_static_libs=$prefer_static_libs |
| 2586 | if test "$use_static_libs" = built && test "$installed" = yes ; then |
| 2587 | use_static_libs=no |
| 2588 | fi |
| 2589 | if test -n "$library_names" && |
| 2590 | { test "$use_static_libs" = no || test -z "$old_library"; }; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2591 | if test "$installed" = no; then |
| 2592 | notinst_deplibs="$notinst_deplibs $lib" |
| 2593 | need_relink=yes |
| 2594 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2595 | # This is a shared library |
| 2596 | |
| 2597 | # Warn about portability, can't link against -module's on |
| 2598 | # some systems (darwin) |
| 2599 | if test "$shouldnotlink" = yes && test "$pass" = link ; then |
| 2600 | $echo |
| 2601 | if test "$linkmode" = prog; then |
| 2602 | $echo "*** Warning: Linking the executable $output against the loadable module" |
| 2603 | else |
| 2604 | $echo "*** Warning: Linking the shared library $output against the loadable module" |
| 2605 | fi |
| 2606 | $echo "*** $linklib is not portable!" |
| 2607 | fi |
| 2608 | if test "$linkmode" = lib && |
| 2609 | test "$hardcode_into_libs" = yes; then |
| 2610 | # Hardcode the library path. |
| 2611 | # Skip directories that are in the system default run-time |
| 2612 | # search path. |
| 2613 | case " $sys_lib_dlsearch_path " in |
| 2614 | *" $absdir "*) ;; |
| 2615 | *) |
| 2616 | case "$compile_rpath " in |
| 2617 | *" $absdir "*) ;; |
| 2618 | *) compile_rpath="$compile_rpath $absdir" |
| 2619 | esac |
| 2620 | ;; |
| 2621 | esac |
| 2622 | case " $sys_lib_dlsearch_path " in |
| 2623 | *" $libdir "*) ;; |
| 2624 | *) |
| 2625 | case "$finalize_rpath " in |
| 2626 | *" $libdir "*) ;; |
| 2627 | *) finalize_rpath="$finalize_rpath $libdir" |
| 2628 | esac |
| 2629 | ;; |
| 2630 | esac |
| 2631 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2632 | |
| 2633 | if test -n "$old_archive_from_expsyms_cmds"; then |
| 2634 | # figure out the soname |
| 2635 | set dummy $library_names |
| 2636 | realname="$2" |
| 2637 | shift; shift |
| 2638 | libname=`eval \\$echo \"$libname_spec\"` |
| 2639 | # use dlname if we got it. it's perfectly good, no? |
| 2640 | if test -n "$dlname"; then |
| 2641 | soname="$dlname" |
| 2642 | elif test -n "$soname_spec"; then |
| 2643 | # bleh windows |
| 2644 | case $host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2645 | *cygwin* | mingw*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2646 | major=`expr $current - $age` |
| 2647 | versuffix="-$major" |
| 2648 | ;; |
| 2649 | esac |
| 2650 | eval soname=\"$soname_spec\" |
| 2651 | else |
| 2652 | soname="$realname" |
| 2653 | fi |
| 2654 | |
| 2655 | # Make a new name for the extract_expsyms_cmds to use |
| 2656 | soroot="$soname" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2657 | soname=`$echo $soroot | ${SED} -e 's/^.*\///'` |
| 2658 | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2659 | |
| 2660 | # If the library has no export list, then create one now |
| 2661 | if test -f "$output_objdir/$soname-def"; then : |
| 2662 | else |
| 2663 | $show "extracting exported symbol list from \`$soname'" |
| 2664 | save_ifs="$IFS"; IFS='~' |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2665 | cmds=$extract_expsyms_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2666 | for cmd in $cmds; do |
| 2667 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2668 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2669 | $show "$cmd" |
| 2670 | $run eval "$cmd" || exit $? |
| 2671 | done |
| 2672 | IFS="$save_ifs" |
| 2673 | fi |
| 2674 | |
| 2675 | # Create $newlib |
| 2676 | if test -f "$output_objdir/$newlib"; then :; else |
| 2677 | $show "generating import library for \`$soname'" |
| 2678 | save_ifs="$IFS"; IFS='~' |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2679 | cmds=$old_archive_from_expsyms_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2680 | for cmd in $cmds; do |
| 2681 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2682 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2683 | $show "$cmd" |
| 2684 | $run eval "$cmd" || exit $? |
| 2685 | done |
| 2686 | IFS="$save_ifs" |
| 2687 | fi |
| 2688 | # make sure the library variables are pointing to the new library |
| 2689 | dir=$output_objdir |
| 2690 | linklib=$newlib |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2691 | fi # test -n "$old_archive_from_expsyms_cmds" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2692 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2693 | if test "$linkmode" = prog || test "$mode" != relink; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2694 | add_shlibpath= |
| 2695 | add_dir= |
| 2696 | add= |
| 2697 | lib_linked=yes |
| 2698 | case $hardcode_action in |
| 2699 | immediate | unsupported) |
| 2700 | if test "$hardcode_direct" = no; then |
| 2701 | add="$dir/$linklib" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2702 | case $host in |
| 2703 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
| 2704 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
| 2705 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
| 2706 | *-*-unixware7*) add_dir="-L$dir" ;; |
| 2707 | *-*-darwin* ) |
| 2708 | # if the lib is a module then we can not link against |
| 2709 | # it, someone is ignoring the new warnings I added |
| 2710 | if /usr/bin/file -L $add 2> /dev/null | |
| 2711 | $EGREP ": [^:]* bundle" >/dev/null ; then |
| 2712 | $echo "** Warning, lib $linklib is a module, not a shared library" |
| 2713 | if test -z "$old_library" ; then |
| 2714 | $echo |
| 2715 | $echo "** And there doesn't seem to be a static archive available" |
| 2716 | $echo "** The link will probably fail, sorry" |
| 2717 | else |
| 2718 | add="$dir/$old_library" |
| 2719 | fi |
| 2720 | fi |
| 2721 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2722 | elif test "$hardcode_minus_L" = no; then |
| 2723 | case $host in |
| 2724 | *-*-sunos*) add_shlibpath="$dir" ;; |
| 2725 | esac |
| 2726 | add_dir="-L$dir" |
| 2727 | add="-l$name" |
| 2728 | elif test "$hardcode_shlibpath_var" = no; then |
| 2729 | add_shlibpath="$dir" |
| 2730 | add="-l$name" |
| 2731 | else |
| 2732 | lib_linked=no |
| 2733 | fi |
| 2734 | ;; |
| 2735 | relink) |
| 2736 | if test "$hardcode_direct" = yes; then |
| 2737 | add="$dir/$linklib" |
| 2738 | elif test "$hardcode_minus_L" = yes; then |
| 2739 | add_dir="-L$dir" |
| 2740 | # Try looking first in the location we're being installed to. |
| 2741 | if test -n "$inst_prefix_dir"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2742 | case $libdir in |
| 2743 | [\\/]*) |
| 2744 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
| 2745 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2746 | esac |
| 2747 | fi |
| 2748 | add="-l$name" |
| 2749 | elif test "$hardcode_shlibpath_var" = yes; then |
| 2750 | add_shlibpath="$dir" |
| 2751 | add="-l$name" |
| 2752 | else |
| 2753 | lib_linked=no |
| 2754 | fi |
| 2755 | ;; |
| 2756 | *) lib_linked=no ;; |
| 2757 | esac |
| 2758 | |
| 2759 | if test "$lib_linked" != yes; then |
| 2760 | $echo "$modename: configuration error: unsupported hardcode properties" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2761 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2762 | fi |
| 2763 | |
| 2764 | if test -n "$add_shlibpath"; then |
| 2765 | case :$compile_shlibpath: in |
| 2766 | *":$add_shlibpath:"*) ;; |
| 2767 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
| 2768 | esac |
| 2769 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2770 | if test "$linkmode" = prog; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2771 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 2772 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
| 2773 | else |
| 2774 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2775 | test -n "$add" && deplibs="$add $deplibs" |
| 2776 | if test "$hardcode_direct" != yes && \ |
| 2777 | test "$hardcode_minus_L" != yes && \ |
| 2778 | test "$hardcode_shlibpath_var" = yes; then |
| 2779 | case :$finalize_shlibpath: in |
| 2780 | *":$libdir:"*) ;; |
| 2781 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
| 2782 | esac |
| 2783 | fi |
| 2784 | fi |
| 2785 | fi |
| 2786 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2787 | if test "$linkmode" = prog || test "$mode" = relink; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2788 | add_shlibpath= |
| 2789 | add_dir= |
| 2790 | add= |
| 2791 | # Finalize command for both is simple: just hardcode it. |
| 2792 | if test "$hardcode_direct" = yes; then |
| 2793 | add="$libdir/$linklib" |
| 2794 | elif test "$hardcode_minus_L" = yes; then |
| 2795 | add_dir="-L$libdir" |
| 2796 | add="-l$name" |
| 2797 | elif test "$hardcode_shlibpath_var" = yes; then |
| 2798 | case :$finalize_shlibpath: in |
| 2799 | *":$libdir:"*) ;; |
| 2800 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
| 2801 | esac |
| 2802 | add="-l$name" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2803 | elif test "$hardcode_automatic" = yes; then |
| 2804 | if test -n "$inst_prefix_dir" && |
| 2805 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
| 2806 | add="$inst_prefix_dir$libdir/$linklib" |
| 2807 | else |
| 2808 | add="$libdir/$linklib" |
| 2809 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2810 | else |
| 2811 | # We cannot seem to hardcode it, guess we'll fake it. |
| 2812 | add_dir="-L$libdir" |
| 2813 | # Try looking first in the location we're being installed to. |
| 2814 | if test -n "$inst_prefix_dir"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2815 | case $libdir in |
| 2816 | [\\/]*) |
| 2817 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
| 2818 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2819 | esac |
| 2820 | fi |
| 2821 | add="-l$name" |
| 2822 | fi |
| 2823 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2824 | if test "$linkmode" = prog; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2825 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 2826 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
| 2827 | else |
| 2828 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2829 | test -n "$add" && deplibs="$add $deplibs" |
| 2830 | fi |
| 2831 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2832 | elif test "$linkmode" = prog; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2833 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 2834 | # is not unsupported. This is valid on all known static and |
| 2835 | # shared platforms. |
| 2836 | if test "$hardcode_direct" != unsupported; then |
| 2837 | test -n "$old_library" && linklib="$old_library" |
| 2838 | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 2839 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
| 2840 | else |
| 2841 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 2842 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
| 2843 | fi |
| 2844 | elif test "$build_libtool_libs" = yes; then |
| 2845 | # Not a shared library |
| 2846 | if test "$deplibs_check_method" != pass_all; then |
| 2847 | # We're trying link a shared library against a static one |
| 2848 | # but the system doesn't support it. |
| 2849 | |
| 2850 | # Just print a warning and add the library to dependency_libs so |
| 2851 | # that the program can be linked against the static library. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2852 | $echo |
| 2853 | $echo "*** Warning: This system can not link to static lib archive $lib." |
| 2854 | $echo "*** I have the capability to make that library automatically link in when" |
| 2855 | $echo "*** you link to this library. But I can only do this if you have a" |
| 2856 | $echo "*** shared version of the library, which you do not appear to have." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2857 | if test "$module" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2858 | $echo "*** But as you try to build a module library, libtool will still create " |
| 2859 | $echo "*** a static module, that should work as long as the dlopening application" |
| 2860 | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2861 | if test -z "$global_symbol_pipe"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2862 | $echo |
| 2863 | $echo "*** However, this would only work if libtool was able to extract symbol" |
| 2864 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 2865 | $echo "*** not find such a program. So, this module is probably useless." |
| 2866 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2867 | fi |
| 2868 | if test "$build_old_libs" = no; then |
| 2869 | build_libtool_libs=module |
| 2870 | build_old_libs=yes |
| 2871 | else |
| 2872 | build_libtool_libs=no |
| 2873 | fi |
| 2874 | fi |
| 2875 | else |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2876 | deplibs="$dir/$old_library $deplibs" |
| 2877 | link_static=yes |
| 2878 | fi |
| 2879 | fi # link shared/static library? |
| 2880 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2881 | if test "$linkmode" = lib; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2882 | if test -n "$dependency_libs" && |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2883 | { test "$hardcode_into_libs" != yes || |
| 2884 | test "$build_old_libs" = yes || |
| 2885 | test "$link_static" = yes; }; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2886 | # Extract -R from dependency_libs |
| 2887 | temp_deplibs= |
| 2888 | for libdir in $dependency_libs; do |
| 2889 | case $libdir in |
| 2890 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` |
| 2891 | case " $xrpath " in |
| 2892 | *" $temp_xrpath "*) ;; |
| 2893 | *) xrpath="$xrpath $temp_xrpath";; |
| 2894 | esac;; |
| 2895 | *) temp_deplibs="$temp_deplibs $libdir";; |
| 2896 | esac |
| 2897 | done |
| 2898 | dependency_libs="$temp_deplibs" |
| 2899 | fi |
| 2900 | |
| 2901 | newlib_search_path="$newlib_search_path $absdir" |
| 2902 | # Link against this library |
| 2903 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
| 2904 | # ... and its dependency_libs |
| 2905 | tmp_libs= |
| 2906 | for deplib in $dependency_libs; do |
| 2907 | newdependency_libs="$deplib $newdependency_libs" |
| 2908 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2909 | case "$tmp_libs " in |
| 2910 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2911 | esac |
| 2912 | fi |
| 2913 | tmp_libs="$tmp_libs $deplib" |
| 2914 | done |
| 2915 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2916 | if test "$link_all_deplibs" != no; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2917 | # Add the search paths of all dependency libraries |
| 2918 | for deplib in $dependency_libs; do |
| 2919 | case $deplib in |
| 2920 | -L*) path="$deplib" ;; |
| 2921 | *.la) |
| 2922 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` |
| 2923 | test "X$dir" = "X$deplib" && dir="." |
| 2924 | # We need an absolute path. |
| 2925 | case $dir in |
| 2926 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
| 2927 | *) |
| 2928 | absdir=`cd "$dir" && pwd` |
| 2929 | if test -z "$absdir"; then |
| 2930 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 |
| 2931 | absdir="$dir" |
| 2932 | fi |
| 2933 | ;; |
| 2934 | esac |
| 2935 | if grep "^installed=no" $deplib > /dev/null; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2936 | path="$absdir/$objdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2937 | else |
| 2938 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 2939 | if test -z "$libdir"; then |
| 2940 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2941 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2942 | fi |
| 2943 | if test "$absdir" != "$libdir"; then |
| 2944 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 |
| 2945 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2946 | path="$absdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2947 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2948 | depdepl= |
| 2949 | case $host in |
| 2950 | *-*-darwin*) |
| 2951 | # we do not want to link against static libs, |
| 2952 | # but need to link against shared |
| 2953 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
| 2954 | if test -n "$deplibrary_names" ; then |
| 2955 | for tmp in $deplibrary_names ; do |
| 2956 | depdepl=$tmp |
| 2957 | done |
| 2958 | if test -f "$path/$depdepl" ; then |
| 2959 | depdepl="$path/$depdepl" |
| 2960 | fi |
| 2961 | # do not add paths which are already there |
| 2962 | case " $newlib_search_path " in |
| 2963 | *" $path "*) ;; |
| 2964 | *) newlib_search_path="$newlib_search_path $path";; |
| 2965 | esac |
| 2966 | fi |
| 2967 | path="" |
| 2968 | ;; |
| 2969 | *) |
| 2970 | path="-L$path" |
| 2971 | ;; |
| 2972 | esac |
| 2973 | ;; |
| 2974 | -l*) |
| 2975 | case $host in |
| 2976 | *-*-darwin*) |
| 2977 | # Again, we only want to link against shared libraries |
| 2978 | eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` |
| 2979 | for tmp in $newlib_search_path ; do |
| 2980 | if test -f "$tmp/lib$tmp_libs.dylib" ; then |
| 2981 | eval depdepl="$tmp/lib$tmp_libs.dylib" |
| 2982 | break |
| 2983 | fi |
| 2984 | done |
| 2985 | path="" |
| 2986 | ;; |
| 2987 | *) continue ;; |
| 2988 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2989 | ;; |
| 2990 | *) continue ;; |
| 2991 | esac |
| 2992 | case " $deplibs " in |
| 2993 | *" $path "*) ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 2994 | *) deplibs="$path $deplibs" ;; |
| 2995 | esac |
| 2996 | case " $deplibs " in |
| 2997 | *" $depdepl "*) ;; |
| 2998 | *) deplibs="$depdepl $deplibs" ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 2999 | esac |
| 3000 | done |
| 3001 | fi # link_all_deplibs != no |
| 3002 | fi # linkmode = lib |
| 3003 | done # for deplib in $libs |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3004 | dependency_libs="$newdependency_libs" |
| 3005 | if test "$pass" = dlpreopen; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3006 | # Link the dlpreopened libraries before other libraries |
| 3007 | for deplib in $save_deplibs; do |
| 3008 | deplibs="$deplib $deplibs" |
| 3009 | done |
| 3010 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3011 | if test "$pass" != dlopen; then |
| 3012 | if test "$pass" != conv; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3013 | # Make sure lib_search_path contains only unique directories. |
| 3014 | lib_search_path= |
| 3015 | for dir in $newlib_search_path; do |
| 3016 | case "$lib_search_path " in |
| 3017 | *" $dir "*) ;; |
| 3018 | *) lib_search_path="$lib_search_path $dir" ;; |
| 3019 | esac |
| 3020 | done |
| 3021 | newlib_search_path= |
| 3022 | fi |
| 3023 | |
| 3024 | if test "$linkmode,$pass" != "prog,link"; then |
| 3025 | vars="deplibs" |
| 3026 | else |
| 3027 | vars="compile_deplibs finalize_deplibs" |
| 3028 | fi |
| 3029 | for var in $vars dependency_libs; do |
| 3030 | # Add libraries to $var in reverse order |
| 3031 | eval tmp_libs=\"\$$var\" |
| 3032 | new_libs= |
| 3033 | for deplib in $tmp_libs; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3034 | # FIXME: Pedantically, this is the right thing to do, so |
| 3035 | # that some nasty dependency loop isn't accidentally |
| 3036 | # broken: |
| 3037 | #new_libs="$deplib $new_libs" |
| 3038 | # Pragmatically, this seems to cause very few problems in |
| 3039 | # practice: |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3040 | case $deplib in |
| 3041 | -L*) new_libs="$deplib $new_libs" ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3042 | -R*) ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3043 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3044 | # And here is the reason: when a library appears more |
| 3045 | # than once as an explicit dependence of a library, or |
| 3046 | # is implicitly linked in more than once by the |
| 3047 | # compiler, it is considered special, and multiple |
| 3048 | # occurrences thereof are not removed. Compare this |
| 3049 | # with having the same library being listed as a |
| 3050 | # dependency of multiple other libraries: in this case, |
| 3051 | # we know (pedantically, we assume) the library does not |
| 3052 | # need to be listed more than once, so we keep only the |
| 3053 | # last copy. This is not always right, but it is rare |
| 3054 | # enough that we require users that really mean to play |
| 3055 | # such unportable linking tricks to link the library |
| 3056 | # using -Wl,-lname, so that libtool does not consider it |
| 3057 | # for duplicate removal. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3058 | case " $specialdeplibs " in |
| 3059 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
| 3060 | *) |
| 3061 | case " $new_libs " in |
| 3062 | *" $deplib "*) ;; |
| 3063 | *) new_libs="$deplib $new_libs" ;; |
| 3064 | esac |
| 3065 | ;; |
| 3066 | esac |
| 3067 | ;; |
| 3068 | esac |
| 3069 | done |
| 3070 | tmp_libs= |
| 3071 | for deplib in $new_libs; do |
| 3072 | case $deplib in |
| 3073 | -L*) |
| 3074 | case " $tmp_libs " in |
| 3075 | *" $deplib "*) ;; |
| 3076 | *) tmp_libs="$tmp_libs $deplib" ;; |
| 3077 | esac |
| 3078 | ;; |
| 3079 | *) tmp_libs="$tmp_libs $deplib" ;; |
| 3080 | esac |
| 3081 | done |
| 3082 | eval $var=\"$tmp_libs\" |
| 3083 | done # for var |
| 3084 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3085 | # Last step: remove runtime libs from dependency_libs |
| 3086 | # (they stay in deplibs) |
| 3087 | tmp_libs= |
| 3088 | for i in $dependency_libs ; do |
| 3089 | case " $predeps $postdeps $compiler_lib_search_path " in |
| 3090 | *" $i "*) |
| 3091 | i="" |
| 3092 | ;; |
| 3093 | esac |
| 3094 | if test -n "$i" ; then |
| 3095 | tmp_libs="$tmp_libs $i" |
| 3096 | fi |
| 3097 | done |
| 3098 | dependency_libs=$tmp_libs |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3099 | done # for pass |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3100 | if test "$linkmode" = prog; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3101 | dlfiles="$newdlfiles" |
| 3102 | dlprefiles="$newdlprefiles" |
| 3103 | fi |
| 3104 | |
| 3105 | case $linkmode in |
| 3106 | oldlib) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3107 | if test -n "$deplibs"; then |
| 3108 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 |
| 3109 | fi |
| 3110 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3111 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 3112 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
| 3113 | fi |
| 3114 | |
| 3115 | if test -n "$rpath"; then |
| 3116 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 |
| 3117 | fi |
| 3118 | |
| 3119 | if test -n "$xrpath"; then |
| 3120 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 |
| 3121 | fi |
| 3122 | |
| 3123 | if test -n "$vinfo"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3124 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3125 | fi |
| 3126 | |
| 3127 | if test -n "$release"; then |
| 3128 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 |
| 3129 | fi |
| 3130 | |
| 3131 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
| 3132 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 |
| 3133 | fi |
| 3134 | |
| 3135 | # Now set the variables for building old libraries. |
| 3136 | build_libtool_libs=no |
| 3137 | oldlibs="$output" |
| 3138 | objs="$objs$old_deplibs" |
| 3139 | ;; |
| 3140 | |
| 3141 | lib) |
| 3142 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 3143 | case $outputname in |
| 3144 | lib*) |
| 3145 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3146 | eval shared_ext=\"$shrext_cmds\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3147 | eval libname=\"$libname_spec\" |
| 3148 | ;; |
| 3149 | *) |
| 3150 | if test "$module" = no; then |
| 3151 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 |
| 3152 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3153 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3154 | fi |
| 3155 | if test "$need_lib_prefix" != no; then |
| 3156 | # Add the "lib" prefix for modules if required |
| 3157 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3158 | eval shared_ext=\"$shrext_cmds\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3159 | eval libname=\"$libname_spec\" |
| 3160 | else |
| 3161 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
| 3162 | fi |
| 3163 | ;; |
| 3164 | esac |
| 3165 | |
| 3166 | if test -n "$objs"; then |
| 3167 | if test "$deplibs_check_method" != pass_all; then |
| 3168 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3169 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3170 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3171 | $echo |
| 3172 | $echo "*** Warning: Linking the shared library $output against the non-libtool" |
| 3173 | $echo "*** objects $objs is not portable!" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3174 | libobjs="$libobjs $objs" |
| 3175 | fi |
| 3176 | fi |
| 3177 | |
| 3178 | if test "$dlself" != no; then |
| 3179 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 |
| 3180 | fi |
| 3181 | |
| 3182 | set dummy $rpath |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3183 | if test "$#" -gt 2; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3184 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
| 3185 | fi |
| 3186 | install_libdir="$2" |
| 3187 | |
| 3188 | oldlibs= |
| 3189 | if test -z "$rpath"; then |
| 3190 | if test "$build_libtool_libs" = yes; then |
| 3191 | # Building a libtool convenience library. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3192 | # Some compilers have problems with a `.al' extension so |
| 3193 | # convenience libraries should have the same extension an |
| 3194 | # archive normally would. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3195 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
| 3196 | build_libtool_libs=convenience |
| 3197 | build_old_libs=yes |
| 3198 | fi |
| 3199 | |
| 3200 | if test -n "$vinfo"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3201 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3202 | fi |
| 3203 | |
| 3204 | if test -n "$release"; then |
| 3205 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 |
| 3206 | fi |
| 3207 | else |
| 3208 | |
| 3209 | # Parse the version information argument. |
| 3210 | save_ifs="$IFS"; IFS=':' |
| 3211 | set dummy $vinfo 0 0 0 |
| 3212 | IFS="$save_ifs" |
| 3213 | |
| 3214 | if test -n "$8"; then |
| 3215 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 |
| 3216 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3217 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3218 | fi |
| 3219 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3220 | # convert absolute version numbers to libtool ages |
| 3221 | # this retains compatibility with .la files and attempts |
| 3222 | # to make the code below a bit more comprehensible |
| 3223 | |
| 3224 | case $vinfo_number in |
| 3225 | yes) |
| 3226 | number_major="$2" |
| 3227 | number_minor="$3" |
| 3228 | number_revision="$4" |
| 3229 | # |
| 3230 | # There are really only two kinds -- those that |
| 3231 | # use the current revision as the major version |
| 3232 | # and those that subtract age and use age as |
| 3233 | # a minor version. But, then there is irix |
| 3234 | # which has an extra 1 added just for fun |
| 3235 | # |
| 3236 | case $version_type in |
| 3237 | darwin|linux|osf|windows) |
| 3238 | current=`expr $number_major + $number_minor` |
| 3239 | age="$number_minor" |
| 3240 | revision="$number_revision" |
| 3241 | ;; |
| 3242 | freebsd-aout|freebsd-elf|sunos) |
| 3243 | current="$number_major" |
| 3244 | revision="$number_minor" |
| 3245 | age="0" |
| 3246 | ;; |
| 3247 | irix|nonstopux) |
Glenn Randers-Pehrson | 1ce0836 | 2006-03-08 23:35:59 -0600 | [diff] [blame^] | 3248 | current=`expr $number_major + $number_minor` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3249 | age="$number_minor" |
| 3250 | revision="$number_minor" |
| 3251 | ;; |
| 3252 | esac |
| 3253 | ;; |
| 3254 | no) |
| 3255 | current="$2" |
| 3256 | revision="$3" |
| 3257 | age="$4" |
| 3258 | ;; |
| 3259 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3260 | |
| 3261 | # Check that each of the things are valid numbers. |
| 3262 | case $current in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3263 | 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]) ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3264 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3265 | $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3266 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3267 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3268 | ;; |
| 3269 | esac |
| 3270 | |
| 3271 | case $revision in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3272 | 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]) ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3273 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3274 | $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3275 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3276 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3277 | ;; |
| 3278 | esac |
| 3279 | |
| 3280 | case $age in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3281 | 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]) ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3282 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3283 | $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3284 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3285 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3286 | ;; |
| 3287 | esac |
| 3288 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3289 | if test "$age" -gt "$current"; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3290 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
| 3291 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3292 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3293 | fi |
| 3294 | |
| 3295 | # Calculate the version variables. |
| 3296 | major= |
| 3297 | versuffix= |
| 3298 | verstring= |
| 3299 | case $version_type in |
| 3300 | none) ;; |
| 3301 | |
| 3302 | darwin) |
| 3303 | # Like Linux, but with the current version available in |
| 3304 | # verstring for coding it into the library header |
| 3305 | major=.`expr $current - $age` |
| 3306 | versuffix="$major.$age.$revision" |
| 3307 | # Darwin ld doesn't like 0 for these options... |
| 3308 | minor_current=`expr $current + 1` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3309 | verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3310 | ;; |
| 3311 | |
| 3312 | freebsd-aout) |
| 3313 | major=".$current" |
| 3314 | versuffix=".$current.$revision"; |
| 3315 | ;; |
| 3316 | |
| 3317 | freebsd-elf) |
| 3318 | major=".$current" |
| 3319 | versuffix=".$current"; |
| 3320 | ;; |
| 3321 | |
| 3322 | irix | nonstopux) |
Glenn Randers-Pehrson | 1ce0836 | 2006-03-08 23:35:59 -0600 | [diff] [blame^] | 3323 | major=`expr $current - $age` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3324 | |
| 3325 | case $version_type in |
| 3326 | nonstopux) verstring_prefix=nonstopux ;; |
| 3327 | *) verstring_prefix=sgi ;; |
| 3328 | esac |
| 3329 | verstring="$verstring_prefix$major.$revision" |
| 3330 | |
| 3331 | # Add in all the interfaces that we are compatible with. |
| 3332 | loop=$revision |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3333 | while test "$loop" -ne 0; do |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3334 | iface=`expr $revision - $loop` |
| 3335 | loop=`expr $loop - 1` |
| 3336 | verstring="$verstring_prefix$major.$iface:$verstring" |
| 3337 | done |
| 3338 | |
| 3339 | # Before this point, $major must not contain `.'. |
| 3340 | major=.$major |
| 3341 | versuffix="$major.$revision" |
| 3342 | ;; |
| 3343 | |
| 3344 | linux) |
| 3345 | major=.`expr $current - $age` |
| 3346 | versuffix="$major.$age.$revision" |
| 3347 | ;; |
| 3348 | |
| 3349 | osf) |
| 3350 | major=.`expr $current - $age` |
| 3351 | versuffix=".$current.$age.$revision" |
| 3352 | verstring="$current.$age.$revision" |
| 3353 | |
| 3354 | # Add in all the interfaces that we are compatible with. |
| 3355 | loop=$age |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3356 | while test "$loop" -ne 0; do |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3357 | iface=`expr $current - $loop` |
| 3358 | loop=`expr $loop - 1` |
| 3359 | verstring="$verstring:${iface}.0" |
| 3360 | done |
| 3361 | |
| 3362 | # Make executables depend on our current version. |
| 3363 | verstring="$verstring:${current}.0" |
| 3364 | ;; |
| 3365 | |
| 3366 | sunos) |
| 3367 | major=".$current" |
| 3368 | versuffix=".$current.$revision" |
| 3369 | ;; |
| 3370 | |
| 3371 | windows) |
| 3372 | # Use '-' rather than '.', since we only want one |
| 3373 | # extension on DOS 8.3 filesystems. |
| 3374 | major=`expr $current - $age` |
| 3375 | versuffix="-$major" |
| 3376 | ;; |
| 3377 | |
| 3378 | *) |
| 3379 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3380 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 3381 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3382 | ;; |
| 3383 | esac |
| 3384 | |
| 3385 | # Clear the version info if we defaulted, and they specified a release. |
| 3386 | if test -z "$vinfo" && test -n "$release"; then |
| 3387 | major= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3388 | case $version_type in |
| 3389 | darwin) |
| 3390 | # we can't check for "0.0" in archive_cmds due to quoting |
| 3391 | # problems, so we reset it completely |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3392 | verstring= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3393 | ;; |
| 3394 | *) |
| 3395 | verstring="0.0" |
| 3396 | ;; |
| 3397 | esac |
| 3398 | if test "$need_version" = no; then |
| 3399 | versuffix= |
| 3400 | else |
| 3401 | versuffix=".0.0" |
| 3402 | fi |
| 3403 | fi |
| 3404 | |
| 3405 | # Remove version info from name if versioning should be avoided |
| 3406 | if test "$avoid_version" = yes && test "$need_version" = no; then |
| 3407 | major= |
| 3408 | versuffix= |
| 3409 | verstring="" |
| 3410 | fi |
| 3411 | |
| 3412 | # Check to see if the archive will have undefined symbols. |
| 3413 | if test "$allow_undefined" = yes; then |
| 3414 | if test "$allow_undefined_flag" = unsupported; then |
| 3415 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 |
| 3416 | build_libtool_libs=no |
| 3417 | build_old_libs=yes |
| 3418 | fi |
| 3419 | else |
| 3420 | # Don't allow undefined symbols. |
| 3421 | allow_undefined_flag="$no_undefined_flag" |
| 3422 | fi |
| 3423 | fi |
| 3424 | |
| 3425 | if test "$mode" != relink; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3426 | # Remove our outputs, but don't remove object files since they |
| 3427 | # may have been created when compiling PIC objects. |
| 3428 | removelist= |
| 3429 | tempremovelist=`$echo "$output_objdir/*"` |
| 3430 | for p in $tempremovelist; do |
| 3431 | case $p in |
| 3432 | *.$objext) |
| 3433 | ;; |
| 3434 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
| 3435 | if test "X$precious_files_regex" != "X"; then |
| 3436 | if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
| 3437 | then |
| 3438 | continue |
| 3439 | fi |
| 3440 | fi |
| 3441 | removelist="$removelist $p" |
| 3442 | ;; |
| 3443 | *) ;; |
| 3444 | esac |
| 3445 | done |
| 3446 | if test -n "$removelist"; then |
| 3447 | $show "${rm}r $removelist" |
| 3448 | $run ${rm}r $removelist |
| 3449 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3450 | fi |
| 3451 | |
| 3452 | # Now set the variables for building old libraries. |
| 3453 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
| 3454 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
| 3455 | |
| 3456 | # Transform .lo files to .o files. |
| 3457 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` |
| 3458 | fi |
| 3459 | |
| 3460 | # Eliminate all temporary directories. |
| 3461 | for path in $notinst_path; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3462 | lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` |
| 3463 | deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` |
| 3464 | dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3465 | done |
| 3466 | |
| 3467 | if test -n "$xrpath"; then |
| 3468 | # If the user specified any rpath flags, then add them. |
| 3469 | temp_xrpath= |
| 3470 | for libdir in $xrpath; do |
| 3471 | temp_xrpath="$temp_xrpath -R$libdir" |
| 3472 | case "$finalize_rpath " in |
| 3473 | *" $libdir "*) ;; |
| 3474 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
| 3475 | esac |
| 3476 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3477 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3478 | dependency_libs="$temp_xrpath $dependency_libs" |
| 3479 | fi |
| 3480 | fi |
| 3481 | |
| 3482 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
| 3483 | old_dlfiles="$dlfiles" |
| 3484 | dlfiles= |
| 3485 | for lib in $old_dlfiles; do |
| 3486 | case " $dlprefiles $dlfiles " in |
| 3487 | *" $lib "*) ;; |
| 3488 | *) dlfiles="$dlfiles $lib" ;; |
| 3489 | esac |
| 3490 | done |
| 3491 | |
| 3492 | # Make sure dlprefiles contains only unique files |
| 3493 | old_dlprefiles="$dlprefiles" |
| 3494 | dlprefiles= |
| 3495 | for lib in $old_dlprefiles; do |
| 3496 | case "$dlprefiles " in |
| 3497 | *" $lib "*) ;; |
| 3498 | *) dlprefiles="$dlprefiles $lib" ;; |
| 3499 | esac |
| 3500 | done |
| 3501 | |
| 3502 | if test "$build_libtool_libs" = yes; then |
| 3503 | if test -n "$rpath"; then |
| 3504 | case $host in |
| 3505 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) |
| 3506 | # these systems don't actually have a c library (as such)! |
| 3507 | ;; |
| 3508 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 3509 | # Rhapsody C library is in the System framework |
| 3510 | deplibs="$deplibs -framework System" |
| 3511 | ;; |
| 3512 | *-*-netbsd*) |
| 3513 | # Don't link with libc until the a.out ld.so is fixed. |
| 3514 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3515 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3516 | # Do not include libc due to us having libc/libc_r. |
| 3517 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3518 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 3519 | # Causes problems with __ctype |
| 3520 | ;; |
| 3521 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 3522 | # Compiler inserts libc in the correct place for threads to work |
| 3523 | ;; |
| 3524 | *) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3525 | # Add libc to deplibs on all other systems if necessary. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3526 | if test "$build_libtool_need_lc" = "yes"; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3527 | deplibs="$deplibs -lc" |
| 3528 | fi |
| 3529 | ;; |
| 3530 | esac |
| 3531 | fi |
| 3532 | |
| 3533 | # Transform deplibs into only deplibs that can be linked in shared. |
| 3534 | name_save=$name |
| 3535 | libname_save=$libname |
| 3536 | release_save=$release |
| 3537 | versuffix_save=$versuffix |
| 3538 | major_save=$major |
| 3539 | # I'm not sure if I'm treating the release correctly. I think |
| 3540 | # release should show up in the -l (ie -lgmp5) so we don't want to |
| 3541 | # add it in twice. Is that correct? |
| 3542 | release="" |
| 3543 | versuffix="" |
| 3544 | major="" |
| 3545 | newdeplibs= |
| 3546 | droppeddeps=no |
| 3547 | case $deplibs_check_method in |
| 3548 | pass_all) |
| 3549 | # Don't check for shared/static. Everything works. |
| 3550 | # This might be a little naive. We might want to check |
| 3551 | # whether the library exists or not. But this is on |
| 3552 | # osf3 & osf4 and I'm not really sure... Just |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3553 | # implementing what was already the behavior. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3554 | newdeplibs=$deplibs |
| 3555 | ;; |
| 3556 | test_compile) |
| 3557 | # This code stresses the "libraries are programs" paradigm to its |
| 3558 | # limits. Maybe even breaks it. We compile a program, linking it |
| 3559 | # against the deplibs as a proxy for the library. Then we can check |
| 3560 | # whether they linked in statically or dynamically with ldd. |
| 3561 | $rm conftest.c |
| 3562 | cat > conftest.c <<EOF |
| 3563 | int main() { return 0; } |
| 3564 | EOF |
| 3565 | $rm conftest |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3566 | $LTCC $LTCFLAGS -o conftest conftest.c $deplibs |
| 3567 | if test "$?" -eq 0 ; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3568 | ldd_output=`ldd conftest` |
| 3569 | for i in $deplibs; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3570 | name=`expr $i : '-l\(.*\)'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3571 | # If $name is empty we are operating on a -L argument. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3572 | if test "$name" != "" && test "$name" -ne "0"; then |
| 3573 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3574 | case " $predeps $postdeps " in |
| 3575 | *" $i "*) |
| 3576 | newdeplibs="$newdeplibs $i" |
| 3577 | i="" |
| 3578 | ;; |
| 3579 | esac |
| 3580 | fi |
| 3581 | if test -n "$i" ; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3582 | libname=`eval \\$echo \"$libname_spec\"` |
| 3583 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
| 3584 | set dummy $deplib_matches |
| 3585 | deplib_match=$2 |
| 3586 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
| 3587 | newdeplibs="$newdeplibs $i" |
| 3588 | else |
| 3589 | droppeddeps=yes |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3590 | $echo |
| 3591 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
| 3592 | $echo "*** I have the capability to make that library automatically link in when" |
| 3593 | $echo "*** you link to this library. But I can only do this if you have a" |
| 3594 | $echo "*** shared version of the library, which I believe you do not have" |
| 3595 | $echo "*** because a test_compile did reveal that the linker did not use it for" |
| 3596 | $echo "*** its dynamic dependency list that programs get resolved with at runtime." |
| 3597 | fi |
| 3598 | fi |
| 3599 | else |
| 3600 | newdeplibs="$newdeplibs $i" |
| 3601 | fi |
| 3602 | done |
| 3603 | else |
| 3604 | # Error occurred in the first compile. Let's try to salvage |
| 3605 | # the situation: Compile a separate program for each library. |
| 3606 | for i in $deplibs; do |
| 3607 | name=`expr $i : '-l\(.*\)'` |
| 3608 | # If $name is empty we are operating on a -L argument. |
| 3609 | if test "$name" != "" && test "$name" != "0"; then |
| 3610 | $rm conftest |
| 3611 | $LTCC $LTCFLAGS -o conftest conftest.c $i |
| 3612 | # Did it work? |
| 3613 | if test "$?" -eq 0 ; then |
| 3614 | ldd_output=`ldd conftest` |
| 3615 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3616 | case " $predeps $postdeps " in |
| 3617 | *" $i "*) |
| 3618 | newdeplibs="$newdeplibs $i" |
| 3619 | i="" |
| 3620 | ;; |
| 3621 | esac |
| 3622 | fi |
| 3623 | if test -n "$i" ; then |
| 3624 | libname=`eval \\$echo \"$libname_spec\"` |
| 3625 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
| 3626 | set dummy $deplib_matches |
| 3627 | deplib_match=$2 |
| 3628 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
| 3629 | newdeplibs="$newdeplibs $i" |
| 3630 | else |
| 3631 | droppeddeps=yes |
| 3632 | $echo |
| 3633 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
| 3634 | $echo "*** I have the capability to make that library automatically link in when" |
| 3635 | $echo "*** you link to this library. But I can only do this if you have a" |
| 3636 | $echo "*** shared version of the library, which you do not appear to have" |
| 3637 | $echo "*** because a test_compile did reveal that the linker did not use this one" |
| 3638 | $echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
| 3639 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3640 | fi |
| 3641 | else |
| 3642 | droppeddeps=yes |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3643 | $echo |
| 3644 | $echo "*** Warning! Library $i is needed by this library but I was not able to" |
| 3645 | $echo "*** make it link in! You will probably need to install it or some" |
| 3646 | $echo "*** library that it depends on before this library will be fully" |
| 3647 | $echo "*** functional. Installing it before continuing would be even better." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3648 | fi |
| 3649 | else |
| 3650 | newdeplibs="$newdeplibs $i" |
| 3651 | fi |
| 3652 | done |
| 3653 | fi |
| 3654 | ;; |
| 3655 | file_magic*) |
| 3656 | set dummy $deplibs_check_method |
| 3657 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 3658 | for a_deplib in $deplibs; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3659 | name=`expr $a_deplib : '-l\(.*\)'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3660 | # If $name is empty we are operating on a -L argument. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3661 | if test "$name" != "" && test "$name" != "0"; then |
| 3662 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3663 | case " $predeps $postdeps " in |
| 3664 | *" $a_deplib "*) |
| 3665 | newdeplibs="$newdeplibs $a_deplib" |
| 3666 | a_deplib="" |
| 3667 | ;; |
| 3668 | esac |
| 3669 | fi |
| 3670 | if test -n "$a_deplib" ; then |
| 3671 | libname=`eval \\$echo \"$libname_spec\"` |
| 3672 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
| 3673 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
| 3674 | for potent_lib in $potential_libs; do |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3675 | # Follow soft links. |
| 3676 | if ls -lLd "$potent_lib" 2>/dev/null \ |
| 3677 | | grep " -> " >/dev/null; then |
| 3678 | continue |
| 3679 | fi |
| 3680 | # The statement above tries to avoid entering an |
| 3681 | # endless loop below, in case of cyclic links. |
| 3682 | # We might still enter an endless loop, since a link |
| 3683 | # loop can be closed while we follow links, |
| 3684 | # but so what? |
| 3685 | potlib="$potent_lib" |
| 3686 | while test -h "$potlib" 2>/dev/null; do |
| 3687 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
| 3688 | case $potliblink in |
| 3689 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
| 3690 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
| 3691 | esac |
| 3692 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3693 | # It is ok to link against an archive when |
| 3694 | # building a shared library. |
| 3695 | if $AR -t $potlib > /dev/null 2>&1; then |
| 3696 | newdeplibs="$newdeplibs $a_deplib" |
| 3697 | a_deplib="" |
| 3698 | break 2 |
| 3699 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3700 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
| 3701 | | ${SED} 10q \ |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3702 | | $EGREP "$file_magic_regex" > /dev/null; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3703 | newdeplibs="$newdeplibs $a_deplib" |
| 3704 | a_deplib="" |
| 3705 | break 2 |
| 3706 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3707 | done |
| 3708 | done |
| 3709 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3710 | if test -n "$a_deplib" ; then |
| 3711 | droppeddeps=yes |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3712 | $echo |
| 3713 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
| 3714 | $echo "*** I have the capability to make that library automatically link in when" |
| 3715 | $echo "*** you link to this library. But I can only do this if you have a" |
| 3716 | $echo "*** shared version of the library, which you do not appear to have" |
| 3717 | $echo "*** because I did check the linker path looking for a file starting" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3718 | if test -z "$potlib" ; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3719 | $echo "*** with $libname but no candidates were found. (...for file magic test)" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3720 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3721 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3722 | $echo "*** using a file magic. Last file checked: $potlib" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3723 | fi |
| 3724 | fi |
| 3725 | else |
| 3726 | # Add a -L argument. |
| 3727 | newdeplibs="$newdeplibs $a_deplib" |
| 3728 | fi |
| 3729 | done # Gone through all deplibs. |
| 3730 | ;; |
| 3731 | match_pattern*) |
| 3732 | set dummy $deplibs_check_method |
| 3733 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 3734 | for a_deplib in $deplibs; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3735 | name=`expr $a_deplib : '-l\(.*\)'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3736 | # If $name is empty we are operating on a -L argument. |
| 3737 | if test -n "$name" && test "$name" != "0"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3738 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3739 | case " $predeps $postdeps " in |
| 3740 | *" $a_deplib "*) |
| 3741 | newdeplibs="$newdeplibs $a_deplib" |
| 3742 | a_deplib="" |
| 3743 | ;; |
| 3744 | esac |
| 3745 | fi |
| 3746 | if test -n "$a_deplib" ; then |
| 3747 | libname=`eval \\$echo \"$libname_spec\"` |
| 3748 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
| 3749 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
| 3750 | for potent_lib in $potential_libs; do |
| 3751 | potlib="$potent_lib" # see symlink-check above in file_magic test |
| 3752 | if eval $echo \"$potent_lib\" 2>/dev/null \ |
| 3753 | | ${SED} 10q \ |
| 3754 | | $EGREP "$match_pattern_regex" > /dev/null; then |
| 3755 | newdeplibs="$newdeplibs $a_deplib" |
| 3756 | a_deplib="" |
| 3757 | break 2 |
| 3758 | fi |
| 3759 | done |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3760 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3761 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3762 | if test -n "$a_deplib" ; then |
| 3763 | droppeddeps=yes |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3764 | $echo |
| 3765 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
| 3766 | $echo "*** I have the capability to make that library automatically link in when" |
| 3767 | $echo "*** you link to this library. But I can only do this if you have a" |
| 3768 | $echo "*** shared version of the library, which you do not appear to have" |
| 3769 | $echo "*** because I did check the linker path looking for a file starting" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3770 | if test -z "$potlib" ; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3771 | $echo "*** with $libname but no candidates were found. (...for regex pattern test)" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3772 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3773 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3774 | $echo "*** using a regex pattern. Last file checked: $potlib" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3775 | fi |
| 3776 | fi |
| 3777 | else |
| 3778 | # Add a -L argument. |
| 3779 | newdeplibs="$newdeplibs $a_deplib" |
| 3780 | fi |
| 3781 | done # Gone through all deplibs. |
| 3782 | ;; |
| 3783 | none | unknown | *) |
| 3784 | newdeplibs="" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3785 | tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
| 3786 | -e 's/ -[LR][^ ]*//g'` |
| 3787 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3788 | for i in $predeps $postdeps ; do |
| 3789 | # can't use Xsed below, because $i might contain '/' |
| 3790 | tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` |
| 3791 | done |
| 3792 | fi |
| 3793 | if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ |
| 3794 | | grep . >/dev/null; then |
| 3795 | $echo |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3796 | if test "X$deplibs_check_method" = "Xnone"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3797 | $echo "*** Warning: inter-library dependencies are not supported in this platform." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3798 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3799 | $echo "*** Warning: inter-library dependencies are not known to be supported." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3800 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3801 | $echo "*** All declared inter-library dependencies are being dropped." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3802 | droppeddeps=yes |
| 3803 | fi |
| 3804 | ;; |
| 3805 | esac |
| 3806 | versuffix=$versuffix_save |
| 3807 | major=$major_save |
| 3808 | release=$release_save |
| 3809 | libname=$libname_save |
| 3810 | name=$name_save |
| 3811 | |
| 3812 | case $host in |
| 3813 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 3814 | # On Rhapsody replace the C library is the System framework |
| 3815 | newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` |
| 3816 | ;; |
| 3817 | esac |
| 3818 | |
| 3819 | if test "$droppeddeps" = yes; then |
| 3820 | if test "$module" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3821 | $echo |
| 3822 | $echo "*** Warning: libtool could not satisfy all declared inter-library" |
| 3823 | $echo "*** dependencies of module $libname. Therefore, libtool will create" |
| 3824 | $echo "*** a static module, that should work as long as the dlopening" |
| 3825 | $echo "*** application is linked with the -dlopen flag." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3826 | if test -z "$global_symbol_pipe"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3827 | $echo |
| 3828 | $echo "*** However, this would only work if libtool was able to extract symbol" |
| 3829 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 3830 | $echo "*** not find such a program. So, this module is probably useless." |
| 3831 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3832 | fi |
| 3833 | if test "$build_old_libs" = no; then |
| 3834 | oldlibs="$output_objdir/$libname.$libext" |
| 3835 | build_libtool_libs=module |
| 3836 | build_old_libs=yes |
| 3837 | else |
| 3838 | build_libtool_libs=no |
| 3839 | fi |
| 3840 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3841 | $echo "*** The inter-library dependencies that have been dropped here will be" |
| 3842 | $echo "*** automatically added whenever a program is linked with this library" |
| 3843 | $echo "*** or is declared to -dlopen it." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3844 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3845 | if test "$allow_undefined" = no; then |
| 3846 | $echo |
| 3847 | $echo "*** Since this library must not contain undefined symbols," |
| 3848 | $echo "*** because either the platform does not support them or" |
| 3849 | $echo "*** it was explicitly requested with -no-undefined," |
| 3850 | $echo "*** libtool will only create a static version of it." |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3851 | if test "$build_old_libs" = no; then |
| 3852 | oldlibs="$output_objdir/$libname.$libext" |
| 3853 | build_libtool_libs=module |
| 3854 | build_old_libs=yes |
| 3855 | else |
| 3856 | build_libtool_libs=no |
| 3857 | fi |
| 3858 | fi |
| 3859 | fi |
| 3860 | fi |
| 3861 | # Done checking deplibs! |
| 3862 | deplibs=$newdeplibs |
| 3863 | fi |
| 3864 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3865 | |
| 3866 | # move library search paths that coincide with paths to not yet |
| 3867 | # installed libraries to the beginning of the library search list |
| 3868 | new_libs= |
| 3869 | for path in $notinst_path; do |
| 3870 | case " $new_libs " in |
| 3871 | *" -L$path/$objdir "*) ;; |
| 3872 | *) |
| 3873 | case " $deplibs " in |
| 3874 | *" -L$path/$objdir "*) |
| 3875 | new_libs="$new_libs -L$path/$objdir" ;; |
| 3876 | esac |
| 3877 | ;; |
| 3878 | esac |
| 3879 | done |
| 3880 | for deplib in $deplibs; do |
| 3881 | case $deplib in |
| 3882 | -L*) |
| 3883 | case " $new_libs " in |
| 3884 | *" $deplib "*) ;; |
| 3885 | *) new_libs="$new_libs $deplib" ;; |
| 3886 | esac |
| 3887 | ;; |
| 3888 | *) new_libs="$new_libs $deplib" ;; |
| 3889 | esac |
| 3890 | done |
| 3891 | deplibs="$new_libs" |
| 3892 | |
| 3893 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3894 | # All the library-specific variables (install_libdir is set above). |
| 3895 | library_names= |
| 3896 | old_library= |
| 3897 | dlname= |
| 3898 | |
| 3899 | # Test again, we may have decided not to build it any more |
| 3900 | if test "$build_libtool_libs" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3901 | if test "$hardcode_into_libs" = yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3902 | # Hardcode the library paths |
| 3903 | hardcode_libdirs= |
| 3904 | dep_rpath= |
| 3905 | rpath="$finalize_rpath" |
| 3906 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
| 3907 | for libdir in $rpath; do |
| 3908 | if test -n "$hardcode_libdir_flag_spec"; then |
| 3909 | if test -n "$hardcode_libdir_separator"; then |
| 3910 | if test -z "$hardcode_libdirs"; then |
| 3911 | hardcode_libdirs="$libdir" |
| 3912 | else |
| 3913 | # Just accumulate the unique libdirs. |
| 3914 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 3915 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 3916 | ;; |
| 3917 | *) |
| 3918 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
| 3919 | ;; |
| 3920 | esac |
| 3921 | fi |
| 3922 | else |
| 3923 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 3924 | dep_rpath="$dep_rpath $flag" |
| 3925 | fi |
| 3926 | elif test -n "$runpath_var"; then |
| 3927 | case "$perm_rpath " in |
| 3928 | *" $libdir "*) ;; |
| 3929 | *) perm_rpath="$perm_rpath $libdir" ;; |
| 3930 | esac |
| 3931 | fi |
| 3932 | done |
| 3933 | # Substitute the hardcoded libdirs into the rpath. |
| 3934 | if test -n "$hardcode_libdir_separator" && |
| 3935 | test -n "$hardcode_libdirs"; then |
| 3936 | libdir="$hardcode_libdirs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3937 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
| 3938 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
| 3939 | else |
| 3940 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
| 3941 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3942 | fi |
| 3943 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
| 3944 | # We should set the runpath_var. |
| 3945 | rpath= |
| 3946 | for dir in $perm_rpath; do |
| 3947 | rpath="$rpath$dir:" |
| 3948 | done |
| 3949 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
| 3950 | fi |
| 3951 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
| 3952 | fi |
| 3953 | |
| 3954 | shlibpath="$finalize_shlibpath" |
| 3955 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
| 3956 | if test -n "$shlibpath"; then |
| 3957 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
| 3958 | fi |
| 3959 | |
| 3960 | # Get the real and link names of the library. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3961 | eval shared_ext=\"$shrext_cmds\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3962 | eval library_names=\"$library_names_spec\" |
| 3963 | set dummy $library_names |
| 3964 | realname="$2" |
| 3965 | shift; shift |
| 3966 | |
| 3967 | if test -n "$soname_spec"; then |
| 3968 | eval soname=\"$soname_spec\" |
| 3969 | else |
| 3970 | soname="$realname" |
| 3971 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3972 | if test -z "$dlname"; then |
| 3973 | dlname=$soname |
| 3974 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3975 | |
| 3976 | lib="$output_objdir/$realname" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3977 | linknames= |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3978 | for link |
| 3979 | do |
| 3980 | linknames="$linknames $link" |
| 3981 | done |
| 3982 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3983 | # Use standard objects if they are pic |
| 3984 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
| 3985 | |
| 3986 | # Prepare the list of exported symbols |
| 3987 | if test -z "$export_symbols"; then |
| 3988 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
| 3989 | $show "generating symbol list for \`$libname.la'" |
| 3990 | export_symbols="$output_objdir/$libname.exp" |
| 3991 | $run $rm $export_symbols |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3992 | cmds=$export_symbols_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 3993 | save_ifs="$IFS"; IFS='~' |
| 3994 | for cmd in $cmds; do |
| 3995 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 3996 | eval cmd=\"$cmd\" |
| 3997 | if len=`expr "X$cmd" : ".*"` && |
| 3998 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 3999 | $show "$cmd" |
| 4000 | $run eval "$cmd" || exit $? |
| 4001 | skipped_export=false |
| 4002 | else |
| 4003 | # The command line is too long to execute in one step. |
| 4004 | $show "using reloadable object file for export list..." |
| 4005 | skipped_export=: |
| 4006 | # Break out early, otherwise skipped_export may be |
| 4007 | # set to false by a later but shorter cmd. |
| 4008 | break |
| 4009 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4010 | done |
| 4011 | IFS="$save_ifs" |
| 4012 | if test -n "$export_symbols_regex"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4013 | $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
| 4014 | $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4015 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
| 4016 | $run eval '$mv "${export_symbols}T" "$export_symbols"' |
| 4017 | fi |
| 4018 | fi |
| 4019 | fi |
| 4020 | |
| 4021 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 4022 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' |
| 4023 | fi |
| 4024 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4025 | tmp_deplibs= |
| 4026 | for test_deplib in $deplibs; do |
| 4027 | case " $convenience " in |
| 4028 | *" $test_deplib "*) ;; |
| 4029 | *) |
| 4030 | tmp_deplibs="$tmp_deplibs $test_deplib" |
| 4031 | ;; |
| 4032 | esac |
| 4033 | done |
| 4034 | deplibs="$tmp_deplibs" |
| 4035 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4036 | if test -n "$convenience"; then |
| 4037 | if test -n "$whole_archive_flag_spec"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4038 | save_libobjs=$libobjs |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4039 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 4040 | else |
| 4041 | gentop="$output_objdir/${outputname}x" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4042 | generated="$generated $gentop" |
| 4043 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4044 | func_extract_archives $gentop $convenience |
| 4045 | libobjs="$libobjs $func_extract_archives_result" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4046 | fi |
| 4047 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4048 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4049 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
| 4050 | eval flag=\"$thread_safe_flag_spec\" |
| 4051 | linker_flags="$linker_flags $flag" |
| 4052 | fi |
| 4053 | |
| 4054 | # Make a backup of the uninstalled library when relinking |
| 4055 | if test "$mode" = relink; then |
| 4056 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? |
| 4057 | fi |
| 4058 | |
| 4059 | # Do each of the archive commands. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4060 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 4061 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 4062 | eval test_cmds=\"$module_expsym_cmds\" |
| 4063 | cmds=$module_expsym_cmds |
| 4064 | else |
| 4065 | eval test_cmds=\"$module_cmds\" |
| 4066 | cmds=$module_cmds |
| 4067 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4068 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4069 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 4070 | eval test_cmds=\"$archive_expsym_cmds\" |
| 4071 | cmds=$archive_expsym_cmds |
| 4072 | else |
| 4073 | eval test_cmds=\"$archive_cmds\" |
| 4074 | cmds=$archive_cmds |
| 4075 | fi |
| 4076 | fi |
| 4077 | |
| 4078 | if test "X$skipped_export" != "X:" && |
| 4079 | len=`expr "X$test_cmds" : ".*" 2>/dev/null` && |
| 4080 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 4081 | : |
| 4082 | else |
| 4083 | # The command line is too long to link in one step, link piecewise. |
| 4084 | $echo "creating reloadable object files..." |
| 4085 | |
| 4086 | # Save the value of $output and $libobjs because we want to |
| 4087 | # use them later. If we have whole_archive_flag_spec, we |
| 4088 | # want to use save_libobjs as it was before |
| 4089 | # whole_archive_flag_spec was expanded, because we can't |
| 4090 | # assume the linker understands whole_archive_flag_spec. |
| 4091 | # This may have to be revisited, in case too many |
| 4092 | # convenience libraries get linked in and end up exceeding |
| 4093 | # the spec. |
| 4094 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
| 4095 | save_libobjs=$libobjs |
| 4096 | fi |
| 4097 | save_output=$output |
| 4098 | output_la=`$echo "X$output" | $Xsed -e "$basename"` |
| 4099 | |
| 4100 | # Clear the reloadable object creation command queue and |
| 4101 | # initialize k to one. |
| 4102 | test_cmds= |
| 4103 | concat_cmds= |
| 4104 | objlist= |
| 4105 | delfiles= |
| 4106 | last_robj= |
| 4107 | k=1 |
| 4108 | output=$output_objdir/$output_la-${k}.$objext |
| 4109 | # Loop over the list of objects to be linked. |
| 4110 | for obj in $save_libobjs |
| 4111 | do |
| 4112 | eval test_cmds=\"$reload_cmds $objlist $last_robj\" |
| 4113 | if test "X$objlist" = X || |
| 4114 | { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && |
| 4115 | test "$len" -le "$max_cmd_len"; }; then |
| 4116 | objlist="$objlist $obj" |
| 4117 | else |
| 4118 | # The command $test_cmds is almost too long, add a |
| 4119 | # command to the queue. |
| 4120 | if test "$k" -eq 1 ; then |
| 4121 | # The first file doesn't have a previous command to add. |
| 4122 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" |
| 4123 | else |
| 4124 | # All subsequent reloadable object files will link in |
| 4125 | # the last one created. |
| 4126 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4127 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4128 | last_robj=$output_objdir/$output_la-${k}.$objext |
| 4129 | k=`expr $k + 1` |
| 4130 | output=$output_objdir/$output_la-${k}.$objext |
| 4131 | objlist=$obj |
| 4132 | len=1 |
| 4133 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4134 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4135 | # Handle the remaining objects by creating one last |
| 4136 | # reloadable object file. All subsequent reloadable object |
| 4137 | # files will link in the last one created. |
| 4138 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 4139 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" |
| 4140 | |
| 4141 | if ${skipped_export-false}; then |
| 4142 | $show "generating symbol list for \`$libname.la'" |
| 4143 | export_symbols="$output_objdir/$libname.exp" |
| 4144 | $run $rm $export_symbols |
| 4145 | libobjs=$output |
| 4146 | # Append the command to create the export file. |
| 4147 | eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" |
| 4148 | fi |
| 4149 | |
| 4150 | # Set up a command to remove the reloadable object files |
| 4151 | # after they are used. |
| 4152 | i=0 |
| 4153 | while test "$i" -lt "$k" |
| 4154 | do |
| 4155 | i=`expr $i + 1` |
| 4156 | delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" |
| 4157 | done |
| 4158 | |
| 4159 | $echo "creating a temporary reloadable object file: $output" |
| 4160 | |
| 4161 | # Loop through the commands generated above and execute them. |
| 4162 | save_ifs="$IFS"; IFS='~' |
| 4163 | for cmd in $concat_cmds; do |
| 4164 | IFS="$save_ifs" |
| 4165 | $show "$cmd" |
| 4166 | $run eval "$cmd" || exit $? |
| 4167 | done |
| 4168 | IFS="$save_ifs" |
| 4169 | |
| 4170 | libobjs=$output |
| 4171 | # Restore the value of output. |
| 4172 | output=$save_output |
| 4173 | |
| 4174 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
| 4175 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 4176 | fi |
| 4177 | # Expand the library linking commands again to reset the |
| 4178 | # value of $libobjs for piecewise linking. |
| 4179 | |
| 4180 | # Do each of the archive commands. |
| 4181 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 4182 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 4183 | cmds=$module_expsym_cmds |
| 4184 | else |
| 4185 | cmds=$module_cmds |
| 4186 | fi |
| 4187 | else |
| 4188 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 4189 | cmds=$archive_expsym_cmds |
| 4190 | else |
| 4191 | cmds=$archive_cmds |
| 4192 | fi |
| 4193 | fi |
| 4194 | |
| 4195 | # Append the command to remove the reloadable object files |
| 4196 | # to the just-reset $cmds. |
| 4197 | eval cmds=\"\$cmds~\$rm $delfiles\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4198 | fi |
| 4199 | save_ifs="$IFS"; IFS='~' |
| 4200 | for cmd in $cmds; do |
| 4201 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4202 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4203 | $show "$cmd" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4204 | $run eval "$cmd" || { |
| 4205 | lt_exit=$? |
| 4206 | |
| 4207 | # Restore the uninstalled library and exit |
| 4208 | if test "$mode" = relink; then |
| 4209 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' |
| 4210 | fi |
| 4211 | |
| 4212 | exit $lt_exit |
| 4213 | } |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4214 | done |
| 4215 | IFS="$save_ifs" |
| 4216 | |
| 4217 | # Restore the uninstalled library and exit |
| 4218 | if test "$mode" = relink; then |
| 4219 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4220 | |
| 4221 | if test -n "$convenience"; then |
| 4222 | if test -z "$whole_archive_flag_spec"; then |
| 4223 | $show "${rm}r $gentop" |
| 4224 | $run ${rm}r "$gentop" |
| 4225 | fi |
| 4226 | fi |
| 4227 | |
| 4228 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4229 | fi |
| 4230 | |
| 4231 | # Create links to the real library. |
| 4232 | for linkname in $linknames; do |
| 4233 | if test "$realname" != "$linkname"; then |
| 4234 | $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" |
| 4235 | $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? |
| 4236 | fi |
| 4237 | done |
| 4238 | |
| 4239 | # If -module or -export-dynamic was specified, set the dlname. |
| 4240 | if test "$module" = yes || test "$export_dynamic" = yes; then |
| 4241 | # On all known operating systems, these are identical. |
| 4242 | dlname="$soname" |
| 4243 | fi |
| 4244 | fi |
| 4245 | ;; |
| 4246 | |
| 4247 | obj) |
| 4248 | if test -n "$deplibs"; then |
| 4249 | $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 |
| 4250 | fi |
| 4251 | |
| 4252 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 4253 | $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 |
| 4254 | fi |
| 4255 | |
| 4256 | if test -n "$rpath"; then |
| 4257 | $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 |
| 4258 | fi |
| 4259 | |
| 4260 | if test -n "$xrpath"; then |
| 4261 | $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 |
| 4262 | fi |
| 4263 | |
| 4264 | if test -n "$vinfo"; then |
| 4265 | $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 |
| 4266 | fi |
| 4267 | |
| 4268 | if test -n "$release"; then |
| 4269 | $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 |
| 4270 | fi |
| 4271 | |
| 4272 | case $output in |
| 4273 | *.lo) |
| 4274 | if test -n "$objs$old_deplibs"; then |
| 4275 | $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4276 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4277 | fi |
| 4278 | libobj="$output" |
| 4279 | obj=`$echo "X$output" | $Xsed -e "$lo2o"` |
| 4280 | ;; |
| 4281 | *) |
| 4282 | libobj= |
| 4283 | obj="$output" |
| 4284 | ;; |
| 4285 | esac |
| 4286 | |
| 4287 | # Delete the old objects. |
| 4288 | $run $rm $obj $libobj |
| 4289 | |
| 4290 | # Objects from convenience libraries. This assumes |
| 4291 | # single-version convenience libraries. Whenever we create |
| 4292 | # different ones for PIC/non-PIC, this we'll have to duplicate |
| 4293 | # the extraction. |
| 4294 | reload_conv_objs= |
| 4295 | gentop= |
| 4296 | # reload_cmds runs $LD directly, so let us get rid of |
| 4297 | # -Wl from whole_archive_flag_spec |
| 4298 | wl= |
| 4299 | |
| 4300 | if test -n "$convenience"; then |
| 4301 | if test -n "$whole_archive_flag_spec"; then |
| 4302 | eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" |
| 4303 | else |
| 4304 | gentop="$output_objdir/${obj}x" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4305 | generated="$generated $gentop" |
| 4306 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4307 | func_extract_archives $gentop $convenience |
| 4308 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4309 | fi |
| 4310 | fi |
| 4311 | |
| 4312 | # Create the old-style object. |
| 4313 | reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
| 4314 | |
| 4315 | output="$obj" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4316 | cmds=$reload_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4317 | save_ifs="$IFS"; IFS='~' |
| 4318 | for cmd in $cmds; do |
| 4319 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4320 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4321 | $show "$cmd" |
| 4322 | $run eval "$cmd" || exit $? |
| 4323 | done |
| 4324 | IFS="$save_ifs" |
| 4325 | |
| 4326 | # Exit if we aren't doing a library object file. |
| 4327 | if test -z "$libobj"; then |
| 4328 | if test -n "$gentop"; then |
| 4329 | $show "${rm}r $gentop" |
| 4330 | $run ${rm}r $gentop |
| 4331 | fi |
| 4332 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4333 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4334 | fi |
| 4335 | |
| 4336 | if test "$build_libtool_libs" != yes; then |
| 4337 | if test -n "$gentop"; then |
| 4338 | $show "${rm}r $gentop" |
| 4339 | $run ${rm}r $gentop |
| 4340 | fi |
| 4341 | |
| 4342 | # Create an invalid libtool object if no PIC, so that we don't |
| 4343 | # accidentally link it into a program. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4344 | # $show "echo timestamp > $libobj" |
| 4345 | # $run eval "echo timestamp > $libobj" || exit $? |
| 4346 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4347 | fi |
| 4348 | |
| 4349 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
| 4350 | # Only do commands if we really have different PIC objects. |
| 4351 | reload_objs="$libobjs $reload_conv_objs" |
| 4352 | output="$libobj" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4353 | cmds=$reload_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4354 | save_ifs="$IFS"; IFS='~' |
| 4355 | for cmd in $cmds; do |
| 4356 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4357 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4358 | $show "$cmd" |
| 4359 | $run eval "$cmd" || exit $? |
| 4360 | done |
| 4361 | IFS="$save_ifs" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4362 | fi |
| 4363 | |
| 4364 | if test -n "$gentop"; then |
| 4365 | $show "${rm}r $gentop" |
| 4366 | $run ${rm}r $gentop |
| 4367 | fi |
| 4368 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4369 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4370 | ;; |
| 4371 | |
| 4372 | prog) |
| 4373 | case $host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4374 | *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4375 | esac |
| 4376 | if test -n "$vinfo"; then |
| 4377 | $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 |
| 4378 | fi |
| 4379 | |
| 4380 | if test -n "$release"; then |
| 4381 | $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 |
| 4382 | fi |
| 4383 | |
| 4384 | if test "$preload" = yes; then |
| 4385 | if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && |
| 4386 | test "$dlopen_self_static" = unknown; then |
| 4387 | $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." |
| 4388 | fi |
| 4389 | fi |
| 4390 | |
| 4391 | case $host in |
| 4392 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 4393 | # On Rhapsody replace the C library is the System framework |
| 4394 | compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
| 4395 | finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4396 | ;; |
| 4397 | esac |
| 4398 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4399 | case $host in |
| 4400 | *darwin*) |
| 4401 | # Don't allow lazy linking, it breaks C++ global constructors |
| 4402 | if test "$tagname" = CXX ; then |
| 4403 | compile_command="$compile_command ${wl}-bind_at_load" |
| 4404 | finalize_command="$finalize_command ${wl}-bind_at_load" |
| 4405 | fi |
| 4406 | ;; |
| 4407 | esac |
| 4408 | |
| 4409 | |
| 4410 | # move library search paths that coincide with paths to not yet |
| 4411 | # installed libraries to the beginning of the library search list |
| 4412 | new_libs= |
| 4413 | for path in $notinst_path; do |
| 4414 | case " $new_libs " in |
| 4415 | *" -L$path/$objdir "*) ;; |
| 4416 | *) |
| 4417 | case " $compile_deplibs " in |
| 4418 | *" -L$path/$objdir "*) |
| 4419 | new_libs="$new_libs -L$path/$objdir" ;; |
| 4420 | esac |
| 4421 | ;; |
| 4422 | esac |
| 4423 | done |
| 4424 | for deplib in $compile_deplibs; do |
| 4425 | case $deplib in |
| 4426 | -L*) |
| 4427 | case " $new_libs " in |
| 4428 | *" $deplib "*) ;; |
| 4429 | *) new_libs="$new_libs $deplib" ;; |
| 4430 | esac |
| 4431 | ;; |
| 4432 | *) new_libs="$new_libs $deplib" ;; |
| 4433 | esac |
| 4434 | done |
| 4435 | compile_deplibs="$new_libs" |
| 4436 | |
| 4437 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4438 | compile_command="$compile_command $compile_deplibs" |
| 4439 | finalize_command="$finalize_command $finalize_deplibs" |
| 4440 | |
| 4441 | if test -n "$rpath$xrpath"; then |
| 4442 | # If the user specified any rpath flags, then add them. |
| 4443 | for libdir in $rpath $xrpath; do |
| 4444 | # This is the magic to use -rpath. |
| 4445 | case "$finalize_rpath " in |
| 4446 | *" $libdir "*) ;; |
| 4447 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
| 4448 | esac |
| 4449 | done |
| 4450 | fi |
| 4451 | |
| 4452 | # Now hardcode the library paths |
| 4453 | rpath= |
| 4454 | hardcode_libdirs= |
| 4455 | for libdir in $compile_rpath $finalize_rpath; do |
| 4456 | if test -n "$hardcode_libdir_flag_spec"; then |
| 4457 | if test -n "$hardcode_libdir_separator"; then |
| 4458 | if test -z "$hardcode_libdirs"; then |
| 4459 | hardcode_libdirs="$libdir" |
| 4460 | else |
| 4461 | # Just accumulate the unique libdirs. |
| 4462 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 4463 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 4464 | ;; |
| 4465 | *) |
| 4466 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
| 4467 | ;; |
| 4468 | esac |
| 4469 | fi |
| 4470 | else |
| 4471 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 4472 | rpath="$rpath $flag" |
| 4473 | fi |
| 4474 | elif test -n "$runpath_var"; then |
| 4475 | case "$perm_rpath " in |
| 4476 | *" $libdir "*) ;; |
| 4477 | *) perm_rpath="$perm_rpath $libdir" ;; |
| 4478 | esac |
| 4479 | fi |
| 4480 | case $host in |
| 4481 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4482 | testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4483 | case :$dllsearchpath: in |
| 4484 | *":$libdir:"*) ;; |
| 4485 | *) dllsearchpath="$dllsearchpath:$libdir";; |
| 4486 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4487 | case :$dllsearchpath: in |
| 4488 | *":$testbindir:"*) ;; |
| 4489 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
| 4490 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4491 | ;; |
| 4492 | esac |
| 4493 | done |
| 4494 | # Substitute the hardcoded libdirs into the rpath. |
| 4495 | if test -n "$hardcode_libdir_separator" && |
| 4496 | test -n "$hardcode_libdirs"; then |
| 4497 | libdir="$hardcode_libdirs" |
| 4498 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 4499 | fi |
| 4500 | compile_rpath="$rpath" |
| 4501 | |
| 4502 | rpath= |
| 4503 | hardcode_libdirs= |
| 4504 | for libdir in $finalize_rpath; do |
| 4505 | if test -n "$hardcode_libdir_flag_spec"; then |
| 4506 | if test -n "$hardcode_libdir_separator"; then |
| 4507 | if test -z "$hardcode_libdirs"; then |
| 4508 | hardcode_libdirs="$libdir" |
| 4509 | else |
| 4510 | # Just accumulate the unique libdirs. |
| 4511 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 4512 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 4513 | ;; |
| 4514 | *) |
| 4515 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
| 4516 | ;; |
| 4517 | esac |
| 4518 | fi |
| 4519 | else |
| 4520 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 4521 | rpath="$rpath $flag" |
| 4522 | fi |
| 4523 | elif test -n "$runpath_var"; then |
| 4524 | case "$finalize_perm_rpath " in |
| 4525 | *" $libdir "*) ;; |
| 4526 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; |
| 4527 | esac |
| 4528 | fi |
| 4529 | done |
| 4530 | # Substitute the hardcoded libdirs into the rpath. |
| 4531 | if test -n "$hardcode_libdir_separator" && |
| 4532 | test -n "$hardcode_libdirs"; then |
| 4533 | libdir="$hardcode_libdirs" |
| 4534 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 4535 | fi |
| 4536 | finalize_rpath="$rpath" |
| 4537 | |
| 4538 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
| 4539 | # Transform all the library objects into standard objects. |
| 4540 | compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
| 4541 | finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
| 4542 | fi |
| 4543 | |
| 4544 | dlsyms= |
| 4545 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 4546 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
| 4547 | dlsyms="${outputname}S.c" |
| 4548 | else |
| 4549 | $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 |
| 4550 | fi |
| 4551 | fi |
| 4552 | |
| 4553 | if test -n "$dlsyms"; then |
| 4554 | case $dlsyms in |
| 4555 | "") ;; |
| 4556 | *.c) |
| 4557 | # Discover the nlist of each of the dlfiles. |
| 4558 | nlist="$output_objdir/${outputname}.nm" |
| 4559 | |
| 4560 | $show "$rm $nlist ${nlist}S ${nlist}T" |
| 4561 | $run $rm "$nlist" "${nlist}S" "${nlist}T" |
| 4562 | |
| 4563 | # Parse the name list into a source file. |
| 4564 | $show "creating $output_objdir/$dlsyms" |
| 4565 | |
| 4566 | test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ |
| 4567 | /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ |
| 4568 | /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ |
| 4569 | |
| 4570 | #ifdef __cplusplus |
| 4571 | extern \"C\" { |
| 4572 | #endif |
| 4573 | |
| 4574 | /* Prevent the only kind of declaration conflicts we can make. */ |
| 4575 | #define lt_preloaded_symbols some_other_symbol |
| 4576 | |
| 4577 | /* External symbol declarations for the compiler. */\ |
| 4578 | " |
| 4579 | |
| 4580 | if test "$dlself" = yes; then |
| 4581 | $show "generating symbol list for \`$output'" |
| 4582 | |
| 4583 | test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" |
| 4584 | |
| 4585 | # Add our own program objects to the symbol list. |
| 4586 | progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
| 4587 | for arg in $progfiles; do |
| 4588 | $show "extracting global C symbols from \`$arg'" |
| 4589 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
| 4590 | done |
| 4591 | |
| 4592 | if test -n "$exclude_expsyms"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4593 | $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4594 | $run eval '$mv "$nlist"T "$nlist"' |
| 4595 | fi |
| 4596 | |
| 4597 | if test -n "$export_symbols_regex"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4598 | $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4599 | $run eval '$mv "$nlist"T "$nlist"' |
| 4600 | fi |
| 4601 | |
| 4602 | # Prepare the list of exported symbols |
| 4603 | if test -z "$export_symbols"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4604 | export_symbols="$output_objdir/$outputname.exp" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4605 | $run $rm $export_symbols |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4606 | $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
| 4607 | case $host in |
| 4608 | *cygwin* | *mingw* ) |
| 4609 | $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 4610 | $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
| 4611 | ;; |
| 4612 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4613 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4614 | $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
| 4615 | $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4616 | $run eval 'mv "$nlist"T "$nlist"' |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4617 | case $host in |
| 4618 | *cygwin* | *mingw* ) |
| 4619 | $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 4620 | $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
| 4621 | ;; |
| 4622 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4623 | fi |
| 4624 | fi |
| 4625 | |
| 4626 | for arg in $dlprefiles; do |
| 4627 | $show "extracting global C symbols from \`$arg'" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4628 | name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` |
| 4629 | $run eval '$echo ": $name " >> "$nlist"' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4630 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
| 4631 | done |
| 4632 | |
| 4633 | if test -z "$run"; then |
| 4634 | # Make sure we have at least an empty file. |
| 4635 | test -f "$nlist" || : > "$nlist" |
| 4636 | |
| 4637 | if test -n "$exclude_expsyms"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4638 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4639 | $mv "$nlist"T "$nlist" |
| 4640 | fi |
| 4641 | |
| 4642 | # Try sorting and uniquifying the output. |
| 4643 | if grep -v "^: " < "$nlist" | |
| 4644 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
| 4645 | sort -k 3 |
| 4646 | else |
| 4647 | sort +2 |
| 4648 | fi | |
| 4649 | uniq > "$nlist"S; then |
| 4650 | : |
| 4651 | else |
| 4652 | grep -v "^: " < "$nlist" > "$nlist"S |
| 4653 | fi |
| 4654 | |
| 4655 | if test -f "$nlist"S; then |
| 4656 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' |
| 4657 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4658 | $echo '/* NONE */' >> "$output_objdir/$dlsyms" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4659 | fi |
| 4660 | |
| 4661 | $echo >> "$output_objdir/$dlsyms" "\ |
| 4662 | |
| 4663 | #undef lt_preloaded_symbols |
| 4664 | |
| 4665 | #if defined (__STDC__) && __STDC__ |
| 4666 | # define lt_ptr void * |
| 4667 | #else |
| 4668 | # define lt_ptr char * |
| 4669 | # define const |
| 4670 | #endif |
| 4671 | |
| 4672 | /* The mapping between symbol names and symbols. */ |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4673 | " |
| 4674 | |
| 4675 | case $host in |
| 4676 | *cygwin* | *mingw* ) |
| 4677 | $echo >> "$output_objdir/$dlsyms" "\ |
| 4678 | /* DATA imports from DLLs on WIN32 can't be const, because |
| 4679 | runtime relocations are performed -- see ld's documentation |
| 4680 | on pseudo-relocs */ |
| 4681 | struct { |
| 4682 | " |
| 4683 | ;; |
| 4684 | * ) |
| 4685 | $echo >> "$output_objdir/$dlsyms" "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4686 | const struct { |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4687 | " |
| 4688 | ;; |
| 4689 | esac |
| 4690 | |
| 4691 | |
| 4692 | $echo >> "$output_objdir/$dlsyms" "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4693 | const char *name; |
| 4694 | lt_ptr address; |
| 4695 | } |
| 4696 | lt_preloaded_symbols[] = |
| 4697 | {\ |
| 4698 | " |
| 4699 | |
| 4700 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" |
| 4701 | |
| 4702 | $echo >> "$output_objdir/$dlsyms" "\ |
| 4703 | {0, (lt_ptr) 0} |
| 4704 | }; |
| 4705 | |
| 4706 | /* This works around a problem in FreeBSD linker */ |
| 4707 | #ifdef FREEBSD_WORKAROUND |
| 4708 | static const void *lt_preloaded_setup() { |
| 4709 | return lt_preloaded_symbols; |
| 4710 | } |
| 4711 | #endif |
| 4712 | |
| 4713 | #ifdef __cplusplus |
| 4714 | } |
| 4715 | #endif\ |
| 4716 | " |
| 4717 | fi |
| 4718 | |
| 4719 | pic_flag_for_symtable= |
| 4720 | case $host in |
| 4721 | # compiling the symbol table file with pic_flag works around |
| 4722 | # a FreeBSD bug that causes programs to crash when -lm is |
| 4723 | # linked before any other PIC object. But we must not use |
| 4724 | # pic_flag when linking with -static. The problem exists in |
| 4725 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
| 4726 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
| 4727 | case "$compile_command " in |
| 4728 | *" -static "*) ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4729 | *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4730 | esac;; |
| 4731 | *-*-hpux*) |
| 4732 | case "$compile_command " in |
| 4733 | *" -static "*) ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4734 | *) pic_flag_for_symtable=" $pic_flag";; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4735 | esac |
| 4736 | esac |
| 4737 | |
| 4738 | # Now compile the dynamic symbol file. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4739 | $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
| 4740 | $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4741 | |
| 4742 | # Clean up the generated files. |
| 4743 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" |
| 4744 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" |
| 4745 | |
| 4746 | # Transform the symbol file into the correct name. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4747 | case $host in |
| 4748 | *cygwin* | *mingw* ) |
| 4749 | if test -f "$output_objdir/${outputname}.def" ; then |
| 4750 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` |
| 4751 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` |
| 4752 | else |
| 4753 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
| 4754 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
| 4755 | fi |
| 4756 | ;; |
| 4757 | * ) |
| 4758 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
| 4759 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
| 4760 | ;; |
| 4761 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4762 | ;; |
| 4763 | *) |
| 4764 | $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4765 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4766 | ;; |
| 4767 | esac |
| 4768 | else |
| 4769 | # We keep going just in case the user didn't refer to |
| 4770 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
| 4771 | # really was required. |
| 4772 | |
| 4773 | # Nullify the symbol file. |
| 4774 | compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` |
| 4775 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` |
| 4776 | fi |
| 4777 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4778 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4779 | # Replace the output file specification. |
| 4780 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
| 4781 | link_command="$compile_command$compile_rpath" |
| 4782 | |
| 4783 | # We have no uninstalled library dependencies, so finalize right now. |
| 4784 | $show "$link_command" |
| 4785 | $run eval "$link_command" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4786 | exit_status=$? |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4787 | |
| 4788 | # Delete the generated files. |
| 4789 | if test -n "$dlsyms"; then |
| 4790 | $show "$rm $output_objdir/${outputname}S.${objext}" |
| 4791 | $run $rm "$output_objdir/${outputname}S.${objext}" |
| 4792 | fi |
| 4793 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4794 | exit $exit_status |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4795 | fi |
| 4796 | |
| 4797 | if test -n "$shlibpath_var"; then |
| 4798 | # We should set the shlibpath_var |
| 4799 | rpath= |
| 4800 | for dir in $temp_rpath; do |
| 4801 | case $dir in |
| 4802 | [\\/]* | [A-Za-z]:[\\/]*) |
| 4803 | # Absolute path. |
| 4804 | rpath="$rpath$dir:" |
| 4805 | ;; |
| 4806 | *) |
| 4807 | # Relative path: add a thisdir entry. |
| 4808 | rpath="$rpath\$thisdir/$dir:" |
| 4809 | ;; |
| 4810 | esac |
| 4811 | done |
| 4812 | temp_rpath="$rpath" |
| 4813 | fi |
| 4814 | |
| 4815 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
| 4816 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
| 4817 | fi |
| 4818 | if test -n "$finalize_shlibpath"; then |
| 4819 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
| 4820 | fi |
| 4821 | |
| 4822 | compile_var= |
| 4823 | finalize_var= |
| 4824 | if test -n "$runpath_var"; then |
| 4825 | if test -n "$perm_rpath"; then |
| 4826 | # We should set the runpath_var. |
| 4827 | rpath= |
| 4828 | for dir in $perm_rpath; do |
| 4829 | rpath="$rpath$dir:" |
| 4830 | done |
| 4831 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 4832 | fi |
| 4833 | if test -n "$finalize_perm_rpath"; then |
| 4834 | # We should set the runpath_var. |
| 4835 | rpath= |
| 4836 | for dir in $finalize_perm_rpath; do |
| 4837 | rpath="$rpath$dir:" |
| 4838 | done |
| 4839 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 4840 | fi |
| 4841 | fi |
| 4842 | |
| 4843 | if test "$no_install" = yes; then |
| 4844 | # We don't need to create a wrapper script. |
| 4845 | link_command="$compile_var$compile_command$compile_rpath" |
| 4846 | # Replace the output file specification. |
| 4847 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
| 4848 | # Delete the old output file. |
| 4849 | $run $rm $output |
| 4850 | # Link the executable and exit |
| 4851 | $show "$link_command" |
| 4852 | $run eval "$link_command" || exit $? |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4853 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4854 | fi |
| 4855 | |
| 4856 | if test "$hardcode_action" = relink; then |
| 4857 | # Fast installation is not supported |
| 4858 | link_command="$compile_var$compile_command$compile_rpath" |
| 4859 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 4860 | |
| 4861 | $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 |
| 4862 | $echo "$modename: \`$output' will be relinked during installation" 1>&2 |
| 4863 | else |
| 4864 | if test "$fast_install" != no; then |
| 4865 | link_command="$finalize_var$compile_command$finalize_rpath" |
| 4866 | if test "$fast_install" = yes; then |
| 4867 | relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` |
| 4868 | else |
| 4869 | # fast_install is set to needless |
| 4870 | relink_command= |
| 4871 | fi |
| 4872 | else |
| 4873 | link_command="$compile_var$compile_command$compile_rpath" |
| 4874 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 4875 | fi |
| 4876 | fi |
| 4877 | |
| 4878 | # Replace the output file specification. |
| 4879 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
| 4880 | |
| 4881 | # Delete the old output files. |
| 4882 | $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname |
| 4883 | |
| 4884 | $show "$link_command" |
| 4885 | $run eval "$link_command" || exit $? |
| 4886 | |
| 4887 | # Now create the wrapper script. |
| 4888 | $show "creating $output" |
| 4889 | |
| 4890 | # Quote the relink command for shipping. |
| 4891 | if test -n "$relink_command"; then |
| 4892 | # Preserve any variables that may affect compiler behavior |
| 4893 | for var in $variables_saved_for_relink; do |
| 4894 | if eval test -z \"\${$var+set}\"; then |
| 4895 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
| 4896 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 4897 | relink_command="$var=; export $var; $relink_command" |
| 4898 | else |
| 4899 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
| 4900 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
| 4901 | fi |
| 4902 | done |
| 4903 | relink_command="(cd `pwd`; $relink_command)" |
| 4904 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
| 4905 | fi |
| 4906 | |
| 4907 | # Quote $echo for shipping. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4908 | if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then |
| 4909 | case $progpath in |
| 4910 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; |
| 4911 | *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4912 | esac |
| 4913 | qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` |
| 4914 | else |
| 4915 | qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` |
| 4916 | fi |
| 4917 | |
| 4918 | # Only actually do things if our run command is non-null. |
| 4919 | if test -z "$run"; then |
| 4920 | # win32 will think the script is a binary if it has |
| 4921 | # a .exe suffix, so we strip it off here. |
| 4922 | case $output in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4923 | *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4924 | esac |
| 4925 | # test for cygwin because mv fails w/o .exe extensions |
| 4926 | case $host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4927 | *cygwin*) |
| 4928 | exeext=.exe |
| 4929 | outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 4930 | *) exeext= ;; |
| 4931 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 4932 | case $host in |
| 4933 | *cygwin* | *mingw* ) |
| 4934 | output_name=`basename $output` |
| 4935 | output_path=`dirname $output` |
| 4936 | cwrappersource="$output_path/$objdir/lt-$output_name.c" |
| 4937 | cwrapper="$output_path/$output_name.exe" |
| 4938 | $rm $cwrappersource $cwrapper |
| 4939 | trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
| 4940 | |
| 4941 | cat > $cwrappersource <<EOF |
| 4942 | |
| 4943 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
| 4944 | Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 4945 | |
| 4946 | The $output program cannot be directly executed until all the libtool |
| 4947 | libraries that it depends on are installed. |
| 4948 | |
| 4949 | This wrapper executable should never be moved out of the build directory. |
| 4950 | If it is, it will not operate correctly. |
| 4951 | |
| 4952 | Currently, it simply execs the wrapper *script* "/bin/sh $output", |
| 4953 | but could eventually absorb all of the scripts functionality and |
| 4954 | exec $objdir/$outputname directly. |
| 4955 | */ |
| 4956 | EOF |
| 4957 | cat >> $cwrappersource<<"EOF" |
| 4958 | #include <stdio.h> |
| 4959 | #include <stdlib.h> |
| 4960 | #include <unistd.h> |
| 4961 | #include <malloc.h> |
| 4962 | #include <stdarg.h> |
| 4963 | #include <assert.h> |
| 4964 | #include <string.h> |
| 4965 | #include <ctype.h> |
| 4966 | #include <sys/stat.h> |
| 4967 | |
| 4968 | #if defined(PATH_MAX) |
| 4969 | # define LT_PATHMAX PATH_MAX |
| 4970 | #elif defined(MAXPATHLEN) |
| 4971 | # define LT_PATHMAX MAXPATHLEN |
| 4972 | #else |
| 4973 | # define LT_PATHMAX 1024 |
| 4974 | #endif |
| 4975 | |
| 4976 | #ifndef DIR_SEPARATOR |
| 4977 | # define DIR_SEPARATOR '/' |
| 4978 | # define PATH_SEPARATOR ':' |
| 4979 | #endif |
| 4980 | |
| 4981 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
| 4982 | defined (__OS2__) |
| 4983 | # define HAVE_DOS_BASED_FILE_SYSTEM |
| 4984 | # ifndef DIR_SEPARATOR_2 |
| 4985 | # define DIR_SEPARATOR_2 '\\' |
| 4986 | # endif |
| 4987 | # ifndef PATH_SEPARATOR_2 |
| 4988 | # define PATH_SEPARATOR_2 ';' |
| 4989 | # endif |
| 4990 | #endif |
| 4991 | |
| 4992 | #ifndef DIR_SEPARATOR_2 |
| 4993 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
| 4994 | #else /* DIR_SEPARATOR_2 */ |
| 4995 | # define IS_DIR_SEPARATOR(ch) \ |
| 4996 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
| 4997 | #endif /* DIR_SEPARATOR_2 */ |
| 4998 | |
| 4999 | #ifndef PATH_SEPARATOR_2 |
| 5000 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
| 5001 | #else /* PATH_SEPARATOR_2 */ |
| 5002 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
| 5003 | #endif /* PATH_SEPARATOR_2 */ |
| 5004 | |
| 5005 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
| 5006 | #define XFREE(stale) do { \ |
| 5007 | if (stale) { free ((void *) stale); stale = 0; } \ |
| 5008 | } while (0) |
| 5009 | |
| 5010 | /* -DDEBUG is fairly common in CFLAGS. */ |
| 5011 | #undef DEBUG |
| 5012 | #if defined DEBUGWRAPPER |
| 5013 | # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) |
| 5014 | #else |
| 5015 | # define DEBUG(format, ...) |
| 5016 | #endif |
| 5017 | |
| 5018 | const char *program_name = NULL; |
| 5019 | |
| 5020 | void * xmalloc (size_t num); |
| 5021 | char * xstrdup (const char *string); |
| 5022 | const char * base_name (const char *name); |
| 5023 | char * find_executable(const char *wrapper); |
| 5024 | int check_executable(const char *path); |
| 5025 | char * strendzap(char *str, const char *pat); |
| 5026 | void lt_fatal (const char *message, ...); |
| 5027 | |
| 5028 | int |
| 5029 | main (int argc, char *argv[]) |
| 5030 | { |
| 5031 | char **newargz; |
| 5032 | int i; |
| 5033 | |
| 5034 | program_name = (char *) xstrdup (base_name (argv[0])); |
| 5035 | DEBUG("(main) argv[0] : %s\n",argv[0]); |
| 5036 | DEBUG("(main) program_name : %s\n",program_name); |
| 5037 | newargz = XMALLOC(char *, argc+2); |
| 5038 | EOF |
| 5039 | |
| 5040 | cat >> $cwrappersource <<EOF |
| 5041 | newargz[0] = (char *) xstrdup("$SHELL"); |
| 5042 | EOF |
| 5043 | |
| 5044 | cat >> $cwrappersource <<"EOF" |
| 5045 | newargz[1] = find_executable(argv[0]); |
| 5046 | if (newargz[1] == NULL) |
| 5047 | lt_fatal("Couldn't find %s", argv[0]); |
| 5048 | DEBUG("(main) found exe at : %s\n",newargz[1]); |
| 5049 | /* we know the script has the same name, without the .exe */ |
| 5050 | /* so make sure newargz[1] doesn't end in .exe */ |
| 5051 | strendzap(newargz[1],".exe"); |
| 5052 | for (i = 1; i < argc; i++) |
| 5053 | newargz[i+1] = xstrdup(argv[i]); |
| 5054 | newargz[argc+1] = NULL; |
| 5055 | |
| 5056 | for (i=0; i<argc+1; i++) |
| 5057 | { |
| 5058 | DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); |
| 5059 | ; |
| 5060 | } |
| 5061 | |
| 5062 | EOF |
| 5063 | |
| 5064 | case $host_os in |
| 5065 | mingw*) |
| 5066 | cat >> $cwrappersource <<EOF |
| 5067 | execv("$SHELL",(char const **)newargz); |
| 5068 | EOF |
| 5069 | ;; |
| 5070 | *) |
| 5071 | cat >> $cwrappersource <<EOF |
| 5072 | execv("$SHELL",newargz); |
| 5073 | EOF |
| 5074 | ;; |
| 5075 | esac |
| 5076 | |
| 5077 | cat >> $cwrappersource <<"EOF" |
| 5078 | return 127; |
| 5079 | } |
| 5080 | |
| 5081 | void * |
| 5082 | xmalloc (size_t num) |
| 5083 | { |
| 5084 | void * p = (void *) malloc (num); |
| 5085 | if (!p) |
| 5086 | lt_fatal ("Memory exhausted"); |
| 5087 | |
| 5088 | return p; |
| 5089 | } |
| 5090 | |
| 5091 | char * |
| 5092 | xstrdup (const char *string) |
| 5093 | { |
| 5094 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL |
| 5095 | ; |
| 5096 | } |
| 5097 | |
| 5098 | const char * |
| 5099 | base_name (const char *name) |
| 5100 | { |
| 5101 | const char *base; |
| 5102 | |
| 5103 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5104 | /* Skip over the disk name in MSDOS pathnames. */ |
| 5105 | if (isalpha ((unsigned char)name[0]) && name[1] == ':') |
| 5106 | name += 2; |
| 5107 | #endif |
| 5108 | |
| 5109 | for (base = name; *name; name++) |
| 5110 | if (IS_DIR_SEPARATOR (*name)) |
| 5111 | base = name + 1; |
| 5112 | return base; |
| 5113 | } |
| 5114 | |
| 5115 | int |
| 5116 | check_executable(const char * path) |
| 5117 | { |
| 5118 | struct stat st; |
| 5119 | |
| 5120 | DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); |
| 5121 | if ((!path) || (!*path)) |
| 5122 | return 0; |
| 5123 | |
| 5124 | if ((stat (path, &st) >= 0) && |
| 5125 | ( |
| 5126 | /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ |
| 5127 | #if defined (S_IXOTH) |
| 5128 | ((st.st_mode & S_IXOTH) == S_IXOTH) || |
| 5129 | #endif |
| 5130 | #if defined (S_IXGRP) |
| 5131 | ((st.st_mode & S_IXGRP) == S_IXGRP) || |
| 5132 | #endif |
| 5133 | ((st.st_mode & S_IXUSR) == S_IXUSR)) |
| 5134 | ) |
| 5135 | return 1; |
| 5136 | else |
| 5137 | return 0; |
| 5138 | } |
| 5139 | |
| 5140 | /* Searches for the full path of the wrapper. Returns |
| 5141 | newly allocated full path name if found, NULL otherwise */ |
| 5142 | char * |
| 5143 | find_executable (const char* wrapper) |
| 5144 | { |
| 5145 | int has_slash = 0; |
| 5146 | const char* p; |
| 5147 | const char* p_next; |
| 5148 | /* static buffer for getcwd */ |
| 5149 | char tmp[LT_PATHMAX + 1]; |
| 5150 | int tmp_len; |
| 5151 | char* concat_name; |
| 5152 | |
| 5153 | DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); |
| 5154 | |
| 5155 | if ((wrapper == NULL) || (*wrapper == '\0')) |
| 5156 | return NULL; |
| 5157 | |
| 5158 | /* Absolute path? */ |
| 5159 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5160 | if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') |
| 5161 | { |
| 5162 | concat_name = xstrdup (wrapper); |
| 5163 | if (check_executable(concat_name)) |
| 5164 | return concat_name; |
| 5165 | XFREE(concat_name); |
| 5166 | } |
| 5167 | else |
| 5168 | { |
| 5169 | #endif |
| 5170 | if (IS_DIR_SEPARATOR (wrapper[0])) |
| 5171 | { |
| 5172 | concat_name = xstrdup (wrapper); |
| 5173 | if (check_executable(concat_name)) |
| 5174 | return concat_name; |
| 5175 | XFREE(concat_name); |
| 5176 | } |
| 5177 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5178 | } |
| 5179 | #endif |
| 5180 | |
| 5181 | for (p = wrapper; *p; p++) |
| 5182 | if (*p == '/') |
| 5183 | { |
| 5184 | has_slash = 1; |
| 5185 | break; |
| 5186 | } |
| 5187 | if (!has_slash) |
| 5188 | { |
| 5189 | /* no slashes; search PATH */ |
| 5190 | const char* path = getenv ("PATH"); |
| 5191 | if (path != NULL) |
| 5192 | { |
| 5193 | for (p = path; *p; p = p_next) |
| 5194 | { |
| 5195 | const char* q; |
| 5196 | size_t p_len; |
| 5197 | for (q = p; *q; q++) |
| 5198 | if (IS_PATH_SEPARATOR(*q)) |
| 5199 | break; |
| 5200 | p_len = q - p; |
| 5201 | p_next = (*q == '\0' ? q : q + 1); |
| 5202 | if (p_len == 0) |
| 5203 | { |
| 5204 | /* empty path: current directory */ |
| 5205 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
| 5206 | lt_fatal ("getcwd failed"); |
| 5207 | tmp_len = strlen(tmp); |
| 5208 | concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); |
| 5209 | memcpy (concat_name, tmp, tmp_len); |
| 5210 | concat_name[tmp_len] = '/'; |
| 5211 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5212 | } |
| 5213 | else |
| 5214 | { |
| 5215 | concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); |
| 5216 | memcpy (concat_name, p, p_len); |
| 5217 | concat_name[p_len] = '/'; |
| 5218 | strcpy (concat_name + p_len + 1, wrapper); |
| 5219 | } |
| 5220 | if (check_executable(concat_name)) |
| 5221 | return concat_name; |
| 5222 | XFREE(concat_name); |
| 5223 | } |
| 5224 | } |
| 5225 | /* not found in PATH; assume curdir */ |
| 5226 | } |
| 5227 | /* Relative path | not found in path: prepend cwd */ |
| 5228 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
| 5229 | lt_fatal ("getcwd failed"); |
| 5230 | tmp_len = strlen(tmp); |
| 5231 | concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); |
| 5232 | memcpy (concat_name, tmp, tmp_len); |
| 5233 | concat_name[tmp_len] = '/'; |
| 5234 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5235 | |
| 5236 | if (check_executable(concat_name)) |
| 5237 | return concat_name; |
| 5238 | XFREE(concat_name); |
| 5239 | return NULL; |
| 5240 | } |
| 5241 | |
| 5242 | char * |
| 5243 | strendzap(char *str, const char *pat) |
| 5244 | { |
| 5245 | size_t len, patlen; |
| 5246 | |
| 5247 | assert(str != NULL); |
| 5248 | assert(pat != NULL); |
| 5249 | |
| 5250 | len = strlen(str); |
| 5251 | patlen = strlen(pat); |
| 5252 | |
| 5253 | if (patlen <= len) |
| 5254 | { |
| 5255 | str += len - patlen; |
| 5256 | if (strcmp(str, pat) == 0) |
| 5257 | *str = '\0'; |
| 5258 | } |
| 5259 | return str; |
| 5260 | } |
| 5261 | |
| 5262 | static void |
| 5263 | lt_error_core (int exit_status, const char * mode, |
| 5264 | const char * message, va_list ap) |
| 5265 | { |
| 5266 | fprintf (stderr, "%s: %s: ", program_name, mode); |
| 5267 | vfprintf (stderr, message, ap); |
| 5268 | fprintf (stderr, ".\n"); |
| 5269 | |
| 5270 | if (exit_status >= 0) |
| 5271 | exit (exit_status); |
| 5272 | } |
| 5273 | |
| 5274 | void |
| 5275 | lt_fatal (const char *message, ...) |
| 5276 | { |
| 5277 | va_list ap; |
| 5278 | va_start (ap, message); |
| 5279 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); |
| 5280 | va_end (ap); |
| 5281 | } |
| 5282 | EOF |
| 5283 | # we should really use a build-platform specific compiler |
| 5284 | # here, but OTOH, the wrappers (shell script and this C one) |
| 5285 | # are only useful if you want to execute the "real" binary. |
| 5286 | # Since the "real" binary is built for $host, then this |
| 5287 | # wrapper might as well be built for $host, too. |
| 5288 | $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource |
| 5289 | ;; |
| 5290 | esac |
| 5291 | $rm $output |
| 5292 | trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5293 | |
| 5294 | $echo > $output "\ |
| 5295 | #! $SHELL |
| 5296 | |
| 5297 | # $output - temporary wrapper script for $objdir/$outputname |
| 5298 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 5299 | # |
| 5300 | # The $output program cannot be directly executed until all the libtool |
| 5301 | # libraries that it depends on are installed. |
| 5302 | # |
| 5303 | # This wrapper script should never be moved out of the build directory. |
| 5304 | # If it is, it will not operate correctly. |
| 5305 | |
| 5306 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 5307 | # metacharacters that are still active within double-quoted strings. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5308 | Xsed='${SED} -e 1s/^X//' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5309 | sed_quote_subst='$sed_quote_subst' |
| 5310 | |
| 5311 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
| 5312 | # if CDPATH is set. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5313 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5314 | |
| 5315 | relink_command=\"$relink_command\" |
| 5316 | |
| 5317 | # This environment variable determines our operation mode. |
| 5318 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
| 5319 | # install mode needs the following variable: |
| 5320 | notinst_deplibs='$notinst_deplibs' |
| 5321 | else |
| 5322 | # When we are sourced in execute mode, \$file and \$echo are already set. |
| 5323 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 5324 | echo=\"$qecho\" |
| 5325 | file=\"\$0\" |
| 5326 | # Make sure echo works. |
| 5327 | if test \"X\$1\" = X--no-reexec; then |
| 5328 | # Discard the --no-reexec flag, and continue. |
| 5329 | shift |
| 5330 | elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then |
| 5331 | # Yippee, \$echo works! |
| 5332 | : |
| 5333 | else |
| 5334 | # Restart under the correct shell, and then maybe \$echo will work. |
| 5335 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} |
| 5336 | fi |
| 5337 | fi\ |
| 5338 | " |
| 5339 | $echo >> $output "\ |
| 5340 | |
| 5341 | # Find the directory that this script lives in. |
| 5342 | thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` |
| 5343 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
| 5344 | |
| 5345 | # Follow symbolic links until we get to the real thisdir. |
| 5346 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` |
| 5347 | while test -n \"\$file\"; do |
| 5348 | destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` |
| 5349 | |
| 5350 | # If there was a directory component, then change thisdir. |
| 5351 | if test \"x\$destdir\" != \"x\$file\"; then |
| 5352 | case \"\$destdir\" in |
| 5353 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
| 5354 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
| 5355 | esac |
| 5356 | fi |
| 5357 | |
| 5358 | file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` |
| 5359 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` |
| 5360 | done |
| 5361 | |
| 5362 | # Try to get the absolute directory name. |
| 5363 | absdir=\`cd \"\$thisdir\" && pwd\` |
| 5364 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
| 5365 | " |
| 5366 | |
| 5367 | if test "$fast_install" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5368 | $echo >> $output "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5369 | program=lt-'$outputname'$exeext |
| 5370 | progdir=\"\$thisdir/$objdir\" |
| 5371 | |
| 5372 | if test ! -f \"\$progdir/\$program\" || \\ |
| 5373 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
| 5374 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
| 5375 | |
| 5376 | file=\"\$\$-\$program\" |
| 5377 | |
| 5378 | if test ! -d \"\$progdir\"; then |
| 5379 | $mkdir \"\$progdir\" |
| 5380 | else |
| 5381 | $rm \"\$progdir/\$file\" |
| 5382 | fi" |
| 5383 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5384 | $echo >> $output "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5385 | |
| 5386 | # relink executable if necessary |
| 5387 | if test -n \"\$relink_command\"; then |
| 5388 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
| 5389 | else |
| 5390 | $echo \"\$relink_command_output\" >&2 |
| 5391 | $rm \"\$progdir/\$file\" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5392 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5393 | fi |
| 5394 | fi |
| 5395 | |
| 5396 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
| 5397 | { $rm \"\$progdir/\$program\"; |
| 5398 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
| 5399 | $rm \"\$progdir/\$file\" |
| 5400 | fi" |
| 5401 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5402 | $echo >> $output "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5403 | program='$outputname' |
| 5404 | progdir=\"\$thisdir/$objdir\" |
| 5405 | " |
| 5406 | fi |
| 5407 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5408 | $echo >> $output "\ |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5409 | |
| 5410 | if test -f \"\$progdir/\$program\"; then" |
| 5411 | |
| 5412 | # Export our shlibpath_var if we have one. |
| 5413 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
| 5414 | $echo >> $output "\ |
| 5415 | # Add our own library path to $shlibpath_var |
| 5416 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
| 5417 | |
| 5418 | # Some systems cannot cope with colon-terminated $shlibpath_var |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5419 | # The second colon is a workaround for a bug in BeOS R4 sed |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5420 | $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` |
| 5421 | |
| 5422 | export $shlibpath_var |
| 5423 | " |
| 5424 | fi |
| 5425 | |
| 5426 | # fixup the dll searchpath if we need to. |
| 5427 | if test -n "$dllsearchpath"; then |
| 5428 | $echo >> $output "\ |
| 5429 | # Add the dll search path components to the executable PATH |
| 5430 | PATH=$dllsearchpath:\$PATH |
| 5431 | " |
| 5432 | fi |
| 5433 | |
| 5434 | $echo >> $output "\ |
| 5435 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 5436 | # Run the actual program with our arguments. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5437 | |
| 5438 | # Make sure env LD_LIBRARY_PATH does not mess us up |
| 5439 | if test -n \"\${LD_LIBRARY_PATH+set}\"; then |
| 5440 | export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH |
| 5441 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5442 | " |
| 5443 | case $host in |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5444 | # Backslashes separate directories on plain windows |
| 5445 | *-*-mingw | *-*-os2*) |
| 5446 | $echo >> $output "\ |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5447 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5448 | " |
| 5449 | ;; |
| 5450 | |
| 5451 | *) |
| 5452 | $echo >> $output "\ |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5453 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5454 | " |
| 5455 | ;; |
| 5456 | esac |
| 5457 | $echo >> $output "\ |
| 5458 | \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5459 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5460 | fi |
| 5461 | else |
| 5462 | # The program doesn't exist. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5463 | \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5464 | \$echo \"This script is just a wrapper for \$program.\" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5465 | $echo \"See the $PACKAGE documentation for more information.\" 1>&2 |
| 5466 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5467 | fi |
| 5468 | fi\ |
| 5469 | " |
| 5470 | chmod +x $output |
| 5471 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5472 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5473 | ;; |
| 5474 | esac |
| 5475 | |
| 5476 | # See if we need to build an old-fashioned archive. |
| 5477 | for oldlib in $oldlibs; do |
| 5478 | |
| 5479 | if test "$build_libtool_libs" = convenience; then |
| 5480 | oldobjs="$libobjs_save" |
| 5481 | addlibs="$convenience" |
| 5482 | build_libtool_libs=no |
| 5483 | else |
| 5484 | if test "$build_libtool_libs" = module; then |
| 5485 | oldobjs="$libobjs_save" |
| 5486 | build_libtool_libs=no |
| 5487 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5488 | oldobjs="$old_deplibs $non_pic_objects" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5489 | fi |
| 5490 | addlibs="$old_convenience" |
| 5491 | fi |
| 5492 | |
| 5493 | if test -n "$addlibs"; then |
| 5494 | gentop="$output_objdir/${outputname}x" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5495 | generated="$generated $gentop" |
| 5496 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5497 | func_extract_archives $gentop $addlibs |
| 5498 | oldobjs="$oldobjs $func_extract_archives_result" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5499 | fi |
| 5500 | |
| 5501 | # Do each command in the archive commands. |
| 5502 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5503 | cmds=$old_archive_from_new_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5504 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5505 | # POSIX demands no paths to be encoded in archives. We have |
| 5506 | # to avoid creating archives with duplicate basenames if we |
| 5507 | # might have to extract them afterwards, e.g., when creating a |
| 5508 | # static archive out of a convenience library, or when linking |
| 5509 | # the entirety of a libtool archive into another (currently |
| 5510 | # not supported by libtool). |
| 5511 | if (for obj in $oldobjs |
| 5512 | do |
| 5513 | $echo "X$obj" | $Xsed -e 's%^.*/%%' |
| 5514 | done | sort | sort -uc >/dev/null 2>&1); then |
| 5515 | : |
| 5516 | else |
| 5517 | $echo "copying selected object files to avoid basename conflicts..." |
| 5518 | |
| 5519 | if test -z "$gentop"; then |
| 5520 | gentop="$output_objdir/${outputname}x" |
| 5521 | generated="$generated $gentop" |
| 5522 | |
| 5523 | $show "${rm}r $gentop" |
| 5524 | $run ${rm}r "$gentop" |
| 5525 | $show "$mkdir $gentop" |
| 5526 | $run $mkdir "$gentop" |
| 5527 | exit_status=$? |
| 5528 | if test "$exit_status" -ne 0 && test ! -d "$gentop"; then |
| 5529 | exit $exit_status |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5530 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5531 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5532 | |
| 5533 | save_oldobjs=$oldobjs |
| 5534 | oldobjs= |
| 5535 | counter=1 |
| 5536 | for obj in $save_oldobjs |
| 5537 | do |
| 5538 | objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
| 5539 | case " $oldobjs " in |
| 5540 | " ") oldobjs=$obj ;; |
| 5541 | *[\ /]"$objbase "*) |
| 5542 | while :; do |
| 5543 | # Make sure we don't pick an alternate name that also |
| 5544 | # overlaps. |
| 5545 | newobj=lt$counter-$objbase |
| 5546 | counter=`expr $counter + 1` |
| 5547 | case " $oldobjs " in |
| 5548 | *[\ /]"$newobj "*) ;; |
| 5549 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; |
| 5550 | esac |
| 5551 | done |
| 5552 | $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
| 5553 | $run ln "$obj" "$gentop/$newobj" || |
| 5554 | $run cp "$obj" "$gentop/$newobj" |
| 5555 | oldobjs="$oldobjs $gentop/$newobj" |
| 5556 | ;; |
| 5557 | *) oldobjs="$oldobjs $obj" ;; |
| 5558 | esac |
| 5559 | done |
| 5560 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5561 | |
| 5562 | eval cmds=\"$old_archive_cmds\" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5563 | |
| 5564 | if len=`expr "X$cmds" : ".*"` && |
| 5565 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 5566 | cmds=$old_archive_cmds |
| 5567 | else |
| 5568 | # the command line is too long to link in one step, link in parts |
| 5569 | $echo "using piecewise archive linking..." |
| 5570 | save_RANLIB=$RANLIB |
| 5571 | RANLIB=: |
| 5572 | objlist= |
| 5573 | concat_cmds= |
| 5574 | save_oldobjs=$oldobjs |
| 5575 | |
| 5576 | # Is there a better way of finding the last object in the list? |
| 5577 | for obj in $save_oldobjs |
| 5578 | do |
| 5579 | last_oldobj=$obj |
| 5580 | done |
| 5581 | for obj in $save_oldobjs |
| 5582 | do |
| 5583 | oldobjs="$objlist $obj" |
| 5584 | objlist="$objlist $obj" |
| 5585 | eval test_cmds=\"$old_archive_cmds\" |
| 5586 | if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && |
| 5587 | test "$len" -le "$max_cmd_len"; then |
| 5588 | : |
| 5589 | else |
| 5590 | # the above command should be used before it gets too long |
| 5591 | oldobjs=$objlist |
| 5592 | if test "$obj" = "$last_oldobj" ; then |
| 5593 | RANLIB=$save_RANLIB |
| 5594 | fi |
| 5595 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 5596 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
| 5597 | objlist= |
| 5598 | fi |
| 5599 | done |
| 5600 | RANLIB=$save_RANLIB |
| 5601 | oldobjs=$objlist |
| 5602 | if test "X$oldobjs" = "X" ; then |
| 5603 | eval cmds=\"\$concat_cmds\" |
| 5604 | else |
| 5605 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
| 5606 | fi |
| 5607 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5608 | fi |
| 5609 | save_ifs="$IFS"; IFS='~' |
| 5610 | for cmd in $cmds; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5611 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5612 | IFS="$save_ifs" |
| 5613 | $show "$cmd" |
| 5614 | $run eval "$cmd" || exit $? |
| 5615 | done |
| 5616 | IFS="$save_ifs" |
| 5617 | done |
| 5618 | |
| 5619 | if test -n "$generated"; then |
| 5620 | $show "${rm}r$generated" |
| 5621 | $run ${rm}r$generated |
| 5622 | fi |
| 5623 | |
| 5624 | # Now create the libtool archive. |
| 5625 | case $output in |
| 5626 | *.la) |
| 5627 | old_library= |
| 5628 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
| 5629 | $show "creating $output" |
| 5630 | |
| 5631 | # Preserve any variables that may affect compiler behavior |
| 5632 | for var in $variables_saved_for_relink; do |
| 5633 | if eval test -z \"\${$var+set}\"; then |
| 5634 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
| 5635 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 5636 | relink_command="$var=; export $var; $relink_command" |
| 5637 | else |
| 5638 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
| 5639 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
| 5640 | fi |
| 5641 | done |
| 5642 | # Quote the link command for shipping. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5643 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5644 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5645 | if test "$hardcode_automatic" = yes ; then |
| 5646 | relink_command= |
| 5647 | fi |
| 5648 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5649 | |
| 5650 | # Only create the output if not a dry run. |
| 5651 | if test -z "$run"; then |
| 5652 | for installed in no yes; do |
| 5653 | if test "$installed" = yes; then |
| 5654 | if test -z "$install_libdir"; then |
| 5655 | break |
| 5656 | fi |
| 5657 | output="$output_objdir/$outputname"i |
| 5658 | # Replace all uninstalled libtool libraries with the installed ones |
| 5659 | newdependency_libs= |
| 5660 | for deplib in $dependency_libs; do |
| 5661 | case $deplib in |
| 5662 | *.la) |
| 5663 | name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` |
| 5664 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 5665 | if test -z "$libdir"; then |
| 5666 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5667 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5668 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5669 | if test "X$EGREP" = X ; then |
| 5670 | EGREP=egrep |
| 5671 | fi |
| 5672 | # We do not want portage's install root ($D) present. Check only for |
| 5673 | # this if the .la is being installed. |
| 5674 | if test "$installed" = yes && test "$D"; then |
| 5675 | eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` |
| 5676 | else |
| 5677 | mynewdependency_lib="$libdir/$name" |
| 5678 | fi |
| 5679 | # Do not add duplicates |
| 5680 | if test "$mynewdependency_lib"; then |
| 5681 | my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` |
| 5682 | if test -z "$my_little_ninja_foo_1"; then |
| 5683 | newdependency_libs="$newdependency_libs $mynewdependency_lib" |
| 5684 | fi |
| 5685 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5686 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5687 | *) |
| 5688 | if test "$installed" = yes; then |
| 5689 | # Rather use S=WORKDIR if our version of portage supports it. |
| 5690 | # This is because some ebuild (gcc) do not use $S as buildroot. |
| 5691 | if test "$PWORKDIR"; then |
| 5692 | S="$PWORKDIR" |
| 5693 | fi |
| 5694 | # We do not want portage's build root ($S) present. |
| 5695 | my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"` |
| 5696 | # We do not want portage's install root ($D) present. |
| 5697 | my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"` |
| 5698 | if test -n "$my_little_ninja_foo_2" && test "$S"; then |
| 5699 | mynewdependency_lib="" |
| 5700 | elif test -n "$my_little_ninja_foo_3" && test "$D"; then |
| 5701 | eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` |
| 5702 | else |
| 5703 | mynewdependency_lib="$deplib" |
| 5704 | fi |
| 5705 | else |
| 5706 | mynewdependency_lib="$deplib" |
| 5707 | fi |
| 5708 | # Do not add duplicates |
| 5709 | if test "$mynewdependency_lib"; then |
| 5710 | my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` |
| 5711 | if test -z "$my_little_ninja_foo_4"; then |
| 5712 | newdependency_libs="$newdependency_libs $mynewdependency_lib" |
| 5713 | fi |
| 5714 | fi |
| 5715 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5716 | esac |
| 5717 | done |
| 5718 | dependency_libs="$newdependency_libs" |
| 5719 | newdlfiles= |
| 5720 | for lib in $dlfiles; do |
| 5721 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
| 5722 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 5723 | if test -z "$libdir"; then |
| 5724 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5725 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5726 | fi |
| 5727 | newdlfiles="$newdlfiles $libdir/$name" |
| 5728 | done |
| 5729 | dlfiles="$newdlfiles" |
| 5730 | newdlprefiles= |
| 5731 | for lib in $dlprefiles; do |
| 5732 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
| 5733 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 5734 | if test -z "$libdir"; then |
| 5735 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5736 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5737 | fi |
| 5738 | newdlprefiles="$newdlprefiles $libdir/$name" |
| 5739 | done |
| 5740 | dlprefiles="$newdlprefiles" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5741 | else |
| 5742 | newdlfiles= |
| 5743 | for lib in $dlfiles; do |
| 5744 | case $lib in |
| 5745 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 5746 | *) abs=`pwd`"/$lib" ;; |
| 5747 | esac |
| 5748 | newdlfiles="$newdlfiles $abs" |
| 5749 | done |
| 5750 | dlfiles="$newdlfiles" |
| 5751 | newdlprefiles= |
| 5752 | for lib in $dlprefiles; do |
| 5753 | case $lib in |
| 5754 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 5755 | *) abs=`pwd`"/$lib" ;; |
| 5756 | esac |
| 5757 | newdlprefiles="$newdlprefiles $abs" |
| 5758 | done |
| 5759 | dlprefiles="$newdlprefiles" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5760 | fi |
| 5761 | $rm $output |
| 5762 | # place dlname in correct position for cygwin |
| 5763 | tdlname=$dlname |
| 5764 | case $host,$output,$installed,$module,$dlname in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5765 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5766 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5767 | # Do not add duplicates |
| 5768 | if test "$installed" = yes && test "$D"; then |
| 5769 | install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` |
| 5770 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5771 | $echo > $output "\ |
| 5772 | # $outputname - a libtool library file |
| 5773 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 5774 | # |
| 5775 | # Please DO NOT delete this file! |
| 5776 | # It is necessary for linking the library. |
| 5777 | |
| 5778 | # The name that we can dlopen(3). |
| 5779 | dlname='$tdlname' |
| 5780 | |
| 5781 | # Names of this library. |
| 5782 | library_names='$library_names' |
| 5783 | |
| 5784 | # The name of the static archive. |
| 5785 | old_library='$old_library' |
| 5786 | |
| 5787 | # Libraries that this one depends upon. |
| 5788 | dependency_libs='$dependency_libs' |
| 5789 | |
| 5790 | # Version information for $libname. |
| 5791 | current=$current |
| 5792 | age=$age |
| 5793 | revision=$revision |
| 5794 | |
| 5795 | # Is this an already installed library? |
| 5796 | installed=$installed |
| 5797 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5798 | # Should we warn about portability when linking against -modules? |
| 5799 | shouldnotlink=$module |
| 5800 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5801 | # Files to dlopen/dlpreopen |
| 5802 | dlopen='$dlfiles' |
| 5803 | dlpreopen='$dlprefiles' |
| 5804 | |
| 5805 | # Directory that this library needs to be installed in: |
| 5806 | libdir='$install_libdir'" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5807 | if test "$installed" = no && test "$need_relink" = yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5808 | $echo >> $output "\ |
| 5809 | relink_command=\"$relink_command\"" |
| 5810 | fi |
| 5811 | done |
| 5812 | fi |
| 5813 | |
| 5814 | # Do a symbolic link so that the libtool archive can be found in |
| 5815 | # LD_LIBRARY_PATH before the program is installed. |
| 5816 | $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" |
| 5817 | $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? |
| 5818 | ;; |
| 5819 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5820 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5821 | ;; |
| 5822 | |
| 5823 | # libtool install mode |
| 5824 | install) |
| 5825 | modename="$modename: install" |
| 5826 | |
| 5827 | # There may be an optional sh(1) argument at the beginning of |
| 5828 | # install_prog (especially on Windows NT). |
| 5829 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
| 5830 | # Allow the use of GNU shtool's install command. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5831 | $echo "X$nonopt" | grep shtool > /dev/null; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5832 | # Aesthetically quote it. |
| 5833 | arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` |
| 5834 | case $arg in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5835 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5836 | arg="\"$arg\"" |
| 5837 | ;; |
| 5838 | esac |
| 5839 | install_prog="$arg " |
| 5840 | arg="$1" |
| 5841 | shift |
| 5842 | else |
| 5843 | install_prog= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5844 | arg=$nonopt |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5845 | fi |
| 5846 | |
| 5847 | # The real first argument should be the name of the installation program. |
| 5848 | # Aesthetically quote it. |
| 5849 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 5850 | case $arg in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5851 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5852 | arg="\"$arg\"" |
| 5853 | ;; |
| 5854 | esac |
| 5855 | install_prog="$install_prog$arg" |
| 5856 | |
| 5857 | # We need to accept at least all the BSD install flags. |
| 5858 | dest= |
| 5859 | files= |
| 5860 | opts= |
| 5861 | prev= |
| 5862 | install_type= |
| 5863 | isdir=no |
| 5864 | stripme= |
| 5865 | for arg |
| 5866 | do |
| 5867 | if test -n "$dest"; then |
| 5868 | files="$files $dest" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5869 | dest=$arg |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5870 | continue |
| 5871 | fi |
| 5872 | |
| 5873 | case $arg in |
| 5874 | -d) isdir=yes ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5875 | -f) |
| 5876 | case " $install_prog " in |
| 5877 | *[\\\ /]cp\ *) ;; |
| 5878 | *) prev=$arg ;; |
| 5879 | esac |
| 5880 | ;; |
| 5881 | -g | -m | -o) prev=$arg ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5882 | -s) |
| 5883 | stripme=" -s" |
| 5884 | continue |
| 5885 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5886 | -*) |
| 5887 | ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5888 | *) |
| 5889 | # If the previous option needed an argument, then skip it. |
| 5890 | if test -n "$prev"; then |
| 5891 | prev= |
| 5892 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5893 | dest=$arg |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5894 | continue |
| 5895 | fi |
| 5896 | ;; |
| 5897 | esac |
| 5898 | |
| 5899 | # Aesthetically quote the argument. |
| 5900 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 5901 | case $arg in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5902 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5903 | arg="\"$arg\"" |
| 5904 | ;; |
| 5905 | esac |
| 5906 | install_prog="$install_prog $arg" |
| 5907 | done |
| 5908 | |
| 5909 | if test -z "$install_prog"; then |
| 5910 | $echo "$modename: you must specify an install program" 1>&2 |
| 5911 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5912 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5913 | fi |
| 5914 | |
| 5915 | if test -n "$prev"; then |
| 5916 | $echo "$modename: the \`$prev' option requires an argument" 1>&2 |
| 5917 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5918 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5919 | fi |
| 5920 | |
| 5921 | if test -z "$files"; then |
| 5922 | if test -z "$dest"; then |
| 5923 | $echo "$modename: no file or destination specified" 1>&2 |
| 5924 | else |
| 5925 | $echo "$modename: you must specify a destination" 1>&2 |
| 5926 | fi |
| 5927 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5928 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5929 | fi |
| 5930 | |
| 5931 | # Strip any trailing slash from the destination. |
| 5932 | dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` |
| 5933 | |
| 5934 | # Check to see that the destination is a directory. |
| 5935 | test -d "$dest" && isdir=yes |
| 5936 | if test "$isdir" = yes; then |
| 5937 | destdir="$dest" |
| 5938 | destname= |
| 5939 | else |
| 5940 | destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` |
| 5941 | test "X$destdir" = "X$dest" && destdir=. |
| 5942 | destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` |
| 5943 | |
| 5944 | # Not a directory, so check to see that there is only one file specified. |
| 5945 | set dummy $files |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5946 | if test "$#" -gt 2; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5947 | $echo "$modename: \`$dest' is not a directory" 1>&2 |
| 5948 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5949 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5950 | fi |
| 5951 | fi |
| 5952 | case $destdir in |
| 5953 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 5954 | *) |
| 5955 | for file in $files; do |
| 5956 | case $file in |
| 5957 | *.lo) ;; |
| 5958 | *) |
| 5959 | $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 |
| 5960 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5961 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5962 | ;; |
| 5963 | esac |
| 5964 | done |
| 5965 | ;; |
| 5966 | esac |
| 5967 | |
| 5968 | # This variable tells wrapper scripts just to set variables rather |
| 5969 | # than running their programs. |
| 5970 | libtool_install_magic="$magic" |
| 5971 | |
| 5972 | staticlibs= |
| 5973 | future_libdirs= |
| 5974 | current_libdirs= |
| 5975 | for file in $files; do |
| 5976 | |
| 5977 | # Do each installation. |
| 5978 | case $file in |
| 5979 | *.$libext) |
| 5980 | # Do the static libraries later. |
| 5981 | staticlibs="$staticlibs $file" |
| 5982 | ;; |
| 5983 | |
| 5984 | *.la) |
| 5985 | # Check to see that this really is a libtool archive. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5986 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5987 | else |
| 5988 | $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 |
| 5989 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 5990 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 5991 | fi |
| 5992 | |
| 5993 | library_names= |
| 5994 | old_library= |
| 5995 | relink_command= |
| 5996 | # If there is no directory component, then add one. |
| 5997 | case $file in |
| 5998 | */* | *\\*) . $file ;; |
| 5999 | *) . ./$file ;; |
| 6000 | esac |
| 6001 | |
| 6002 | # Add the libdir to current_libdirs if it is the destination. |
| 6003 | if test "X$destdir" = "X$libdir"; then |
| 6004 | case "$current_libdirs " in |
| 6005 | *" $libdir "*) ;; |
| 6006 | *) current_libdirs="$current_libdirs $libdir" ;; |
| 6007 | esac |
| 6008 | else |
| 6009 | # Note the libdir as a future libdir. |
| 6010 | case "$future_libdirs " in |
| 6011 | *" $libdir "*) ;; |
| 6012 | *) future_libdirs="$future_libdirs $libdir" ;; |
| 6013 | esac |
| 6014 | fi |
| 6015 | |
| 6016 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ |
| 6017 | test "X$dir" = "X$file/" && dir= |
| 6018 | dir="$dir$objdir" |
| 6019 | |
| 6020 | if test -n "$relink_command"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6021 | # Determine the prefix the user has applied to our future dir. |
| 6022 | inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` |
| 6023 | |
| 6024 | # Don't allow the user to place us outside of our expected |
| 6025 | # location b/c this prevents finding dependent libraries that |
| 6026 | # are installed to the same prefix. |
| 6027 | # At present, this check doesn't affect windows .dll's that |
| 6028 | # are installed into $libdir/../bin (currently, that works fine) |
| 6029 | # but it's something to keep an eye on. |
| 6030 | if test "$inst_prefix_dir" = "$destdir"; then |
| 6031 | $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 |
| 6032 | exit $EXIT_FAILURE |
| 6033 | fi |
| 6034 | |
| 6035 | if test -n "$inst_prefix_dir"; then |
| 6036 | # Stick the inst_prefix_dir data into the link command. |
| 6037 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
| 6038 | else |
| 6039 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
| 6040 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6041 | |
| 6042 | $echo "$modename: warning: relinking \`$file'" 1>&2 |
| 6043 | $show "$relink_command" |
| 6044 | if $run eval "$relink_command"; then : |
| 6045 | else |
| 6046 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6047 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6048 | fi |
| 6049 | fi |
| 6050 | |
| 6051 | # See the names of the shared library. |
| 6052 | set dummy $library_names |
| 6053 | if test -n "$2"; then |
| 6054 | realname="$2" |
| 6055 | shift |
| 6056 | shift |
| 6057 | |
| 6058 | srcname="$realname" |
| 6059 | test -n "$relink_command" && srcname="$realname"T |
| 6060 | |
| 6061 | # Install the shared library and build the symlinks. |
| 6062 | $show "$install_prog $dir/$srcname $destdir/$realname" |
| 6063 | $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? |
| 6064 | if test -n "$stripme" && test -n "$striplib"; then |
| 6065 | $show "$striplib $destdir/$realname" |
| 6066 | $run eval "$striplib $destdir/$realname" || exit $? |
| 6067 | fi |
| 6068 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6069 | if test "$#" -gt 0; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6070 | # Delete the old symlinks, and create new ones. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6071 | # Try `ln -sf' first, because the `ln' binary might depend on |
| 6072 | # the symlink we replace! Solaris /bin/ln does not understand -f, |
| 6073 | # so we also need to try rm && ln -s. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6074 | for linkname |
| 6075 | do |
| 6076 | if test "$linkname" != "$realname"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6077 | $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" |
| 6078 | $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6079 | fi |
| 6080 | done |
| 6081 | fi |
| 6082 | |
| 6083 | # Do each command in the postinstall commands. |
| 6084 | lib="$destdir/$realname" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6085 | cmds=$postinstall_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6086 | save_ifs="$IFS"; IFS='~' |
| 6087 | for cmd in $cmds; do |
| 6088 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6089 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6090 | $show "$cmd" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6091 | $run eval "$cmd" || { |
| 6092 | lt_exit=$? |
| 6093 | |
| 6094 | # Restore the uninstalled library and exit |
| 6095 | if test "$mode" = relink; then |
| 6096 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' |
| 6097 | fi |
| 6098 | |
| 6099 | exit $lt_exit |
| 6100 | } |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6101 | done |
| 6102 | IFS="$save_ifs" |
| 6103 | fi |
| 6104 | |
| 6105 | # Install the pseudo-library for information purposes. |
| 6106 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 6107 | instname="$dir/$name"i |
| 6108 | $show "$install_prog $instname $destdir/$name" |
| 6109 | $run eval "$install_prog $instname $destdir/$name" || exit $? |
| 6110 | |
| 6111 | # Maybe install the static library, too. |
| 6112 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
| 6113 | ;; |
| 6114 | |
| 6115 | *.lo) |
| 6116 | # Install (i.e. copy) a libtool object. |
| 6117 | |
| 6118 | # Figure out destination file name, if it wasn't already specified. |
| 6119 | if test -n "$destname"; then |
| 6120 | destfile="$destdir/$destname" |
| 6121 | else |
| 6122 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 6123 | destfile="$destdir/$destfile" |
| 6124 | fi |
| 6125 | |
| 6126 | # Deduce the name of the destination old-style object file. |
| 6127 | case $destfile in |
| 6128 | *.lo) |
| 6129 | staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` |
| 6130 | ;; |
| 6131 | *.$objext) |
| 6132 | staticdest="$destfile" |
| 6133 | destfile= |
| 6134 | ;; |
| 6135 | *) |
| 6136 | $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 |
| 6137 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6138 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6139 | ;; |
| 6140 | esac |
| 6141 | |
| 6142 | # Install the libtool object if requested. |
| 6143 | if test -n "$destfile"; then |
| 6144 | $show "$install_prog $file $destfile" |
| 6145 | $run eval "$install_prog $file $destfile" || exit $? |
| 6146 | fi |
| 6147 | |
| 6148 | # Install the old object if enabled. |
| 6149 | if test "$build_old_libs" = yes; then |
| 6150 | # Deduce the name of the old-style object file. |
| 6151 | staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` |
| 6152 | |
| 6153 | $show "$install_prog $staticobj $staticdest" |
| 6154 | $run eval "$install_prog \$staticobj \$staticdest" || exit $? |
| 6155 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6156 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6157 | ;; |
| 6158 | |
| 6159 | *) |
| 6160 | # Figure out destination file name, if it wasn't already specified. |
| 6161 | if test -n "$destname"; then |
| 6162 | destfile="$destdir/$destname" |
| 6163 | else |
| 6164 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 6165 | destfile="$destdir/$destfile" |
| 6166 | fi |
| 6167 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6168 | # If the file is missing, and there is a .exe on the end, strip it |
| 6169 | # because it is most likely a libtool script we actually want to |
| 6170 | # install |
| 6171 | stripped_ext="" |
| 6172 | case $file in |
| 6173 | *.exe) |
| 6174 | if test ! -f "$file"; then |
| 6175 | file=`$echo $file|${SED} 's,.exe$,,'` |
| 6176 | stripped_ext=".exe" |
| 6177 | fi |
| 6178 | ;; |
| 6179 | esac |
| 6180 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6181 | # Do a test to see if this is really a libtool program. |
| 6182 | case $host in |
| 6183 | *cygwin*|*mingw*) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6184 | wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6185 | ;; |
| 6186 | *) |
| 6187 | wrapper=$file |
| 6188 | ;; |
| 6189 | esac |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6190 | if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6191 | notinst_deplibs= |
| 6192 | relink_command= |
| 6193 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6194 | # Note that it is not necessary on cygwin/mingw to append a dot to |
| 6195 | # foo even if both foo and FILE.exe exist: automatic-append-.exe |
| 6196 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
| 6197 | # `FILE.' does not work on cygwin managed mounts. |
| 6198 | # |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6199 | # If there is no directory component, then add one. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6200 | case $wrapper in |
| 6201 | */* | *\\*) . ${wrapper} ;; |
| 6202 | *) . ./${wrapper} ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6203 | esac |
| 6204 | |
| 6205 | # Check the variables that should have been set. |
| 6206 | if test -z "$notinst_deplibs"; then |
| 6207 | $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6208 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6209 | fi |
| 6210 | |
| 6211 | finalize=yes |
| 6212 | for lib in $notinst_deplibs; do |
| 6213 | # Check to see that each library is installed. |
| 6214 | libdir= |
| 6215 | if test -f "$lib"; then |
| 6216 | # If there is no directory component, then add one. |
| 6217 | case $lib in |
| 6218 | */* | *\\*) . $lib ;; |
| 6219 | *) . ./$lib ;; |
| 6220 | esac |
| 6221 | fi |
| 6222 | libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test |
| 6223 | if test -n "$libdir" && test ! -f "$libfile"; then |
| 6224 | $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 |
| 6225 | finalize=no |
| 6226 | fi |
| 6227 | done |
| 6228 | |
| 6229 | relink_command= |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6230 | # Note that it is not necessary on cygwin/mingw to append a dot to |
| 6231 | # foo even if both foo and FILE.exe exist: automatic-append-.exe |
| 6232 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
| 6233 | # `FILE.' does not work on cygwin managed mounts. |
| 6234 | # |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6235 | # If there is no directory component, then add one. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6236 | case $wrapper in |
| 6237 | */* | *\\*) . ${wrapper} ;; |
| 6238 | *) . ./${wrapper} ;; |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6239 | esac |
| 6240 | |
| 6241 | outputname= |
| 6242 | if test "$fast_install" = no && test -n "$relink_command"; then |
| 6243 | if test "$finalize" = yes && test -z "$run"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6244 | tmpdir=`func_mktempdir` |
| 6245 | file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6246 | outputname="$tmpdir/$file" |
| 6247 | # Replace the output file specification. |
| 6248 | relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` |
| 6249 | |
| 6250 | $show "$relink_command" |
| 6251 | if $run eval "$relink_command"; then : |
| 6252 | else |
| 6253 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
| 6254 | ${rm}r "$tmpdir" |
| 6255 | continue |
| 6256 | fi |
| 6257 | file="$outputname" |
| 6258 | else |
| 6259 | $echo "$modename: warning: cannot relink \`$file'" 1>&2 |
| 6260 | fi |
| 6261 | else |
| 6262 | # Install the binary that we compiled earlier. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6263 | file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6264 | fi |
| 6265 | fi |
| 6266 | |
| 6267 | # remove .exe since cygwin /usr/bin/install will append another |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6268 | # one anyway |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6269 | case $install_prog,$host in |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6270 | */usr/bin/install*,*cygwin*) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6271 | case $file:$destfile in |
| 6272 | *.exe:*.exe) |
| 6273 | # this is ok |
| 6274 | ;; |
| 6275 | *.exe:*) |
| 6276 | destfile=$destfile.exe |
| 6277 | ;; |
| 6278 | *:*.exe) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6279 | destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6280 | ;; |
| 6281 | esac |
| 6282 | ;; |
| 6283 | esac |
| 6284 | $show "$install_prog$stripme $file $destfile" |
| 6285 | $run eval "$install_prog\$stripme \$file \$destfile" || exit $? |
| 6286 | test -n "$outputname" && ${rm}r "$tmpdir" |
| 6287 | ;; |
| 6288 | esac |
| 6289 | done |
| 6290 | |
| 6291 | for file in $staticlibs; do |
| 6292 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
| 6293 | |
| 6294 | # Set up the ranlib parameters. |
| 6295 | oldlib="$destdir/$name" |
| 6296 | |
| 6297 | $show "$install_prog $file $oldlib" |
| 6298 | $run eval "$install_prog \$file \$oldlib" || exit $? |
| 6299 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6300 | if test -n "$stripme" && test -n "$old_striplib"; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6301 | $show "$old_striplib $oldlib" |
| 6302 | $run eval "$old_striplib $oldlib" || exit $? |
| 6303 | fi |
| 6304 | |
| 6305 | # Do each command in the postinstall commands. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6306 | cmds=$old_postinstall_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6307 | save_ifs="$IFS"; IFS='~' |
| 6308 | for cmd in $cmds; do |
| 6309 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6310 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6311 | $show "$cmd" |
| 6312 | $run eval "$cmd" || exit $? |
| 6313 | done |
| 6314 | IFS="$save_ifs" |
| 6315 | done |
| 6316 | |
| 6317 | if test -n "$future_libdirs"; then |
| 6318 | $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 |
| 6319 | fi |
| 6320 | |
| 6321 | if test -n "$current_libdirs"; then |
| 6322 | # Maybe just do a dry run. |
| 6323 | test -n "$run" && current_libdirs=" -n$current_libdirs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6324 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6325 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6326 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6327 | fi |
| 6328 | ;; |
| 6329 | |
| 6330 | # libtool finish mode |
| 6331 | finish) |
| 6332 | modename="$modename: finish" |
| 6333 | libdirs="$nonopt" |
| 6334 | admincmds= |
| 6335 | |
| 6336 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
| 6337 | for dir |
| 6338 | do |
| 6339 | libdirs="$libdirs $dir" |
| 6340 | done |
| 6341 | |
| 6342 | for libdir in $libdirs; do |
| 6343 | if test -n "$finish_cmds"; then |
| 6344 | # Do each command in the finish commands. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6345 | cmds=$finish_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6346 | save_ifs="$IFS"; IFS='~' |
| 6347 | for cmd in $cmds; do |
| 6348 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6349 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6350 | $show "$cmd" |
| 6351 | $run eval "$cmd" || admincmds="$admincmds |
| 6352 | $cmd" |
| 6353 | done |
| 6354 | IFS="$save_ifs" |
| 6355 | fi |
| 6356 | if test -n "$finish_eval"; then |
| 6357 | # Do the single finish_eval. |
| 6358 | eval cmds=\"$finish_eval\" |
| 6359 | $run eval "$cmds" || admincmds="$admincmds |
| 6360 | $cmds" |
| 6361 | fi |
| 6362 | done |
| 6363 | fi |
| 6364 | |
| 6365 | # Exit here if they wanted silent mode. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6366 | test "$show" = : && exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6367 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6368 | $echo "X----------------------------------------------------------------------" | $Xsed |
| 6369 | $echo "Libraries have been installed in:" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6370 | for libdir in $libdirs; do |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6371 | $echo " $libdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6372 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6373 | $echo |
| 6374 | $echo "If you ever happen to want to link against installed libraries" |
| 6375 | $echo "in a given directory, LIBDIR, you must either use libtool, and" |
| 6376 | $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
| 6377 | $echo "flag during linking and do at least one of the following:" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6378 | if test -n "$shlibpath_var"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6379 | $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
| 6380 | $echo " during execution" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6381 | fi |
| 6382 | if test -n "$runpath_var"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6383 | $echo " - add LIBDIR to the \`$runpath_var' environment variable" |
| 6384 | $echo " during linking" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6385 | fi |
| 6386 | if test -n "$hardcode_libdir_flag_spec"; then |
| 6387 | libdir=LIBDIR |
| 6388 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 6389 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6390 | $echo " - use the \`$flag' linker flag" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6391 | fi |
| 6392 | if test -n "$admincmds"; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6393 | $echo " - have your system administrator run these commands:$admincmds" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6394 | fi |
| 6395 | if test -f /etc/ld.so.conf; then |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6396 | $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6397 | fi |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6398 | $echo |
| 6399 | $echo "See any operating system documentation about shared libraries for" |
| 6400 | $echo "more information, such as the ld(1) and ld.so(8) manual pages." |
| 6401 | $echo "X----------------------------------------------------------------------" | $Xsed |
| 6402 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6403 | ;; |
| 6404 | |
| 6405 | # libtool execute mode |
| 6406 | execute) |
| 6407 | modename="$modename: execute" |
| 6408 | |
| 6409 | # The first argument is the command name. |
| 6410 | cmd="$nonopt" |
| 6411 | if test -z "$cmd"; then |
| 6412 | $echo "$modename: you must specify a COMMAND" 1>&2 |
| 6413 | $echo "$help" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6414 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6415 | fi |
| 6416 | |
| 6417 | # Handle -dlopen flags immediately. |
| 6418 | for file in $execute_dlfiles; do |
| 6419 | if test ! -f "$file"; then |
| 6420 | $echo "$modename: \`$file' is not a file" 1>&2 |
| 6421 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6422 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6423 | fi |
| 6424 | |
| 6425 | dir= |
| 6426 | case $file in |
| 6427 | *.la) |
| 6428 | # Check to see that this really is a libtool archive. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6429 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6430 | else |
| 6431 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
| 6432 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6433 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6434 | fi |
| 6435 | |
| 6436 | # Read the libtool library. |
| 6437 | dlname= |
| 6438 | library_names= |
| 6439 | |
| 6440 | # If there is no directory component, then add one. |
| 6441 | case $file in |
| 6442 | */* | *\\*) . $file ;; |
| 6443 | *) . ./$file ;; |
| 6444 | esac |
| 6445 | |
| 6446 | # Skip this library if it cannot be dlopened. |
| 6447 | if test -z "$dlname"; then |
| 6448 | # Warn if it was a shared library. |
| 6449 | test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" |
| 6450 | continue |
| 6451 | fi |
| 6452 | |
| 6453 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 6454 | test "X$dir" = "X$file" && dir=. |
| 6455 | |
| 6456 | if test -f "$dir/$objdir/$dlname"; then |
| 6457 | dir="$dir/$objdir" |
| 6458 | else |
| 6459 | $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6460 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6461 | fi |
| 6462 | ;; |
| 6463 | |
| 6464 | *.lo) |
| 6465 | # Just add the directory containing the .lo file. |
| 6466 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 6467 | test "X$dir" = "X$file" && dir=. |
| 6468 | ;; |
| 6469 | |
| 6470 | *) |
| 6471 | $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 |
| 6472 | continue |
| 6473 | ;; |
| 6474 | esac |
| 6475 | |
| 6476 | # Get the absolute pathname. |
| 6477 | absdir=`cd "$dir" && pwd` |
| 6478 | test -n "$absdir" && dir="$absdir" |
| 6479 | |
| 6480 | # Now add the directory to shlibpath_var. |
| 6481 | if eval "test -z \"\$$shlibpath_var\""; then |
| 6482 | eval "$shlibpath_var=\"\$dir\"" |
| 6483 | else |
| 6484 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
| 6485 | fi |
| 6486 | done |
| 6487 | |
| 6488 | # This variable tells wrapper scripts just to set shlibpath_var |
| 6489 | # rather than running their programs. |
| 6490 | libtool_execute_magic="$magic" |
| 6491 | |
| 6492 | # Check if any of the arguments is a wrapper script. |
| 6493 | args= |
| 6494 | for file |
| 6495 | do |
| 6496 | case $file in |
| 6497 | -*) ;; |
| 6498 | *) |
| 6499 | # Do a test to see if this is really a libtool program. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6500 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6501 | # If there is no directory component, then add one. |
| 6502 | case $file in |
| 6503 | */* | *\\*) . $file ;; |
| 6504 | *) . ./$file ;; |
| 6505 | esac |
| 6506 | |
| 6507 | # Transform arg to wrapped name. |
| 6508 | file="$progdir/$program" |
| 6509 | fi |
| 6510 | ;; |
| 6511 | esac |
| 6512 | # Quote arguments (to preserve shell metacharacters). |
| 6513 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
| 6514 | args="$args \"$file\"" |
| 6515 | done |
| 6516 | |
| 6517 | if test -z "$run"; then |
| 6518 | if test -n "$shlibpath_var"; then |
| 6519 | # Export the shlibpath_var. |
| 6520 | eval "export $shlibpath_var" |
| 6521 | fi |
| 6522 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6523 | # Restore saved environment variables |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6524 | if test "${save_LC_ALL+set}" = set; then |
| 6525 | LC_ALL="$save_LC_ALL"; export LC_ALL |
| 6526 | fi |
| 6527 | if test "${save_LANG+set}" = set; then |
| 6528 | LANG="$save_LANG"; export LANG |
| 6529 | fi |
| 6530 | |
| 6531 | # Now prepare to actually exec the command. |
| 6532 | exec_cmd="\$cmd$args" |
| 6533 | else |
| 6534 | # Display what would be done. |
| 6535 | if test -n "$shlibpath_var"; then |
| 6536 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
| 6537 | $echo "export $shlibpath_var" |
| 6538 | fi |
| 6539 | $echo "$cmd$args" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6540 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6541 | fi |
| 6542 | ;; |
| 6543 | |
| 6544 | # libtool clean and uninstall mode |
| 6545 | clean | uninstall) |
| 6546 | modename="$modename: $mode" |
| 6547 | rm="$nonopt" |
| 6548 | files= |
| 6549 | rmforce= |
| 6550 | exit_status=0 |
| 6551 | |
| 6552 | # This variable tells wrapper scripts just to set variables rather |
| 6553 | # than running their programs. |
| 6554 | libtool_install_magic="$magic" |
| 6555 | |
| 6556 | for arg |
| 6557 | do |
| 6558 | case $arg in |
| 6559 | -f) rm="$rm $arg"; rmforce=yes ;; |
| 6560 | -*) rm="$rm $arg" ;; |
| 6561 | *) files="$files $arg" ;; |
| 6562 | esac |
| 6563 | done |
| 6564 | |
| 6565 | if test -z "$rm"; then |
| 6566 | $echo "$modename: you must specify an RM program" 1>&2 |
| 6567 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6568 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6569 | fi |
| 6570 | |
| 6571 | rmdirs= |
| 6572 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6573 | origobjdir="$objdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6574 | for file in $files; do |
| 6575 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
| 6576 | if test "X$dir" = "X$file"; then |
| 6577 | dir=. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6578 | objdir="$origobjdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6579 | else |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6580 | objdir="$dir/$origobjdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6581 | fi |
| 6582 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6583 | test "$mode" = uninstall && objdir="$dir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6584 | |
| 6585 | # Remember objdir for removal later, being careful to avoid duplicates |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6586 | if test "$mode" = clean; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6587 | case " $rmdirs " in |
| 6588 | *" $objdir "*) ;; |
| 6589 | *) rmdirs="$rmdirs $objdir" ;; |
| 6590 | esac |
| 6591 | fi |
| 6592 | |
| 6593 | # Don't error if the file doesn't exist and rm -f was used. |
| 6594 | if (test -L "$file") >/dev/null 2>&1 \ |
| 6595 | || (test -h "$file") >/dev/null 2>&1 \ |
| 6596 | || test -f "$file"; then |
| 6597 | : |
| 6598 | elif test -d "$file"; then |
| 6599 | exit_status=1 |
| 6600 | continue |
| 6601 | elif test "$rmforce" = yes; then |
| 6602 | continue |
| 6603 | fi |
| 6604 | |
| 6605 | rmfiles="$file" |
| 6606 | |
| 6607 | case $name in |
| 6608 | *.la) |
| 6609 | # Possibly a libtool archive, so verify it. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6610 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6611 | . $dir/$name |
| 6612 | |
| 6613 | # Delete the libtool libraries and symlinks. |
| 6614 | for n in $library_names; do |
| 6615 | rmfiles="$rmfiles $objdir/$n" |
| 6616 | done |
| 6617 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6618 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6619 | case "$mode" in |
| 6620 | clean) |
| 6621 | case " $library_names " in |
| 6622 | # " " in the beginning catches empty $dlname |
| 6623 | *" $dlname "*) ;; |
| 6624 | *) rmfiles="$rmfiles $objdir/$dlname" ;; |
| 6625 | esac |
| 6626 | test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" |
| 6627 | ;; |
| 6628 | uninstall) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6629 | if test -n "$library_names"; then |
| 6630 | # Do each command in the postuninstall commands. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6631 | cmds=$postuninstall_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6632 | save_ifs="$IFS"; IFS='~' |
| 6633 | for cmd in $cmds; do |
| 6634 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6635 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6636 | $show "$cmd" |
| 6637 | $run eval "$cmd" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6638 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6639 | exit_status=1 |
| 6640 | fi |
| 6641 | done |
| 6642 | IFS="$save_ifs" |
| 6643 | fi |
| 6644 | |
| 6645 | if test -n "$old_library"; then |
| 6646 | # Do each command in the old_postuninstall commands. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6647 | cmds=$old_postuninstall_cmds |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6648 | save_ifs="$IFS"; IFS='~' |
| 6649 | for cmd in $cmds; do |
| 6650 | IFS="$save_ifs" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6651 | eval cmd=\"$cmd\" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6652 | $show "$cmd" |
| 6653 | $run eval "$cmd" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6654 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6655 | exit_status=1 |
| 6656 | fi |
| 6657 | done |
| 6658 | IFS="$save_ifs" |
| 6659 | fi |
| 6660 | # FIXME: should reinstall the best remaining shared library. |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6661 | ;; |
| 6662 | esac |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6663 | fi |
| 6664 | ;; |
| 6665 | |
| 6666 | *.lo) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6667 | # Possibly a libtool object, so verify it. |
| 6668 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 6669 | |
| 6670 | # Read the .lo file |
| 6671 | . $dir/$name |
| 6672 | |
| 6673 | # Add PIC object to the list of files to remove. |
| 6674 | if test -n "$pic_object" \ |
| 6675 | && test "$pic_object" != none; then |
| 6676 | rmfiles="$rmfiles $dir/$pic_object" |
| 6677 | fi |
| 6678 | |
| 6679 | # Add non-PIC object to the list of files to remove. |
| 6680 | if test -n "$non_pic_object" \ |
| 6681 | && test "$non_pic_object" != none; then |
| 6682 | rmfiles="$rmfiles $dir/$non_pic_object" |
| 6683 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6684 | fi |
| 6685 | ;; |
| 6686 | |
| 6687 | *) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6688 | if test "$mode" = clean ; then |
| 6689 | noexename=$name |
| 6690 | case $file in |
| 6691 | *.exe) |
| 6692 | file=`$echo $file|${SED} 's,.exe$,,'` |
| 6693 | noexename=`$echo $name|${SED} 's,.exe$,,'` |
| 6694 | # $file with .exe has already been added to rmfiles, |
| 6695 | # add $file without .exe |
| 6696 | rmfiles="$rmfiles $file" |
| 6697 | ;; |
| 6698 | esac |
| 6699 | # Do a test to see if this is a libtool program. |
| 6700 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 6701 | relink_command= |
| 6702 | . $dir/$noexename |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6703 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6704 | # note $name still contains .exe if it was in $file originally |
| 6705 | # as does the version of $file that was added into $rmfiles |
| 6706 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" |
| 6707 | if test "$fast_install" = yes && test -n "$relink_command"; then |
| 6708 | rmfiles="$rmfiles $objdir/lt-$name" |
| 6709 | fi |
| 6710 | if test "X$noexename" != "X$name" ; then |
| 6711 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" |
| 6712 | fi |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6713 | fi |
| 6714 | fi |
| 6715 | ;; |
| 6716 | esac |
| 6717 | $show "$rm $rmfiles" |
| 6718 | $run $rm $rmfiles || exit_status=1 |
| 6719 | done |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6720 | objdir="$origobjdir" |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6721 | |
| 6722 | # Try to remove the ${objdir}s in the directories where we deleted files |
| 6723 | for dir in $rmdirs; do |
| 6724 | if test -d "$dir"; then |
| 6725 | $show "rmdir $dir" |
| 6726 | $run rmdir $dir >/dev/null 2>&1 |
| 6727 | fi |
| 6728 | done |
| 6729 | |
| 6730 | exit $exit_status |
| 6731 | ;; |
| 6732 | |
| 6733 | "") |
| 6734 | $echo "$modename: you must specify a MODE" 1>&2 |
| 6735 | $echo "$generic_help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6736 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6737 | ;; |
| 6738 | esac |
| 6739 | |
| 6740 | if test -z "$exec_cmd"; then |
| 6741 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
| 6742 | $echo "$generic_help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6743 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6744 | fi |
| 6745 | fi # test -z "$show_help" |
| 6746 | |
| 6747 | if test -n "$exec_cmd"; then |
| 6748 | eval exec $exec_cmd |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6749 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6750 | fi |
| 6751 | |
| 6752 | # We need to display help for each of the modes. |
| 6753 | case $mode in |
| 6754 | "") $echo \ |
| 6755 | "Usage: $modename [OPTION]... [MODE-ARG]... |
| 6756 | |
| 6757 | Provide generalized library-building support services. |
| 6758 | |
| 6759 | --config show all configuration variables |
| 6760 | --debug enable verbose shell tracing |
| 6761 | -n, --dry-run display commands without modifying any files |
| 6762 | --features display basic configuration information and exit |
| 6763 | --finish same as \`--mode=finish' |
| 6764 | --help display this help message and exit |
| 6765 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] |
| 6766 | --quiet same as \`--silent' |
| 6767 | --silent don't print informational messages |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6768 | --tag=TAG use configuration variables from tag TAG |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6769 | --version print version information |
| 6770 | |
| 6771 | MODE must be one of the following: |
| 6772 | |
| 6773 | clean remove files from the build directory |
| 6774 | compile compile a source file into a libtool object |
| 6775 | execute automatically set library path, then run a program |
| 6776 | finish complete the installation of libtool libraries |
| 6777 | install install libraries or executables |
| 6778 | link create a library or an executable |
| 6779 | uninstall remove libraries from an installed directory |
| 6780 | |
| 6781 | MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6782 | a more detailed description of MODE. |
| 6783 | |
| 6784 | Report bugs to <bug-libtool@gnu.org>." |
| 6785 | exit $EXIT_SUCCESS |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6786 | ;; |
| 6787 | |
| 6788 | clean) |
| 6789 | $echo \ |
| 6790 | "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
| 6791 | |
| 6792 | Remove files from the build directory. |
| 6793 | |
| 6794 | RM is the name of the program to use to delete files associated with each FILE |
| 6795 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 6796 | to RM. |
| 6797 | |
| 6798 | If FILE is a libtool library, object or program, all the files associated |
| 6799 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
| 6800 | ;; |
| 6801 | |
| 6802 | compile) |
| 6803 | $echo \ |
| 6804 | "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
| 6805 | |
| 6806 | Compile a source file into a libtool library object. |
| 6807 | |
| 6808 | This mode accepts the following additional options: |
| 6809 | |
| 6810 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
| 6811 | -prefer-pic try to building PIC objects only |
| 6812 | -prefer-non-pic try to building non-PIC objects only |
| 6813 | -static always build a \`.o' file suitable for static linking |
| 6814 | |
| 6815 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
| 6816 | from the given SOURCEFILE. |
| 6817 | |
| 6818 | The output file name is determined by removing the directory component from |
| 6819 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
| 6820 | library object suffix, \`.lo'." |
| 6821 | ;; |
| 6822 | |
| 6823 | execute) |
| 6824 | $echo \ |
| 6825 | "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... |
| 6826 | |
| 6827 | Automatically set library path, then run a program. |
| 6828 | |
| 6829 | This mode accepts the following additional options: |
| 6830 | |
| 6831 | -dlopen FILE add the directory containing FILE to the library path |
| 6832 | |
| 6833 | This mode sets the library path environment variable according to \`-dlopen' |
| 6834 | flags. |
| 6835 | |
| 6836 | If any of the ARGS are libtool executable wrappers, then they are translated |
| 6837 | into their corresponding uninstalled binary, and any of their required library |
| 6838 | directories are added to the library path. |
| 6839 | |
| 6840 | Then, COMMAND is executed, with ARGS as arguments." |
| 6841 | ;; |
| 6842 | |
| 6843 | finish) |
| 6844 | $echo \ |
| 6845 | "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... |
| 6846 | |
| 6847 | Complete the installation of libtool libraries. |
| 6848 | |
| 6849 | Each LIBDIR is a directory that contains libtool libraries. |
| 6850 | |
| 6851 | The commands that this mode executes may require superuser privileges. Use |
| 6852 | the \`--dry-run' option if you just want to see what would be executed." |
| 6853 | ;; |
| 6854 | |
| 6855 | install) |
| 6856 | $echo \ |
| 6857 | "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... |
| 6858 | |
| 6859 | Install executables or libraries. |
| 6860 | |
| 6861 | INSTALL-COMMAND is the installation command. The first component should be |
| 6862 | either the \`install' or \`cp' program. |
| 6863 | |
| 6864 | The rest of the components are interpreted as arguments to that command (only |
| 6865 | BSD-compatible install options are recognized)." |
| 6866 | ;; |
| 6867 | |
| 6868 | link) |
| 6869 | $echo \ |
| 6870 | "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... |
| 6871 | |
| 6872 | Link object files or libraries together to form another library, or to |
| 6873 | create an executable program. |
| 6874 | |
| 6875 | LINK-COMMAND is a command using the C compiler that you would use to create |
| 6876 | a program from several object files. |
| 6877 | |
| 6878 | The following components of LINK-COMMAND are treated specially: |
| 6879 | |
| 6880 | -all-static do not do any dynamic linking at all |
| 6881 | -avoid-version do not add a version suffix if possible |
| 6882 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
| 6883 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
| 6884 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
| 6885 | -export-symbols SYMFILE |
| 6886 | try to export only the symbols listed in SYMFILE |
| 6887 | -export-symbols-regex REGEX |
| 6888 | try to export only the symbols matching REGEX |
| 6889 | -LLIBDIR search LIBDIR for required installed libraries |
| 6890 | -lNAME OUTPUT-FILE requires the installed library libNAME |
| 6891 | -module build a library that can dlopened |
| 6892 | -no-fast-install disable the fast-install mode |
| 6893 | -no-install link a not-installable executable |
| 6894 | -no-undefined declare that a library does not refer to external symbols |
| 6895 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6896 | -objectlist FILE Use a list of object files found in FILE to specify objects |
| 6897 | -precious-files-regex REGEX |
| 6898 | don't remove output files matching REGEX |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6899 | -release RELEASE specify package release information |
| 6900 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
| 6901 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
| 6902 | -static do not do any dynamic linking of libtool libraries |
| 6903 | -version-info CURRENT[:REVISION[:AGE]] |
| 6904 | specify library version info [each variable defaults to 0] |
| 6905 | |
| 6906 | All other options (arguments beginning with \`-') are ignored. |
| 6907 | |
| 6908 | Every other argument is treated as a filename. Files ending in \`.la' are |
| 6909 | treated as uninstalled libtool libraries, other files are standard or library |
| 6910 | object files. |
| 6911 | |
| 6912 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
| 6913 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
| 6914 | required, except when creating a convenience library. |
| 6915 | |
| 6916 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
| 6917 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
| 6918 | |
| 6919 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
| 6920 | is created, otherwise an executable program is created." |
| 6921 | ;; |
| 6922 | |
| 6923 | uninstall) |
| 6924 | $echo \ |
| 6925 | "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
| 6926 | |
| 6927 | Remove libraries from an installation directory. |
| 6928 | |
| 6929 | RM is the name of the program to use to delete files associated with each FILE |
| 6930 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 6931 | to RM. |
| 6932 | |
| 6933 | If FILE is a libtool library, all the files associated with it are deleted. |
| 6934 | Otherwise, only FILE itself is deleted using RM." |
| 6935 | ;; |
| 6936 | |
| 6937 | *) |
| 6938 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
| 6939 | $echo "$help" 1>&2 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6940 | exit $EXIT_FAILURE |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6941 | ;; |
| 6942 | esac |
| 6943 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6944 | $echo |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6945 | $echo "Try \`$modename --help' for more information about other modes." |
| 6946 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 6947 | exit $? |
| 6948 | |
| 6949 | # The TAGs below are defined such that we never get into a situation |
| 6950 | # in which we disable both kinds of libraries. Given conflicting |
| 6951 | # choices, we go for a static library, that is the most portable, |
| 6952 | # since we can't tell whether shared libraries were disabled because |
| 6953 | # the user asked for that or because the platform doesn't support |
| 6954 | # them. This is particularly important on AIX, because we don't |
| 6955 | # support having both static and shared libraries enabled at the same |
| 6956 | # time on that platform, so we default to a shared-only configuration. |
| 6957 | # If a disable-shared tag is given, we'll fallback to a static-only |
| 6958 | # configuration. But we'll never go from static-only to shared-only. |
| 6959 | |
| 6960 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
| 6961 | disable_libs=shared |
| 6962 | # ### END LIBTOOL TAG CONFIG: disable-shared |
| 6963 | |
| 6964 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
| 6965 | disable_libs=static |
| 6966 | # ### END LIBTOOL TAG CONFIG: disable-static |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 6967 | |
| 6968 | # Local Variables: |
| 6969 | # mode:shell-script |
| 6970 | # sh-indentation:2 |
| 6971 | # End: |