Added conditional inclusion of config.h to source files
[gromacs.git] / config / ltmain.sh
blob0d3ae83eb5dd1c37052e4e1ff46832518735c721
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
47 EOF
48 exit 0
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
53 modename="$progname"
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.4e
59 TIMESTAMP=" (1.1087 2002/01/11 00:25:18)"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
75 # NLS nuisances.
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 # Make sure IFS has a sensible default
88 : ${IFS=" "}
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
93 exit 1
96 # Global variables.
97 mode=$default_mode
98 nonopt=
99 prev=
100 prevopt=
101 run=
102 show="$echo"
103 show_help=
104 execute_dlfiles=
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
108 # Parse our command line options once, thoroughly.
109 while test "$#" -gt 0
111 arg="$1"
112 shift
114 case $arg in
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
116 *) optarg= ;;
117 esac
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
121 case $prev in
122 execute_dlfiles)
123 execute_dlfiles="$execute_dlfiles $arg"
125 tag)
126 tagname="$arg"
128 # Check whether tagname contains only valid characters
129 case $tagname in
130 *[!-_A-Za-z0-9,/]*)
131 echo "$progname: invalid tag name: $tagname" 1>&2
132 exit 1
134 esac
136 case $tagname in
138 # Don't test for the "default" C tag, as we know, it's there, but
139 # not specially marked.
142 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
143 taglist="$taglist $tagname"
144 # Evaluate the configuration.
145 eval "`sed -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
146 else
147 echo "$progname: ignoring unknown tag $tagname" 1>&2
150 esac
153 eval "$prev=\$arg"
155 esac
157 prev=
158 prevopt=
159 continue
162 # Have we seen a non-optional argument yet?
163 case $arg in
164 --help)
165 show_help=yes
168 --version)
169 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
170 echo
171 echo "Copyright 1996, 1997, 1998, 1999, 2000, 2001"
172 echo "Free Software Foundation, Inc."
173 echo "This is free software; see the source for copying conditions. There is NO"
174 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
175 exit 0
178 --config)
179 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
180 # Now print the configurations for the tags.
181 for tagname in $taglist; do
182 sed -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
183 done
184 exit 0
187 --debug)
188 echo "$progname: enabling shell trace mode"
189 set -x
192 --dry-run | -n)
193 run=:
196 --features)
197 echo "host: $host"
198 if test "$build_libtool_libs" = yes; then
199 echo "enable shared libraries"
200 else
201 echo "disable shared libraries"
203 if test "$build_old_libs" = yes; then
204 echo "enable static libraries"
205 else
206 echo "disable static libraries"
208 exit 0
211 --finish) mode="finish" ;;
213 --mode) prevopt="--mode" prev=mode ;;
214 --mode=*) mode="$optarg" ;;
216 --preserve-dup-deps) duplicate_deps="yes" ;;
218 --quiet | --silent)
219 show=:
222 --tag) prevopt="--tag" prev=tag ;;
223 --tag=*)
224 set tag "$optarg" ${1+"$@"}
225 shift
226 prev=tag
229 -dlopen)
230 prevopt="-dlopen"
231 prev=execute_dlfiles
235 $echo "$modename: unrecognized option \`$arg'" 1>&2
236 $echo "$help" 1>&2
237 exit 1
241 nonopt="$arg"
242 break
244 esac
245 done
247 if test -n "$prevopt"; then
248 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
249 $echo "$help" 1>&2
250 exit 1
253 # If this variable is set in any of the actions, the command in it
254 # will be execed at the end. This prevents here-documents from being
255 # left over by shells.
256 exec_cmd=
258 if test -z "$show_help"; then
260 # Infer the operation mode.
261 if test -z "$mode"; then
262 case $nonopt in
263 *cc | *++ | gcc* | *-gcc*)
264 mode=link
265 for arg
267 case $arg in
269 mode=compile
270 break
272 esac
273 done
275 *db | *dbx | *strace | *truss)
276 mode=execute
278 *install*|cp|mv)
279 mode=install
281 *rm)
282 mode=uninstall
285 # If we have no mode, but dlfiles were specified, then do execute mode.
286 test -n "$execute_dlfiles" && mode=execute
288 # Just use the default operation mode.
289 if test -z "$mode"; then
290 if test -n "$nonopt"; then
291 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
292 else
293 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
297 esac
300 # Only execute mode is allowed to have -dlopen flags.
301 if test -n "$execute_dlfiles" && test "$mode" != execute; then
302 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
303 $echo "$help" 1>&2
304 exit 1
307 # Change the help message to a mode-specific one.
308 generic_help="$help"
309 help="Try \`$modename --help --mode=$mode' for more information."
311 # These modes are in order of execution frequency so that they run quickly.
312 case $mode in
313 # libtool compile mode
314 compile)
315 modename="$modename: compile"
316 # Get the compilation command and the source file.
317 base_compile=
318 prev=
319 lastarg=
320 srcfile="$nonopt"
321 suppress_output=
323 user_target=no
324 for arg
326 case $prev in
327 "") ;;
328 xcompiler)
329 # Aesthetically quote the previous argument.
330 prev=
331 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
333 case $arg in
334 # Double-quote args containing other shell metacharacters.
335 # Many Bourne shells cannot handle close brackets correctly
336 # in scan sets, so we specify it separately.
337 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
338 arg="\"$arg\""
340 esac
342 # Add the previous argument to base_compile.
343 if test -z "$base_compile"; then
344 base_compile="$lastarg"
345 else
346 base_compile="$base_compile $lastarg"
348 continue
350 esac
352 # Accept any command-line options.
353 case $arg in
355 if test "$user_target" != "no"; then
356 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
357 exit 1
359 user_target=next
362 -static)
363 build_old_libs=yes
364 continue
367 -prefer-pic)
368 pic_mode=yes
369 continue
372 -prefer-non-pic)
373 pic_mode=no
374 continue
377 -Xcompiler)
378 prev=xcompiler
379 continue
382 -Wc,*)
383 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
384 lastarg=
385 save_ifs="$IFS"; IFS=','
386 for arg in $args; do
387 IFS="$save_ifs"
389 # Double-quote args containing other shell metacharacters.
390 # Many Bourne shells cannot handle close brackets correctly
391 # in scan sets, so we specify it separately.
392 case $arg in
393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
394 arg="\"$arg\""
396 esac
397 lastarg="$lastarg $arg"
398 done
399 IFS="$save_ifs"
400 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
402 # Add the arguments to base_compile.
403 if test -z "$base_compile"; then
404 base_compile="$lastarg"
405 else
406 base_compile="$base_compile $lastarg"
408 continue
410 esac
412 case $user_target in
413 next)
414 # The next one is the -o target name
415 user_target=yes
416 continue
418 yes)
419 # We got the output file
420 user_target=set
421 libobj="$arg"
422 continue
424 esac
426 # Accept the current argument as the source file.
427 lastarg="$srcfile"
428 srcfile="$arg"
430 # Aesthetically quote the previous argument.
432 # Backslashify any backslashes, double quotes, and dollar signs.
433 # These are the only characters that are still specially
434 # interpreted inside of double-quoted scrings.
435 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
437 # Double-quote args containing other shell metacharacters.
438 # Many Bourne shells cannot handle close brackets correctly
439 # in scan sets, so we specify it separately.
440 case $lastarg in
441 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
442 lastarg="\"$lastarg\""
444 esac
446 # Add the previous argument to base_compile.
447 if test -z "$base_compile"; then
448 base_compile="$lastarg"
449 else
450 base_compile="$base_compile $lastarg"
452 done
454 case $user_target in
455 set)
458 # Get the name of the library object.
459 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
462 $echo "$modename: you must specify a target with \`-o'" 1>&2
463 exit 1
465 esac
467 # Recognize several different file suffixes.
468 # If the user specifies -o file.o, it is replaced with file.lo
469 xform='[cCFSifmso]'
470 case $libobj in
471 *.ada) xform=ada ;;
472 *.adb) xform=adb ;;
473 *.ads) xform=ads ;;
474 *.asm) xform=asm ;;
475 *.c++) xform=c++ ;;
476 *.cc) xform=cc ;;
477 *.ii) xform=ii ;;
478 *.class) xform=class ;;
479 *.cpp) xform=cpp ;;
480 *.cxx) xform=cxx ;;
481 *.f90) xform=f90 ;;
482 *.for) xform=for ;;
483 *.java) xform=java ;;
484 esac
486 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
488 case $libobj in
489 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
491 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
492 exit 1
494 esac
496 # Infer tagged configuration to use if any are available and
497 # if one wasn't chosen via the "--tag" command line option.
498 # Only attempt this if the compiler in the base compile
499 # command doesn't match the default compiler.
500 if test -n "$available_tags" && test -z "$tagname"; then
501 case "$base_compile " in
502 "$CC "*) ;;
503 # Blanks in the command may have been stripped by the calling shell,
504 # but not from the CC environment variable when ltconfig was run.
505 "`$echo $CC` "*) ;;
507 for z in $available_tags; do
508 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
509 # Evaluate the configuration.
510 eval "`sed -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
511 case "$base_compile " in
512 "$CC "*)
513 # The compiler in the base compile command matches
514 # the one in the tagged configuration.
515 # Assume this is the tagged configuration we want.
516 tagname=$z
517 break
519 "`$echo $CC` "*)
520 tagname=$z
521 break
523 esac
525 done
526 # If $tagname still isn't set, then no tagged configuration
527 # was found and let the user know that the "--tag" command
528 # line option must be used.
529 if test -z "$tagname"; then
530 echo "$modename: unable to infer tagged configuration"
531 echo "$modename: specify a tag with \`--tag'" 1>&2
532 exit 1
533 # else
534 # echo "$modename: using $tagname tagged configuration"
537 esac
540 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
541 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
542 if test "X$xdir" = "X$obj"; then
543 xdir=
544 else
545 xdir=$xdir/
547 lobj=${xdir}$objdir/$objname
549 if test -z "$base_compile"; then
550 $echo "$modename: you must specify a compilation command" 1>&2
551 $echo "$help" 1>&2
552 exit 1
555 # Delete any leftover library objects.
556 if test "$build_old_libs" = yes; then
557 removelist="$obj $lobj $libobj ${libobj}T"
558 else
559 removelist="$lobj $libobj ${libobj}T"
562 $run $rm $removelist
563 trap "$run $rm $removelist; exit 1" 1 2 15
565 # On Cygwin there's no "real" PIC flag so we must build both object types
566 case $host_os in
567 cygwin* | mingw* | pw32* | os2*)
568 pic_mode=default
570 esac
571 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
572 # non-PIC code in shared libraries is not supported
573 pic_mode=default
576 # Calculate the filename of the output object if compiler does
577 # not support -o with -c
578 if test "$compiler_c_o" = no; then
579 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
580 lockfile="$output_obj.lock"
581 removelist="$removelist $output_obj $lockfile"
582 trap "$run $rm $removelist; exit 1" 1 2 15
583 else
584 output_obj=
585 need_locks=no
586 lockfile=
589 # Lock this critical section if it is needed
590 # We use this script file to make the link, it avoids creating a new file
591 if test "$need_locks" = yes; then
592 until $run ln "$0" "$lockfile" 2>/dev/null; do
593 $show "Waiting for $lockfile to be removed"
594 sleep 2
595 done
596 elif test "$need_locks" = warn; then
597 if test -f "$lockfile"; then
598 echo "\
599 *** ERROR, $lockfile exists and contains:
600 `cat $lockfile 2>/dev/null`
602 This indicates that another process is trying to use the same
603 temporary object file, and libtool could not work around it because
604 your compiler does not support \`-c' and \`-o' together. If you
605 repeat this compilation, it may succeed, by chance, but you had better
606 avoid parallel builds (make -j) in this platform, or get a better
607 compiler."
609 $run $rm $removelist
610 exit 1
612 echo $srcfile > "$lockfile"
615 if test -n "$fix_srcfile_path"; then
616 eval srcfile=\"$fix_srcfile_path\"
619 $run $rm "$libobj" "${libobj}T"
621 # Create a libtool object file (analogous to a ".la" file),
622 # but don't create it if we're doing a dry run.
623 test -z "$run" && cat > ${libobj}T <<EOF
624 # $libobj - a libtool object file
625 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
627 # Please DO NOT delete this file!
628 # It is necessary for linking the library.
630 # Name of the PIC object.
633 # Only build a PIC object if we are building libtool libraries.
634 if test "$build_libtool_libs" = yes; then
635 # Without this assignment, base_compile gets emptied.
636 fbsd_hideous_sh_bug=$base_compile
638 if test "$pic_mode" != no; then
639 command="$base_compile $srcfile $pic_flag"
640 else
641 # Don't build PIC code
642 command="$base_compile $srcfile"
645 if test ! -d "${xdir}$objdir"; then
646 $show "$mkdir ${xdir}$objdir"
647 $run $mkdir ${xdir}$objdir
648 status=$?
649 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
650 exit $status
654 if test -z "$output_obj"; then
655 # Place PIC objects in $objdir
656 command="$command -o $lobj"
659 $run $rm "$lobj" "$output_obj"
661 $show "$command"
662 if $run eval "$command"; then :
663 else
664 test -n "$output_obj" && $run $rm $removelist
665 exit 1
668 if test "$need_locks" = warn &&
669 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
670 echo "\
671 *** ERROR, $lockfile contains:
672 `cat $lockfile 2>/dev/null`
674 but it should contain:
675 $srcfile
677 This indicates that another process is trying to use the same
678 temporary object file, and libtool could not work around it because
679 your compiler does not support \`-c' and \`-o' together. If you
680 repeat this compilation, it may succeed, by chance, but you had better
681 avoid parallel builds (make -j) in this platform, or get a better
682 compiler."
684 $run $rm $removelist
685 exit 1
688 # Just move the object if needed, then go on to compile the next one
689 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
690 $show "$mv $output_obj $lobj"
691 if $run $mv $output_obj $lobj; then :
692 else
693 error=$?
694 $run $rm $removelist
695 exit $error
699 # Append the name of the PIC object to the libtool object file.
700 test -z "$run" && cat >> ${libobj}T <<EOF
701 pic_object='$objdir/$objname'
705 # Allow error messages only from the first compilation.
706 suppress_output=' >/dev/null 2>&1'
707 else
708 # No PIC object so indicate it doesn't exist in the libtool
709 # object file.
710 test -z "$run" && cat >> ${libobj}T <<EOF
711 pic_object=none
716 # Only build a position-dependent object if we build old libraries.
717 if test "$build_old_libs" = yes; then
718 if test "$pic_mode" != yes; then
719 # Don't build PIC code
720 command="$base_compile $srcfile"
721 else
722 command="$base_compile $srcfile $pic_flag"
724 if test "$compiler_c_o" = yes; then
725 command="$command -o $obj"
728 # Suppress compiler output if we already did a PIC compilation.
729 command="$command$suppress_output"
730 $run $rm "$obj" "$output_obj"
731 $show "$command"
732 if $run eval "$command"; then :
733 else
734 $run $rm $removelist
735 exit 1
738 if test "$need_locks" = warn &&
739 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
740 echo "\
741 *** ERROR, $lockfile contains:
742 `cat $lockfile 2>/dev/null`
744 but it should contain:
745 $srcfile
747 This indicates that another process is trying to use the same
748 temporary object file, and libtool could not work around it because
749 your compiler does not support \`-c' and \`-o' together. If you
750 repeat this compilation, it may succeed, by chance, but you had better
751 avoid parallel builds (make -j) in this platform, or get a better
752 compiler."
754 $run $rm $removelist
755 exit 1
758 # Just move the object if needed
759 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
760 $show "$mv $output_obj $obj"
761 if $run $mv $output_obj $obj; then :
762 else
763 error=$?
764 $run $rm $removelist
765 exit $error
769 # Append the name of the non-PIC object the libtool object file.
770 # Only append if the libtool object file exists.
771 test -z "$run" && cat >> ${libobj}T <<EOF
772 # Name of the non-PIC object.
773 non_pic_object='$objname'
776 else
777 # Append the name of the non-PIC object the libtool object file.
778 # Only append if the libtool object file exists.
779 test -z "$run" && cat >> ${libobj}T <<EOF
780 # Name of the non-PIC object.
781 non_pic_object=none
786 $run $mv "${libobj}T" "${libobj}"
788 # Unlock the critical section if it was locked
789 if test "$need_locks" != no; then
790 $run $rm "$lockfile"
793 exit 0
796 # libtool link mode
797 link | relink)
798 modename="$modename: link"
799 case $host in
800 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
801 # It is impossible to link a dll without this setting, and
802 # we shouldn't force the makefile maintainer to figure out
803 # which system we are compiling for in order to pass an extra
804 # flag for every libtool invokation.
805 # allow_undefined=no
807 # FIXME: Unfortunately, there are problems with the above when trying
808 # to make a dll which has undefined symbols, in which case not
809 # even a static library is built. For now, we need to specify
810 # -no-undefined on the libtool link line when we can be certain
811 # that all symbols are satisfied, otherwise we get a static library.
812 allow_undefined=yes
815 allow_undefined=yes
817 esac
818 libtool_args="$nonopt"
819 base_compile="$nonopt"
820 compile_command="$nonopt"
821 finalize_command="$nonopt"
823 compile_rpath=
824 finalize_rpath=
825 compile_shlibpath=
826 finalize_shlibpath=
827 convenience=
828 old_convenience=
829 deplibs=
830 old_deplibs=
831 compiler_flags=
832 linker_flags=
833 dllsearchpath=
834 lib_search_path=`pwd`
836 avoid_version=no
837 dlfiles=
838 dlprefiles=
839 dlself=no
840 export_dynamic=no
841 export_symbols=
842 export_symbols_regex=
843 generated=
844 libobjs=
845 ltlibs=
846 module=no
847 no_install=no
848 objs=
849 non_pic_objects=
850 prefer_static_libs=no
851 preload=no
852 prev=
853 prevarg=
854 release=
855 rpath=
856 xrpath=
857 perm_rpath=
858 temp_rpath=
859 thread_safe=no
860 vinfo=
862 # We need to know -static, to get the right output filenames.
863 for arg
865 case $arg in
866 -all-static | -static)
867 if test "X$arg" = "X-all-static"; then
868 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
869 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
871 if test -n "$link_static_flag"; then
872 dlopen_self=$dlopen_self_static
874 else
875 if test -z "$pic_flag" && test -n "$link_static_flag"; then
876 dlopen_self=$dlopen_self_static
879 build_libtool_libs=no
880 build_old_libs=yes
881 prefer_static_libs=yes
882 break
884 esac
885 done
887 # See if our shared archives depend on static archives.
888 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
890 # Go through the arguments, transforming them on the way.
891 while test "$#" -gt 0; do
892 arg="$1"
893 base_compile="$base_compile $arg"
894 shift
895 case $arg in
896 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
897 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
899 *) qarg=$arg ;;
900 esac
901 libtool_args="$libtool_args $qarg"
903 # If the previous option needs an argument, assign it.
904 if test -n "$prev"; then
905 case $prev in
906 output)
907 compile_command="$compile_command @OUTPUT@"
908 finalize_command="$finalize_command @OUTPUT@"
910 esac
912 case $prev in
913 dlfiles|dlprefiles)
914 if test "$preload" = no; then
915 # Add the symbol object into the linking commands.
916 compile_command="$compile_command @SYMFILE@"
917 finalize_command="$finalize_command @SYMFILE@"
918 preload=yes
920 case $arg in
921 *.la | *.lo) ;; # We handle these cases below.
922 force)
923 if test "$dlself" = no; then
924 dlself=needless
925 export_dynamic=yes
927 prev=
928 continue
930 self)
931 if test "$prev" = dlprefiles; then
932 dlself=yes
933 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
934 dlself=yes
935 else
936 dlself=needless
937 export_dynamic=yes
939 prev=
940 continue
943 if test "$prev" = dlfiles; then
944 dlfiles="$dlfiles $arg"
945 else
946 dlprefiles="$dlprefiles $arg"
948 prev=
949 continue
951 esac
953 expsyms)
954 export_symbols="$arg"
955 if test ! -f "$arg"; then
956 $echo "$modename: symbol file \`$arg' does not exist"
957 exit 1
959 prev=
960 continue
962 expsyms_regex)
963 export_symbols_regex="$arg"
964 prev=
965 continue
967 release)
968 release="-$arg"
969 prev=
970 continue
972 objectlist)
973 if test -f "$arg"; then
974 save_arg=$arg
975 moreargs=
976 for fil in `cat $save_arg`
978 # moreargs="$moreargs $fil"
979 arg=$fil
980 # A libtool-controlled object.
982 # Check to see that this really is a libtool object.
983 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
984 pic_object=
985 non_pic_object=
987 # Read the .lo file
988 # If there is no directory component, then add one.
989 case $arg in
990 */* | *\\*) . $arg ;;
991 *) . ./$arg ;;
992 esac
994 if test -z "$pic_object" || \
995 test -z "$non_pic_object" ||
996 test "$pic_object" = none && \
997 test "$non_pic_object" = none; then
998 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
999 exit 1
1002 # Extract subdirectory from the argument.
1003 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1004 if test "X$xdir" = "X$arg"; then
1005 xdir=
1006 else
1007 xdir="$xdir/"
1010 if test "$pic_object" != none; then
1011 # Prepend the subdirectory the object is found in.
1012 pic_object="$xdir$pic_object"
1014 if test "$prev" = dlfiles; then
1015 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1016 dlfiles="$dlfiles $pic_object"
1017 prev=
1018 continue
1019 else
1020 # If libtool objects are unsupported, then we need to preload.
1021 prev=dlprefiles
1025 # CHECK ME: I think I busted this. -Ossama
1026 if test "$prev" = dlprefiles; then
1027 # Preload the old-style object.
1028 dlprefiles="$dlprefiles $pic_object"
1029 prev=
1032 # A PIC object.
1033 libobjs="$libobjs $pic_object"
1034 arg="$pic_object"
1037 # Non-PIC object.
1038 if test "$non_pic_object" != none; then
1039 # Prepend the subdirectory the object is found in.
1040 non_pic_object="$xdir$non_pic_object"
1042 # A standard non-PIC object
1043 non_pic_objects="$non_pic_objects $non_pic_object"
1044 if test -z "$pic_object" || test "$pic_object" = none ; then
1045 arg="$non_pic_object"
1048 else
1049 # Only an error if not doing a dry-run.
1050 if test -z "$run"; then
1051 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1052 exit 1
1053 else
1054 # Dry-run case.
1056 # Extract subdirectory from the argument.
1057 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1058 if test "X$xdir" = "X$arg"; then
1059 xdir=
1060 else
1061 xdir="$xdir/"
1064 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1065 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1066 libobjs="$libobjs $pic_object"
1067 non_pic_objects="$non_pic_objects $non_pic_object"
1070 done
1071 else
1072 $echo "$modename: link input file \`$save_arg' does not exist"
1073 exit 1
1075 arg=$save_arg
1076 prev=
1077 continue
1079 rpath | xrpath)
1080 # We need an absolute path.
1081 case $arg in
1082 [\\/]* | [A-Za-z]:[\\/]*) ;;
1084 $echo "$modename: only absolute run-paths are allowed" 1>&2
1085 exit 1
1087 esac
1088 if test "$prev" = rpath; then
1089 case "$rpath " in
1090 *" $arg "*) ;;
1091 *) rpath="$rpath $arg" ;;
1092 esac
1093 else
1094 case "$xrpath " in
1095 *" $arg "*) ;;
1096 *) xrpath="$xrpath $arg" ;;
1097 esac
1099 prev=
1100 continue
1102 xcompiler)
1103 compiler_flags="$compiler_flags $qarg"
1104 prev=
1105 compile_command="$compile_command $qarg"
1106 finalize_command="$finalize_command $qarg"
1107 continue
1109 xlinker)
1110 linker_flags="$linker_flags $qarg"
1111 compiler_flags="$compiler_flags $wl$qarg"
1112 prev=
1113 compile_command="$compile_command $wl$qarg"
1114 finalize_command="$finalize_command $wl$qarg"
1115 continue
1118 eval "$prev=\"\$arg\""
1119 prev=
1120 continue
1122 esac
1123 fi # test -n "$prev"
1125 prevarg="$arg"
1127 case $arg in
1128 -all-static)
1129 if test -n "$link_static_flag"; then
1130 compile_command="$compile_command $link_static_flag"
1131 finalize_command="$finalize_command $link_static_flag"
1133 continue
1136 -allow-undefined)
1137 # FIXME: remove this flag sometime in the future.
1138 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1139 continue
1142 -avoid-version)
1143 avoid_version=yes
1144 continue
1147 -dlopen)
1148 prev=dlfiles
1149 continue
1152 -dlpreopen)
1153 prev=dlprefiles
1154 continue
1157 -export-dynamic)
1158 export_dynamic=yes
1159 continue
1162 -export-symbols | -export-symbols-regex)
1163 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1164 $echo "$modename: more than one -exported-symbols argument is not allowed"
1165 exit 1
1167 if test "X$arg" = "X-export-symbols"; then
1168 prev=expsyms
1169 else
1170 prev=expsyms_regex
1172 continue
1175 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1176 # so, if we see these flags be careful not to treat them like -L
1177 -L[A-Z][A-Z]*:*)
1178 case $with_gcc/$host in
1179 no/*-*-irix* | /*-*-irix*)
1180 compile_command="$compile_command $arg"
1181 finalize_command="$finalize_command $arg"
1183 esac
1184 continue
1187 -L*)
1188 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1189 # We need an absolute path.
1190 case $dir in
1191 [\\/]* | [A-Za-z]:[\\/]*) ;;
1193 absdir=`cd "$dir" && pwd`
1194 if test -z "$absdir"; then
1195 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1196 exit 1
1198 dir="$absdir"
1200 esac
1201 case "$deplibs " in
1202 *" -L$dir "*) ;;
1204 deplibs="$deplibs -L$dir"
1205 lib_search_path="$lib_search_path $dir"
1207 esac
1208 case $host in
1209 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1210 case :$dllsearchpath: in
1211 *":$dir:"*) ;;
1212 *) dllsearchpath="$dllsearchpath:$dir";;
1213 esac
1215 esac
1216 continue
1219 -l*)
1220 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1221 case $host in
1222 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1223 # These systems don't actually have a C or math library (as such)
1224 continue
1226 *-*-mingw* | *-*-os2*)
1227 # These systems don't actually have a C library (as such)
1228 test "X$arg" = "X-lc" && continue
1230 *-*-openbsd* | *-*-freebsd*)
1231 # Do not include libc due to us having libc/libc_r.
1232 test "X$arg" = "X-lc" && continue
1234 *-*-rhapsody* | *-*-darwin1.[012])
1235 # Rhapsody C and math libraries are in the System framework
1236 deplibs="$deplibs -framework System"
1237 continue
1238 esac
1239 elif test "X$arg" = "X-lc_r"; then
1240 case $host in
1241 *-*-openbsd* | *-*-freebsd*)
1242 # Do not include libc_r directly, use -pthread flag.
1243 continue
1245 esac
1247 deplibs="$deplibs $arg"
1248 continue
1251 -module)
1252 module=yes
1253 continue
1256 -no-fast-install)
1257 fast_install=no
1258 continue
1261 -no-install)
1262 case $host in
1263 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1264 # The PATH hackery in wrapper scripts is required on Windows
1265 # in order for the loader to find any dlls it needs.
1266 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1267 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1268 fast_install=no
1270 *) no_install=yes ;;
1271 esac
1272 continue
1275 -no-undefined)
1276 allow_undefined=no
1277 continue
1280 -objectlist)
1281 prev=objectlist
1282 continue
1285 -o) prev=output ;;
1287 -release)
1288 prev=release
1289 continue
1292 -rpath)
1293 prev=rpath
1294 continue
1298 prev=xrpath
1299 continue
1302 -R*)
1303 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1304 # We need an absolute path.
1305 case $dir in
1306 [\\/]* | [A-Za-z]:[\\/]*) ;;
1308 $echo "$modename: only absolute run-paths are allowed" 1>&2
1309 exit 1
1311 esac
1312 case "$xrpath " in
1313 *" $dir "*) ;;
1314 *) xrpath="$xrpath $dir" ;;
1315 esac
1316 continue
1319 -static)
1320 # The effects of -static are defined in a previous loop.
1321 # We used to do the same as -all-static on platforms that
1322 # didn't have a PIC flag, but the assumption that the effects
1323 # would be equivalent was wrong. It would break on at least
1324 # Digital Unix and AIX.
1325 continue
1328 -thread-safe)
1329 thread_safe=yes
1330 continue
1333 -version-info)
1334 prev=vinfo
1335 continue
1338 -Wc,*)
1339 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1340 arg=
1341 save_ifs="$IFS"; IFS=','
1342 for flag in $args; do
1343 IFS="$save_ifs"
1344 case $flag in
1345 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1346 flag="\"$flag\""
1348 esac
1349 arg="$arg $wl$flag"
1350 compiler_flags="$compiler_flags $flag"
1351 done
1352 IFS="$save_ifs"
1353 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1356 -Wl,*)
1357 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1358 arg=
1359 save_ifs="$IFS"; IFS=','
1360 for flag in $args; do
1361 IFS="$save_ifs"
1362 case $flag in
1363 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1364 flag="\"$flag\""
1366 esac
1367 arg="$arg $wl$flag"
1368 compiler_flags="$compiler_flags $wl$flag"
1369 linker_flags="$linker_flags $flag"
1370 done
1371 IFS="$save_ifs"
1372 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1375 -Xcompiler)
1376 prev=xcompiler
1377 continue
1380 -Xlinker)
1381 prev=xlinker
1382 continue
1385 # Some other compiler flag.
1386 -* | +*)
1387 # Unknown arguments in both finalize_command and compile_command need
1388 # to be aesthetically quoted because they are evaled later.
1389 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1390 case $arg in
1391 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1392 arg="\"$arg\""
1394 esac
1397 *.$objext)
1398 # A standard object.
1399 objs="$objs $arg"
1402 *.lo)
1403 # A libtool-controlled object.
1405 # Check to see that this really is a libtool object.
1406 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1407 pic_object=
1408 non_pic_object=
1410 # Read the .lo file
1411 # If there is no directory component, then add one.
1412 case $arg in
1413 */* | *\\*) . $arg ;;
1414 *) . ./$arg ;;
1415 esac
1417 if test -z "$pic_object" || \
1418 test -z "$non_pic_object" ||
1419 test "$pic_object" = none && \
1420 test "$non_pic_object" = none; then
1421 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1422 exit 1
1425 # Extract subdirectory from the argument.
1426 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1427 if test "X$xdir" = "X$arg"; then
1428 xdir=
1429 else
1430 xdir="$xdir/"
1433 if test "$pic_object" != none; then
1434 # Prepend the subdirectory the object is found in.
1435 pic_object="$xdir$pic_object"
1437 if test "$prev" = dlfiles; then
1438 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1439 dlfiles="$dlfiles $pic_object"
1440 prev=
1441 continue
1442 else
1443 # If libtool objects are unsupported, then we need to preload.
1444 prev=dlprefiles
1448 # CHECK ME: I think I busted this. -Ossama
1449 if test "$prev" = dlprefiles; then
1450 # Preload the old-style object.
1451 dlprefiles="$dlprefiles $pic_object"
1452 prev=
1455 # A PIC object.
1456 libobjs="$libobjs $pic_object"
1457 arg="$pic_object"
1460 # Non-PIC object.
1461 if test "$non_pic_object" != none; then
1462 # Prepend the subdirectory the object is found in.
1463 non_pic_object="$xdir$non_pic_object"
1465 # A standard non-PIC object
1466 non_pic_objects="$non_pic_objects $non_pic_object"
1467 if test -z "$pic_object" || test "$pic_object" = none ; then
1468 arg="$non_pic_object"
1471 else
1472 # Only an error if not doing a dry-run.
1473 if test -z "$run"; then
1474 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1475 exit 1
1476 else
1477 # Dry-run case.
1479 # Extract subdirectory from the argument.
1480 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1481 if test "X$xdir" = "X$arg"; then
1482 xdir=
1483 else
1484 xdir="$xdir/"
1487 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1488 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1489 libobjs="$libobjs $pic_object"
1490 non_pic_objects="$non_pic_objects $non_pic_object"
1495 *.$libext)
1496 # An archive.
1497 deplibs="$deplibs $arg"
1498 old_deplibs="$old_deplibs $arg"
1499 continue
1502 *.la)
1503 # A libtool-controlled library.
1505 if test "$prev" = dlfiles; then
1506 # This library was specified with -dlopen.
1507 dlfiles="$dlfiles $arg"
1508 prev=
1509 elif test "$prev" = dlprefiles; then
1510 # The library was specified with -dlpreopen.
1511 dlprefiles="$dlprefiles $arg"
1512 prev=
1513 else
1514 deplibs="$deplibs $arg"
1516 continue
1519 # Some other compiler argument.
1521 # Unknown arguments in both finalize_command and compile_command need
1522 # to be aesthetically quoted because they are evaled later.
1523 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1524 case $arg in
1525 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1526 arg="\"$arg\""
1528 esac
1530 esac # arg
1532 # Now actually substitute the argument into the commands.
1533 if test -n "$arg"; then
1534 compile_command="$compile_command $arg"
1535 finalize_command="$finalize_command $arg"
1537 done # argument parsing loop
1539 if test -n "$prev"; then
1540 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1541 $echo "$help" 1>&2
1542 exit 1
1545 # Infer tagged configuration to use if any are available and
1546 # if one wasn't chosen via the "--tag" command line option.
1547 # Only attempt this if the compiler in the base link
1548 # command doesn't match the default compiler.
1549 if test -n "$available_tags" && test -z "$tagname"; then
1550 case $base_compile in
1551 "$CC "*) ;;
1552 # Blanks in the command may have been stripped by the calling shell,
1553 # but not from the CC environment variable when ltconfig was run.
1554 "`$echo $CC` "*) ;;
1556 for z in $available_tags; do
1557 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1558 # Evaluate the configuration.
1559 eval "`sed -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1560 case $base_compile in
1561 "$CC "*)
1562 # The compiler in $compile_command matches
1563 # the one in the tagged configuration.
1564 # Assume this is the tagged configuration we want.
1565 tagname=$z
1566 break
1568 "`$echo $CC` "*)
1569 tagname=$z
1570 break
1572 esac
1574 done
1575 # If $tagname still isn't set, then no tagged configuration
1576 # was found and let the user know that the "--tag" command
1577 # line option must be used.
1578 if test -z "$tagname"; then
1579 echo "$modename: unable to infer tagged configuration"
1580 echo "$modename: specify a tag with \`--tag'" 1>&2
1581 exit 1
1582 # else
1583 # echo "$modename: using $tagname tagged configuration"
1586 esac
1589 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1590 eval arg=\"$export_dynamic_flag_spec\"
1591 compile_command="$compile_command $arg"
1592 finalize_command="$finalize_command $arg"
1595 oldlibs=
1596 # calculate the name of the file, without its directory
1597 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1598 libobjs_save="$libobjs"
1600 if test -n "$shlibpath_var"; then
1601 # get the directories listed in $shlibpath_var
1602 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1603 else
1604 shlib_search_path=
1606 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1607 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1609 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1610 if test "X$output_objdir" = "X$output"; then
1611 output_objdir="$objdir"
1612 else
1613 output_objdir="$output_objdir/$objdir"
1615 # Create the object directory.
1616 if test ! -d "$output_objdir"; then
1617 $show "$mkdir $output_objdir"
1618 $run $mkdir $output_objdir
1619 status=$?
1620 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1621 exit $status
1625 # Determine the type of output
1626 case $output in
1628 $echo "$modename: you must specify an output file" 1>&2
1629 $echo "$help" 1>&2
1630 exit 1
1632 *.$libext) linkmode=oldlib ;;
1633 *.lo | *.$objext) linkmode=obj ;;
1634 *.la) linkmode=lib ;;
1635 *) linkmode=prog ;; # Anything else should be a program.
1636 esac
1638 specialdeplibs=
1639 libs=
1640 # Find all interdependent deplibs by searching for libraries
1641 # that are linked more than once (e.g. -la -lb -la)
1642 for deplib in $deplibs; do
1643 if test "X$duplicate_deps" = "Xyes" ; then
1644 case "$libs " in
1645 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1646 esac
1648 libs="$libs $deplib"
1649 done
1651 if test "$linkmode" = lib; then
1652 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1654 # Compute libraries that are listed more than once in $predeps
1655 # $postdeps and mark them as special (i.e., whose duplicates are
1656 # not to be eliminated).
1657 pre_post_deps=
1658 if test "X$duplicate_deps" = "Xyes" ; then
1659 for pre_post_dep in $predeps $postdeps; do
1660 case "$pre_post_deps " in
1661 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1662 esac
1663 pre_post_deps="$pre_post_deps $pre_post_dep"
1664 done
1666 pre_post_deps=
1669 deplibs=
1670 newdependency_libs=
1671 newlib_search_path=
1672 need_relink=no # whether we're linking any uninstalled libtool libraries
1673 notinst_deplibs= # not-installed libtool libraries
1674 notinst_path= # paths that contain not-installed libtool libraries
1675 case $linkmode in
1676 lib)
1677 passes="conv link"
1678 for file in $dlfiles $dlprefiles; do
1679 case $file in
1680 *.la) ;;
1682 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1683 exit 1
1685 esac
1686 done
1688 prog)
1689 compile_deplibs=
1690 finalize_deplibs=
1691 alldeplibs=no
1692 newdlfiles=
1693 newdlprefiles=
1694 passes="conv scan dlopen dlpreopen link"
1696 *) passes="conv"
1698 esac
1699 for pass in $passes; do
1700 if test "$linkmode,$pass" = "lib,link" ||
1701 test "$linkmode,$pass" = "prog,scan"; then
1702 libs="$deplibs"
1703 deplibs=
1705 if test "$linkmode" = prog; then
1706 case $pass in
1707 dlopen) libs="$dlfiles" ;;
1708 dlpreopen) libs="$dlprefiles" ;;
1709 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1710 esac
1712 if test "$pass" = dlopen; then
1713 # Collect dlpreopened libraries
1714 save_deplibs="$deplibs"
1715 deplibs=
1717 for deplib in $libs; do
1718 lib=
1719 found=no
1720 case $deplib in
1721 -l*)
1722 if test "$linkmode" != lib && test "$linkmode" != prog; then
1723 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1724 continue
1726 if test "$pass" = conv; then
1727 deplibs="$deplib $deplibs"
1728 continue
1730 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1731 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1732 # Search the libtool library
1733 lib="$searchdir/lib${name}.la"
1734 if test -f "$lib"; then
1735 found=yes
1736 break
1738 done
1739 if test "$found" != yes; then
1740 # deplib doesn't seem to be a libtool library
1741 if test "$linkmode,$pass" = "prog,link"; then
1742 compile_deplibs="$deplib $compile_deplibs"
1743 finalize_deplibs="$deplib $finalize_deplibs"
1744 else
1745 deplibs="$deplib $deplibs"
1746 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1748 continue
1750 ;; # -l
1751 -L*)
1752 case $linkmode in
1753 lib)
1754 deplibs="$deplib $deplibs"
1755 test "$pass" = conv && continue
1756 newdependency_libs="$deplib $newdependency_libs"
1757 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1759 prog)
1760 if test "$pass" = conv; then
1761 deplibs="$deplib $deplibs"
1762 continue
1764 if test "$pass" = scan; then
1765 deplibs="$deplib $deplibs"
1766 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1767 else
1768 compile_deplibs="$deplib $compile_deplibs"
1769 finalize_deplibs="$deplib $finalize_deplibs"
1773 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1775 esac # linkmode
1776 continue
1777 ;; # -L
1778 -R*)
1779 if test "$pass" = link; then
1780 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1781 # Make sure the xrpath contains only unique directories.
1782 case "$xrpath " in
1783 *" $dir "*) ;;
1784 *) xrpath="$xrpath $dir" ;;
1785 esac
1787 deplibs="$deplib $deplibs"
1788 continue
1790 *.la) lib="$deplib" ;;
1791 *.$libext)
1792 if test "$pass" = conv; then
1793 deplibs="$deplib $deplibs"
1794 continue
1796 case $linkmode in
1797 lib)
1798 if test "$deplibs_check_method" != pass_all; then
1799 echo
1800 echo "*** Warning: Trying to link with static lib archive $deplib."
1801 echo "*** I have the capability to make that library automatically link in when"
1802 echo "*** you link to this library. But I can only do this if you have a"
1803 echo "*** shared version of the library, which you do not appear to have"
1804 echo "*** because the file extensions .$libext of this argument makes me believe"
1805 echo "*** that it is just a static archive that I should not used here."
1806 else
1807 echo
1808 echo "*** Warning: Linking the shared library $output against the"
1809 echo "*** static library $deplib is not portable!"
1810 deplibs="$deplib $deplibs"
1812 continue
1814 prog)
1815 if test "$pass" != link; then
1816 deplibs="$deplib $deplibs"
1817 else
1818 compile_deplibs="$deplib $compile_deplibs"
1819 finalize_deplibs="$deplib $finalize_deplibs"
1821 continue
1823 esac # linkmode
1824 ;; # *.$libext
1825 *.lo | *.$objext)
1826 if test "$pass" = conv; then
1827 deplibs="$deplib $deplibs"
1828 elif test "$linkmode" = prog; then
1829 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1830 # If there is no dlopen support or we're linking statically,
1831 # we need to preload.
1832 newdlprefiles="$newdlprefiles $deplib"
1833 compile_deplibs="$deplib $compile_deplibs"
1834 finalize_deplibs="$deplib $finalize_deplibs"
1835 else
1836 newdlfiles="$newdlfiles $deplib"
1839 continue
1841 %DEPLIBS%)
1842 alldeplibs=yes
1843 continue
1845 esac # case $deplib
1846 if test "$found" = yes || test -f "$lib"; then :
1847 else
1848 $echo "$modename: cannot find the library \`$lib'" 1>&2
1849 exit 1
1852 # Check to see that this really is a libtool archive.
1853 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1854 else
1855 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1856 exit 1
1859 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1860 test "X$ladir" = "X$lib" && ladir="."
1862 dlname=
1863 dlopen=
1864 dlpreopen=
1865 libdir=
1866 library_names=
1867 old_library=
1868 # If the library was installed with an old release of libtool,
1869 # it will not redefine variable installed.
1870 installed=yes
1872 # Read the .la file
1873 case $lib in
1874 */* | *\\*) . $lib ;;
1875 *) . ./$lib ;;
1876 esac
1878 if test "$linkmode,$pass" = "lib,link" ||
1879 test "$linkmode,$pass" = "prog,scan" ||
1880 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1881 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1882 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1885 if test "$pass" = conv; then
1886 # Only check for convenience libraries
1887 deplibs="$lib $deplibs"
1888 if test -z "$libdir"; then
1889 if test -z "$old_library"; then
1890 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1891 exit 1
1893 # It is a libtool convenience library, so add in its objects.
1894 convenience="$convenience $ladir/$objdir/$old_library"
1895 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1896 tmp_libs=
1897 for deplib in $dependency_libs; do
1898 deplibs="$deplib $deplibs"
1899 if test "X$duplicate_deps" = "Xyes" ; then
1900 case "$tmp_libs " in
1901 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1902 esac
1904 tmp_libs="$tmp_libs $deplib"
1905 done
1906 elif test "$linkmode" != prog && test "$linkmode" != lib; then
1907 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1908 exit 1
1910 continue
1911 fi # $pass = conv
1913 # Get the name of the library we link against.
1914 linklib=
1915 for l in $old_library $library_names; do
1916 linklib="$l"
1917 done
1918 if test -z "$linklib"; then
1919 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1920 exit 1
1923 # This library was specified with -dlopen.
1924 if test "$pass" = dlopen; then
1925 if test -z "$libdir"; then
1926 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1927 exit 1
1929 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1930 # If there is no dlname, no dlopen support or we're linking
1931 # statically, we need to preload. We also need to preload any
1932 # dependent libraries so libltdl's deplib preloader doesn't
1933 # bomb out in the load deplibs phase.
1934 dlprefiles="$dlprefiles $lib $dependency_libs"
1935 else
1936 newdlfiles="$newdlfiles $lib"
1938 continue
1939 fi # $pass = dlopen
1941 # We need an absolute path.
1942 case $ladir in
1943 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1945 abs_ladir=`cd "$ladir" && pwd`
1946 if test -z "$abs_ladir"; then
1947 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1948 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1949 abs_ladir="$ladir"
1952 esac
1953 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1955 # Find the relevant object directory and library name.
1956 if test "X$installed" = Xyes; then
1957 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1958 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1959 dir="$ladir"
1960 absdir="$abs_ladir"
1961 libdir="$abs_ladir"
1962 else
1963 dir="$libdir"
1964 absdir="$libdir"
1966 else
1967 dir="$ladir/$objdir"
1968 absdir="$abs_ladir/$objdir"
1969 # Remove this search path later
1970 notinst_path="$notinst_path $abs_ladir"
1971 fi # $installed = yes
1972 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1974 # This library was specified with -dlpreopen.
1975 if test "$pass" = dlpreopen; then
1976 if test -z "$libdir"; then
1977 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1978 exit 1
1980 # Prefer using a static library (so that no silly _DYNAMIC symbols
1981 # are required to link).
1982 if test -n "$old_library"; then
1983 newdlprefiles="$newdlprefiles $dir/$old_library"
1984 # Otherwise, use the dlname, so that lt_dlopen finds it.
1985 elif test -n "$dlname"; then
1986 newdlprefiles="$newdlprefiles $dir/$dlname"
1987 else
1988 newdlprefiles="$newdlprefiles $dir/$linklib"
1990 fi # $pass = dlpreopen
1992 if test -z "$libdir"; then
1993 # Link the convenience library
1994 if test "$linkmode" = lib; then
1995 deplibs="$dir/$old_library $deplibs"
1996 elif test "$linkmode,$pass" = "prog,link"; then
1997 compile_deplibs="$dir/$old_library $compile_deplibs"
1998 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1999 else
2000 deplibs="$lib $deplibs" # used for prog,scan pass
2002 continue
2005 if test "$linkmode" = prog && test "$pass" != link; then
2006 newlib_search_path="$newlib_search_path $ladir"
2007 deplibs="$lib $deplibs"
2009 linkalldeplibs=no
2010 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2011 test "$build_libtool_libs" = no; then
2012 linkalldeplibs=yes
2015 tmp_libs=
2016 for deplib in $dependency_libs; do
2017 case $deplib in
2018 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2019 esac
2020 # Need to link against all dependency_libs?
2021 if test "$linkalldeplibs" = yes; then
2022 deplibs="$deplib $deplibs"
2023 else
2024 # Need to hardcode shared library paths
2025 # or/and link against static libraries
2026 newdependency_libs="$deplib $newdependency_libs"
2028 if test "X$duplicate_deps" = "Xyes" ; then
2029 case "$tmp_libs " in
2030 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2031 esac
2033 tmp_libs="$tmp_libs $deplib"
2034 done # for deplib
2035 continue
2036 fi # $linkmode = prog...
2038 if test "$linkmode,$pass" = "prog,link"; then
2039 if test -n "$library_names" &&
2040 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2041 # We need to hardcode the library path
2042 if test -n "$shlibpath_var"; then
2043 # Make sure the rpath contains only unique directories.
2044 case "$temp_rpath " in
2045 *" $dir "*) ;;
2046 *" $absdir "*) ;;
2047 *) temp_rpath="$temp_rpath $dir" ;;
2048 esac
2051 # Hardcode the library path.
2052 # Skip directories that are in the system default run-time
2053 # search path.
2054 case " $sys_lib_dlsearch_path " in
2055 *" $absdir "*) ;;
2057 case "$compile_rpath " in
2058 *" $absdir "*) ;;
2059 *) compile_rpath="$compile_rpath $absdir"
2060 esac
2062 esac
2063 case " $sys_lib_dlsearch_path " in
2064 *" $libdir "*) ;;
2066 case "$finalize_rpath " in
2067 *" $libdir "*) ;;
2068 *) finalize_rpath="$finalize_rpath $libdir"
2069 esac
2071 esac
2072 fi # $linkmode,$pass = prog,link...
2074 if test "$alldeplibs" = yes &&
2075 { test "$deplibs_check_method" = pass_all ||
2076 { test "$build_libtool_libs" = yes &&
2077 test -n "$library_names"; }; }; then
2078 # We only need to search for static libraries
2079 continue
2083 link_static=no # Whether the deplib will be linked statically
2084 if test -n "$library_names" &&
2085 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2086 if test "$installed" = no; then
2087 notinst_deplibs="$notinst_deplibs $lib"
2088 need_relink=yes
2090 # This is a shared library
2091 if test "$linkmode" = lib &&
2092 test "$hardcode_into_libs" = yes; then
2093 # Hardcode the library path.
2094 # Skip directories that are in the system default run-time
2095 # search path.
2096 case " $sys_lib_dlsearch_path " in
2097 *" $absdir "*) ;;
2099 case "$compile_rpath " in
2100 *" $absdir "*) ;;
2101 *) compile_rpath="$compile_rpath $absdir"
2102 esac
2104 esac
2105 case " $sys_lib_dlsearch_path " in
2106 *" $libdir "*) ;;
2108 case "$finalize_rpath " in
2109 *" $libdir "*) ;;
2110 *) finalize_rpath="$finalize_rpath $libdir"
2111 esac
2113 esac
2116 if test -n "$old_archive_from_expsyms_cmds"; then
2117 # figure out the soname
2118 set dummy $library_names
2119 realname="$2"
2120 shift; shift
2121 libname=`eval \\$echo \"$libname_spec\"`
2122 # use dlname if we got it. it's perfectly good, no?
2123 if test -n "$dlname"; then
2124 soname="$dlname"
2125 elif test -n "$soname_spec"; then
2126 # bleh windows
2127 case $host in
2128 *cygwin*)
2129 major=`expr $current - $age`
2130 versuffix="-$major"
2132 esac
2133 eval soname=\"$soname_spec\"
2134 else
2135 soname="$realname"
2138 # Make a new name for the extract_expsyms_cmds to use
2139 soroot="$soname"
2140 soname=`echo $soroot | sed -e 's/^.*\///'`
2141 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2143 # If the library has no export list, then create one now
2144 if test -f "$output_objdir/$soname-def"; then :
2145 else
2146 $show "extracting exported symbol list from \`$soname'"
2147 save_ifs="$IFS"; IFS='~'
2148 eval cmds=\"$extract_expsyms_cmds\"
2149 for cmd in $cmds; do
2150 IFS="$save_ifs"
2151 $show "$cmd"
2152 $run eval "$cmd" || exit $?
2153 done
2154 IFS="$save_ifs"
2157 # Create $newlib
2158 if test -f "$output_objdir/$newlib"; then :; else
2159 $show "generating import library for \`$soname'"
2160 save_ifs="$IFS"; IFS='~'
2161 eval cmds=\"$old_archive_from_expsyms_cmds\"
2162 for cmd in $cmds; do
2163 IFS="$save_ifs"
2164 $show "$cmd"
2165 $run eval "$cmd" || exit $?
2166 done
2167 IFS="$save_ifs"
2169 # make sure the library variables are pointing to the new library
2170 dir=$output_objdir
2171 linklib=$newlib
2172 fi # test -n "$old_archive_from_expsyms_cmds"
2174 if test "$linkmode" = prog || test "$mode" != relink; then
2175 add_shlibpath=
2176 add_dir=
2177 add=
2178 lib_linked=yes
2179 case $hardcode_action in
2180 immediate | unsupported)
2181 if test "$hardcode_direct" = no; then
2182 add="$dir/$linklib"
2183 elif test "$hardcode_minus_L" = no; then
2184 case $host in
2185 *-*-sunos*) add_shlibpath="$dir" ;;
2186 esac
2187 add_dir="-L$dir"
2188 add="-l$name"
2189 elif test "$hardcode_shlibpath_var" = no; then
2190 add_shlibpath="$dir"
2191 add="-l$name"
2192 else
2193 lib_linked=no
2196 relink)
2197 if test "$hardcode_direct" = yes; then
2198 add="$dir/$linklib"
2199 elif test "$hardcode_minus_L" = yes; then
2200 add_dir="-L$dir"
2201 add="-l$name"
2202 elif test "$hardcode_shlibpath_var" = yes; then
2203 add_shlibpath="$dir"
2204 add="-l$name"
2205 else
2206 lib_linked=no
2209 *) lib_linked=no ;;
2210 esac
2212 if test "$lib_linked" != yes; then
2213 $echo "$modename: configuration error: unsupported hardcode properties"
2214 exit 1
2217 if test -n "$add_shlibpath"; then
2218 case :$compile_shlibpath: in
2219 *":$add_shlibpath:"*) ;;
2220 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2221 esac
2223 if test "$linkmode" = prog; then
2224 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2225 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2226 else
2227 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2228 test -n "$add" && deplibs="$add $deplibs"
2229 if test "$hardcode_direct" != yes && \
2230 test "$hardcode_minus_L" != yes && \
2231 test "$hardcode_shlibpath_var" = yes; then
2232 case :$finalize_shlibpath: in
2233 *":$libdir:"*) ;;
2234 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2235 esac
2240 if test "$linkmode" = prog || test "$mode" = relink; then
2241 add_shlibpath=
2242 add_dir=
2243 add=
2244 # Finalize command for both is simple: just hardcode it.
2245 if test "$hardcode_direct" = yes; then
2246 add="$libdir/$linklib"
2247 elif test "$hardcode_minus_L" = yes; then
2248 add_dir="-L$libdir"
2249 add="-l$name"
2250 elif test "$hardcode_shlibpath_var" = yes; then
2251 case :$finalize_shlibpath: in
2252 *":$libdir:"*) ;;
2253 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2254 esac
2255 add="-l$name"
2256 else
2257 # We cannot seem to hardcode it, guess we'll fake it.
2258 add_dir="-L$libdir"
2259 add="-l$name"
2262 if test "$linkmode" = prog; then
2263 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2264 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2265 else
2266 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2267 test -n "$add" && deplibs="$add $deplibs"
2270 elif test "$linkmode" = prog; then
2271 # Here we assume that one of hardcode_direct or hardcode_minus_L
2272 # is not unsupported. This is valid on all known static and
2273 # shared platforms.
2274 if test "$hardcode_direct" != unsupported; then
2275 test -n "$old_library" && linklib="$old_library"
2276 compile_deplibs="$dir/$linklib $compile_deplibs"
2277 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2278 else
2279 compile_deplibs="-l$name -L$dir $compile_deplibs"
2280 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2282 elif test "$build_libtool_libs" = yes; then
2283 # Not a shared library
2284 if test "$deplibs_check_method" != pass_all; then
2285 # We're trying link a shared library against a static one
2286 # but the system doesn't support it.
2288 # Just print a warning and add the library to dependency_libs so
2289 # that the program can be linked against the static library.
2290 echo
2291 echo "*** Warning: This system can not link to static lib archive $lib."
2292 echo "*** I have the capability to make that library automatically link in when"
2293 echo "*** you link to this library. But I can only do this if you have a"
2294 echo "*** shared version of the library, which you do not appear to have."
2295 if test "$module" = yes; then
2296 echo "*** But as you try to build a module library, libtool will still create "
2297 echo "*** a static module, that should work as long as the dlopening application"
2298 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2299 if test -z "$global_symbol_pipe"; then
2300 echo
2301 echo "*** However, this would only work if libtool was able to extract symbol"
2302 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2303 echo "*** not find such a program. So, this module is probably useless."
2304 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2306 if test "$build_old_libs" = no; then
2307 build_libtool_libs=module
2308 build_old_libs=yes
2309 else
2310 build_libtool_libs=no
2313 else
2314 convenience="$convenience $dir/$old_library"
2315 old_convenience="$old_convenience $dir/$old_library"
2316 deplibs="$dir/$old_library $deplibs"
2317 link_static=yes
2319 fi # link shared/static library?
2321 if test "$linkmode" = lib; then
2322 if test -n "$dependency_libs" &&
2323 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2324 test "$link_static" = yes; }; then
2325 # Extract -R from dependency_libs
2326 temp_deplibs=
2327 for libdir in $dependency_libs; do
2328 case $libdir in
2329 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2330 case " $xrpath " in
2331 *" $temp_xrpath "*) ;;
2332 *) xrpath="$xrpath $temp_xrpath";;
2333 esac;;
2334 *) temp_deplibs="$temp_deplibs $libdir";;
2335 esac
2336 done
2337 dependency_libs="$temp_deplibs"
2340 newlib_search_path="$newlib_search_path $absdir"
2341 # Link against this library
2342 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2343 # ... and its dependency_libs
2344 tmp_libs=
2345 for deplib in $dependency_libs; do
2346 newdependency_libs="$deplib $newdependency_libs"
2347 if test "X$duplicate_deps" = "Xyes" ; then
2348 case "$tmp_libs " in
2349 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2350 esac
2352 tmp_libs="$tmp_libs $deplib"
2353 done
2355 if test "$link_all_deplibs" != no; then
2356 # Add the search paths of all dependency libraries
2357 for deplib in $dependency_libs; do
2358 case $deplib in
2359 -L*) path="$deplib" ;;
2360 *.la)
2361 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2362 test "X$dir" = "X$deplib" && dir="."
2363 # We need an absolute path.
2364 case $dir in
2365 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2367 absdir=`cd "$dir" && pwd`
2368 if test -z "$absdir"; then
2369 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2370 absdir="$dir"
2373 esac
2374 if grep "^installed=no" $deplib > /dev/null; then
2375 path="-L$absdir/$objdir"
2376 else
2377 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2378 if test -z "$libdir"; then
2379 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2380 exit 1
2382 if test "$absdir" != "$libdir"; then
2383 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2385 path="-L$absdir"
2388 *) continue ;;
2389 esac
2390 case " $deplibs " in
2391 *" $path "*) ;;
2392 *) deplibs="$deplibs $path" ;;
2393 esac
2394 done
2395 fi # link_all_deplibs != no
2396 fi # linkmode = lib
2397 done # for deplib in $libs
2398 dependency_libs="$newdependency_libs"
2399 if test "$pass" = dlpreopen; then
2400 # Link the dlpreopened libraries before other libraries
2401 for deplib in $save_deplibs; do
2402 deplibs="$deplib $deplibs"
2403 done
2405 if test "$pass" != dlopen; then
2406 if test "$pass" != conv; then
2407 # Make sure lib_search_path contains only unique directories.
2408 lib_search_path=
2409 for dir in $newlib_search_path; do
2410 case "$lib_search_path " in
2411 *" $dir "*) ;;
2412 *) lib_search_path="$lib_search_path $dir" ;;
2413 esac
2414 done
2415 newlib_search_path=
2418 if test "$linkmode,$pass" != "prog,link"; then
2419 vars="deplibs"
2420 else
2421 vars="compile_deplibs finalize_deplibs"
2423 for var in $vars dependency_libs; do
2424 # Add libraries to $var in reverse order
2425 eval tmp_libs=\"\$$var\"
2426 new_libs=
2427 for deplib in $tmp_libs; do
2428 # FIXME: Pedantically, this is the right thing to do, so
2429 # that some nasty dependency loop isn't accidentally
2430 # broken:
2431 #new_libs="$deplib $new_libs"
2432 # Pragmatically, this seems to cause very few problems in
2433 # practice:
2434 case $deplib in
2435 -L*) new_libs="$deplib $new_libs" ;;
2437 # And here is the reason: when a library appears more
2438 # than once as an explicit dependence of a library, or
2439 # is implicitly linked in more than once by the
2440 # compiler, it is considered special, and multiple
2441 # occurrences thereof are not removed. Compare this
2442 # with having the same library being listed as a
2443 # dependency of multiple other libraries: in this case,
2444 # we know (pedantically, we assume) the library does not
2445 # need to be listed more than once, so we keep only the
2446 # last copy. This is not always right, but it is rare
2447 # enough that we require users that really mean to play
2448 # such unportable linking tricks to link the library
2449 # using -Wl,-lname, so that libtool does not consider it
2450 # for duplicate removal.
2451 case " $specialdeplibs " in
2452 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2454 case " $new_libs " in
2455 *" $deplib "*) ;;
2456 *) new_libs="$deplib $new_libs" ;;
2457 esac
2459 esac
2461 esac
2462 done
2463 tmp_libs=
2464 for deplib in $new_libs; do
2465 case $deplib in
2466 -L*)
2467 case " $tmp_libs " in
2468 *" $deplib "*) ;;
2469 *) tmp_libs="$tmp_libs $deplib" ;;
2470 esac
2472 *) tmp_libs="$tmp_libs $deplib" ;;
2473 esac
2474 done
2475 eval $var=\"$tmp_libs\"
2476 done # for var
2478 done # for pass
2479 if test "$linkmode" = prog; then
2480 dlfiles="$newdlfiles"
2481 dlprefiles="$newdlprefiles"
2484 case $linkmode in
2485 oldlib)
2486 if test -n "$deplibs"; then
2487 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2490 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2491 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2494 if test -n "$rpath"; then
2495 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2498 if test -n "$xrpath"; then
2499 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2502 if test -n "$vinfo"; then
2503 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2506 if test -n "$release"; then
2507 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2510 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2511 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2514 # Now set the variables for building old libraries.
2515 build_libtool_libs=no
2516 oldlibs="$output"
2517 objs="$objs$old_deplibs"
2520 lib)
2521 # Make sure we only generate libraries of the form `libNAME.la'.
2522 case $outputname in
2523 lib*)
2524 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2525 eval libname=\"$libname_spec\"
2528 if test "$module" = no; then
2529 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2530 $echo "$help" 1>&2
2531 exit 1
2533 if test "$need_lib_prefix" != no; then
2534 # Add the "lib" prefix for modules if required
2535 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2536 eval libname=\"$libname_spec\"
2537 else
2538 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2541 esac
2543 if test -n "$objs"; then
2544 if test "$deplibs_check_method" != pass_all; then
2545 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2546 exit 1
2547 else
2548 echo
2549 echo "*** Warning: Linking the shared library $output against the non-libtool"
2550 echo "*** objects $objs is not portable!"
2551 libobjs="$libobjs $objs"
2555 if test "$dlself" != no; then
2556 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2559 set dummy $rpath
2560 if test "$#" -gt 2; then
2561 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2563 install_libdir="$2"
2565 oldlibs=
2566 if test -z "$rpath"; then
2567 if test "$build_libtool_libs" = yes; then
2568 # Building a libtool convenience library.
2569 # Some compilers have problems with a `.al' extension so
2570 # convenience libraries should have the same extension an
2571 # archive normally would.
2572 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2573 build_libtool_libs=convenience
2574 build_old_libs=yes
2577 if test -n "$vinfo"; then
2578 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2581 if test -n "$release"; then
2582 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2584 else
2586 # Parse the version information argument.
2587 save_ifs="$IFS"; IFS=':'
2588 set dummy $vinfo 0 0 0
2589 IFS="$save_ifs"
2591 if test -n "$8"; then
2592 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2593 $echo "$help" 1>&2
2594 exit 1
2597 current="$2"
2598 revision="$3"
2599 age="$4"
2601 # Check that each of the things are valid numbers.
2602 case $current in
2603 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2605 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2606 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2607 exit 1
2609 esac
2611 case $revision in
2612 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2614 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2615 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2616 exit 1
2618 esac
2620 case $age in
2621 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2623 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2624 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2625 exit 1
2627 esac
2629 if test "$age" -gt "$current"; then
2630 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2631 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2632 exit 1
2635 # Calculate the version variables.
2636 major=
2637 versuffix=
2638 verstring=
2639 case $version_type in
2640 none) ;;
2642 darwin)
2643 # Like Linux, but with the current version available in
2644 # verstring for coding it into the library header
2645 major=.`expr $current - $age`
2646 versuffix="$major.$age.$revision"
2647 # Darwin ld doesn't like 0 for these options...
2648 minor_current=`expr $current + 1`
2649 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2652 freebsd-aout)
2653 major=".$current"
2654 versuffix=".$current.$revision";
2657 freebsd-elf)
2658 major=".$current"
2659 versuffix=".$current";
2662 irix | nonstopux)
2663 case $version_type in
2664 nonstopux) verstring_prefix=nonstopux ;;
2665 *) verstring_prefix=sgi ;;
2666 esac
2667 verstring="$verstring_prefix$major.$revision"
2669 major=`expr $current - $age + 1`
2671 # Add in all the interfaces that we are compatible with.
2672 loop=$revision
2673 while test "$loop" -ne 0; do
2674 iface=`expr $revision - $loop`
2675 loop=`expr $loop - 1`
2676 verstring="$verstring_prefix$major.$iface:$verstring"
2677 done
2679 # Before this point, $major must not contain `.'.
2680 major=.$major
2681 versuffix="$major.$revision"
2684 linux)
2685 major=.`expr $current - $age`
2686 versuffix="$major.$age.$revision"
2689 osf)
2690 major=`expr $current - $age`
2691 versuffix=".$current.$age.$revision"
2692 verstring="$current.$age.$revision"
2694 # Add in all the interfaces that we are compatible with.
2695 loop=$age
2696 while test "$loop" -ne 0; do
2697 iface=`expr $current - $loop`
2698 loop=`expr $loop - 1`
2699 verstring="$verstring:${iface}.0"
2700 done
2702 # Make executables depend on our current version.
2703 verstring="$verstring:${current}.0"
2706 sunos)
2707 major=".$current"
2708 versuffix=".$current.$revision"
2711 windows)
2712 # Use '-' rather than '.', since we only want one
2713 # extension on DOS 8.3 filesystems.
2714 major=`expr $current - $age`
2715 versuffix="-$major"
2719 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2720 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2721 exit 1
2723 esac
2725 # Clear the version info if we defaulted, and they specified a release.
2726 if test -z "$vinfo" && test -n "$release"; then
2727 major=
2728 case $version_type in
2729 darwin)
2730 # we can't check for "0.0" in archive_cmds due to quoting
2731 # problems, so we reset it completely
2732 verstring=
2735 verstring="0.0"
2737 esac
2738 if test "$need_version" = no; then
2739 versuffix=
2740 else
2741 versuffix=".0.0"
2745 # Remove version info from name if versioning should be avoided
2746 if test "$avoid_version" = yes && test "$need_version" = no; then
2747 major=
2748 versuffix=
2749 verstring=""
2752 # Check to see if the archive will have undefined symbols.
2753 if test "$allow_undefined" = yes; then
2754 if test "$allow_undefined_flag" = unsupported; then
2755 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2756 build_libtool_libs=no
2757 build_old_libs=yes
2759 else
2760 # Don't allow undefined symbols.
2761 allow_undefined_flag="$no_undefined_flag"
2765 if test "$mode" != relink; then
2766 # Remove our outputs, but don't remove object files since they
2767 # may have been created when compiling PIC objects.
2768 removelist=
2769 tempremovelist=`echo "$output_objdir/*"`
2770 for p in $tempremovelist; do
2771 case $p in
2772 *.$objext)
2774 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2775 removelist="$removelist $p"
2777 *) ;;
2778 esac
2779 done
2780 if test -n "$removelist"; then
2781 $show "${rm}r $removelist"
2782 $run ${rm}r $removelist
2786 # Now set the variables for building old libraries.
2787 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2788 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2790 # Transform .lo files to .o files.
2791 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2794 # Eliminate all temporary directories.
2795 for path in $notinst_path; do
2796 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2797 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2798 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2799 done
2801 if test -n "$xrpath"; then
2802 # If the user specified any rpath flags, then add them.
2803 temp_xrpath=
2804 for libdir in $xrpath; do
2805 temp_xrpath="$temp_xrpath -R$libdir"
2806 case "$finalize_rpath " in
2807 *" $libdir "*) ;;
2808 *) finalize_rpath="$finalize_rpath $libdir" ;;
2809 esac
2810 done
2811 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2812 dependency_libs="$temp_xrpath $dependency_libs"
2816 # Make sure dlfiles contains only unique files that won't be dlpreopened
2817 old_dlfiles="$dlfiles"
2818 dlfiles=
2819 for lib in $old_dlfiles; do
2820 case " $dlprefiles $dlfiles " in
2821 *" $lib "*) ;;
2822 *) dlfiles="$dlfiles $lib" ;;
2823 esac
2824 done
2826 # Make sure dlprefiles contains only unique files
2827 old_dlprefiles="$dlprefiles"
2828 dlprefiles=
2829 for lib in $old_dlprefiles; do
2830 case "$dlprefiles " in
2831 *" $lib "*) ;;
2832 *) dlprefiles="$dlprefiles $lib" ;;
2833 esac
2834 done
2836 if test "$build_libtool_libs" = yes; then
2837 if test -n "$rpath"; then
2838 case $host in
2839 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2840 # these systems don't actually have a c library (as such)!
2842 *-*-rhapsody* | *-*-darwin1.[012])
2843 # Rhapsody C library is in the System framework
2844 deplibs="$deplibs -framework System"
2846 *-*-netbsd*)
2847 # Don't link with libc until the a.out ld.so is fixed.
2849 *-*-openbsd* | *-*-freebsd*)
2850 # Do not include libc due to us having libc/libc_r.
2851 test "X$arg" = "X-lc" && continue
2854 # Add libc to deplibs on all other systems if necessary.
2855 if test "$build_libtool_need_lc" = "yes"; then
2856 deplibs="$deplibs -lc"
2859 esac
2862 # Transform deplibs into only deplibs that can be linked in shared.
2863 name_save=$name
2864 libname_save=$libname
2865 release_save=$release
2866 versuffix_save=$versuffix
2867 major_save=$major
2868 # I'm not sure if I'm treating the release correctly. I think
2869 # release should show up in the -l (ie -lgmp5) so we don't want to
2870 # add it in twice. Is that correct?
2871 release=""
2872 versuffix=""
2873 major=""
2874 newdeplibs=
2875 droppeddeps=no
2876 case $deplibs_check_method in
2877 pass_all)
2878 # Don't check for shared/static. Everything works.
2879 # This might be a little naive. We might want to check
2880 # whether the library exists or not. But this is on
2881 # osf3 & osf4 and I'm not really sure... Just
2882 # implementing what was already the behaviour.
2883 newdeplibs=$deplibs
2885 test_compile)
2886 # This code stresses the "libraries are programs" paradigm to its
2887 # limits. Maybe even breaks it. We compile a program, linking it
2888 # against the deplibs as a proxy for the library. Then we can check
2889 # whether they linked in statically or dynamically with ldd.
2890 $rm conftest.c
2891 cat > conftest.c <<EOF
2892 int main() { return 0; }
2894 $rm conftest
2895 $LTCC -o conftest conftest.c $deplibs
2896 if test "$?" -eq 0 ; then
2897 ldd_output=`ldd conftest`
2898 for i in $deplibs; do
2899 name="`expr $i : '-l\(.*\)'`"
2900 # If $name is empty we are operating on a -L argument.
2901 if test "$name" != "" && test "$name" -ne "0"; then
2902 libname=`eval \\$echo \"$libname_spec\"`
2903 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2904 set dummy $deplib_matches
2905 deplib_match=$2
2906 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2907 newdeplibs="$newdeplibs $i"
2908 else
2909 droppeddeps=yes
2910 echo
2911 echo "*** Warning: dynamic linker does not accept needed library $i."
2912 echo "*** I have the capability to make that library automatically link in when"
2913 echo "*** you link to this library. But I can only do this if you have a"
2914 echo "*** shared version of the library, which I believe you do not have"
2915 echo "*** because a test_compile did reveal that the linker did not use it for"
2916 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2918 else
2919 newdeplibs="$newdeplibs $i"
2921 done
2922 else
2923 # Error occured in the first compile. Let's try to salvage
2924 # the situation: Compile a separate program for each library.
2925 for i in $deplibs; do
2926 name="`expr $i : '-l\(.*\)'`"
2927 # If $name is empty we are operating on a -L argument.
2928 if test "$name" != "" && test "$name" != "0"; then
2929 $rm conftest
2930 $LTCC -o conftest conftest.c $i
2931 # Did it work?
2932 if test "$?" -eq 0 ; then
2933 ldd_output=`ldd conftest`
2934 libname=`eval \\$echo \"$libname_spec\"`
2935 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2936 set dummy $deplib_matches
2937 deplib_match=$2
2938 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2939 newdeplibs="$newdeplibs $i"
2940 else
2941 droppeddeps=yes
2942 echo
2943 echo "*** Warning: dynamic linker does not accept needed library $i."
2944 echo "*** I have the capability to make that library automatically link in when"
2945 echo "*** you link to this library. But I can only do this if you have a"
2946 echo "*** shared version of the library, which you do not appear to have"
2947 echo "*** because a test_compile did reveal that the linker did not use this one"
2948 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2950 else
2951 droppeddeps=yes
2952 echo
2953 echo "*** Warning! Library $i is needed by this library but I was not able to"
2954 echo "*** make it link in! You will probably need to install it or some"
2955 echo "*** library that it depends on before this library will be fully"
2956 echo "*** functional. Installing it before continuing would be even better."
2958 else
2959 newdeplibs="$newdeplibs $i"
2961 done
2964 file_magic*)
2965 set dummy $deplibs_check_method
2966 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2967 for a_deplib in $deplibs; do
2968 name="`expr $a_deplib : '-l\(.*\)'`"
2969 # If $name is empty we are operating on a -L argument.
2970 if test "$name" != "" && test "$name" != "0"; then
2971 libname=`eval \\$echo \"$libname_spec\"`
2972 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2973 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2974 for potent_lib in $potential_libs; do
2975 # Follow soft links.
2976 if ls -lLd "$potent_lib" 2>/dev/null \
2977 | grep " -> " >/dev/null; then
2978 continue
2980 # The statement above tries to avoid entering an
2981 # endless loop below, in case of cyclic links.
2982 # We might still enter an endless loop, since a link
2983 # loop can be closed while we follow links,
2984 # but so what?
2985 potlib="$potent_lib"
2986 while test -h "$potlib" 2>/dev/null; do
2987 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2988 case $potliblink in
2989 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2990 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2991 esac
2992 done
2993 # It is ok to link against an archive when
2994 # building a shared library.
2995 if $AR -t $potlib > /dev/null 2>&1; then
2996 newdeplibs="$newdeplibs $a_deplib"
2997 a_deplib=""
2998 break 2
3000 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3001 | sed 10q \
3002 | egrep "$file_magic_regex" > /dev/null; then
3003 newdeplibs="$newdeplibs $a_deplib"
3004 a_deplib=""
3005 break 2
3007 done
3008 done
3009 if test -n "$a_deplib" ; then
3010 droppeddeps=yes
3011 echo
3012 echo "*** Warning: linker path does not have real file for library $a_deplib."
3013 echo "*** I have the capability to make that library automatically link in when"
3014 echo "*** you link to this library. But I can only do this if you have a"
3015 echo "*** shared version of the library, which you do not appear to have"
3016 echo "*** because I did check the linker path looking for a file starting"
3017 if test -z "$potlib" ; then
3018 echo "*** with $libname but no candidates were found. (...for file magic test)"
3019 else
3020 echo "*** with $libname and none of the candidates passed a file format test"
3021 echo "*** using a file magic. Last file checked: $potlib"
3024 else
3025 # Add a -L argument.
3026 newdeplibs="$newdeplibs $a_deplib"
3028 done # Gone through all deplibs.
3030 match_pattern*)
3031 set dummy $deplibs_check_method
3032 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3033 for a_deplib in $deplibs; do
3034 name="`expr $a_deplib : '-l\(.*\)'`"
3035 # If $name is empty we are operating on a -L argument.
3036 if test -n "$name" && test "$name" != "0"; then
3037 libname=`eval \\$echo \"$libname_spec\"`
3038 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3039 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3040 for potent_lib in $potential_libs; do
3041 potlib="$potent_lib" # see symlink-check above in file_magic test
3042 if eval echo \"$potent_lib\" 2>/dev/null \
3043 | sed 10q \
3044 | egrep "$match_pattern_regex" > /dev/null; then
3045 newdeplibs="$newdeplibs $a_deplib"
3046 a_deplib=""
3047 break 2
3049 done
3050 done
3051 if test -n "$a_deplib" ; then
3052 droppeddeps=yes
3053 echo
3054 echo "*** Warning: linker path does not have real file for library $a_deplib."
3055 echo "*** I have the capability to make that library automatically link in when"
3056 echo "*** you link to this library. But I can only do this if you have a"
3057 echo "*** shared version of the library, which you do not appear to have"
3058 echo "*** because I did check the linker path looking for a file starting"
3059 if test -z "$potlib" ; then
3060 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3061 else
3062 echo "*** with $libname and none of the candidates passed a file format test"
3063 echo "*** using a regex pattern. Last file checked: $potlib"
3066 else
3067 # Add a -L argument.
3068 newdeplibs="$newdeplibs $a_deplib"
3070 done # Gone through all deplibs.
3072 none | unknown | *)
3073 newdeplibs=""
3074 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3075 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
3076 grep . >/dev/null; then
3077 echo
3078 if test "X$deplibs_check_method" = "Xnone"; then
3079 echo "*** Warning: inter-library dependencies are not supported in this platform."
3080 else
3081 echo "*** Warning: inter-library dependencies are not known to be supported."
3083 echo "*** All declared inter-library dependencies are being dropped."
3084 droppeddeps=yes
3087 esac
3088 versuffix=$versuffix_save
3089 major=$major_save
3090 release=$release_save
3091 libname=$libname_save
3092 name=$name_save
3094 case $host in
3095 *-*-rhapsody* | *-*-darwin1.[012])
3096 # On Rhapsody replace the C library is the System framework
3097 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3099 esac
3101 if test "$droppeddeps" = yes; then
3102 if test "$module" = yes; then
3103 echo
3104 echo "*** Warning: libtool could not satisfy all declared inter-library"
3105 echo "*** dependencies of module $libname. Therefore, libtool will create"
3106 echo "*** a static module, that should work as long as the dlopening"
3107 echo "*** application is linked with the -dlopen flag."
3108 if test -z "$global_symbol_pipe"; then
3109 echo
3110 echo "*** However, this would only work if libtool was able to extract symbol"
3111 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3112 echo "*** not find such a program. So, this module is probably useless."
3113 echo "*** \`nm' from GNU binutils and a full rebuild may help."
3115 if test "$build_old_libs" = no; then
3116 oldlibs="$output_objdir/$libname.$libext"
3117 build_libtool_libs=module
3118 build_old_libs=yes
3119 else
3120 build_libtool_libs=no
3122 else
3123 echo "*** The inter-library dependencies that have been dropped here will be"
3124 echo "*** automatically added whenever a program is linked with this library"
3125 echo "*** or is declared to -dlopen it."
3127 if test "$allow_undefined" = no; then
3128 echo
3129 echo "*** Since this library must not contain undefined symbols,"
3130 echo "*** because either the platform does not support them or"
3131 echo "*** it was explicitly requested with -no-undefined,"
3132 echo "*** libtool will only create a static version of it."
3133 if test "$build_old_libs" = no; then
3134 oldlibs="$output_objdir/$libname.$libext"
3135 build_libtool_libs=module
3136 build_old_libs=yes
3137 else
3138 build_libtool_libs=no
3143 # Done checking deplibs!
3144 deplibs=$newdeplibs
3147 # All the library-specific variables (install_libdir is set above).
3148 library_names=
3149 old_library=
3150 dlname=
3152 # Test again, we may have decided not to build it any more
3153 if test "$build_libtool_libs" = yes; then
3154 if test "$hardcode_into_libs" = yes; then
3155 # Hardcode the library paths
3156 hardcode_libdirs=
3157 dep_rpath=
3158 rpath="$finalize_rpath"
3159 test "$mode" != relink && rpath="$compile_rpath$rpath"
3160 for libdir in $rpath; do
3161 if test -n "$hardcode_libdir_flag_spec"; then
3162 if test -n "$hardcode_libdir_separator"; then
3163 if test -z "$hardcode_libdirs"; then
3164 hardcode_libdirs="$libdir"
3165 else
3166 # Just accumulate the unique libdirs.
3167 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3168 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3171 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3173 esac
3175 else
3176 eval flag=\"$hardcode_libdir_flag_spec\"
3177 dep_rpath="$dep_rpath $flag"
3179 elif test -n "$runpath_var"; then
3180 case "$perm_rpath " in
3181 *" $libdir "*) ;;
3182 *) perm_rpath="$perm_rpath $libdir" ;;
3183 esac
3185 done
3186 # Substitute the hardcoded libdirs into the rpath.
3187 if test -n "$hardcode_libdir_separator" &&
3188 test -n "$hardcode_libdirs"; then
3189 libdir="$hardcode_libdirs"
3190 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3192 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3193 # We should set the runpath_var.
3194 rpath=
3195 for dir in $perm_rpath; do
3196 rpath="$rpath$dir:"
3197 done
3198 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3200 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3203 shlibpath="$finalize_shlibpath"
3204 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3205 if test -n "$shlibpath"; then
3206 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3209 # Get the real and link names of the library.
3210 eval library_names=\"$library_names_spec\"
3211 set dummy $library_names
3212 realname="$2"
3213 shift; shift
3215 if test -n "$soname_spec"; then
3216 eval soname=\"$soname_spec\"
3217 else
3218 soname="$realname"
3220 if test -z "$dlname"; then
3221 dlname=$soname
3224 lib="$output_objdir/$realname"
3225 for link
3227 linknames="$linknames $link"
3228 done
3230 # Use standard objects if they are pic
3231 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3233 # Prepare the list of exported symbols
3234 if test -z "$export_symbols"; then
3235 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3236 $show "generating symbol list for \`$libname.la'"
3237 export_symbols="$output_objdir/$libname.exp"
3238 $run $rm $export_symbols
3239 eval cmds=\"$export_symbols_cmds\"
3240 save_ifs="$IFS"; IFS='~'
3241 for cmd in $cmds; do
3242 IFS="$save_ifs"
3243 $show "$cmd"
3244 $run eval "$cmd" || exit $?
3245 done
3246 IFS="$save_ifs"
3247 if test -n "$export_symbols_regex"; then
3248 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3249 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3250 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3251 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3256 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3257 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3260 if test -n "$convenience"; then
3261 if test -n "$whole_archive_flag_spec"; then
3262 save_libobjs=$libobjs
3263 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3264 else
3265 gentop="$output_objdir/${outputname}x"
3266 $show "${rm}r $gentop"
3267 $run ${rm}r "$gentop"
3268 $show "$mkdir $gentop"
3269 $run $mkdir "$gentop"
3270 status=$?
3271 if test "$status" -ne 0 && test ! -d "$gentop"; then
3272 exit $status
3274 generated="$generated $gentop"
3276 for xlib in $convenience; do
3277 # Extract the objects.
3278 case $xlib in
3279 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3280 *) xabs=`pwd`"/$xlib" ;;
3281 esac
3282 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3283 xdir="$gentop/$xlib"
3285 $show "${rm}r $xdir"
3286 $run ${rm}r "$xdir"
3287 $show "$mkdir $xdir"
3288 $run $mkdir "$xdir"
3289 status=$?
3290 if test "$status" -ne 0 && test ! -d "$xdir"; then
3291 exit $status
3293 $show "(cd $xdir && $AR x $xabs)"
3294 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3296 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3297 done
3301 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3302 eval flag=\"$thread_safe_flag_spec\"
3303 linker_flags="$linker_flags $flag"
3306 # Make a backup of the uninstalled library when relinking
3307 if test "$mode" = relink; then
3308 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3311 # Do each of the archive commands.
3312 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3313 eval cmds=\"$archive_expsym_cmds\"
3314 else
3315 eval cmds=\"$archive_cmds\"
3318 if len=`expr "X$cmds" : ".*"` &&
3319 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3321 else
3322 # The command line is too long to link in one step, link piecewise.
3323 $echo "creating reloadable object files..."
3325 # Save the value of $output and $libobjs because we want to
3326 # use them later. If we have whole_archive_flag_spec, we
3327 # want to use save_libobjs as it was before
3328 # whole_archive_flag_spec was expanded, because we can't
3329 # assume the linker understands whole_archive_flag_spec.
3330 # This may have to be revisited, in case too many
3331 # convenience libraries get linked in and end up exceeding
3332 # the spec.
3333 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3334 save_libobjs=$libobjs
3336 save_output=$output
3338 # Clear the reloadable object creation command queue and
3339 # initialize k to one.
3340 test_cmds=
3341 concat_cmds=
3342 objlist=
3343 delfiles=
3344 last_robj=
3346 output=$output_objdir/$save_output-${k}.$objext
3347 # Loop over the list of objects to be linked.
3348 for obj in $save_libobjs
3350 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3351 if test "X$objlist" = X ||
3352 { len=`expr "X$test_cmds" : ".*"` &&
3353 test "$len" -le "$max_cmd_len"; }; then
3354 objlist="$objlist $obj"
3355 else
3356 # The command $test_cmds is almost too long, add a
3357 # command to the queue.
3358 if test "$k" -eq 1 ; then
3359 # The first file doesn't have a previous command to add.
3360 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3361 else
3362 # All subsequent reloadable object files will link in
3363 # the last one created.
3364 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3366 last_robj=$output_objdir/$save_output-${k}.$objext
3367 k=`expr $k + 1`
3368 output=$output_objdir/$save_output-${k}.$objext
3369 objlist=$obj
3370 len=1
3372 done
3373 # Handle the remaining objects by creating one last
3374 # reloadable object file. All subsequent reloadable object
3375 # files will link in the last one created.
3376 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3377 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3379 # Set up a command to remove the reloadale object files
3380 # after they are used.
3382 while test "$i" -lt "$k"
3384 i=`expr $i + 1`
3385 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3386 done
3388 $echo "creating a temporary reloadable object file: $output"
3390 # Loop through the commands generated above and execute them.
3391 save_ifs="$IFS"; IFS='~'
3392 for cmd in $concat_cmds; do
3393 IFS="$save_ifs"
3394 $show "$cmd"
3395 $run eval "$cmd" || exit $?
3396 done
3397 IFS="$save_ifs"
3399 libobjs=$output
3400 # Restore the value of output.
3401 output=$save_output
3403 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3404 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3406 # Expand the library linking commands again to reset the
3407 # value of $libobjs for piecewise linking.
3409 # Do each of the archive commands.
3410 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3411 eval cmds=\"$archive_expsym_cmds\"
3412 else
3413 eval cmds=\"$archive_cmds\"
3416 # Append the command to remove the reloadable object files
3417 # to the just-reset $cmds.
3418 eval cmds=\"\$cmds~$rm $delfiles\"
3420 save_ifs="$IFS"; IFS='~'
3421 for cmd in $cmds; do
3422 IFS="$save_ifs"
3423 $show "$cmd"
3424 $run eval "$cmd" || exit $?
3425 done
3426 IFS="$save_ifs"
3428 # Restore the uninstalled library and exit
3429 if test "$mode" = relink; then
3430 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3431 exit 0
3434 # Create links to the real library.
3435 for linkname in $linknames; do
3436 if test "$realname" != "$linkname"; then
3437 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3438 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3440 done
3442 # If -module or -export-dynamic was specified, set the dlname.
3443 if test "$module" = yes || test "$export_dynamic" = yes; then
3444 # On all known operating systems, these are identical.
3445 dlname="$soname"
3450 obj)
3451 if test -n "$deplibs"; then
3452 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3455 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3456 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3459 if test -n "$rpath"; then
3460 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3463 if test -n "$xrpath"; then
3464 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3467 if test -n "$vinfo"; then
3468 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3471 if test -n "$release"; then
3472 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3475 case $output in
3476 *.lo)
3477 if test -n "$objs$old_deplibs"; then
3478 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3479 exit 1
3481 libobj="$output"
3482 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3485 libobj=
3486 obj="$output"
3488 esac
3490 # Delete the old objects.
3491 $run $rm $obj $libobj
3493 # Objects from convenience libraries. This assumes
3494 # single-version convenience libraries. Whenever we create
3495 # different ones for PIC/non-PIC, this we'll have to duplicate
3496 # the extraction.
3497 reload_conv_objs=
3498 gentop=
3499 # reload_cmds runs $LD directly, so let us get rid of
3500 # -Wl from whole_archive_flag_spec
3503 if test -n "$convenience"; then
3504 if test -n "$whole_archive_flag_spec"; then
3505 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3506 else
3507 gentop="$output_objdir/${obj}x"
3508 $show "${rm}r $gentop"
3509 $run ${rm}r "$gentop"
3510 $show "$mkdir $gentop"
3511 $run $mkdir "$gentop"
3512 status=$?
3513 if test "$status" -ne 0 && test ! -d "$gentop"; then
3514 exit $status
3516 generated="$generated $gentop"
3518 for xlib in $convenience; do
3519 # Extract the objects.
3520 case $xlib in
3521 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3522 *) xabs=`pwd`"/$xlib" ;;
3523 esac
3524 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3525 xdir="$gentop/$xlib"
3527 $show "${rm}r $xdir"
3528 $run ${rm}r "$xdir"
3529 $show "$mkdir $xdir"
3530 $run $mkdir "$xdir"
3531 status=$?
3532 if test "$status" -ne 0 && test ! -d "$xdir"; then
3533 exit $status
3535 $show "(cd $xdir && $AR x $xabs)"
3536 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3538 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3539 done
3543 # Create the old-style object.
3544 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
3546 output="$obj"
3547 eval cmds=\"$reload_cmds\"
3548 save_ifs="$IFS"; IFS='~'
3549 for cmd in $cmds; do
3550 IFS="$save_ifs"
3551 $show "$cmd"
3552 $run eval "$cmd" || exit $?
3553 done
3554 IFS="$save_ifs"
3556 # Exit if we aren't doing a library object file.
3557 if test -z "$libobj"; then
3558 if test -n "$gentop"; then
3559 $show "${rm}r $gentop"
3560 $run ${rm}r $gentop
3563 exit 0
3566 if test "$build_libtool_libs" != yes; then
3567 if test -n "$gentop"; then
3568 $show "${rm}r $gentop"
3569 $run ${rm}r $gentop
3572 # Create an invalid libtool object if no PIC, so that we don't
3573 # accidentally link it into a program.
3574 # $show "echo timestamp > $libobj"
3575 # $run eval "echo timestamp > $libobj" || exit $?
3576 exit 0
3579 if test -n "$pic_flag" || test "$pic_mode" != default; then
3580 # Only do commands if we really have different PIC objects.
3581 reload_objs="$libobjs $reload_conv_objs"
3582 output="$libobj"
3583 eval cmds=\"$reload_cmds\"
3584 save_ifs="$IFS"; IFS='~'
3585 for cmd in $cmds; do
3586 IFS="$save_ifs"
3587 $show "$cmd"
3588 $run eval "$cmd" || exit $?
3589 done
3590 IFS="$save_ifs"
3593 if test -n "$gentop"; then
3594 $show "${rm}r $gentop"
3595 $run ${rm}r $gentop
3598 exit 0
3601 prog)
3602 case $host in
3603 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3604 esac
3605 if test -n "$vinfo"; then
3606 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3609 if test -n "$release"; then
3610 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3613 if test "$preload" = yes; then
3614 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3615 test "$dlopen_self_static" = unknown; then
3616 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3620 case $host in
3621 *-*-rhapsody* | *-*-darwin1.[012])
3622 # On Rhapsody replace the C library is the System framework
3623 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3624 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3626 esac
3628 compile_command="$compile_command $compile_deplibs"
3629 finalize_command="$finalize_command $finalize_deplibs"
3631 if test -n "$rpath$xrpath"; then
3632 # If the user specified any rpath flags, then add them.
3633 for libdir in $rpath $xrpath; do
3634 # This is the magic to use -rpath.
3635 case "$finalize_rpath " in
3636 *" $libdir "*) ;;
3637 *) finalize_rpath="$finalize_rpath $libdir" ;;
3638 esac
3639 done
3642 # Now hardcode the library paths
3643 rpath=
3644 hardcode_libdirs=
3645 for libdir in $compile_rpath $finalize_rpath; do
3646 if test -n "$hardcode_libdir_flag_spec"; then
3647 if test -n "$hardcode_libdir_separator"; then
3648 if test -z "$hardcode_libdirs"; then
3649 hardcode_libdirs="$libdir"
3650 else
3651 # Just accumulate the unique libdirs.
3652 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3653 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3656 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3658 esac
3660 else
3661 eval flag=\"$hardcode_libdir_flag_spec\"
3662 rpath="$rpath $flag"
3664 elif test -n "$runpath_var"; then
3665 case "$perm_rpath " in
3666 *" $libdir "*) ;;
3667 *) perm_rpath="$perm_rpath $libdir" ;;
3668 esac
3670 case $host in
3671 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3672 case :$dllsearchpath: in
3673 *":$libdir:"*) ;;
3674 *) dllsearchpath="$dllsearchpath:$libdir";;
3675 esac
3677 esac
3678 done
3679 # Substitute the hardcoded libdirs into the rpath.
3680 if test -n "$hardcode_libdir_separator" &&
3681 test -n "$hardcode_libdirs"; then
3682 libdir="$hardcode_libdirs"
3683 eval rpath=\" $hardcode_libdir_flag_spec\"
3685 compile_rpath="$rpath"
3687 rpath=
3688 hardcode_libdirs=
3689 for libdir in $finalize_rpath; do
3690 if test -n "$hardcode_libdir_flag_spec"; then
3691 if test -n "$hardcode_libdir_separator"; then
3692 if test -z "$hardcode_libdirs"; then
3693 hardcode_libdirs="$libdir"
3694 else
3695 # Just accumulate the unique libdirs.
3696 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3697 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3700 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3702 esac
3704 else
3705 eval flag=\"$hardcode_libdir_flag_spec\"
3706 rpath="$rpath $flag"
3708 elif test -n "$runpath_var"; then
3709 case "$finalize_perm_rpath " in
3710 *" $libdir "*) ;;
3711 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3712 esac
3714 done
3715 # Substitute the hardcoded libdirs into the rpath.
3716 if test -n "$hardcode_libdir_separator" &&
3717 test -n "$hardcode_libdirs"; then
3718 libdir="$hardcode_libdirs"
3719 eval rpath=\" $hardcode_libdir_flag_spec\"
3721 finalize_rpath="$rpath"
3723 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3724 # Transform all the library objects into standard objects.
3725 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3726 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3729 dlsyms=
3730 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3731 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3732 dlsyms="${outputname}S.c"
3733 else
3734 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3738 if test -n "$dlsyms"; then
3739 case $dlsyms in
3740 "") ;;
3741 *.c)
3742 # Discover the nlist of each of the dlfiles.
3743 nlist="$output_objdir/${outputname}.nm"
3745 $show "$rm $nlist ${nlist}S ${nlist}T"
3746 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3748 # Parse the name list into a source file.
3749 $show "creating $output_objdir/$dlsyms"
3751 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3752 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3753 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3755 #ifdef __cplusplus
3756 extern \"C\" {
3757 #endif
3759 /* Prevent the only kind of declaration conflicts we can make. */
3760 #define lt_preloaded_symbols some_other_symbol
3762 /* External symbol declarations for the compiler. */\
3765 if test "$dlself" = yes; then
3766 $show "generating symbol list for \`$output'"
3768 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3770 # Add our own program objects to the symbol list.
3771 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3772 for arg in $progfiles; do
3773 $show "extracting global C symbols from \`$arg'"
3774 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3775 done
3777 if test -n "$exclude_expsyms"; then
3778 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3779 $run eval '$mv "$nlist"T "$nlist"'
3782 if test -n "$export_symbols_regex"; then
3783 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3784 $run eval '$mv "$nlist"T "$nlist"'
3787 # Prepare the list of exported symbols
3788 if test -z "$export_symbols"; then
3789 export_symbols="$output_objdir/$output.exp"
3790 $run $rm $export_symbols
3791 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3792 else
3793 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3794 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3795 $run eval 'mv "$nlist"T "$nlist"'
3799 for arg in $dlprefiles; do
3800 $show "extracting global C symbols from \`$arg'"
3801 name=`echo "$arg" | sed -e 's%^.*/%%'`
3802 $run eval 'echo ": $name " >> "$nlist"'
3803 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3804 done
3806 if test -z "$run"; then
3807 # Make sure we have at least an empty file.
3808 test -f "$nlist" || : > "$nlist"
3810 if test -n "$exclude_expsyms"; then
3811 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3812 $mv "$nlist"T "$nlist"
3815 # Try sorting and uniquifying the output.
3816 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3818 else
3819 grep -v "^: " < "$nlist" > "$nlist"S
3822 if test -f "$nlist"S; then
3823 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3824 else
3825 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3828 $echo >> "$output_objdir/$dlsyms" "\
3830 #undef lt_preloaded_symbols
3832 #if defined (__STDC__) && __STDC__
3833 # define lt_ptr void *
3834 #else
3835 # define lt_ptr char *
3836 # define const
3837 #endif
3839 /* The mapping between symbol names and symbols. */
3840 const struct {
3841 const char *name;
3842 lt_ptr address;
3844 lt_preloaded_symbols[] =
3848 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3850 $echo >> "$output_objdir/$dlsyms" "\
3851 {0, (lt_ptr) 0}
3854 /* This works around a problem in FreeBSD linker */
3855 #ifdef FREEBSD_WORKAROUND
3856 static const void *lt_preloaded_setup() {
3857 return lt_preloaded_symbols;
3859 #endif
3861 #ifdef __cplusplus
3863 #endif\
3867 pic_flag_for_symtable=
3868 case $host in
3869 # compiling the symbol table file with pic_flag works around
3870 # a FreeBSD bug that causes programs to crash when -lm is
3871 # linked before any other PIC object. But we must not use
3872 # pic_flag when linking with -static. The problem exists in
3873 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3874 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3875 case "$compile_command " in
3876 *" -static "*) ;;
3877 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3878 esac;;
3879 *-*-hpux*)
3880 case "$compile_command " in
3881 *" -static "*) ;;
3882 *) pic_flag_for_symtable=" $pic_flag";;
3883 esac
3884 esac
3886 # Now compile the dynamic symbol file.
3887 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3888 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3890 # Clean up the generated files.
3891 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3892 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3894 # Transform the symbol file into the correct name.
3895 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3896 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3899 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3900 exit 1
3902 esac
3903 else
3904 # We keep going just in case the user didn't refer to
3905 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3906 # really was required.
3908 # Nullify the symbol file.
3909 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3910 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3913 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3914 # Replace the output file specification.
3915 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3916 link_command="$compile_command$compile_rpath"
3918 # We have no uninstalled library dependencies, so finalize right now.
3919 $show "$link_command"
3920 $run eval "$link_command"
3921 status=$?
3923 # Delete the generated files.
3924 if test -n "$dlsyms"; then
3925 $show "$rm $output_objdir/${outputname}S.${objext}"
3926 $run $rm "$output_objdir/${outputname}S.${objext}"
3929 exit $status
3932 if test -n "$shlibpath_var"; then
3933 # We should set the shlibpath_var
3934 rpath=
3935 for dir in $temp_rpath; do
3936 case $dir in
3937 [\\/]* | [A-Za-z]:[\\/]*)
3938 # Absolute path.
3939 rpath="$rpath$dir:"
3942 # Relative path: add a thisdir entry.
3943 rpath="$rpath\$thisdir/$dir:"
3945 esac
3946 done
3947 temp_rpath="$rpath"
3950 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3951 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3953 if test -n "$finalize_shlibpath"; then
3954 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3957 compile_var=
3958 finalize_var=
3959 if test -n "$runpath_var"; then
3960 if test -n "$perm_rpath"; then
3961 # We should set the runpath_var.
3962 rpath=
3963 for dir in $perm_rpath; do
3964 rpath="$rpath$dir:"
3965 done
3966 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3968 if test -n "$finalize_perm_rpath"; then
3969 # We should set the runpath_var.
3970 rpath=
3971 for dir in $finalize_perm_rpath; do
3972 rpath="$rpath$dir:"
3973 done
3974 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3978 if test "$no_install" = yes; then
3979 # We don't need to create a wrapper script.
3980 link_command="$compile_var$compile_command$compile_rpath"
3981 # Replace the output file specification.
3982 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3983 # Delete the old output file.
3984 $run $rm $output
3985 # Link the executable and exit
3986 $show "$link_command"
3987 $run eval "$link_command" || exit $?
3988 exit 0
3991 if test "$hardcode_action" = relink; then
3992 # Fast installation is not supported
3993 link_command="$compile_var$compile_command$compile_rpath"
3994 relink_command="$finalize_var$finalize_command$finalize_rpath"
3996 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3997 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3998 else
3999 if test "$fast_install" != no; then
4000 link_command="$finalize_var$compile_command$finalize_rpath"
4001 if test "$fast_install" = yes; then
4002 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4003 else
4004 # fast_install is set to needless
4005 relink_command=
4007 else
4008 link_command="$compile_var$compile_command$compile_rpath"
4009 relink_command="$finalize_var$finalize_command$finalize_rpath"
4013 # Replace the output file specification.
4014 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4016 # Delete the old output files.
4017 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4019 $show "$link_command"
4020 $run eval "$link_command" || exit $?
4022 # Now create the wrapper script.
4023 $show "creating $output"
4025 # Quote the relink command for shipping.
4026 if test -n "$relink_command"; then
4027 # Preserve any variables that may affect compiler behavior
4028 for var in $variables_saved_for_relink; do
4029 if eval test -z \"\${$var+set}\"; then
4030 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4031 elif eval var_value=\$$var; test -z "$var_value"; then
4032 relink_command="$var=; export $var; $relink_command"
4033 else
4034 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4035 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4037 done
4038 relink_command="(cd `pwd`; $relink_command)"
4039 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4042 # Quote $echo for shipping.
4043 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4044 case $0 in
4045 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4046 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4047 esac
4048 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4049 else
4050 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4053 # Only actually do things if our run command is non-null.
4054 if test -z "$run"; then
4055 # win32 will think the script is a binary if it has
4056 # a .exe suffix, so we strip it off here.
4057 case $output in
4058 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
4059 esac
4060 # test for cygwin because mv fails w/o .exe extensions
4061 case $host in
4062 *cygwin*) exeext=.exe ;;
4063 *) exeext= ;;
4064 esac
4065 $rm $output
4066 trap "$rm $output; exit 1" 1 2 15
4068 $echo > $output "\
4069 #! $SHELL
4071 # $output - temporary wrapper script for $objdir/$outputname
4072 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4074 # The $output program cannot be directly executed until all the libtool
4075 # libraries that it depends on are installed.
4077 # This wrapper script should never be moved out of the build directory.
4078 # If it is, it will not operate correctly.
4080 # Sed substitution that helps us do robust quoting. It backslashifies
4081 # metacharacters that are still active within double-quoted strings.
4082 Xsed='sed -e 1s/^X//'
4083 sed_quote_subst='$sed_quote_subst'
4085 # The HP-UX ksh and POSIX shell print the target directory to stdout
4086 # if CDPATH is set.
4087 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4089 relink_command=\"$relink_command\"
4091 # This environment variable determines our operation mode.
4092 if test \"\$libtool_install_magic\" = \"$magic\"; then
4093 # install mode needs the following variable:
4094 notinst_deplibs='$notinst_deplibs'
4095 else
4096 # When we are sourced in execute mode, \$file and \$echo are already set.
4097 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4098 echo=\"$qecho\"
4099 file=\"\$0\"
4100 # Make sure echo works.
4101 if test \"X\$1\" = X--no-reexec; then
4102 # Discard the --no-reexec flag, and continue.
4103 shift
4104 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4105 # Yippee, \$echo works!
4107 else
4108 # Restart under the correct shell, and then maybe \$echo will work.
4109 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4113 $echo >> $output "\
4115 # Find the directory that this script lives in.
4116 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4117 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4119 # Follow symbolic links until we get to the real thisdir.
4120 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4121 while test -n \"\$file\"; do
4122 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4124 # If there was a directory component, then change thisdir.
4125 if test \"x\$destdir\" != \"x\$file\"; then
4126 case \"\$destdir\" in
4127 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4128 *) thisdir=\"\$thisdir/\$destdir\" ;;
4129 esac
4132 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4133 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4134 done
4136 # Try to get the absolute directory name.
4137 absdir=\`cd \"\$thisdir\" && pwd\`
4138 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4141 if test "$fast_install" = yes; then
4142 echo >> $output "\
4143 program=lt-'$outputname'$exeext
4144 progdir=\"\$thisdir/$objdir\"
4146 if test ! -f \"\$progdir/\$program\" || \\
4147 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4148 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4150 file=\"\$\$-\$program\"
4152 if test ! -d \"\$progdir\"; then
4153 $mkdir \"\$progdir\"
4154 else
4155 $rm \"\$progdir/\$file\"
4158 echo >> $output "\
4160 # relink executable if necessary
4161 if test -n \"\$relink_command\"; then
4162 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4163 else
4164 $echo \"\$relink_command_output\" >&2
4165 $rm \"\$progdir/\$file\"
4166 exit 1
4170 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4171 { $rm \"\$progdir/\$program\";
4172 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4173 $rm \"\$progdir/\$file\"
4175 else
4176 echo >> $output "\
4177 program='$outputname'
4178 progdir=\"\$thisdir/$objdir\"
4182 echo >> $output "\
4184 if test -f \"\$progdir/\$program\"; then"
4186 # Export our shlibpath_var if we have one.
4187 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4188 $echo >> $output "\
4189 # Add our own library path to $shlibpath_var
4190 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4192 # Some systems cannot cope with colon-terminated $shlibpath_var
4193 # The second colon is a workaround for a bug in BeOS R4 sed
4194 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4196 export $shlibpath_var
4200 # fixup the dll searchpath if we need to.
4201 if test -n "$dllsearchpath"; then
4202 $echo >> $output "\
4203 # Add the dll search path components to the executable PATH
4204 PATH=$dllsearchpath:\$PATH
4208 $echo >> $output "\
4209 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4210 # Run the actual program with our arguments.
4212 case $host in
4213 # win32 systems need to use the prog path for dll
4214 # lookup to work
4215 *-*-cygwin* | *-*-pw32*)
4216 $echo >> $output "\
4217 exec \$progdir/\$program \${1+\"\$@\"}
4221 # Backslashes separate directories on plain windows
4222 *-*-mingw | *-*-os2*)
4223 $echo >> $output "\
4224 exec \$progdir\\\\\$program \${1+\"\$@\"}
4229 $echo >> $output "\
4230 # Export the path to the program.
4231 PATH=\"\$progdir:\$PATH\"
4232 export PATH
4234 exec \$program \${1+\"\$@\"}
4237 esac
4238 $echo >> $output "\
4239 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4240 exit 1
4242 else
4243 # The program doesn't exist.
4244 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4245 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4246 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4247 exit 1
4251 chmod +x $output
4253 exit 0
4255 esac
4257 # See if we need to build an old-fashioned archive.
4258 for oldlib in $oldlibs; do
4260 if test "$build_libtool_libs" = convenience; then
4261 oldobjs="$libobjs_save"
4262 addlibs="$convenience"
4263 build_libtool_libs=no
4264 else
4265 if test "$build_libtool_libs" = module; then
4266 oldobjs="$libobjs_save"
4267 build_libtool_libs=no
4268 else
4269 oldobjs="$objs$old_deplibs $non_pic_objects"
4271 addlibs="$old_convenience"
4274 if test -n "$addlibs"; then
4275 gentop="$output_objdir/${outputname}x"
4276 $show "${rm}r $gentop"
4277 $run ${rm}r "$gentop"
4278 $show "$mkdir $gentop"
4279 $run $mkdir "$gentop"
4280 status=$?
4281 if test "$status" -ne 0 && test ! -d "$gentop"; then
4282 exit $status
4284 generated="$generated $gentop"
4286 # Add in members from convenience archives.
4287 for xlib in $addlibs; do
4288 # Extract the objects.
4289 case $xlib in
4290 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4291 *) xabs=`pwd`"/$xlib" ;;
4292 esac
4293 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4294 xdir="$gentop/$xlib"
4296 $show "${rm}r $xdir"
4297 $run ${rm}r "$xdir"
4298 $show "$mkdir $xdir"
4299 $run $mkdir "$xdir"
4300 status=$?
4301 if test "$status" -ne 0 && test ! -d "$xdir"; then
4302 exit $status
4304 $show "(cd $xdir && $AR x $xabs)"
4305 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4307 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4308 done
4311 # Do each command in the archive commands.
4312 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4313 eval cmds=\"$old_archive_from_new_cmds\"
4314 else
4315 eval cmds=\"$old_archive_cmds\"
4317 if len=`expr "X$cmds" : ".*"` &&
4318 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4320 else
4321 # the command line is too long to link in one step, link in parts
4322 $echo "using piecewise archive linking..."
4323 save_RANLIB=$RANLIB
4324 RANLIB=:
4325 objlist=
4326 concat_cmds=
4327 save_oldobjs=$oldobjs
4328 for obj in $save_oldobjs
4330 oldobjs="$objlist $obj"
4331 objlist="$objlist $obj"
4332 eval test_cmds=\"$old_archive_cmds\"
4333 if len=`expr "X$test_cmds" : ".*"` &&
4334 test "$len" -le "$max_cmd_len"; then
4336 else
4337 # the above command should be used before it gets too long
4338 oldobjs=$objlist
4339 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4340 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4341 objlist=
4343 done
4344 RANLIB=$save_RANLIB
4345 oldobjs=$objlist
4346 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4349 save_ifs="$IFS"; IFS='~'
4350 for cmd in $cmds; do
4351 IFS="$save_ifs"
4352 $show "$cmd"
4353 $run eval "$cmd" || exit $?
4354 done
4355 IFS="$save_ifs"
4356 done
4358 if test -n "$generated"; then
4359 $show "${rm}r$generated"
4360 $run ${rm}r$generated
4363 # Now create the libtool archive.
4364 case $output in
4365 *.la)
4366 old_library=
4367 test "$build_old_libs" = yes && old_library="$libname.$libext"
4368 $show "creating $output"
4370 # Preserve any variables that may affect compiler behavior
4371 for var in $variables_saved_for_relink; do
4372 if eval test -z \"\${$var+set}\"; then
4373 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4374 elif eval var_value=\$$var; test -z "$var_value"; then
4375 relink_command="$var=; export $var; $relink_command"
4376 else
4377 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4378 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4380 done
4381 # Quote the link command for shipping.
4382 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
4383 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4385 # Only create the output if not a dry run.
4386 if test -z "$run"; then
4387 for installed in no yes; do
4388 if test "$installed" = yes; then
4389 if test -z "$install_libdir"; then
4390 break
4392 output="$output_objdir/$outputname"i
4393 # Replace all uninstalled libtool libraries with the installed ones
4394 newdependency_libs=
4395 for deplib in $dependency_libs; do
4396 case $deplib in
4397 *.la)
4398 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4399 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4400 if test -z "$libdir"; then
4401 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4402 exit 1
4404 newdependency_libs="$newdependency_libs $libdir/$name"
4406 *) newdependency_libs="$newdependency_libs $deplib" ;;
4407 esac
4408 done
4409 dependency_libs="$newdependency_libs"
4410 newdlfiles=
4411 for lib in $dlfiles; do
4412 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4413 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4414 if test -z "$libdir"; then
4415 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4416 exit 1
4418 newdlfiles="$newdlfiles $libdir/$name"
4419 done
4420 dlfiles="$newdlfiles"
4421 newdlprefiles=
4422 for lib in $dlprefiles; do
4423 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4424 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4425 if test -z "$libdir"; then
4426 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4427 exit 1
4429 newdlprefiles="$newdlprefiles $libdir/$name"
4430 done
4431 dlprefiles="$newdlprefiles"
4433 $rm $output
4434 # place dlname in correct position for cygwin
4435 tdlname=$dlname
4436 case $host,$output,$installed,$module,$dlname in
4437 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4438 esac
4439 $echo > $output "\
4440 # $outputname - a libtool library file
4441 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4443 # Please DO NOT delete this file!
4444 # It is necessary for linking the library.
4446 # The name that we can dlopen(3).
4447 dlname='$tdlname'
4449 # Names of this library.
4450 library_names='$library_names'
4452 # The name of the static archive.
4453 old_library='$old_library'
4455 # Libraries that this one depends upon.
4456 dependency_libs='$dependency_libs'
4458 # Version information for $libname.
4459 current=$current
4460 age=$age
4461 revision=$revision
4463 # Is this an already installed library?
4464 installed=$installed
4466 # Files to dlopen/dlpreopen
4467 dlopen='$dlfiles'
4468 dlpreopen='$dlprefiles'
4470 # Directory that this library needs to be installed in:
4471 libdir='$install_libdir'"
4472 if test "$installed" = no && test "$need_relink" = yes; then
4473 $echo >> $output "\
4474 relink_command=\"$relink_command\""
4476 done
4479 # Do a symbolic link so that the libtool archive can be found in
4480 # LD_LIBRARY_PATH before the program is installed.
4481 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4482 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4484 esac
4485 exit 0
4488 # libtool install mode
4489 install)
4490 modename="$modename: install"
4492 # There may be an optional sh(1) argument at the beginning of
4493 # install_prog (especially on Windows NT).
4494 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4495 # Allow the use of GNU shtool's install command.
4496 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4497 # Aesthetically quote it.
4498 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4499 case $arg in
4500 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4501 arg="\"$arg\""
4503 esac
4504 install_prog="$arg "
4505 arg="$1"
4506 shift
4507 else
4508 install_prog=
4509 arg="$nonopt"
4512 # The real first argument should be the name of the installation program.
4513 # Aesthetically quote it.
4514 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4515 case $arg in
4516 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4517 arg="\"$arg\""
4519 esac
4520 install_prog="$install_prog$arg"
4522 # We need to accept at least all the BSD install flags.
4523 dest=
4524 files=
4525 opts=
4526 prev=
4527 install_type=
4528 isdir=no
4529 stripme=
4530 for arg
4532 if test -n "$dest"; then
4533 files="$files $dest"
4534 dest="$arg"
4535 continue
4538 case $arg in
4539 -d) isdir=yes ;;
4540 -f) prev="-f" ;;
4541 -g) prev="-g" ;;
4542 -m) prev="-m" ;;
4543 -o) prev="-o" ;;
4545 stripme=" -s"
4546 continue
4548 -*) ;;
4551 # If the previous option needed an argument, then skip it.
4552 if test -n "$prev"; then
4553 prev=
4554 else
4555 dest="$arg"
4556 continue
4559 esac
4561 # Aesthetically quote the argument.
4562 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4563 case $arg in
4564 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4565 arg="\"$arg\""
4567 esac
4568 install_prog="$install_prog $arg"
4569 done
4571 if test -z "$install_prog"; then
4572 $echo "$modename: you must specify an install program" 1>&2
4573 $echo "$help" 1>&2
4574 exit 1
4577 if test -n "$prev"; then
4578 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4579 $echo "$help" 1>&2
4580 exit 1
4583 if test -z "$files"; then
4584 if test -z "$dest"; then
4585 $echo "$modename: no file or destination specified" 1>&2
4586 else
4587 $echo "$modename: you must specify a destination" 1>&2
4589 $echo "$help" 1>&2
4590 exit 1
4593 # Strip any trailing slash from the destination.
4594 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4596 # Check to see that the destination is a directory.
4597 test -d "$dest" && isdir=yes
4598 if test "$isdir" = yes; then
4599 destdir="$dest"
4600 destname=
4601 else
4602 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4603 test "X$destdir" = "X$dest" && destdir=.
4604 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4606 # Not a directory, so check to see that there is only one file specified.
4607 set dummy $files
4608 if test "$#" -gt 2; then
4609 $echo "$modename: \`$dest' is not a directory" 1>&2
4610 $echo "$help" 1>&2
4611 exit 1
4614 case $destdir in
4615 [\\/]* | [A-Za-z]:[\\/]*) ;;
4617 for file in $files; do
4618 case $file in
4619 *.lo) ;;
4621 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4622 $echo "$help" 1>&2
4623 exit 1
4625 esac
4626 done
4628 esac
4630 # This variable tells wrapper scripts just to set variables rather
4631 # than running their programs.
4632 libtool_install_magic="$magic"
4634 staticlibs=
4635 future_libdirs=
4636 current_libdirs=
4637 for file in $files; do
4639 # Do each installation.
4640 case $file in
4641 *.$libext)
4642 # Do the static libraries later.
4643 staticlibs="$staticlibs $file"
4646 *.la)
4647 # Check to see that this really is a libtool archive.
4648 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4649 else
4650 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4651 $echo "$help" 1>&2
4652 exit 1
4655 library_names=
4656 old_library=
4657 relink_command=
4658 # If there is no directory component, then add one.
4659 case $file in
4660 */* | *\\*) . $file ;;
4661 *) . ./$file ;;
4662 esac
4664 # Add the libdir to current_libdirs if it is the destination.
4665 if test "X$destdir" = "X$libdir"; then
4666 case "$current_libdirs " in
4667 *" $libdir "*) ;;
4668 *) current_libdirs="$current_libdirs $libdir" ;;
4669 esac
4670 else
4671 # Note the libdir as a future libdir.
4672 case "$future_libdirs " in
4673 *" $libdir "*) ;;
4674 *) future_libdirs="$future_libdirs $libdir" ;;
4675 esac
4678 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4679 test "X$dir" = "X$file/" && dir=
4680 dir="$dir$objdir"
4682 if test -n "$relink_command"; then
4683 $echo "$modename: warning: relinking \`$file'" 1>&2
4684 $show "$relink_command"
4685 if $run eval "$relink_command"; then :
4686 else
4687 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4688 continue
4692 # See the names of the shared library.
4693 set dummy $library_names
4694 if test -n "$2"; then
4695 realname="$2"
4696 shift
4697 shift
4699 srcname="$realname"
4700 test -n "$relink_command" && srcname="$realname"T
4702 # Install the shared library and build the symlinks.
4703 $show "$install_prog $dir/$srcname $destdir/$realname"
4704 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4705 if test -n "$stripme" && test -n "$striplib"; then
4706 $show "$striplib $destdir/$realname"
4707 $run eval "$striplib $destdir/$realname" || exit $?
4710 if test "$#" -gt 0; then
4711 # Delete the old symlinks, and create new ones.
4712 for linkname
4714 if test "$linkname" != "$realname"; then
4715 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4716 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4718 done
4721 # Do each command in the postinstall commands.
4722 lib="$destdir/$realname"
4723 eval cmds=\"$postinstall_cmds\"
4724 save_ifs="$IFS"; IFS='~'
4725 for cmd in $cmds; do
4726 IFS="$save_ifs"
4727 $show "$cmd"
4728 $run eval "$cmd" || exit $?
4729 done
4730 IFS="$save_ifs"
4733 # Install the pseudo-library for information purposes.
4734 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4735 instname="$dir/$name"i
4736 $show "$install_prog $instname $destdir/$name"
4737 $run eval "$install_prog $instname $destdir/$name" || exit $?
4739 # Maybe install the static library, too.
4740 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4743 *.lo)
4744 # Install (i.e. copy) a libtool object.
4746 # Figure out destination file name, if it wasn't already specified.
4747 if test -n "$destname"; then
4748 destfile="$destdir/$destname"
4749 else
4750 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4751 destfile="$destdir/$destfile"
4754 # Deduce the name of the destination old-style object file.
4755 case $destfile in
4756 *.lo)
4757 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4759 *.$objext)
4760 staticdest="$destfile"
4761 destfile=
4764 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4765 $echo "$help" 1>&2
4766 exit 1
4768 esac
4770 # Install the libtool object if requested.
4771 if test -n "$destfile"; then
4772 $show "$install_prog $file $destfile"
4773 $run eval "$install_prog $file $destfile" || exit $?
4776 # Install the old object if enabled.
4777 if test "$build_old_libs" = yes; then
4778 # Deduce the name of the old-style object file.
4779 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4781 $show "$install_prog $staticobj $staticdest"
4782 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4784 exit 0
4788 # Figure out destination file name, if it wasn't already specified.
4789 if test -n "$destname"; then
4790 destfile="$destdir/$destname"
4791 else
4792 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4793 destfile="$destdir/$destfile"
4796 # Do a test to see if this is really a libtool program.
4797 case $host in
4798 *cygwin*|*mingw*)
4799 wrapper=`echo $file | sed -e 's,.exe$,,'`
4802 wrapper=$file
4804 esac
4805 if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4806 notinst_deplibs=
4807 relink_command=
4809 # If there is no directory component, then add one.
4810 case $file in
4811 */* | *\\*) . $wrapper ;;
4812 *) . ./$wrapper ;;
4813 esac
4815 # Check the variables that should have been set.
4816 if test -z "$notinst_deplibs"; then
4817 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4818 exit 1
4821 finalize=yes
4822 for lib in $notinst_deplibs; do
4823 # Check to see that each library is installed.
4824 libdir=
4825 if test -f "$lib"; then
4826 # If there is no directory component, then add one.
4827 case $lib in
4828 */* | *\\*) . $lib ;;
4829 *) . ./$lib ;;
4830 esac
4832 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4833 if test -n "$libdir" && test ! -f "$libfile"; then
4834 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4835 finalize=no
4837 done
4839 relink_command=
4840 # If there is no directory component, then add one.
4841 case $file in
4842 */* | *\\*) . $file ;;
4843 *) . ./$file ;;
4844 esac
4846 outputname=
4847 if test "$fast_install" = no && test -n "$relink_command"; then
4848 if test "$finalize" = yes && test -z "$run"; then
4849 tmpdir="/tmp"
4850 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4851 tmpdir="$tmpdir/libtool-$$"
4852 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4853 else
4854 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4855 continue
4857 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4858 outputname="$tmpdir/$file"
4859 # Replace the output file specification.
4860 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4862 $show "$relink_command"
4863 if $run eval "$relink_command"; then :
4864 else
4865 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4866 ${rm}r "$tmpdir"
4867 continue
4869 file="$outputname"
4870 else
4871 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4873 else
4874 # Install the binary that we compiled earlier.
4875 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4879 # remove .exe since cygwin /usr/bin/install will append another
4880 # one anyways
4881 case $install_prog,$host in
4882 */usr/bin/install*,*cygwin*)
4883 case $file:$destfile in
4884 *.exe:*.exe)
4885 # this is ok
4887 *.exe:*)
4888 destfile=$destfile.exe
4890 *:*.exe)
4891 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4893 esac
4895 esac
4896 $show "$install_prog$stripme $file $destfile"
4897 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4898 test -n "$outputname" && ${rm}r "$tmpdir"
4900 esac
4901 done
4903 for file in $staticlibs; do
4904 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4906 # Set up the ranlib parameters.
4907 oldlib="$destdir/$name"
4909 $show "$install_prog $file $oldlib"
4910 $run eval "$install_prog \$file \$oldlib" || exit $?
4912 if test -n "$stripme" && test -n "$striplib"; then
4913 $show "$old_striplib $oldlib"
4914 $run eval "$old_striplib $oldlib" || exit $?
4917 # Do each command in the postinstall commands.
4918 eval cmds=\"$old_postinstall_cmds\"
4919 save_ifs="$IFS"; IFS='~'
4920 for cmd in $cmds; do
4921 IFS="$save_ifs"
4922 $show "$cmd"
4923 $run eval "$cmd" || exit $?
4924 done
4925 IFS="$save_ifs"
4926 done
4928 if test -n "$future_libdirs"; then
4929 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4932 if test -n "$current_libdirs"; then
4933 # Maybe just do a dry run.
4934 test -n "$run" && current_libdirs=" -n$current_libdirs"
4935 exec_cmd='$SHELL $0 --finish$current_libdirs'
4936 else
4937 exit 0
4941 # libtool finish mode
4942 finish)
4943 modename="$modename: finish"
4944 libdirs="$nonopt"
4945 admincmds=
4947 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4948 for dir
4950 libdirs="$libdirs $dir"
4951 done
4953 for libdir in $libdirs; do
4954 if test -n "$finish_cmds"; then
4955 # Do each command in the finish commands.
4956 eval cmds=\"$finish_cmds\"
4957 save_ifs="$IFS"; IFS='~'
4958 for cmd in $cmds; do
4959 IFS="$save_ifs"
4960 $show "$cmd"
4961 $run eval "$cmd" || admincmds="$admincmds
4962 $cmd"
4963 done
4964 IFS="$save_ifs"
4966 if test -n "$finish_eval"; then
4967 # Do the single finish_eval.
4968 eval cmds=\"$finish_eval\"
4969 $run eval "$cmds" || admincmds="$admincmds
4970 $cmds"
4972 done
4975 # Exit here if they wanted silent mode.
4976 test "$show" = : && exit 0
4978 echo "----------------------------------------------------------------------"
4979 echo "Libraries have been installed in:"
4980 for libdir in $libdirs; do
4981 echo " $libdir"
4982 done
4983 echo
4984 echo "If you ever happen to want to link against installed libraries"
4985 echo "in a given directory, LIBDIR, you must either use libtool, and"
4986 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4987 echo "flag during linking and do at least one of the following:"
4988 if test -n "$shlibpath_var"; then
4989 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4990 echo " during execution"
4992 if test -n "$runpath_var"; then
4993 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4994 echo " during linking"
4996 if test -n "$hardcode_libdir_flag_spec"; then
4997 libdir=LIBDIR
4998 eval flag=\"$hardcode_libdir_flag_spec\"
5000 echo " - use the \`$flag' linker flag"
5002 if test -n "$admincmds"; then
5003 echo " - have your system administrator run these commands:$admincmds"
5005 if test -f /etc/ld.so.conf; then
5006 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5008 echo
5009 echo "See any operating system documentation about shared libraries for"
5010 echo "more information, such as the ld(1) and ld.so(8) manual pages."
5011 echo "----------------------------------------------------------------------"
5012 exit 0
5015 # libtool execute mode
5016 execute)
5017 modename="$modename: execute"
5019 # The first argument is the command name.
5020 cmd="$nonopt"
5021 if test -z "$cmd"; then
5022 $echo "$modename: you must specify a COMMAND" 1>&2
5023 $echo "$help"
5024 exit 1
5027 # Handle -dlopen flags immediately.
5028 for file in $execute_dlfiles; do
5029 if test ! -f "$file"; then
5030 $echo "$modename: \`$file' is not a file" 1>&2
5031 $echo "$help" 1>&2
5032 exit 1
5035 dir=
5036 case $file in
5037 *.la)
5038 # Check to see that this really is a libtool archive.
5039 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5040 else
5041 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5042 $echo "$help" 1>&2
5043 exit 1
5046 # Read the libtool library.
5047 dlname=
5048 library_names=
5050 # If there is no directory component, then add one.
5051 case $file in
5052 */* | *\\*) . $file ;;
5053 *) . ./$file ;;
5054 esac
5056 # Skip this library if it cannot be dlopened.
5057 if test -z "$dlname"; then
5058 # Warn if it was a shared library.
5059 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5060 continue
5063 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5064 test "X$dir" = "X$file" && dir=.
5066 if test -f "$dir/$objdir/$dlname"; then
5067 dir="$dir/$objdir"
5068 else
5069 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5070 exit 1
5074 *.lo)
5075 # Just add the directory containing the .lo file.
5076 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5077 test "X$dir" = "X$file" && dir=.
5081 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5082 continue
5084 esac
5086 # Get the absolute pathname.
5087 absdir=`cd "$dir" && pwd`
5088 test -n "$absdir" && dir="$absdir"
5090 # Now add the directory to shlibpath_var.
5091 if eval "test -z \"\$$shlibpath_var\""; then
5092 eval "$shlibpath_var=\"\$dir\""
5093 else
5094 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5096 done
5098 # This variable tells wrapper scripts just to set shlibpath_var
5099 # rather than running their programs.
5100 libtool_execute_magic="$magic"
5102 # Check if any of the arguments is a wrapper script.
5103 args=
5104 for file
5106 case $file in
5107 -*) ;;
5109 # Do a test to see if this is really a libtool program.
5110 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5111 # If there is no directory component, then add one.
5112 case $file in
5113 */* | *\\*) . $file ;;
5114 *) . ./$file ;;
5115 esac
5117 # Transform arg to wrapped name.
5118 file="$progdir/$program"
5121 esac
5122 # Quote arguments (to preserve shell metacharacters).
5123 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5124 args="$args \"$file\""
5125 done
5127 if test -z "$run"; then
5128 if test -n "$shlibpath_var"; then
5129 # Export the shlibpath_var.
5130 eval "export $shlibpath_var"
5133 # Restore saved enviroment variables
5134 if test "${save_LC_ALL+set}" = set; then
5135 LC_ALL="$save_LC_ALL"; export LC_ALL
5137 if test "${save_LANG+set}" = set; then
5138 LANG="$save_LANG"; export LANG
5141 # Now prepare to actually exec the command.
5142 exec_cmd="\$cmd$args"
5143 else
5144 # Display what would be done.
5145 if test -n "$shlibpath_var"; then
5146 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5147 $echo "export $shlibpath_var"
5149 $echo "$cmd$args"
5150 exit 0
5154 # libtool clean and uninstall mode
5155 clean | uninstall)
5156 modename="$modename: $mode"
5157 rm="$nonopt"
5158 files=
5159 rmforce=
5160 exit_status=0
5162 # This variable tells wrapper scripts just to set variables rather
5163 # than running their programs.
5164 libtool_install_magic="$magic"
5166 for arg
5168 case $arg in
5169 -f) rm="$rm $arg"; rmforce=yes ;;
5170 -*) rm="$rm $arg" ;;
5171 *) files="$files $arg" ;;
5172 esac
5173 done
5175 if test -z "$rm"; then
5176 $echo "$modename: you must specify an RM program" 1>&2
5177 $echo "$help" 1>&2
5178 exit 1
5181 rmdirs=
5183 for file in $files; do
5184 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5185 if test "X$dir" = "X$file"; then
5186 dir=.
5187 objdir="$objdir"
5188 else
5189 objdir="$dir/$objdir"
5191 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5192 test "$mode" = uninstall && objdir="$dir"
5194 # Remember objdir for removal later, being careful to avoid duplicates
5195 if test "$mode" = clean; then
5196 case " $rmdirs " in
5197 *" $objdir "*) ;;
5198 *) rmdirs="$rmdirs $objdir" ;;
5199 esac
5202 # Don't error if the file doesn't exist and rm -f was used.
5203 if (test -L "$file") >/dev/null 2>&1 \
5204 || (test -h "$file") >/dev/null 2>&1 \
5205 || test -f "$file"; then
5207 elif test -d "$file"; then
5208 exit_status=1
5209 continue
5210 elif test "$rmforce" = yes; then
5211 continue
5214 rmfiles="$file"
5216 case $name in
5217 *.la)
5218 # Possibly a libtool archive, so verify it.
5219 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5220 . $dir/$name
5222 # Delete the libtool libraries and symlinks.
5223 for n in $library_names; do
5224 rmfiles="$rmfiles $objdir/$n"
5225 done
5226 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5227 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5229 if test "$mode" = uninstall; then
5230 if test -n "$library_names"; then
5231 # Do each command in the postuninstall commands.
5232 eval cmds=\"$postuninstall_cmds\"
5233 save_ifs="$IFS"; IFS='~'
5234 for cmd in $cmds; do
5235 IFS="$save_ifs"
5236 $show "$cmd"
5237 $run eval "$cmd"
5238 if test "$?" -ne 0 && test "$rmforce" != yes; then
5239 exit_status=1
5241 done
5242 IFS="$save_ifs"
5245 if test -n "$old_library"; then
5246 # Do each command in the old_postuninstall commands.
5247 eval cmds=\"$old_postuninstall_cmds\"
5248 save_ifs="$IFS"; IFS='~'
5249 for cmd in $cmds; do
5250 IFS="$save_ifs"
5251 $show "$cmd"
5252 $run eval "$cmd"
5253 if test "$?" -ne 0 && test "$rmforce" != yes; then
5254 exit_status=1
5256 done
5257 IFS="$save_ifs"
5259 # FIXME: should reinstall the best remaining shared library.
5264 *.lo)
5265 # Possibly a libtool object, so verify it.
5266 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5268 # Read the .lo file
5269 . $dir/$name
5271 # Add PIC object to the list of files to remove.
5272 if test -n "$pic_object" \
5273 && test "$pic_object" != none; then
5274 rmfiles="$rmfiles $dir/$pic_object"
5277 # Add non-PIC object to the list of files to remove.
5278 if test -n "$non_pic_object" \
5279 && test "$non_pic_object" != none; then
5280 rmfiles="$rmfiles $dir/$non_pic_object"
5286 # Do a test to see if this is a libtool program.
5287 if test "$mode" = clean &&
5288 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5289 relink_command=
5290 . $dir/$file
5292 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5293 if test "$fast_install" = yes && test -n "$relink_command"; then
5294 rmfiles="$rmfiles $objdir/lt-$name"
5298 esac
5299 $show "$rm $rmfiles"
5300 $run $rm $rmfiles || exit_status=1
5301 done
5303 # Try to remove the ${objdir}s in the directories where we deleted files
5304 for dir in $rmdirs; do
5305 if test -d "$dir"; then
5306 $show "rmdir $dir"
5307 $run rmdir $dir >/dev/null 2>&1
5309 done
5311 exit $exit_status
5315 $echo "$modename: you must specify a MODE" 1>&2
5316 $echo "$generic_help" 1>&2
5317 exit 1
5319 esac
5321 if test -z "$exec_cmd"; then
5322 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5323 $echo "$generic_help" 1>&2
5324 exit 1
5326 fi # test -z "$show_help"
5328 if test -n "$exec_cmd"; then
5329 eval exec $exec_cmd
5330 exit 1
5333 # We need to display help for each of the modes.
5334 case $mode in
5335 "") $echo \
5336 "Usage: $modename [OPTION]... [MODE-ARG]...
5338 Provide generalized library-building support services.
5340 --config show all configuration variables
5341 --debug enable verbose shell tracing
5342 -n, --dry-run display commands without modifying any files
5343 --features display basic configuration information and exit
5344 --finish same as \`--mode=finish'
5345 --help display this help message and exit
5346 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5347 --quiet same as \`--silent'
5348 --silent don't print informational messages
5349 --tag=TAG use configuration variables from tag TAG
5350 --version print version information
5352 MODE must be one of the following:
5354 clean remove files from the build directory
5355 compile compile a source file into a libtool object
5356 execute automatically set library path, then run a program
5357 finish complete the installation of libtool libraries
5358 install install libraries or executables
5359 link create a library or an executable
5360 uninstall remove libraries from an installed directory
5362 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5363 a more detailed description of MODE."
5364 exit 0
5367 clean)
5368 $echo \
5369 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5371 Remove files from the build directory.
5373 RM is the name of the program to use to delete files associated with each FILE
5374 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5375 to RM.
5377 If FILE is a libtool library, object or program, all the files associated
5378 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5381 compile)
5382 $echo \
5383 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5385 Compile a source file into a libtool library object.
5387 This mode accepts the following additional options:
5389 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5390 -prefer-pic try to building PIC objects only
5391 -prefer-non-pic try to building non-PIC objects only
5392 -static always build a \`.o' file suitable for static linking
5394 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5395 from the given SOURCEFILE.
5397 The output file name is determined by removing the directory component from
5398 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5399 library object suffix, \`.lo'."
5402 execute)
5403 $echo \
5404 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5406 Automatically set library path, then run a program.
5408 This mode accepts the following additional options:
5410 -dlopen FILE add the directory containing FILE to the library path
5412 This mode sets the library path environment variable according to \`-dlopen'
5413 flags.
5415 If any of the ARGS are libtool executable wrappers, then they are translated
5416 into their corresponding uninstalled binary, and any of their required library
5417 directories are added to the library path.
5419 Then, COMMAND is executed, with ARGS as arguments."
5422 finish)
5423 $echo \
5424 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5426 Complete the installation of libtool libraries.
5428 Each LIBDIR is a directory that contains libtool libraries.
5430 The commands that this mode executes may require superuser privileges. Use
5431 the \`--dry-run' option if you just want to see what would be executed."
5434 install)
5435 $echo \
5436 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5438 Install executables or libraries.
5440 INSTALL-COMMAND is the installation command. The first component should be
5441 either the \`install' or \`cp' program.
5443 The rest of the components are interpreted as arguments to that command (only
5444 BSD-compatible install options are recognized)."
5447 link)
5448 $echo \
5449 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5451 Link object files or libraries together to form another library, or to
5452 create an executable program.
5454 LINK-COMMAND is a command using the C compiler that you would use to create
5455 a program from several object files.
5457 The following components of LINK-COMMAND are treated specially:
5459 -all-static do not do any dynamic linking at all
5460 -avoid-version do not add a version suffix if possible
5461 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5462 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5463 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5464 -export-symbols SYMFILE
5465 try to export only the symbols listed in SYMFILE
5466 -export-symbols-regex REGEX
5467 try to export only the symbols matching REGEX
5468 -LLIBDIR search LIBDIR for required installed libraries
5469 -lNAME OUTPUT-FILE requires the installed library libNAME
5470 -module build a library that can dlopened
5471 -no-fast-install disable the fast-install mode
5472 -no-install link a not-installable executable
5473 -no-undefined declare that a library does not refer to external symbols
5474 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5475 -objectlist FILE Use a list of object files found in FILE to specify objects
5476 -release RELEASE specify package release information
5477 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5478 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5479 -static do not do any dynamic linking of libtool libraries
5480 -version-info CURRENT[:REVISION[:AGE]]
5481 specify library version info [each variable defaults to 0]
5483 All other options (arguments beginning with \`-') are ignored.
5485 Every other argument is treated as a filename. Files ending in \`.la' are
5486 treated as uninstalled libtool libraries, other files are standard or library
5487 object files.
5489 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5490 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5491 required, except when creating a convenience library.
5493 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5494 using \`ar' and \`ranlib', or on Windows using \`lib'.
5496 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5497 is created, otherwise an executable program is created."
5500 uninstall)
5501 $echo \
5502 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5504 Remove libraries from an installation directory.
5506 RM is the name of the program to use to delete files associated with each FILE
5507 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5508 to RM.
5510 If FILE is a libtool library, all the files associated with it are deleted.
5511 Otherwise, only FILE itself is deleted using RM."
5515 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5516 $echo "$help" 1>&2
5517 exit 1
5519 esac
5521 echo
5522 $echo "Try \`$modename --help' for more information about other modes."
5524 exit 0
5526 # The TAGs below are defined such that we never get into a situation
5527 # in which we disable both kinds of libraries. Given conflicting
5528 # choices, we go for a static library, that is the most portable,
5529 # since we can't tell whether shared libraries were disabled because
5530 # the user asked for that or because the platform doesn't support
5531 # them. This is particularly important on AIX, because we don't
5532 # support having both static and shared libraries enabled at the same
5533 # time on that platform, so we default to a shared-only configuration.
5534 # If a disable-shared tag is given, we'll fallback to a static-only
5535 # configuration. But we'll never go from static-only to shared-only.
5537 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5538 build_libtool_libs=no
5539 build_old_libs=yes
5540 # ### END LIBTOOL TAG CONFIG: disable-shared
5542 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
5543 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5544 # ### END LIBTOOL TAG CONFIG: disable-static
5546 # Local Variables:
5547 # mode:shell-script
5548 # sh-indentation:2
5549 # End: