comparison build-scripts/ltmain.sh @ 1361:19418e4422cb

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