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