| 1 |
# ltmain.sh - Provide generalized library-building support services. |
|---|
| 2 |
# NOTE: Changing this file will not affect anything until you rerun configure. |
|---|
| 3 |
# |
|---|
| 4 |
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 |
|---|
| 5 |
# Free Software Foundation, Inc. |
|---|
| 6 |
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
|---|
| 7 |
# |
|---|
| 8 |
# This program is free software; you can redistribute it and/or modify |
|---|
| 9 |
# it under the terms of the GNU General Public License as published by |
|---|
| 10 |
# the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 |
# (at your option) any later version. |
|---|
| 12 |
# |
|---|
| 13 |
# This program is distributed in the hope that it will be useful, but |
|---|
| 14 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 |
# General Public License for more details. |
|---|
| 17 |
# |
|---|
| 18 |
# You should have received a copy of the GNU General Public License |
|---|
| 19 |
# along with this program; if not, write to the Free Software |
|---|
| 20 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 21 |
# |
|---|
| 22 |
# As a special exception to the GNU General Public License, if you |
|---|
| 23 |
# distribute this file as part of a program that contains a |
|---|
| 24 |
# configuration script generated by Autoconf, you may include it under |
|---|
| 25 |
# the same distribution terms that you use for the rest of that program. |
|---|
| 26 |
|
|---|
| 27 |
basename="s,^.*/,,g" |
|---|
| 28 |
|
|---|
| 29 |
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
|---|
| 30 |
# is ksh but when the shell is invoked as "sh" and the current value of |
|---|
| 31 |
# the _XPG environment variable is not equal to 1 (one), the special |
|---|
| 32 |
# positional parameter $0, within a function call, is the name of the |
|---|
| 33 |
# function. |
|---|
| 34 |
progpath="$0" |
|---|
| 35 |
|
|---|
| 36 |
# RH: define SED for historic ltconfig's generated by Libtool 1.3 |
|---|
| 37 |
[ -z "$SED" ] && SED=sed |
|---|
| 38 |
|
|---|
| 39 |
# The name of this program: |
|---|
| 40 |
progname=`echo "$progpath" | $SED $basename` |
|---|
| 41 |
modename="$progname" |
|---|
| 42 |
|
|---|
| 43 |
# Global variables: |
|---|
| 44 |
EXIT_SUCCESS=0 |
|---|
| 45 |
EXIT_FAILURE=1 |
|---|
| 46 |
|
|---|
| 47 |
PROGRAM=ltmain.sh |
|---|
| 48 |
PACKAGE=libtool |
|---|
| 49 |
VERSION=1.5.6 |
|---|
| 50 |
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)" |
|---|
| 51 |
EGREP="grep -E" |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
# Check that we have a working $echo. |
|---|
| 55 |
if test "X$1" = X--no-reexec; then |
|---|
| 56 |
# Discard the --no-reexec flag, and continue. |
|---|
| 57 |
shift |
|---|
| 58 |
elif test "X$1" = X--fallback-echo; then |
|---|
| 59 |
# Avoid inline document here, it may be left over |
|---|
| 60 |
: |
|---|
| 61 |
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
|---|
| 62 |
# Yippee, $echo works! |
|---|
| 63 |
: |
|---|
| 64 |
else |
|---|
| 65 |
# Restart under the correct shell, and then maybe $echo will work. |
|---|
| 66 |
exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
|---|
| 67 |
fi |
|---|
| 68 |
|
|---|
| 69 |
if test "X$1" = X--fallback-echo; then |
|---|
| 70 |
# used as fallback echo |
|---|
| 71 |
shift |
|---|
| 72 |
cat <<EOF |
|---|
| 73 |
$* |
|---|
| 74 |
EOF |
|---|
| 75 |
exit $EXIT_SUCCESS |
|---|
| 76 |
fi |
|---|
| 77 |
|
|---|
| 78 |
default_mode= |
|---|
| 79 |
help="Try \`$progname --help' for more information." |
|---|
| 80 |
magic="%%%MAGIC variable%%%" |
|---|
| 81 |
mkdir="mkdir" |
|---|
| 82 |
mv="mv -f" |
|---|
| 83 |
rm="rm -f" |
|---|
| 84 |
|
|---|
| 85 |
# Sed substitution that helps us do robust quoting. It backslashifies |
|---|
| 86 |
# metacharacters that are still active within double-quoted strings. |
|---|
| 87 |
Xsed="${SED}"' -e 1s/^X//' |
|---|
| 88 |
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
|---|
| 89 |
# test EBCDIC or ASCII |
|---|
| 90 |
case `echo A|tr A '\301'` in |
|---|
| 91 |
A) # EBCDIC based system |
|---|
| 92 |
SP2NL="tr '\100' '\n'" |
|---|
| 93 |
NL2SP="tr '\r\n' '\100\100'" |
|---|
| 94 |
;; |
|---|
| 95 |
*) # Assume ASCII based system |
|---|
| 96 |
SP2NL="tr '\040' '\012'" |
|---|
| 97 |
NL2SP="tr '\015\012' '\040\040'" |
|---|
| 98 |
;; |
|---|
| 99 |
esac |
|---|
| 100 |
|
|---|
| 101 |
# NLS nuisances. |
|---|
| 102 |
# Only set LANG and LC_ALL to C if already set. |
|---|
| 103 |
# These must not be set unconditionally because not all systems understand |
|---|
| 104 |
# e.g. LANG=C (notably SCO). |
|---|
| 105 |
# We save the old values to restore during execute mode. |
|---|
| 106 |
if test "${LC_ALL+set}" = set; then |
|---|
| 107 |
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
|---|
| 108 |
fi |
|---|
| 109 |
if test "${LANG+set}" = set; then |
|---|
| 110 |
save_LANG="$LANG"; LANG=C; export LANG |
|---|
| 111 |
fi |
|---|
| 112 |
|
|---|
| 113 |
# Make sure IFS has a sensible default |
|---|
| 114 |
: ${IFS=" |
|---|
| 115 |
"} |
|---|
| 116 |
|
|---|
| 117 |
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
|---|
| 118 |
$echo "$modename: not configured to build any kind of library" 1>&2 |
|---|
| 119 |
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
|---|
| 120 |
exit $EXIT_FAILURE |
|---|
| 121 |
fi |
|---|
| 122 |
|
|---|
| 123 |
# Global variables. |
|---|
| 124 |
mode=$default_mode |
|---|
| 125 |
nonopt= |
|---|
| 126 |
prev= |
|---|
| 127 |
prevopt= |
|---|
| 128 |
run= |
|---|
| 129 |
show="$echo" |
|---|
| 130 |
show_help= |
|---|
| 131 |
execute_dlfiles= |
|---|
| 132 |
lo2o="s/\\.lo\$/.${objext}/" |
|---|
| 133 |
o2lo="s/\\.${objext}\$/.lo/" |
|---|
| 134 |
|
|---|
| 135 |
##################################### |
|---|
| 136 |
# Shell function definitions: |
|---|
| 137 |
# This seems to be the best place for them |
|---|
| 138 |
|
|---|
| 139 |
# func_win32_libid arg |
|---|
| 140 |
# return the library type of file 'arg' |
|---|
| 141 |
# |
|---|
| 142 |
# Need a lot of goo to handle *both* DLLs and import libs |
|---|
| 143 |
# Has to be a shell function in order to 'eat' the argument |
|---|
| 144 |
# that is supplied when $file_magic_command is called. |
|---|
| 145 |
func_win32_libid () { |
|---|
| 146 |
win32_libid_type="unknown" |
|---|
| 147 |
win32_fileres=`file -L $1 2>/dev/null` |
|---|
| 148 |
case $win32_fileres in |
|---|
| 149 |
*ar\ archive\ import\ library*) # definitely import |
|---|
| 150 |
win32_libid_type="x86 archive import" |
|---|
| 151 |
;; |
|---|
| 152 |
*ar\ archive*) # could be an import, or static |
|---|
| 153 |
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ |
|---|
| 154 |
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
|---|
| 155 |
win32_nmres=`eval $NM -f posix -A $1 | \ |
|---|
| 156 |
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` |
|---|
| 157 |
if test "X$win32_nmres" = "Ximport" ; then |
|---|
| 158 |
win32_libid_type="x86 archive import" |
|---|
| 159 |
else |
|---|
| 160 |
win32_libid_type="x86 archive static" |
|---|
| 161 |
fi |
|---|
| 162 |
fi |
|---|
| 163 |
;; |
|---|
| 164 |
*DLL*) |
|---|
| 165 |
win32_libid_type="x86 DLL" |
|---|
| 166 |
;; |
|---|
| 167 |
*executable*) # but shell scripts are "executable" too... |
|---|
| 168 |
case $win32_fileres in |
|---|
| 169 |
*MS\ Windows\ PE\ Intel*) |
|---|
| 170 |
win32_libid_type="x86 DLL" |
|---|
| 171 |
;; |
|---|
| 172 |
esac |
|---|
| 173 |
;; |
|---|
| 174 |
esac |
|---|
| 175 |
$echo $win32_libid_type |
|---|
| 176 |
} |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
# func_infer_tag arg |
|---|
| 180 |
# Infer tagged configuration to use if any are available and |
|---|
| 181 |
# if one wasn't chosen via the "--tag" command line option. |
|---|
| 182 |
# Only attempt this if the compiler in the base compile |
|---|
| 183 |
# command doesn't match the default compiler. |
|---|
| 184 |
# arg is usually of the form 'gcc ...' |
|---|
| 185 |
func_infer_tag () { |
|---|
| 186 |
if test -n "$available_tags" && test -z "$tagname"; then |
|---|
| 187 |
CC_quoted= |
|---|
| 188 |
for arg in $CC; do |
|---|
| 189 |
case $arg in |
|---|
| 190 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 191 |
arg="\"$arg\"" |
|---|
| 192 |
;; |
|---|
| 193 |
esac |
|---|
| 194 |
CC_quoted="$CC_quoted $arg" |
|---|
| 195 |
done |
|---|
| 196 |
case $@ in |
|---|
| 197 |
# Blanks in the command may have been stripped by the calling shell, |
|---|
| 198 |
# but not from the CC environment variable when configure was run. |
|---|
| 199 |
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; |
|---|
| 200 |
# Blanks at the start of $base_compile will cause this to fail |
|---|
| 201 |
# if we don't check for them as well. |
|---|
| 202 |
*) |
|---|
| 203 |
for z in $available_tags; do |
|---|
| 204 |
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
|---|
| 205 |
# Evaluate the configuration. |
|---|
| 206 |
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
|---|
| 207 |
CC_quoted= |
|---|
| 208 |
for arg in $CC; do |
|---|
| 209 |
# Double-quote args containing other shell metacharacters. |
|---|
| 210 |
case $arg in |
|---|
| 211 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 212 |
arg="\"$arg\"" |
|---|
| 213 |
;; |
|---|
| 214 |
esac |
|---|
| 215 |
CC_quoted="$CC_quoted $arg" |
|---|
| 216 |
done |
|---|
| 217 |
case "$@ " in |
|---|
| 218 |
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) |
|---|
| 219 |
# The compiler in the base compile command matches |
|---|
| 220 |
# the one in the tagged configuration. |
|---|
| 221 |
# Assume this is the tagged configuration we want. |
|---|
| 222 |
tagname=$z |
|---|
| 223 |
break |
|---|
| 224 |
;; |
|---|
| 225 |
esac |
|---|
| 226 |
fi |
|---|
| 227 |
done |
|---|
| 228 |
# If $tagname still isn't set, then no tagged configuration |
|---|
| 229 |
# was found and let the user know that the "--tag" command |
|---|
| 230 |
# line option must be used. |
|---|
| 231 |
if test -z "$tagname"; then |
|---|
| 232 |
$echo "$modename: unable to infer tagged configuration" |
|---|
| 233 |
$echo "$modename: specify a tag with \`--tag'" 1>&2 |
|---|
| 234 |
exit $EXIT_FAILURE |
|---|
| 235 |
# else |
|---|
| 236 |
# $echo "$modename: using $tagname tagged configuration" |
|---|
| 237 |
fi |
|---|
| 238 |
;; |
|---|
| 239 |
esac |
|---|
| 240 |
fi |
|---|
| 241 |
} |
|---|
| 242 |
# End of Shell function definitions |
|---|
| 243 |
##################################### |
|---|
| 244 |
|
|---|
| 245 |
# Darwin sucks |
|---|
| 246 |
eval std_shrext=\"$shrext_cmds\" |
|---|
| 247 |
|
|---|
| 248 |
# Parse our command line options once, thoroughly. |
|---|
| 249 |
while test "$#" -gt 0 |
|---|
| 250 |
do |
|---|
| 251 |
arg="$1" |
|---|
| 252 |
shift |
|---|
| 253 |
|
|---|
| 254 |
case $arg in |
|---|
| 255 |
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
|---|
| 256 |
*) optarg= ;; |
|---|
| 257 |
esac |
|---|
| 258 |
|
|---|
| 259 |
# If the previous option needs an argument, assign it. |
|---|
| 260 |
if test -n "$prev"; then |
|---|
| 261 |
case $prev in |
|---|
| 262 |
execute_dlfiles) |
|---|
| 263 |
execute_dlfiles="$execute_dlfiles $arg" |
|---|
| 264 |
;; |
|---|
| 265 |
tag) |
|---|
| 266 |
tagname="$arg" |
|---|
| 267 |
preserve_args="${preserve_args}=$arg" |
|---|
| 268 |
|
|---|
| 269 |
# Check whether tagname contains only valid characters |
|---|
| 270 |
case $tagname in |
|---|
| 271 |
*[!-_A-Za-z0-9,/]*) |
|---|
| 272 |
$echo "$progname: invalid tag name: $tagname" 1>&2 |
|---|
| 273 |
exit $EXIT_FAILURE |
|---|
| 274 |
;; |
|---|
| 275 |
esac |
|---|
| 276 |
|
|---|
| 277 |
case $tagname in |
|---|
| 278 |
CC) |
|---|
| 279 |
# Don't test for the "default" C tag, as we know, it's there, but |
|---|
| 280 |
# not specially marked. |
|---|
| 281 |
;; |
|---|
| 282 |
*) |
|---|
| 283 |
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then |
|---|
| 284 |
taglist="$taglist $tagname" |
|---|
| 285 |
# Evaluate the configuration. |
|---|
| 286 |
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" |
|---|
| 287 |
else |
|---|
| 288 |
$echo "$progname: ignoring unknown tag $tagname" 1>&2 |
|---|
| 289 |
fi |
|---|
| 290 |
;; |
|---|
| 291 |
esac |
|---|
| 292 |
;; |
|---|
| 293 |
*) |
|---|
| 294 |
eval "$prev=\$arg" |
|---|
| 295 |
;; |
|---|
| 296 |
esac |
|---|
| 297 |
|
|---|
| 298 |
prev= |
|---|
| 299 |
prevopt= |
|---|
| 300 |
continue |
|---|
| 301 |
fi |
|---|
| 302 |
|
|---|
| 303 |
# Have we seen a non-optional argument yet? |
|---|
| 304 |
case $arg in |
|---|
| 305 |
--help) |
|---|
| 306 |
show_help=yes |
|---|
| 307 |
;; |
|---|
| 308 |
|
|---|
| 309 |
--version) |
|---|
| 310 |
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
|---|
| 311 |
$echo |
|---|
| 312 |
$echo "Copyright (C) 2003 Free Software Foundation, Inc." |
|---|
| 313 |
$echo "This is free software; see the source for copying conditions. There is NO" |
|---|
| 314 |
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
|---|
| 315 |
exit $EXIT_SUCCESS |
|---|
| 316 |
;; |
|---|
| 317 |
|
|---|
| 318 |
--config) |
|---|
| 319 |
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath |
|---|
| 320 |
# Now print the configurations for the tags. |
|---|
| 321 |
for tagname in $taglist; do |
|---|
| 322 |
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" |
|---|
| 323 |
done |
|---|
| 324 |
exit $EXIT_SUCCESS |
|---|
| 325 |
;; |
|---|
| 326 |
|
|---|
| 327 |
--debug) |
|---|
| 328 |
$echo "$progname: enabling shell trace mode" |
|---|
| 329 |
set -x |
|---|
| 330 |
preserve_args="$preserve_args $arg" |
|---|
| 331 |
;; |
|---|
| 332 |
|
|---|
| 333 |
--dry-run | -n) |
|---|
| 334 |
run=: |
|---|
| 335 |
;; |
|---|
| 336 |
|
|---|
| 337 |
--features) |
|---|
| 338 |
$echo "host: $host" |
|---|
| 339 |
if test "$build_libtool_libs" = yes; then |
|---|
| 340 |
$echo "enable shared libraries" |
|---|
| 341 |
else |
|---|
| 342 |
$echo "disable shared libraries" |
|---|
| 343 |
fi |
|---|
| 344 |
if test "$build_old_libs" = yes; then |
|---|
| 345 |
$echo "enable static libraries" |
|---|
| 346 |
else |
|---|
| 347 |
$echo "disable static libraries" |
|---|
| 348 |
fi |
|---|
| 349 |
exit $EXIT_SUCCESS |
|---|
| 350 |
;; |
|---|
| 351 |
|
|---|
| 352 |
--finish) mode="finish" ;; |
|---|
| 353 |
|
|---|
| 354 |
--mode) prevopt="--mode" prev=mode ;; |
|---|
| 355 |
--mode=*) mode="$optarg" ;; |
|---|
| 356 |
|
|---|
| 357 |
--preserve-dup-deps) duplicate_deps="yes" ;; |
|---|
| 358 |
|
|---|
| 359 |
--quiet | --silent) |
|---|
| 360 |
show=: |
|---|
| 361 |
preserve_args="$preserve_args $arg" |
|---|
| 362 |
;; |
|---|
| 363 |
|
|---|
| 364 |
--tag) prevopt="--tag" prev=tag ;; |
|---|
| 365 |
--tag=*) |
|---|
| 366 |
set tag "$optarg" ${1+"$@"} |
|---|
| 367 |
shift |
|---|
| 368 |
prev=tag |
|---|
| 369 |
preserve_args="$preserve_args --tag" |
|---|
| 370 |
;; |
|---|
| 371 |
|
|---|
| 372 |
-dlopen) |
|---|
| 373 |
prevopt="-dlopen" |
|---|
| 374 |
prev=execute_dlfiles |
|---|
| 375 |
;; |
|---|
| 376 |
|
|---|
| 377 |
-*) |
|---|
| 378 |
$echo "$modename: unrecognized option \`$arg'" 1>&2 |
|---|
| 379 |
$echo "$help" 1>&2 |
|---|
| 380 |
exit $EXIT_FAILURE |
|---|
| 381 |
;; |
|---|
| 382 |
|
|---|
| 383 |
*) |
|---|
| 384 |
nonopt="$arg" |
|---|
| 385 |
break |
|---|
| 386 |
;; |
|---|
| 387 |
esac |
|---|
| 388 |
done |
|---|
| 389 |
|
|---|
| 390 |
if test -n "$prevopt"; then |
|---|
| 391 |
$echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
|---|
| 392 |
$echo "$help" 1>&2 |
|---|
| 393 |
exit $EXIT_FAILURE |
|---|
| 394 |
fi |
|---|
| 395 |
|
|---|
| 396 |
# If this variable is set in any of the actions, the command in it |
|---|
| 397 |
# will be execed at the end. This prevents here-documents from being |
|---|
| 398 |
# left over by shells. |
|---|
| 399 |
exec_cmd= |
|---|
| 400 |
|
|---|
| 401 |
if test -z "$show_help"; then |
|---|
| 402 |
|
|---|
| 403 |
# Infer the operation mode. |
|---|
| 404 |
if test -z "$mode"; then |
|---|
| 405 |
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
|---|
| 406 |
$echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 |
|---|
| 407 |
case $nonopt in |
|---|
| 408 |
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
|---|
| 409 |
mode=link |
|---|
| 410 |
for arg |
|---|
| 411 |
do |
|---|
| 412 |
case $arg in |
|---|
| 413 |
-c) |
|---|
| 414 |
mode=compile |
|---|
| 415 |
break |
|---|
| 416 |
;; |
|---|
| 417 |
esac |
|---|
| 418 |
done |
|---|
| 419 |
;; |
|---|
| 420 |
*db | *dbx | *strace | *truss) |
|---|
| 421 |
mode=execute |
|---|
| 422 |
;; |
|---|
| 423 |
*install*|cp|mv) |
|---|
| 424 |
mode=install |
|---|
| 425 |
;; |
|---|
| 426 |
*rm) |
|---|
| 427 |
mode=uninstall |
|---|
| 428 |
;; |
|---|
| 429 |
*) |
|---|
| 430 |
# If we have no mode, but dlfiles were specified, then do execute mode. |
|---|
| 431 |
test -n "$execute_dlfiles" && mode=execute |
|---|
| 432 |
|
|---|
| 433 |
# Just use the default operation mode. |
|---|
| 434 |
if test -z "$mode"; then |
|---|
| 435 |
if test -n "$nonopt"; then |
|---|
| 436 |
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
|---|
| 437 |
else |
|---|
| 438 |
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
|---|
| 439 |
fi |
|---|
| 440 |
fi |
|---|
| 441 |
;; |
|---|
| 442 |
esac |
|---|
| 443 |
fi |
|---|
| 444 |
|
|---|
| 445 |
# Only execute mode is allowed to have -dlopen flags. |
|---|
| 446 |
if test -n "$execute_dlfiles" && test "$mode" != execute; then |
|---|
| 447 |
$echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
|---|
| 448 |
$echo "$help" 1>&2 |
|---|
| 449 |
exit $EXIT_FAILURE |
|---|
| 450 |
fi |
|---|
| 451 |
|
|---|
| 452 |
# Change the help message to a mode-specific one. |
|---|
| 453 |
generic_help="$help" |
|---|
| 454 |
help="Try \`$modename --help --mode=$mode' for more information." |
|---|
| 455 |
|
|---|
| 456 |
# These modes are in order of execution frequency so that they run quickly. |
|---|
| 457 |
case $mode in |
|---|
| 458 |
# libtool compile mode |
|---|
| 459 |
compile) |
|---|
| 460 |
modename="$modename: compile" |
|---|
| 461 |
# Get the compilation command and the source file. |
|---|
| 462 |
base_compile= |
|---|
| 463 |
srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
|---|
| 464 |
suppress_opt=yes |
|---|
| 465 |
suppress_output= |
|---|
| 466 |
arg_mode=normal |
|---|
| 467 |
libobj= |
|---|
| 468 |
later= |
|---|
| 469 |
|
|---|
| 470 |
for arg |
|---|
| 471 |
do |
|---|
| 472 |
case "$arg_mode" in |
|---|
| 473 |
arg ) |
|---|
| 474 |
# do not "continue". Instead, add this to base_compile |
|---|
| 475 |
lastarg="$arg" |
|---|
| 476 |
arg_mode=normal |
|---|
| 477 |
;; |
|---|
| 478 |
|
|---|
| 479 |
target ) |
|---|
| 480 |
libobj="$arg" |
|---|
| 481 |
arg_mode=normal |
|---|
| 482 |
continue |
|---|
| 483 |
;; |
|---|
| 484 |
|
|---|
| 485 |
normal ) |
|---|
| 486 |
# Accept any command-line options. |
|---|
| 487 |
case $arg in |
|---|
| 488 |
-o) |
|---|
| 489 |
if test -n "$libobj" ; then |
|---|
| 490 |
$echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
|---|
| 491 |
exit $EXIT_FAILURE |
|---|
| 492 |
fi |
|---|
| 493 |
arg_mode=target |
|---|
| 494 |
continue |
|---|
| 495 |
;; |
|---|
| 496 |
|
|---|
| 497 |
-static | -prefer-pic | -prefer-non-pic) |
|---|
| 498 |
later="$later $arg" |
|---|
| 499 |
continue |
|---|
| 500 |
;; |
|---|
| 501 |
|
|---|
| 502 |
-no-suppress) |
|---|
| 503 |
suppress_opt=no |
|---|
| 504 |
continue |
|---|
| 505 |
;; |
|---|
| 506 |
|
|---|
| 507 |
-Xcompiler) |
|---|
| 508 |
arg_mode=arg # the next one goes into the "base_compile" arg list |
|---|
| 509 |
continue # The current "srcfile" will either be retained or |
|---|
| 510 |
;; # replaced later. I would guess that would be a bug. |
|---|
| 511 |
|
|---|
| 512 |
-Wc,*) |
|---|
| 513 |
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
|---|
| 514 |
lastarg= |
|---|
| 515 |
save_ifs="$IFS"; IFS=',' |
|---|
| 516 |
for arg in $args; do |
|---|
| 517 |
IFS="$save_ifs" |
|---|
| 518 |
|
|---|
| 519 |
# Double-quote args containing other shell metacharacters. |
|---|
| 520 |
# Many Bourne shells cannot handle close brackets correctly |
|---|
| 521 |
# in scan sets, so we specify it separately. |
|---|
| 522 |
case $arg in |
|---|
| 523 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 524 |
arg="\"$arg\"" |
|---|
| 525 |
;; |
|---|
| 526 |
esac |
|---|
| 527 |
lastarg="$lastarg $arg" |
|---|
| 528 |
done |
|---|
| 529 |
IFS="$save_ifs" |
|---|
| 530 |
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
|---|
| 531 |
|
|---|
| 532 |
# Add the arguments to base_compile. |
|---|
| 533 |
base_compile="$base_compile $lastarg" |
|---|
| 534 |
continue |
|---|
| 535 |
;; |
|---|
| 536 |
|
|---|
| 537 |
* ) |
|---|
| 538 |
# Accept the current argument as the source file. |
|---|
| 539 |
# The previous "srcfile" becomes the current argument. |
|---|
| 540 |
# |
|---|
| 541 |
lastarg="$srcfile" |
|---|
| 542 |
srcfile="$arg" |
|---|
| 543 |
;; |
|---|
| 544 |
esac # case $arg |
|---|
| 545 |
;; |
|---|
| 546 |
esac # case $arg_mode |
|---|
| 547 |
|
|---|
| 548 |
# Aesthetically quote the previous argument. |
|---|
| 549 |
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
|---|
| 550 |
|
|---|
| 551 |
case $lastarg in |
|---|
| 552 |
# Double-quote args containing other shell metacharacters. |
|---|
| 553 |
# Many Bourne shells cannot handle close brackets correctly |
|---|
| 554 |
# in scan sets, so we specify it separately. |
|---|
| 555 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 556 |
lastarg="\"$lastarg\"" |
|---|
| 557 |
;; |
|---|
| 558 |
esac |
|---|
| 559 |
|
|---|
| 560 |
base_compile="$base_compile $lastarg" |
|---|
| 561 |
done # for arg |
|---|
| 562 |
|
|---|
| 563 |
case $arg_mode in |
|---|
| 564 |
arg) |
|---|
| 565 |
$echo "$modename: you must specify an argument for -Xcompile" |
|---|
| 566 |
exit $EXIT_FAILURE |
|---|
| 567 |
;; |
|---|
| 568 |
target) |
|---|
| 569 |
$echo "$modename: you must specify a target with \`-o'" 1>&2 |
|---|
| 570 |
exit $EXIT_FAILURE |
|---|
| 571 |
;; |
|---|
| 572 |
*) |
|---|
| 573 |
# Get the name of the library object. |
|---|
| 574 |
[ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
|---|
| 575 |
;; |
|---|
| 576 |
esac |
|---|
| 577 |
|
|---|
| 578 |
# Recognize several different file suffixes. |
|---|
| 579 |
# If the user specifies -o file.o, it is replaced with file.lo |
|---|
| 580 |
xform='[cCFSifmso]' |
|---|
| 581 |
case $libobj in |
|---|
| 582 |
*.ada) xform=ada ;; |
|---|
| 583 |
*.adb) xform=adb ;; |
|---|
| 584 |
*.ads) xform=ads ;; |
|---|
| 585 |
*.asm) xform=asm ;; |
|---|
| 586 |
*.c++) xform=c++ ;; |
|---|
| 587 |
*.cc) xform=cc ;; |
|---|
| 588 |
*.ii) xform=ii ;; |
|---|
| 589 |
*.class) xform=class ;; |
|---|
| 590 |
*.cpp) xform=cpp ;; |
|---|
| 591 |
*.cxx) xform=cxx ;; |
|---|
| 592 |
*.f90) xform=f90 ;; |
|---|
| 593 |
*.for) xform=for ;; |
|---|
| 594 |
*.java) xform=java ;; |
|---|
| 595 |
esac |
|---|
| 596 |
|
|---|
| 597 |
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
|---|
| 598 |
|
|---|
| 599 |
case $libobj in |
|---|
| 600 |
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
|---|
| 601 |
*) |
|---|
| 602 |
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
|---|
| 603 |
exit $EXIT_FAILURE |
|---|
| 604 |
;; |
|---|
| 605 |
esac |
|---|
| 606 |
|
|---|
| 607 |
func_infer_tag $base_compile |
|---|
| 608 |
|
|---|
| 609 |
for arg in $later; do |
|---|
| 610 |
case $arg in |
|---|
| 611 |
-static) |
|---|
| 612 |
build_old_libs=yes |
|---|
| 613 |
continue |
|---|
| 614 |
;; |
|---|
| 615 |
|
|---|
| 616 |
-prefer-pic) |
|---|
| 617 |
pic_mode=yes |
|---|
| 618 |
continue |
|---|
| 619 |
;; |
|---|
| 620 |
|
|---|
| 621 |
-prefer-non-pic) |
|---|
| 622 |
pic_mode=no |
|---|
| 623 |
continue |
|---|
| 624 |
;; |
|---|
| 625 |
esac |
|---|
| 626 |
done |
|---|
| 627 |
|
|---|
| 628 |
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
|---|
| 629 |
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 630 |
if test "X$xdir" = "X$obj"; then |
|---|
| 631 |
xdir= |
|---|
| 632 |
else |
|---|
| 633 |
xdir=$xdir/ |
|---|
| 634 |
fi |
|---|
| 635 |
lobj=${xdir}$objdir/$objname |
|---|
| 636 |
|
|---|
| 637 |
if test -z "$base_compile"; then |
|---|
| 638 |
$echo "$modename: you must specify a compilation command" 1>&2 |
|---|
| 639 |
$echo "$help" 1>&2 |
|---|
| 640 |
exit $EXIT_FAILURE |
|---|
| 641 |
fi |
|---|
| 642 |
|
|---|
| 643 |
# Delete any leftover library objects. |
|---|
| 644 |
if test "$build_old_libs" = yes; then |
|---|
| 645 |
removelist="$obj $lobj $libobj ${libobj}T" |
|---|
| 646 |
else |
|---|
| 647 |
removelist="$lobj $libobj ${libobj}T" |
|---|
| 648 |
fi |
|---|
| 649 |
|
|---|
| 650 |
$run $rm $removelist |
|---|
| 651 |
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
|---|
| 652 |
|
|---|
| 653 |
# On Cygwin there's no "real" PIC flag so we must build both object types |
|---|
| 654 |
case $host_os in |
|---|
| 655 |
cygwin* | mingw* | pw32* | os2*) |
|---|
| 656 |
pic_mode=default |
|---|
| 657 |
;; |
|---|
| 658 |
esac |
|---|
| 659 |
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
|---|
| 660 |
# non-PIC code in shared libraries is not supported |
|---|
| 661 |
pic_mode=default |
|---|
| 662 |
fi |
|---|
| 663 |
|
|---|
| 664 |
# Calculate the filename of the output object if compiler does |
|---|
| 665 |
# not support -o with -c |
|---|
| 666 |
if test "$compiler_c_o" = no; then |
|---|
| 667 |
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
|---|
| 668 |
lockfile="$output_obj.lock" |
|---|
| 669 |
removelist="$removelist $output_obj $lockfile" |
|---|
| 670 |
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
|---|
| 671 |
else |
|---|
| 672 |
output_obj= |
|---|
| 673 |
need_locks=no |
|---|
| 674 |
lockfile= |
|---|
| 675 |
fi |
|---|
| 676 |
|
|---|
| 677 |
# Lock this critical section if it is needed |
|---|
| 678 |
# We use this script file to make the link, it avoids creating a new file |
|---|
| 679 |
if test "$need_locks" = yes; then |
|---|
| 680 |
until $run ln "$progpath" "$lockfile" 2>/dev/null; do |
|---|
| 681 |
$show "Waiting for $lockfile to be removed" |
|---|
| 682 |
sleep 2 |
|---|
| 683 |
done |
|---|
| 684 |
elif test "$need_locks" = warn; then |
|---|
| 685 |
if test -f "$lockfile"; then |
|---|
| 686 |
$echo "\ |
|---|
| 687 |
*** ERROR, $lockfile exists and contains: |
|---|
| 688 |
`cat $lockfile 2>/dev/null` |
|---|
| 689 |
|
|---|
| 690 |
This indicates that another process is trying to use the same |
|---|
| 691 |
temporary object file, and libtool could not work around it because |
|---|
| 692 |
your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 693 |
repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 694 |
avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 695 |
compiler." |
|---|
| 696 |
|
|---|
| 697 |
$run $rm $removelist |
|---|
| 698 |
exit $EXIT_FAILURE |
|---|
| 699 |
fi |
|---|
| 700 |
$echo $srcfile > "$lockfile" |
|---|
| 701 |
fi |
|---|
| 702 |
|
|---|
| 703 |
if test -n "$fix_srcfile_path"; then |
|---|
| 704 |
eval srcfile=\"$fix_srcfile_path\" |
|---|
| 705 |
fi |
|---|
| 706 |
|
|---|
| 707 |
$run $rm "$libobj" "${libobj}T" |
|---|
| 708 |
|
|---|
| 709 |
# Create a libtool object file (analogous to a ".la" file), |
|---|
| 710 |
# but don't create it if we're doing a dry run. |
|---|
| 711 |
test -z "$run" && cat > ${libobj}T <<EOF |
|---|
| 712 |
# $libobj - a libtool object file |
|---|
| 713 |
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
|---|
| 714 |
# |
|---|
| 715 |
# Please DO NOT delete this file! |
|---|
| 716 |
# It is necessary for linking the library. |
|---|
| 717 |
|
|---|
| 718 |
# Name of the PIC object. |
|---|
| 719 |
EOF |
|---|
| 720 |
|
|---|
| 721 |
# Only build a PIC object if we are building libtool libraries. |
|---|
| 722 |
if test "$build_libtool_libs" = yes; then |
|---|
| 723 |
# Without this assignment, base_compile gets emptied. |
|---|
| 724 |
fbsd_hideous_sh_bug=$base_compile |
|---|
| 725 |
|
|---|
| 726 |
if test "$pic_mode" != no; then |
|---|
| 727 |
command="$base_compile $srcfile $pic_flag" |
|---|
| 728 |
else |
|---|
| 729 |
# Don't build PIC code |
|---|
| 730 |
command="$base_compile $srcfile" |
|---|
| 731 |
fi |
|---|
| 732 |
|
|---|
| 733 |
if test ! -d "${xdir}$objdir"; then |
|---|
| 734 |
$show "$mkdir ${xdir}$objdir" |
|---|
| 735 |
$run $mkdir ${xdir}$objdir |
|---|
| 736 |
status=$? |
|---|
| 737 |
if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then |
|---|
| 738 |
exit $status |
|---|
| 739 |
fi |
|---|
| 740 |
fi |
|---|
| 741 |
|
|---|
| 742 |
if test -z "$output_obj"; then |
|---|
| 743 |
# Place PIC objects in $objdir |
|---|
| 744 |
command="$command -o $lobj" |
|---|
| 745 |
fi |
|---|
| 746 |
|
|---|
| 747 |
$run $rm "$lobj" "$output_obj" |
|---|
| 748 |
|
|---|
| 749 |
$show "$command" |
|---|
| 750 |
if $run eval "$command"; then : |
|---|
| 751 |
else |
|---|
| 752 |
test -n "$output_obj" && $run $rm $removelist |
|---|
| 753 |
exit $EXIT_FAILURE |
|---|
| 754 |
fi |
|---|
| 755 |
|
|---|
| 756 |
if test "$need_locks" = warn && |
|---|
| 757 |
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|---|
| 758 |
$echo "\ |
|---|
| 759 |
*** ERROR, $lockfile contains: |
|---|
| 760 |
`cat $lockfile 2>/dev/null` |
|---|
| 761 |
|
|---|
| 762 |
but it should contain: |
|---|
| 763 |
$srcfile |
|---|
| 764 |
|
|---|
| 765 |
This indicates that another process is trying to use the same |
|---|
| 766 |
temporary object file, and libtool could not work around it because |
|---|
| 767 |
your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 768 |
repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 769 |
avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 770 |
compiler." |
|---|
| 771 |
|
|---|
| 772 |
$run $rm $removelist |
|---|
| 773 |
exit $EXIT_FAILURE |
|---|
| 774 |
fi |
|---|
| 775 |
|
|---|
| 776 |
# Just move the object if needed, then go on to compile the next one |
|---|
| 777 |
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
|---|
| 778 |
$show "$mv $output_obj $lobj" |
|---|
| 779 |
if $run $mv $output_obj $lobj; then : |
|---|
| 780 |
else |
|---|
| 781 |
error=$? |
|---|
| 782 |
$run $rm $removelist |
|---|
| 783 |
exit $error |
|---|
| 784 |
fi |
|---|
| 785 |
fi |
|---|
| 786 |
|
|---|
| 787 |
# Append the name of the PIC object to the libtool object file. |
|---|
| 788 |
test -z "$run" && cat >> ${libobj}T <<EOF |
|---|
| 789 |
pic_object='$objdir/$objname' |
|---|
| 790 |
|
|---|
| 791 |
EOF |
|---|
| 792 |
|
|---|
| 793 |
# Allow error messages only from the first compilation. |
|---|
| 794 |
if test "$suppress_opt" = yes; then |
|---|
| 795 |
suppress_output=' >/dev/null 2>&1' |
|---|
| 796 |
fi |
|---|
| 797 |
else |
|---|
| 798 |
# No PIC object so indicate it doesn't exist in the libtool |
|---|
| 799 |
# object file. |
|---|
| 800 |
test -z "$run" && cat >> ${libobj}T <<EOF |
|---|
| 801 |
pic_object=none |
|---|
| 802 |
|
|---|
| 803 |
EOF |
|---|
| 804 |
fi |
|---|
| 805 |
|
|---|
| 806 |
# Only build a position-dependent object if we build old libraries. |
|---|
| 807 |
if test "$build_old_libs" = yes; then |
|---|
| 808 |
if test "$pic_mode" != yes; then |
|---|
| 809 |
# Don't build PIC code |
|---|
| 810 |
command="$base_compile $srcfile" |
|---|
| 811 |
else |
|---|
| 812 |
command="$base_compile $srcfile $pic_flag" |
|---|
| 813 |
fi |
|---|
| 814 |
if test "$compiler_c_o" = yes; then |
|---|
| 815 |
command="$command -o $obj" |
|---|
| 816 |
fi |
|---|
| 817 |
|
|---|
| 818 |
# Suppress compiler output if we already did a PIC compilation. |
|---|
| 819 |
command="$command$suppress_output" |
|---|
| 820 |
$run $rm "$obj" "$output_obj" |
|---|
| 821 |
$show "$command" |
|---|
| 822 |
if $run eval "$command"; then : |
|---|
| 823 |
else |
|---|
| 824 |
$run $rm $removelist |
|---|
| 825 |
exit $EXIT_FAILURE |
|---|
| 826 |
fi |
|---|
| 827 |
|
|---|
| 828 |
if test "$need_locks" = warn && |
|---|
| 829 |
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|---|
| 830 |
$echo "\ |
|---|
| 831 |
*** ERROR, $lockfile contains: |
|---|
| 832 |
`cat $lockfile 2>/dev/null` |
|---|
| 833 |
|
|---|
| 834 |
but it should contain: |
|---|
| 835 |
$srcfile |
|---|
| 836 |
|
|---|
| 837 |
This indicates that another process is trying to use the same |
|---|
| 838 |
temporary object file, and libtool could not work around it because |
|---|
| 839 |
your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 840 |
repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 841 |
avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 842 |
compiler." |
|---|
| 843 |
|
|---|
| 844 |
$run $rm $removelist |
|---|
| 845 |
exit $EXIT_FAILURE |
|---|
| 846 |
fi |
|---|
| 847 |
|
|---|
| 848 |
# Just move the object if needed |
|---|
| 849 |
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
|---|
| 850 |
$show "$mv $output_obj $obj" |
|---|
| 851 |
if $run $mv $output_obj $obj; then : |
|---|
| 852 |
else |
|---|
| 853 |
error=$? |
|---|
| 854 |
$run $rm $removelist |
|---|
| 855 |
exit $error |
|---|
| 856 |
fi |
|---|
| 857 |
fi |
|---|
| 858 |
|
|---|
| 859 |
# Append the name of the non-PIC object the libtool object file. |
|---|
| 860 |
# Only append if the libtool object file exists. |
|---|
| 861 |
test -z "$run" && cat >> ${libobj}T <<EOF |
|---|
| 862 |
# Name of the non-PIC object. |
|---|
| 863 |
non_pic_object='$objname' |
|---|
| 864 |
|
|---|
| 865 |
EOF |
|---|
| 866 |
else |
|---|
| 867 |
# Append the name of the non-PIC object the libtool object file. |
|---|
| 868 |
# Only append if the libtool object file exists. |
|---|
| 869 |
test -z "$run" && cat >> ${libobj}T <<EOF |
|---|
| 870 |
# Name of the non-PIC object. |
|---|
| 871 |
non_pic_object=none |
|---|
| 872 |
|
|---|
| 873 |
EOF |
|---|
| 874 |
fi |
|---|
| 875 |
|
|---|
| 876 |
$run $mv "${libobj}T" "${libobj}" |
|---|
| 877 |
|
|---|
| 878 |
# Unlock the critical section if it was locked |
|---|
| 879 |
if test "$need_locks" != no; then |
|---|
| 880 |
$run $rm "$lockfile" |
|---|
| 881 |
fi |
|---|
| 882 |
|
|---|
| 883 |
exit $EXIT_SUCCESS |
|---|
| 884 |
;; |
|---|
| 885 |
|
|---|
| 886 |
# libtool link mode |
|---|
| 887 |
link | relink) |
|---|
| 888 |
modename="$modename: link" |
|---|
| 889 |
case $host in |
|---|
| 890 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
|---|
| 891 |
# It is impossible to link a dll without this setting, and |
|---|
| 892 |
# we shouldn't force the makefile maintainer to figure out |
|---|
| 893 |
# which system we are compiling for in order to pass an extra |
|---|
| 894 |
# flag for every libtool invocation. |
|---|
| 895 |
# allow_undefined=no |
|---|
| 896 |
|
|---|
| 897 |
# FIXME: Unfortunately, there are problems with the above when trying |
|---|
| 898 |
# to make a dll which has undefined symbols, in which case not |
|---|
| 899 |
# even a static library is built. For now, we need to specify |
|---|
| 900 |
# -no-undefined on the libtool link line when we can be certain |
|---|
| 901 |
# that all symbols are satisfied, otherwise we get a static library. |
|---|
| 902 |
allow_undefined=yes |
|---|
| 903 |
;; |
|---|
| 904 |
*) |
|---|
| 905 |
allow_undefined=yes |
|---|
| 906 |
;; |
|---|
| 907 |
esac |
|---|
| 908 |
libtool_args="$nonopt" |
|---|
| 909 |
base_compile="$nonopt $@" |
|---|
| 910 |
compile_command="$nonopt" |
|---|
| 911 |
finalize_command="$nonopt" |
|---|
| 912 |
|
|---|
| 913 |
compile_rpath= |
|---|
| 914 |
finalize_rpath= |
|---|
| 915 |
compile_shlibpath= |
|---|
| 916 |
finalize_shlibpath= |
|---|
| 917 |
convenience= |
|---|
| 918 |
old_convenience= |
|---|
| 919 |
deplibs= |
|---|
| 920 |
old_deplibs= |
|---|
| 921 |
compiler_flags= |
|---|
| 922 |
linker_flags= |
|---|
| 923 |
dllsearchpath= |
|---|
| 924 |
lib_search_path=`pwd` |
|---|
| 925 |
inst_prefix_dir= |
|---|
| 926 |
|
|---|
| 927 |
avoid_version=no |
|---|
| 928 |
dlfiles= |
|---|
| 929 |
dlprefiles= |
|---|
| 930 |
dlself=no |
|---|
| 931 |
export_dynamic=no |
|---|
| 932 |
export_symbols= |
|---|
| 933 |
export_symbols_regex= |
|---|
| 934 |
generated= |
|---|
| 935 |
libobjs= |
|---|
| 936 |
ltlibs= |
|---|
| 937 |
module=no |
|---|
| 938 |
no_install=no |
|---|
| 939 |
objs= |
|---|
| 940 |
non_pic_objects= |
|---|
| 941 |
precious_files_regex= |
|---|
| 942 |
prefer_static_libs=no |
|---|
| 943 |
preload=no |
|---|
| 944 |
prev= |
|---|
| 945 |
prevarg= |
|---|
| 946 |
release= |
|---|
| 947 |
rpath= |
|---|
| 948 |
xrpath= |
|---|
| 949 |
perm_rpath= |
|---|
| 950 |
temp_rpath= |
|---|
| 951 |
thread_safe=no |
|---|
| 952 |
vinfo= |
|---|
| 953 |
vinfo_number=no |
|---|
| 954 |
|
|---|
| 955 |
func_infer_tag $base_compile |
|---|
| 956 |
|
|---|
| 957 |
# We need to know -static, to get the right output filenames. |
|---|
| 958 |
for arg |
|---|
| 959 |
do |
|---|
| 960 |
case $arg in |
|---|
| 961 |
-all-static | -static) |
|---|
| 962 |
if test "X$arg" = "X-all-static"; then |
|---|
| 963 |
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
|---|
| 964 |
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
|---|
| 965 |
fi |
|---|
| 966 |
if test -n "$link_static_flag"; then |
|---|
| 967 |
dlopen_self=$dlopen_self_static |
|---|
| 968 |
fi |
|---|
| 969 |
else |
|---|
| 970 |
if test -z "$pic_flag" && test -n "$link_static_flag"; then |
|---|
| 971 |
dlopen_self=$dlopen_self_static |
|---|
| 972 |
fi |
|---|
| 973 |
fi |
|---|
| 974 |
build_libtool_libs=no |
|---|
| 975 |
build_old_libs=yes |
|---|
| 976 |
prefer_static_libs=yes |
|---|
| 977 |
break |
|---|
| 978 |
;; |
|---|
| 979 |
esac |
|---|
| 980 |
done |
|---|
| 981 |
|
|---|
| 982 |
# See if our shared archives depend on static archives. |
|---|
| 983 |
test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
|---|
| 984 |
|
|---|
| 985 |
# Go through the arguments, transforming them on the way. |
|---|
| 986 |
while test "$#" -gt 0; do |
|---|
| 987 |
arg="$1" |
|---|
| 988 |
shift |
|---|
| 989 |
case $arg in |
|---|
| 990 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 991 |
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
|---|
| 992 |
;; |
|---|
| 993 |
*) qarg=$arg ;; |
|---|
| 994 |
esac |
|---|
| 995 |
libtool_args="$libtool_args $qarg" |
|---|
| 996 |
|
|---|
| 997 |
# If the previous option needs an argument, assign it. |
|---|
| 998 |
if test -n "$prev"; then |
|---|
| 999 |
case $prev in |
|---|
| 1000 |
output) |
|---|
| 1001 |
compile_command="$compile_command @OUTPUT@" |
|---|
| 1002 |
finalize_command="$finalize_command @OUTPUT@" |
|---|
| 1003 |
;; |
|---|
| 1004 |
esac |
|---|
| 1005 |
|
|---|
| 1006 |
case $prev in |
|---|
| 1007 |
dlfiles|dlprefiles) |
|---|
| 1008 |
if test "$preload" = no; then |
|---|
| 1009 |
# Add the symbol object into the linking commands. |
|---|
| 1010 |
compile_command="$compile_command @SYMFILE@" |
|---|
| 1011 |
finalize_command="$finalize_command @SYMFILE@" |
|---|
| 1012 |
preload=yes |
|---|
| 1013 |
fi |
|---|
| 1014 |
case $arg in |
|---|
| 1015 |
*.la | *.lo) ;; # We handle these cases below. |
|---|
| 1016 |
force) |
|---|
| 1017 |
if test "$dlself" = no; then |
|---|
| 1018 |
dlself=needless |
|---|
| 1019 |
export_dynamic=yes |
|---|
| 1020 |
fi |
|---|
| 1021 |
prev= |
|---|
| 1022 |
continue |
|---|
| 1023 |
;; |
|---|
| 1024 |
self) |
|---|
| 1025 |
if test "$prev" = dlprefiles; then |
|---|
| 1026 |
dlself=yes |
|---|
| 1027 |
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
|---|
| 1028 |
dlself=yes |
|---|
| 1029 |
else |
|---|
| 1030 |
dlself=needless |
|---|
| 1031 |
export_dynamic=yes |
|---|
| 1032 |
fi |
|---|
| 1033 |
prev= |
|---|
| 1034 |
continue |
|---|
| 1035 |
;; |
|---|
| 1036 |
*) |
|---|
| 1037 |
if test "$prev" = dlfiles; then |
|---|
| 1038 |
dlfiles="$dlfiles $arg" |
|---|
| 1039 |
else |
|---|
| 1040 |
dlprefiles="$dlprefiles $arg" |
|---|
| 1041 |
fi |
|---|
| 1042 |
prev= |
|---|
| 1043 |
continue |
|---|
| 1044 |
;; |
|---|
| 1045 |
esac |
|---|
| 1046 |
;; |
|---|
| 1047 |
expsyms) |
|---|
| 1048 |
export_symbols="$arg" |
|---|
| 1049 |
if test ! -f "$arg"; then |
|---|
| 1050 |
$echo "$modename: symbol file \`$arg' does not exist" |
|---|
| 1051 |
exit $EXIT_FAILURE |
|---|
| 1052 |
fi |
|---|
| 1053 |
prev= |
|---|
| 1054 |
continue |
|---|
| 1055 |
;; |
|---|
| 1056 |
expsyms_regex) |
|---|
| 1057 |
export_symbols_regex="$arg" |
|---|
| 1058 |
prev= |
|---|
| 1059 |
continue |
|---|
| 1060 |
;; |
|---|
| 1061 |
inst_prefix) |
|---|
| 1062 |
inst_prefix_dir="$arg" |
|---|
| 1063 |
prev= |
|---|
| 1064 |
continue |
|---|
| 1065 |
;; |
|---|
| 1066 |
precious_regex) |
|---|
| 1067 |
precious_files_regex="$arg" |
|---|
| 1068 |
prev= |
|---|
| 1069 |
continue |
|---|
| 1070 |
;; |
|---|
| 1071 |
release) |
|---|
| 1072 |
release="-$arg" |
|---|
| 1073 |
prev= |
|---|
| 1074 |
continue |
|---|
| 1075 |
;; |
|---|
| 1076 |
objectlist) |
|---|
| 1077 |
if test -f "$arg"; then |
|---|
| 1078 |
save_arg=$arg |
|---|
| 1079 |
moreargs= |
|---|
| 1080 |
for fil in `cat $save_arg` |
|---|
| 1081 |
do |
|---|
| 1082 |
# moreargs="$moreargs $fil" |
|---|
| 1083 |
arg=$fil |
|---|
| 1084 |
# A libtool-controlled object. |
|---|
| 1085 |
|
|---|
| 1086 |
# Check to see that this really is a libtool object. |
|---|
| 1087 |
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
|---|
| 1088 |
pic_object= |
|---|
| 1089 |
non_pic_object= |
|---|
| 1090 |
|
|---|
| 1091 |
# Read the .lo file |
|---|
| 1092 |
# If there is no directory component, then add one. |
|---|
| 1093 |
case $arg in |
|---|
| 1094 |
*/* | *\\*) . $arg ;; |
|---|
| 1095 |
*) . ./$arg ;; |
|---|
| 1096 |
esac |
|---|
| 1097 |
|
|---|
| 1098 |
if test -z "$pic_object" || \ |
|---|
| 1099 |
test -z "$non_pic_object" || |
|---|
| 1100 |
test "$pic_object" = none && \ |
|---|
| 1101 |
test "$non_pic_object" = none; then |
|---|
| 1102 |
$echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
|---|
| 1103 |
exit $EXIT_FAILURE |
|---|
| 1104 |
fi |
|---|
| 1105 |
|
|---|
| 1106 |
# Extract subdirectory from the argument. |
|---|
| 1107 |
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 1108 |
if test "X$xdir" = "X$arg"; then |
|---|
| 1109 |
xdir= |
|---|
| 1110 |
else |
|---|
| 1111 |
xdir="$xdir/" |
|---|
| 1112 |
fi |
|---|
| 1113 |
|
|---|
| 1114 |
if test "$pic_object" != none; then |
|---|
| 1115 |
# Prepend the subdirectory the object is found in. |
|---|
| 1116 |
pic_object="$xdir$pic_object" |
|---|
| 1117 |
|
|---|
| 1118 |
if test "$prev" = dlfiles; then |
|---|
| 1119 |
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
|---|
| 1120 |
dlfiles="$dlfiles $pic_object" |
|---|
| 1121 |
prev= |
|---|
| 1122 |
continue |
|---|
| 1123 |
else |
|---|
| 1124 |
# If libtool objects are unsupported, then we need to preload. |
|---|
| 1125 |
prev=dlprefiles |
|---|
| 1126 |
fi |
|---|
| 1127 |
fi |
|---|
| 1128 |
|
|---|
| 1129 |
# CHECK ME: I think I busted this. -Ossama |
|---|
| 1130 |
if test "$prev" = dlprefiles; then |
|---|
| 1131 |
# Preload the old-style object. |
|---|
| 1132 |
dlprefiles="$dlprefiles $pic_object" |
|---|
| 1133 |
prev= |
|---|
| 1134 |
fi |
|---|
| 1135 |
|
|---|
| 1136 |
# A PIC object. |
|---|
| 1137 |
libobjs="$libobjs $pic_object" |
|---|
| 1138 |
arg="$pic_object" |
|---|
| 1139 |
fi |
|---|
| 1140 |
|
|---|
| 1141 |
# Non-PIC object. |
|---|
| 1142 |
if test "$non_pic_object" != none; then |
|---|
| 1143 |
# Prepend the subdirectory the object is found in. |
|---|
| 1144 |
non_pic_object="$xdir$non_pic_object" |
|---|
| 1145 |
|
|---|
| 1146 |
# A standard non-PIC object |
|---|
| 1147 |
non_pic_objects="$non_pic_objects $non_pic_object" |
|---|
| 1148 |
if test -z "$pic_object" || test "$pic_object" = none ; then |
|---|
| 1149 |
arg="$non_pic_object" |
|---|
| 1150 |
fi |
|---|
| 1151 |
fi |
|---|
| 1152 |
else |
|---|
| 1153 |
# Only an error if not doing a dry-run. |
|---|
| 1154 |
if test -z "$run"; then |
|---|
| 1155 |
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
|---|
| 1156 |
exit $EXIT_FAILURE |
|---|
| 1157 |
else |
|---|
| 1158 |
# Dry-run case. |
|---|
| 1159 |
|
|---|
| 1160 |
# Extract subdirectory from the argument. |
|---|
| 1161 |
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 1162 |
if test "X$xdir" = "X$arg"; then |
|---|
| 1163 |
xdir= |
|---|
| 1164 |
else |
|---|
| 1165 |
xdir="$xdir/" |
|---|
| 1166 |
fi |
|---|
| 1167 |
|
|---|
| 1168 |
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
|---|
| 1169 |
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
|---|
| 1170 |
libobjs="$libobjs $pic_object" |
|---|
| 1171 |
non_pic_objects="$non_pic_objects $non_pic_object" |
|---|
| 1172 |
fi |
|---|
| 1173 |
fi |
|---|
| 1174 |
done |
|---|
| 1175 |
else |
|---|
| 1176 |
$echo "$modename: link input file \`$save_arg' does not exist" |
|---|
| 1177 |
exit $EXIT_FAILURE |
|---|
| 1178 |
fi |
|---|
| 1179 |
arg=$save_arg |
|---|
| 1180 |
prev= |
|---|
| 1181 |
continue |
|---|
| 1182 |
;; |
|---|
| 1183 |
rpath | xrpath) |
|---|
| 1184 |
&n |
|---|