ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/ltmain.sh
Revision: 1.6
Committed: Sun May 7 12:49:27 2006 UTC (18 years ago) by root
Content type: application/x-sh
Branch: MAIN
Changes since 1.5: +219 -615 lines
Log Message:
distconf

File Contents

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