ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libspf/build_tools/ltmain.sh
Revision: 1.1
Committed: Tue Nov 13 00:51:24 2007 UTC (19 years ago) by root
Content type: application/x-sh
Branch: MAIN
CVS Tags: HEAD
Log Message:
initial import of libspf-1.0.0-p5 from freebsd ports

File Contents

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