comparison ltmain.sh @ 729:dac996d69abb

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