1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Check that we have a working $echo.
27 if test "X$1" = X--no-reexec; then
28 # Discard the --no-reexec flag, and continue.
30 elif test "X$1" = X--fallback-echo; then
31 # Avoid inline document here, it may be left over
33 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
34 # Yippee, $echo works!
37 # Restart under the correct shell, and then maybe $echo will work.
38 exec $SHELL "$0" --no-reexec ${1+"$@"}
41 if test "X$1" = X--fallback-echo; then
42 # used as fallback echo
50 # The name of this program.
51 progname=`$echo "$0" | sed 's%^.*/%%'`
58 TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 NL2SP='tr \015\012 \040\040'
75 # Only set LANG and LC_ALL to C if already set.
76 # These must not be set unconditionally because not all systems understand
77 # e.g. LANG=C (notably SCO).
78 # We save the old values to restore during execute mode.
79 if test "${LC_ALL+set}" = set; then
80 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82 if test "${LANG+set}" = set; then
83 save_LANG="$LANG"; LANG=C; export LANG
86 if test "$LTCONFIG_VERSION" != "$VERSION"; then
87 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
92 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93 echo "$modename: not configured to build any kind of library" 1>&2
94 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
107 lo2o="s/\\.lo\$/.${objext}/"
108 o2lo="s/\\.${objext}\$/.lo/"
110 # Parse our command line options once, thoroughly.
117 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
121 # If the previous option needs an argument, assign it.
122 if test -n "$prev"; then
125 eval "$prev=\"\$$prev \$arg\""
137 # Have we seen a non-optional argument yet?
144 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
149 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
154 echo "$progname: enabling shell trace mode"
164 if test "$build_libtool_libs" = yes; then
165 echo "enable shared libraries"
167 echo "disable shared libraries"
169 if test "$build_old_libs" = yes; then
170 echo "enable static libraries"
172 echo "disable static libraries"
177 --finish) mode="finish" ;;
179 --mode) prevopt="--mode" prev=mode ;;
180 --mode=*) mode="$optarg" ;;
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
204 if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
210 if test -z "$show_help"; then
212 # Infer the operation mode.
213 if test -z "$mode"; then
215 *cc | *++ | gcc* | *-gcc*)
227 *db | *dbx | *strace | *truss)
237 # If we have no mode, but dlfiles were specified, then do execute mode.
238 test -n "$execute_dlfiles" && mode=execute
240 # Just use the default operation mode.
241 if test -z "$mode"; then
242 if test -n "$nonopt"; then
243 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
245 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
252 # Only execute mode is allowed to have -dlopen flags.
253 if test -n "$execute_dlfiles" && test "$mode" != execute; then
254 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
259 # Change the help message to a mode-specific one.
261 help="Try \`$modename --help --mode=$mode' for more information."
263 # These modes are in order of execution frequency so that they run quickly.
265 # libtool compile mode
267 modename="$modename: compile"
268 # Get the compilation command and the source file.
277 # Accept any command-line options.
280 if test "$user_target" != "no"; then
281 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
293 case "$user_target" in
295 # The next one is the -o target name
300 # We got the output file
307 # Accept the current argument as the source file.
311 # Aesthetically quote the previous argument.
313 # Backslashify any backslashes, double quotes, and dollar signs.
314 # These are the only characters that are still specially
315 # interpreted inside of double-quoted scrings.
316 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
318 # Double-quote args containing other shell metacharacters.
319 # Many Bourne shells cannot handle close brackets correctly in scan
320 # sets, so we specify it separately.
322 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
323 lastarg="\"$lastarg\""
327 # Add the previous argument to base_compile.
328 if test -z "$base_compile"; then
329 base_compile="$lastarg"
331 base_compile="$base_compile $lastarg"
335 case "$user_target" in
339 # Get the name of the library object.
340 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
343 $echo "$modename: you must specify a target with \`-o'" 1>&2
348 # Recognize several different file suffixes.
349 # If the user specifies -o file.o, it is replaced with file.lo
364 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
367 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
369 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
374 if test -z "$base_compile"; then
375 $echo "$modename: you must specify a compilation command" 1>&2
380 # Delete any leftover library objects.
381 if test "$build_old_libs" = yes; then
382 removelist="$obj $libobj"
388 trap "$run $rm $removelist; exit 1" 1 2 15
390 # Calculate the filename of the output object if compiler does
391 # not support -o with -c
392 if test "$compiler_c_o" = no; then
393 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
394 lockfile="$output_obj.lock"
395 removelist="$removelist $output_obj $lockfile"
396 trap "$run $rm $removelist; exit 1" 1 2 15
402 # Lock this critical section if it is needed
403 # We use this script file to make the link, it avoids creating a new file
404 if test "$need_locks" = yes; then
405 until ln "$0" "$lockfile" 2>/dev/null; do
406 $show "Waiting for $lockfile to be removed"
409 elif test "$need_locks" = warn; then
410 if test -f "$lockfile"; then
412 *** ERROR, $lockfile exists and contains:
413 `cat $lockfile 2>/dev/null`
415 This indicates that another process is trying to use the same
416 temporary object file, and libtool could not work around it because
417 your compiler does not support \`-c' and \`-o' together. If you
418 repeat this compilation, it may succeed, by chance, but you had better
419 avoid parallel builds (make -j) in this platform, or get a better
425 echo $srcfile > "$lockfile"
428 if test -n "$fix_srcfile_path"; then
429 eval srcfile=\"$fix_srcfile_path\"
432 # Only build a PIC object if we are building libtool libraries.
433 if test "$build_libtool_libs" = yes; then
434 # Without this assignment, base_compile gets emptied.
435 fbsd_hideous_sh_bug=$base_compile
437 # All platforms use -DPIC, to notify preprocessed assembler code.
438 # However, make sure we only set it for non-Java code.
441 command="$base_compile $pic_flag $srcfile";;
443 command="$base_compile $srcfile $pic_flag -DPIC";;
445 if test "$build_old_libs" = yes; then
447 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
448 if test "X$dir" = "X$libobj"; then
453 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
455 if test -d "$dir"; then
462 if test $status -ne 0 && test ! -d $dir; then
467 if test "$compiler_o_lo" = yes; then
469 command="$command -o $output_obj"
470 elif test "$compiler_c_o" = yes; then
472 command="$command -o $output_obj"
475 $run $rm "$output_obj"
477 if $run eval "$command"; then :
479 test -n "$output_obj" && $run $rm $removelist
483 if test "$need_locks" = warn &&
484 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
486 *** ERROR, $lockfile contains:
487 `cat $lockfile 2>/dev/null`
489 but it should contain:
492 This indicates that another process is trying to use the same
493 temporary object file, and libtool could not work around it because
494 your compiler does not support \`-c' and \`-o' together. If you
495 repeat this compilation, it may succeed, by chance, but you had better
496 avoid parallel builds (make -j) in this platform, or get a better
503 # Just move the object if needed, then go on to compile the next one
504 if test x"$output_obj" != x"$libobj"; then
505 $show "$mv $output_obj $libobj"
506 if $run $mv $output_obj $libobj; then :
514 # If we have no pic_flag, then copy the object into place and finish.
515 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
516 # Rename the .lo from within objdir to obj
517 if test -f $obj; then
522 $show "$mv $libobj $obj"
523 if $run $mv $libobj $obj; then :
530 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
531 if test "X$xdir" = "X$obj"; then
536 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
537 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
538 # Now arrange that obj and lo_libobj become the same file
539 $show "(cd $xdir && $LN_S $baseobj $libobj)"
540 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
549 # Allow error messages only from the first compilation.
550 suppress_output=' >/dev/null 2>&1'
553 # Only build a position-dependent object if we build old libraries.
554 if test "$build_old_libs" = yes; then
555 command="$base_compile $srcfile"
556 if test "$compiler_c_o" = yes; then
557 command="$command -o $obj"
561 # Suppress compiler output if we already did a PIC compilation.
562 command="$command$suppress_output"
563 $run $rm "$output_obj"
565 if $run eval "$command"; then :
571 if test "$need_locks" = warn &&
572 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
574 *** ERROR, $lockfile contains:
575 `cat $lockfile 2>/dev/null`
577 but it should contain:
580 This indicates that another process is trying to use the same
581 temporary object file, and libtool could not work around it because
582 your compiler does not support \`-c' and \`-o' together. If you
583 repeat this compilation, it may succeed, by chance, but you had better
584 avoid parallel builds (make -j) in this platform, or get a better
591 # Just move the object if needed
592 if test x"$output_obj" != x"$obj"; then
593 $show "$mv $output_obj $obj"
594 if $run $mv $output_obj $obj; then :
602 # Create an invalid libtool object if no PIC, so that we do not
603 # accidentally link it into a program.
604 if test "$build_libtool_libs" != yes; then
605 $show "echo timestamp > $libobj"
606 $run eval "echo timestamp > \$libobj" || exit $?
608 # Move the .lo from within objdir
609 $show "$mv $libobj $lo_libobj"
610 if $run $mv $libobj $lo_libobj; then :
619 # Unlock the critical section if it was locked
620 if test "$need_locks" != no; then
629 modename="$modename: link"
630 C_compiler="$CC" # save it, to compile generated C sources
631 # Always respect the CC configured in by ltconfig.
633 # CYGNUS LOCAL: tromey/java
634 # Add -B options to link line.
645 *-*-cygwin* | *-*-mingw* | *-*-os2*)
646 # It is impossible to link a dll without this setting, and
647 # we shouldn't force the makefile maintainer to figure out
648 # which system we are compiling for in order to pass an extra
649 # flag for every libtool invokation.
652 # FIXME: Unfortunately, there are problems with the above when trying
653 # to make a dll which has undefined symbols, in which case not
654 # even a static library is built. For now, we need to specify
655 # -no-undefined on the libtool link line when we can be certain
656 # that all symbols are satisfied, otherwise we get a static library.
659 # This is a source program that is used to create dlls on Windows
660 # Don't remove nor modify the starting and closing comments
661 # /* ltdll.c starts here */
662 # #define WIN32_LEAN_AND_MEAN
663 # #include <windows.h>
664 # #undef WIN32_LEAN_AND_MEAN
668 # # ifdef __CYGWIN32__
669 # # define __CYGWIN__ __CYGWIN32__
676 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
682 # #include <cygwin/cygwin_dll.h>
683 # DECLARE_CYGWIN_DLL( DllMain );
685 # HINSTANCE __hDllInstance_base;
688 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
690 # __hDllInstance_base = hInst;
693 # /* ltdll.c ends here */
694 # This is a source program that is used to create import libraries
695 # on Windows for dlls which lack them. Don't remove nor modify the
696 # starting and closing comments
697 # /* impgen.c starts here */
698 # /* Copyright (C) 1999 Free Software Foundation, Inc.
700 # This file is part of GNU libtool.
702 # This program is free software; you can redistribute it and/or modify
703 # it under the terms of the GNU General Public License as published by
704 # the Free Software Foundation; either version 2 of the License, or
705 # (at your option) any later version.
707 # This program is distributed in the hope that it will be useful,
708 # but WITHOUT ANY WARRANTY; without even the implied warranty of
709 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
710 # GNU General Public License for more details.
712 # You should have received a copy of the GNU General Public License
713 # along with this program; if not, write to the Free Software
714 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
717 # #include <stdio.h> /* for printf() */
718 # #include <unistd.h> /* for open(), lseek(), read() */
719 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
720 # #include <string.h> /* for strdup() */
722 # static unsigned int
723 # pe_get16 (fd, offset)
727 # unsigned char b[2];
728 # lseek (fd, offset, SEEK_SET);
730 # return b[0] + (b[1]<<8);
733 # static unsigned int
734 # pe_get32 (fd, offset)
738 # unsigned char b[4];
739 # lseek (fd, offset, SEEK_SET);
741 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
744 # static unsigned int
748 # unsigned char *b = ptr;
749 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
758 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
759 # unsigned long export_rva, export_size, nsections, secptr, expptr;
760 # unsigned long name_rvas, nexp;
761 # unsigned char *expdata, *erva;
762 # char *filename, *dll_name;
764 # filename = argv[1];
766 # dll = open(filename, O_RDONLY|O_BINARY);
770 # dll_name = filename;
772 # for (i=0; filename[i]; i++)
773 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
774 # dll_name = filename + i +1;
776 # pe_header_offset = pe_get32 (dll, 0x3c);
777 # opthdr_ofs = pe_header_offset + 4 + 20;
778 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
780 # if (num_entries < 1) /* no exports */
783 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
784 # export_size = pe_get32 (dll, opthdr_ofs + 100);
785 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
786 # secptr = (pe_header_offset + 4 + 20 +
787 # pe_get16 (dll, pe_header_offset + 4 + 16));
790 # for (i = 0; i < nsections; i++)
793 # unsigned long secptr1 = secptr + 40 * i;
794 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
795 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
796 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
797 # lseek(dll, secptr1, SEEK_SET);
798 # read(dll, sname, 8);
799 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
801 # expptr = fptr + (export_rva - vaddr);
802 # if (export_rva + export_size > vaddr + vsize)
803 # export_size = vsize - (export_rva - vaddr);
808 # expdata = (unsigned char*)malloc(export_size);
809 # lseek (dll, expptr, SEEK_SET);
810 # read (dll, expdata, export_size);
811 # erva = expdata - export_rva;
813 # nexp = pe_as32 (expdata+24);
814 # name_rvas = pe_as32 (expdata+32);
816 # printf ("EXPORTS\n");
817 # for (i = 0; i<nexp; i++)
819 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
820 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
825 # /* impgen.c ends here */
831 compile_command="$nonopt"
832 finalize_command="$nonopt"
843 if test -n "$shlibpath_var"; then
844 # get the directories listed in $shlibpath_var
845 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
849 # now prepend the system-specific ones
850 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
851 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
859 export_symbols_regex=
862 link_against_libtool_libs=
866 prefer_static_libs=no
878 # We need to know -static, to get the right output filenames.
882 -all-static | -static)
883 if test "X$arg" = "X-all-static"; then
884 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
885 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
887 if test -n "$link_static_flag"; then
888 dlopen_self=$dlopen_self_static
891 if test -z "$pic_flag" && test -n "$link_static_flag"; then
892 dlopen_self=$dlopen_self_static
895 build_libtool_libs=no
897 prefer_static_libs=yes
903 # See if our shared archives depend on static archives.
904 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
906 # Go through the arguments, transforming them on the way.
907 while test $# -gt 0; do
911 # If the previous option needs an argument, assign it.
912 if test -n "$prev"; then
915 compile_command="$compile_command @OUTPUT@"
916 finalize_command="$finalize_command @OUTPUT@"
922 if test "$preload" = no; then
923 # Add the symbol object into the linking commands.
924 compile_command="$compile_command @SYMFILE@"
925 finalize_command="$finalize_command @SYMFILE@"
929 *.la | *.lo) ;; # We handle these cases below.
931 if test "$dlself" = no; then
939 if test "$prev" = dlprefiles; then
941 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
951 if test "$prev" = dlfiles; then
952 dlfiles="$dlfiles $arg"
954 dlprefiles="$dlprefiles $arg"
961 export_symbols="$arg"
962 if test ! -f "$arg"; then
963 $echo "$modename: symbol file \`$arg' does not exist"
970 export_symbols_regex="$arg"
980 # We need an absolute path.
982 [\\/]* | [A-Za-z]:[\\/]*) ;;
984 $echo "$modename: only absolute run-paths are allowed" 1>&2
988 if test "$prev" = rpath; then
991 *) rpath="$rpath $arg" ;;
996 *) xrpath="$xrpath $arg" ;;
1003 eval "$prev=\"\$arg\""
1014 if test -n "$link_static_flag"; then
1015 compile_command="$compile_command $link_static_flag"
1016 finalize_command="$finalize_command $link_static_flag"
1022 # FIXME: remove this flag sometime in the future.
1023 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1047 -export-symbols | -export-symbols-regex)
1048 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1049 $echo "$modename: not more than one -exported-symbols argument allowed"
1052 if test "X$arg" = "X-export-symbols"; then
1061 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1062 # We need an absolute path.
1064 [\\/]* | [A-Za-z]:[\\/]*) ;;
1066 absdir=`cd "$dir" && pwd`
1067 if test -z "$absdir"; then
1068 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1069 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1075 case " $deplibs " in
1077 *) deplibs="$deplibs $arg";;
1079 case " $lib_search_path " in
1081 *) lib_search_path="$lib_search_path $dir";;
1084 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1085 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1086 case ":$dllsearchpath:" in
1087 ::) dllsearchpath="$dllsearchdir";;
1088 *":$dllsearchdir:"*) ;;
1089 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1096 if test "$arg" = "-lc"; then
1098 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1099 # These systems don't actually have c library (as such)
1103 elif test "$arg" = "-lm"; then
1105 *-*-cygwin* | *-*-beos*)
1106 # These systems don't actually have math library (as such)
1111 deplibs="$deplibs $arg"
1142 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1143 # We need an absolute path.
1145 [\\/]* | [A-Za-z]:[\\/]*) ;;
1147 $echo "$modename: only absolute run-paths are allowed" 1>&2
1153 *) xrpath="$xrpath $dir" ;;
1159 # If we have no pic_flag, then this is the same as -all-static.
1160 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1161 compile_command="$compile_command $link_static_flag"
1162 finalize_command="$finalize_command $link_static_flag"
1177 # Some other compiler flag.
1179 # Unknown arguments in both finalize_command and compile_command need
1180 # to be aesthetically quoted because they are evaled later.
1181 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1183 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1189 *.o | *.obj | *.a | *.lib)
1190 # A standard object.
1196 if test "$prev" = dlfiles; then
1197 dlfiles="$dlfiles $arg"
1198 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1202 # If libtool objects are unsupported, then we need to preload.
1207 if test "$prev" = dlprefiles; then
1208 # Preload the old-style object.
1209 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1212 libobjs="$libobjs $arg"
1216 # A libtool-controlled library.
1223 # Check to see that this really is a libtool archive.
1224 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1226 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1230 # If the library was installed with an old release of libtool,
1231 # it will not redefine variable installed.
1235 # If there is no directory component, then add one.
1237 */* | *\\*) . $arg ;;
1241 # Get the name of the library we link against.
1243 for l in $old_library $library_names; do
1247 if test -z "$linklib"; then
1248 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1252 # Find the relevant object directory and library name.
1253 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1255 if test "X$installed" = Xyes; then
1258 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1259 if test "X$dir" = "X$arg"; then
1266 if test -n "$dependency_libs"; then
1267 # Extract -R and -L from dependency_libs
1269 for deplib in $dependency_libs; do
1271 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1272 case " $rpath $xrpath " in
1273 *" $temp_xrpath "*) ;;
1274 *) xrpath="$xrpath $temp_xrpath";;
1276 -L*) case "$compile_command $temp_deplibs " in
1278 *) temp_deplibs="$temp_deplibs $deplib";;
1280 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1281 case " $lib_search_path " in
1283 *) lib_search_path="$lib_search_path $temp_dir";;
1286 *) temp_deplibs="$temp_deplibs $deplib";;
1289 dependency_libs="$temp_deplibs"
1292 if test -z "$libdir"; then
1293 # It is a libtool convenience library, so add in its objects.
1294 convenience="$convenience $dir/$old_library"
1295 old_convenience="$old_convenience $dir/$old_library"
1296 deplibs="$deplibs$dependency_libs"
1297 compile_command="$compile_command $dir/$old_library$dependency_libs"
1298 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1302 # This library was specified with -dlopen.
1303 if test "$prev" = dlfiles; then
1304 dlfiles="$dlfiles $arg"
1305 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1306 # If there is no dlname, no dlopen support or we're linking statically,
1307 # we need to preload.
1310 # We should not create a dependency on this library, but we
1311 # may need any libraries it requires.
1312 compile_command="$compile_command$dependency_libs"
1313 finalize_command="$finalize_command$dependency_libs"
1319 # The library was specified with -dlpreopen.
1320 if test "$prev" = dlprefiles; then
1321 # Prefer using a static library (so that no silly _DYNAMIC symbols
1322 # are required to link).
1323 if test -n "$old_library"; then
1324 dlprefiles="$dlprefiles $dir/$old_library"
1326 dlprefiles="$dlprefiles $dir/$linklib"
1331 if test -n "$library_names" &&
1332 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1333 link_against_libtool_libs="$link_against_libtool_libs $arg"
1334 if test -n "$shlibpath_var"; then
1335 # Make sure the rpath contains only unique directories.
1336 case "$temp_rpath " in
1338 *) temp_rpath="$temp_rpath $dir" ;;
1342 # We need an absolute path.
1344 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1346 absdir=`cd "$dir" && pwd`
1347 if test -z "$absdir"; then
1348 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1349 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1355 # This is the magic to use -rpath.
1356 # Skip directories that are in the system default run-time
1357 # search path, unless they have been requested with -R.
1358 case " $sys_lib_dlsearch_path " in
1361 case "$compile_rpath " in
1363 *) compile_rpath="$compile_rpath $absdir"
1368 case " $sys_lib_dlsearch_path " in
1371 case "$finalize_rpath " in
1373 *) finalize_rpath="$finalize_rpath $libdir"
1379 case "$hardcode_action" in
1380 immediate | unsupported)
1381 if test "$hardcode_direct" = no; then
1382 compile_command="$compile_command $dir/$linklib"
1383 deplibs="$deplibs $dir/$linklib"
1385 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1386 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1387 if test -n "$dllsearchpath"; then
1388 dllsearchpath="$dllsearchpath:$dllsearchdir"
1390 dllsearchpath="$dllsearchdir"
1394 elif test "$hardcode_minus_L" = no; then
1397 compile_shlibpath="$compile_shlibpath$dir:"
1400 case "$compile_command " in
1402 *) compile_command="$compile_command -L$dir";;
1404 compile_command="$compile_command -l$name"
1405 deplibs="$deplibs -L$dir -l$name"
1406 elif test "$hardcode_shlibpath_var" = no; then
1407 case ":$compile_shlibpath:" in
1409 *) compile_shlibpath="$compile_shlibpath$dir:";;
1411 compile_command="$compile_command -l$name"
1412 deplibs="$deplibs -l$name"
1419 if test "$hardcode_direct" = yes; then
1420 compile_command="$compile_command $absdir/$linklib"
1421 deplibs="$deplibs $absdir/$linklib"
1422 elif test "$hardcode_minus_L" = yes; then
1423 case "$compile_command " in
1425 *) compile_command="$compile_command -L$absdir";;
1427 compile_command="$compile_command -l$name"
1428 deplibs="$deplibs -L$absdir -l$name"
1429 elif test "$hardcode_shlibpath_var" = yes; then
1430 case ":$compile_shlibpath:" in
1432 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1434 compile_command="$compile_command -l$name"
1435 deplibs="$deplibs -l$name"
1446 if test "$lib_linked" != yes; then
1447 $echo "$modename: configuration error: unsupported hardcode properties"
1451 # Finalize command for both is simple: just hardcode it.
1452 if test "$hardcode_direct" = yes; then
1453 finalize_command="$finalize_command $libdir/$linklib"
1454 elif test "$hardcode_minus_L" = yes; then
1455 case "$finalize_command " in
1457 *) finalize_command="$finalize_command -L$libdir";;
1459 finalize_command="$finalize_command -l$name"
1460 elif test "$hardcode_shlibpath_var" = yes; then
1461 case ":$finalize_shlibpath:" in
1463 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1465 finalize_command="$finalize_command -l$name"
1467 # We cannot seem to hardcode it, guess we'll fake it.
1468 case "$finalize_command " in
1470 *) finalize_command="$finalize_command -L$libdir";;
1472 finalize_command="$finalize_command -l$name"
1475 # Transform directly to old archives if we don't build new libraries.
1476 if test -n "$pic_flag" && test -z "$old_library"; then
1477 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1481 # Here we assume that one of hardcode_direct or hardcode_minus_L
1482 # is not unsupported. This is valid on all known static and
1484 if test "$hardcode_direct" != unsupported; then
1485 test -n "$old_library" && linklib="$old_library"
1486 compile_command="$compile_command $dir/$linklib"
1487 finalize_command="$finalize_command $dir/$linklib"
1489 case "$compile_command " in
1491 *) compile_command="$compile_command -L$dir";;
1493 compile_command="$compile_command -l$name"
1494 case "$finalize_command " in
1496 *) finalize_command="$finalize_command -L$dir";;
1498 finalize_command="$finalize_command -l$name"
1502 # Add in any libraries that this one depends upon.
1503 compile_command="$compile_command$dependency_libs"
1504 finalize_command="$finalize_command$dependency_libs"
1508 # Some other compiler argument.
1510 # Unknown arguments in both finalize_command and compile_command need
1511 # to be aesthetically quoted because they are evaled later.
1512 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1514 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1521 # Now actually substitute the argument into the commands.
1522 if test -n "$arg"; then
1523 compile_command="$compile_command $arg"
1524 finalize_command="$finalize_command $arg"
1528 if test -n "$prev"; then
1529 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1534 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1535 eval arg=\"$export_dynamic_flag_spec\"
1536 compile_command="$compile_command $arg"
1537 finalize_command="$finalize_command $arg"
1541 # calculate the name of the file, without its directory
1542 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1543 libobjs_save="$libobjs"
1547 $echo "$modename: you must specify an output file" 1>&2
1553 if test -n "$link_against_libtool_libs"; then
1554 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1558 if test -n "$deplibs"; then
1559 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1562 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1563 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1566 if test -n "$rpath"; then
1567 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1570 if test -n "$xrpath"; then
1571 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1574 if test -n "$vinfo"; then
1575 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1578 if test -n "$release"; then
1579 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1582 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1583 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1586 # Now set the variables for building old libraries.
1587 build_libtool_libs=no
1592 # Make sure we only generate libraries of the form `libNAME.la'.
1593 case "$outputname" in
1595 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1596 eval libname=\"$libname_spec\"
1599 if test "$module" = no; then
1600 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1604 if test "$need_lib_prefix" != no; then
1605 # Add the "lib" prefix for modules if required
1606 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1607 eval libname=\"$libname_spec\"
1609 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1614 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1615 if test "X$output_objdir" = "X$output"; then
1616 output_objdir="$objdir"
1618 output_objdir="$output_objdir/$objdir"
1621 if test -n "$objs"; then
1622 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1626 # How the heck are we supposed to write a wrapper for a shared library?
1627 if test -n "$link_against_libtool_libs"; then
1628 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1632 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1633 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1637 if test $# -gt 2; then
1638 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1643 if test -z "$rpath"; then
1644 if test "$build_libtool_libs" = yes; then
1645 # Building a libtool convenience library.
1647 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1648 build_libtool_libs=convenience
1651 dependency_libs="$deplibs"
1653 if test -n "$vinfo"; then
1654 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1657 if test -n "$release"; then
1658 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1662 # Parse the version information argument.
1663 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1664 set dummy $vinfo 0 0 0
1667 if test -n "$8"; then
1668 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1677 # Check that each of the things are valid numbers.
1679 0 | [1-9] | [1-9][0-9]*) ;;
1681 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1682 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1688 0 | [1-9] | [1-9][0-9]*) ;;
1690 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1691 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1697 0 | [1-9] | [1-9][0-9]*) ;;
1699 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1700 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1705 if test $age -gt $current; then
1706 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1707 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1711 # Calculate the version variables.
1715 case "$version_type" in
1719 major=`expr $current - $age + 1`
1720 versuffix="$major.$revision"
1721 verstring="sgi$major.$revision"
1723 # Add in all the interfaces that we are compatible with.
1725 while test $loop != 0; do
1726 iface=`expr $revision - $loop`
1727 loop=`expr $loop - 1`
1728 verstring="sgi$major.$iface:$verstring"
1733 major=.`expr $current - $age`
1734 versuffix="$major.$age.$revision"
1738 major=`expr $current - $age`
1739 versuffix=".$current.$age.$revision"
1740 verstring="$current.$age.$revision"
1742 # Add in all the interfaces that we are compatible with.
1744 while test $loop != 0; do
1745 iface=`expr $current - $loop`
1746 loop=`expr $loop - 1`
1747 verstring="$verstring:${iface}.0"
1750 # Make executables depend on our current version.
1751 verstring="$verstring:${current}.0"
1756 versuffix=".$current.$revision"
1761 versuffix=".$current.$revision";
1766 versuffix=".$current";
1770 # Like Linux, but with '-' rather than '.', since we only
1771 # want one extension on Windows 95.
1772 major=`expr $current - $age`
1773 versuffix="-$major-$age-$revision"
1777 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1778 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1783 # Clear the version info if we defaulted, and they specified a release.
1784 if test -z "$vinfo" && test -n "$release"; then
1787 if test "$need_version" = no; then
1794 # Remove version info from name if versioning should be avoided
1795 if test "$avoid_version" = yes && test "$need_version" = no; then
1801 # Check to see if the archive will have undefined symbols.
1802 if test "$allow_undefined" = yes; then
1803 if test "$allow_undefined_flag" = unsupported; then
1804 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1805 build_libtool_libs=no
1809 # Don't allow undefined symbols.
1810 allow_undefined_flag="$no_undefined_flag"
1813 dependency_libs="$deplibs"
1815 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1816 # these systems don't actually have a c library (as such)!
1819 # Add libc to deplibs on all other systems.
1820 deplibs="$deplibs -lc"
1825 # Create the output directory, or remove our outputs if we need to.
1826 if test -d $output_objdir; then
1827 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1828 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1830 $show "$mkdir $output_objdir"
1831 $run $mkdir $output_objdir
1833 if test $status -ne 0 && test ! -d $output_objdir; then
1838 # Now set the variables for building old libraries.
1839 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1840 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1842 # Transform .lo files to .o files.
1843 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1846 if test "$build_libtool_libs" = yes; then
1847 # Transform deplibs into only deplibs that can be linked in shared.
1849 libname_save=$libname
1850 release_save=$release
1851 versuffix_save=$versuffix
1853 # I'm not sure if I'm treating the release correctly. I think
1854 # release should show up in the -l (ie -lgmp5) so we don't want to
1855 # add it in twice. Is that correct?
1861 case "$deplibs_check_method" in
1863 # Don't check for shared/static. Everything works.
1864 # This might be a little naive. We might want to check
1865 # whether the library exists or not. But this is on
1866 # osf3 & osf4 and I'm not really sure... Just
1867 # implementing what was already the behaviour.
1871 # This code stresses the "libraries are programs" paradigm to its
1872 # limits. Maybe even breaks it. We compile a program, linking it
1873 # against the deplibs as a proxy for the library. Then we can check
1874 # whether they linked in statically or dynamically with ldd.
1876 cat > conftest.c <<EOF
1877 int main() { return 0; }
1880 $CC -o conftest conftest.c $deplibs
1881 if test $? -eq 0 ; then
1882 ldd_output=`ldd conftest`
1883 for i in $deplibs; do
1884 name="`expr $i : '-l\(.*\)'`"
1885 # If $name is empty we are operating on a -L argument.
1886 if test "$name" != "" ; then
1887 libname=`eval \\$echo \"$libname_spec\"`
1888 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1889 set dummy $deplib_matches
1891 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1892 newdeplibs="$newdeplibs $i"
1896 echo "*** Warning: This library needs some functionality provided by $i."
1897 echo "*** I have the capability to make that library automatically link in when"
1898 echo "*** you link to this library. But I can only do this if you have a"
1899 echo "*** shared version of the library, which you do not appear to have."
1902 newdeplibs="$newdeplibs $i"
1906 # Error occured in the first compile. Let's try to salvage the situation:
1907 # Compile a seperate program for each library.
1908 for i in $deplibs; do
1909 name="`expr $i : '-l\(.*\)'`"
1910 # If $name is empty we are operating on a -L argument.
1911 if test "$name" != "" ; then
1913 $CC -o conftest conftest.c $i
1915 if test $? -eq 0 ; then
1916 ldd_output=`ldd conftest`
1917 libname=`eval \\$echo \"$libname_spec\"`
1918 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1919 set dummy $deplib_matches
1921 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1922 newdeplibs="$newdeplibs $i"
1926 echo "*** Warning: This library needs some functionality provided by $i."
1927 echo "*** I have the capability to make that library automatically link in when"
1928 echo "*** you link to this library. But I can only do this if you have a"
1929 echo "*** shared version of the library, which you do not appear to have."
1934 echo "*** Warning! Library $i is needed by this library but I was not able to"
1935 echo "*** make it link in! You will probably need to install it or some"
1936 echo "*** library that it depends on before this library will be fully"
1937 echo "*** functional. Installing it before continuing would be even better."
1940 newdeplibs="$newdeplibs $i"
1946 set dummy $deplibs_check_method
1947 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1948 for a_deplib in $deplibs; do
1949 name="`expr $a_deplib : '-l\(.*\)'`"
1950 # If $name is empty we are operating on a -L argument.
1951 if test "$name" != "" ; then
1952 libname=`eval \\$echo \"$libname_spec\"`
1953 for i in $lib_search_path; do
1954 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1955 for potent_lib in $potential_libs; do
1956 # Follow soft links.
1957 if ls -lLd "$potent_lib" 2>/dev/null \
1958 | grep " -> " >/dev/null; then
1961 # The statement above tries to avoid entering an
1962 # endless loop below, in case of cyclic links.
1963 # We might still enter an endless loop, since a link
1964 # loop can be closed while we follow links,
1966 potlib="$potent_lib"
1967 while test -h "$potlib" 2>/dev/null; do
1968 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1969 case "$potliblink" in
1970 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1971 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1974 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1976 | egrep "$file_magic_regex" > /dev/null; then
1977 newdeplibs="$newdeplibs $a_deplib"
1983 if test -n "$a_deplib" ; then
1986 echo "*** Warning: This library needs some functionality provided by $a_deplib."
1987 echo "*** I have the capability to make that library automatically link in when"
1988 echo "*** you link to this library. But I can only do this if you have a"
1989 echo "*** shared version of the library, which you do not appear to have."
1992 # Add a -L argument.
1993 newdeplibs="$newdeplibs $a_deplib"
1995 done # Gone through all deplibs.
1999 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2000 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2001 grep . >/dev/null; then
2003 if test "X$deplibs_check_method" = "Xnone"; then
2004 echo "*** Warning: inter-library dependencies are not supported in this platform."
2006 echo "*** Warning: inter-library dependencies are not known to be supported."
2008 echo "*** All declared inter-library dependencies are being dropped."
2013 versuffix=$versuffix_save
2015 release=$release_save
2016 libname=$libname_save
2019 if test "$droppeddeps" = yes; then
2020 if test "$module" = yes; then
2022 echo "*** Warning: libtool could not satisfy all declared inter-library"
2023 echo "*** dependencies of module $libname. Therefore, libtool will create"
2024 echo "*** a static module, that should work as long as the dlopening"
2025 echo "*** application is linked with the -dlopen flag."
2026 if test -z "$global_symbol_pipe"; then
2028 echo "*** However, this would only work if libtool was able to extract symbol"
2029 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2030 echo "*** not find such a program. So, this module is probably useless."
2031 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2033 if test "$build_old_libs" = no; then
2034 oldlibs="$output_objdir/$libname.$libext"
2035 build_libtool_libs=module
2038 build_libtool_libs=no
2041 echo "*** The inter-library dependencies that have been dropped here will be"
2042 echo "*** automatically added whenever a program is linked with this library"
2043 echo "*** or is declared to -dlopen it."
2046 # Done checking deplibs!
2050 # All the library-specific variables (install_libdir is set above).
2055 # Test again, we may have decided not to build it any more
2056 if test "$build_libtool_libs" = yes; then
2057 # Get the real and link names of the library.
2058 eval library_names=\"$library_names_spec\"
2059 set dummy $library_names
2063 if test -n "$soname_spec"; then
2064 eval soname=\"$soname_spec\"
2069 lib="$output_objdir/$realname"
2072 linknames="$linknames $link"
2075 # Ensure that we have .o objects for linkers which dislike .lo
2076 # (e.g. aix) in case we are running --disable-static
2077 for obj in $libobjs; do
2078 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2079 if test "X$xdir" = "X$obj"; then
2084 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2085 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2086 if test ! -f $xdir/$oldobj; then
2087 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2088 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2092 # Use standard objects if they are pic
2093 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2095 # Prepare the list of exported symbols
2096 if test -z "$export_symbols"; then
2097 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2098 $show "generating symbol list for \`$libname.la'"
2099 export_symbols="$output_objdir/$libname.exp"
2100 $run $rm $export_symbols
2101 eval cmds=\"$export_symbols_cmds\"
2102 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2103 for cmd in $cmds; do
2106 $run eval "$cmd" || exit $?
2109 if test -n "$export_symbols_regex"; then
2110 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2111 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2112 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2113 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2118 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2119 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2122 if test -n "$convenience"; then
2123 if test -n "$whole_archive_flag_spec"; then
2124 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2126 gentop="$output_objdir/${outputname}x"
2127 $show "${rm}r $gentop"
2128 $run ${rm}r "$gentop"
2129 $show "mkdir $gentop"
2130 $run mkdir "$gentop"
2132 if test $status -ne 0 && test ! -d "$gentop"; then
2135 generated="$generated $gentop"
2137 for xlib in $convenience; do
2138 # Extract the objects.
2140 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2141 *) xabs=`pwd`"/$xlib" ;;
2143 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2144 xdir="$gentop/$xlib"
2146 $show "${rm}r $xdir"
2151 if test $status -ne 0 && test ! -d "$xdir"; then
2154 $show "(cd $xdir && $AR x $xabs)"
2155 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2157 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2162 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2163 eval flag=\"$thread_safe_flag_spec\"
2164 linkopts="$linkopts $flag"
2167 # Do each of the archive commands.
2168 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2169 eval cmds=\"$archive_expsym_cmds\"
2171 eval cmds=\"$archive_cmds\"
2173 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2174 for cmd in $cmds; do
2177 $run eval "$cmd" || exit $?
2181 # Create links to the real library.
2182 for linkname in $linknames; do
2183 if test "$realname" != "$linkname"; then
2184 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2185 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2189 # If -module or -export-dynamic was specified, set the dlname.
2190 if test "$module" = yes || test "$export_dynamic" = yes; then
2191 # On all known operating systems, these are identical.
2198 if test -n "$link_against_libtool_libs"; then
2199 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2203 if test -n "$deplibs"; then
2204 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2207 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2208 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2211 if test -n "$rpath"; then
2212 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2215 if test -n "$xrpath"; then
2216 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2219 if test -n "$vinfo"; then
2220 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2223 if test -n "$release"; then
2224 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2229 if test -n "$objs"; then
2230 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2234 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2242 # Delete the old objects.
2243 $run $rm $obj $libobj
2245 # Objects from convenience libraries. This assumes
2246 # single-version convenience libraries. Whenever we create
2247 # different ones for PIC/non-PIC, this we'll have to duplicate
2251 # reload_cmds runs $LD directly, so let us get rid of
2252 # -Wl from whole_archive_flag_spec
2255 if test -n "$convenience"; then
2256 if test -n "$whole_archive_flag_spec"; then
2257 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2259 gentop="$output_objdir/${obj}x"
2260 $show "${rm}r $gentop"
2261 $run ${rm}r "$gentop"
2262 $show "mkdir $gentop"
2263 $run mkdir "$gentop"
2265 if test $status -ne 0 && test ! -d "$gentop"; then
2268 generated="$generated $gentop"
2270 for xlib in $convenience; do
2271 # Extract the objects.
2273 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2274 *) xabs=`pwd`"/$xlib" ;;
2276 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2277 xdir="$gentop/$xlib"
2279 $show "${rm}r $xdir"
2284 if test $status -ne 0 && test ! -d "$xdir"; then
2287 $show "(cd $xdir && $AR x $xabs)"
2288 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2290 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2295 # Create the old-style object.
2296 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2299 eval cmds=\"$reload_cmds\"
2300 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2301 for cmd in $cmds; do
2304 $run eval "$cmd" || exit $?
2308 # Exit if we aren't doing a library object file.
2309 if test -z "$libobj"; then
2310 if test -n "$gentop"; then
2311 $show "${rm}r $gentop"
2318 if test "$build_libtool_libs" != yes; then
2319 if test -n "$gentop"; then
2320 $show "${rm}r $gentop"
2324 # Create an invalid libtool object if no PIC, so that we don't
2325 # accidentally link it into a program.
2326 $show "echo timestamp > $libobj"
2327 $run eval "echo timestamp > $libobj" || exit $?
2331 if test -n "$pic_flag"; then
2332 # Only do commands if we really have different PIC objects.
2333 reload_objs="$libobjs $reload_conv_objs"
2335 eval cmds=\"$reload_cmds\"
2336 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2337 for cmd in $cmds; do
2340 $run eval "$cmd" || exit $?
2344 # Just create a symlink.
2347 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2348 if test "X$xdir" = "X$libobj"; then
2353 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2354 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2355 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2356 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2359 if test -n "$gentop"; then
2360 $show "${rm}r $gentop"
2367 # Anything else should be a program.
2369 if test -n "$vinfo"; then
2370 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2373 if test -n "$release"; then
2374 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2377 if test "$preload" = yes; then
2378 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2379 test "$dlopen_self_static" = unknown; then
2380 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2384 if test -n "$rpath$xrpath"; then
2385 # If the user specified any rpath flags, then add them.
2386 for libdir in $rpath $xrpath; do
2387 # This is the magic to use -rpath.
2388 case "$compile_rpath " in
2390 *) compile_rpath="$compile_rpath $libdir" ;;
2392 case "$finalize_rpath " in
2394 *) finalize_rpath="$finalize_rpath $libdir" ;;
2399 # Now hardcode the library paths
2402 for libdir in $compile_rpath $finalize_rpath; do
2403 if test -n "$hardcode_libdir_flag_spec"; then
2404 if test -n "$hardcode_libdir_separator"; then
2405 if test -z "$hardcode_libdirs"; then
2406 hardcode_libdirs="$libdir"
2408 # Just accumulate the unique libdirs.
2409 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2410 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2413 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2418 eval flag=\"$hardcode_libdir_flag_spec\"
2419 rpath="$rpath $flag"
2421 elif test -n "$runpath_var"; then
2422 case "$perm_rpath " in
2424 *) perm_rpath="$perm_rpath $libdir" ;;
2428 # Substitute the hardcoded libdirs into the rpath.
2429 if test -n "$hardcode_libdir_separator" &&
2430 test -n "$hardcode_libdirs"; then
2431 libdir="$hardcode_libdirs"
2432 eval rpath=\" $hardcode_libdir_flag_spec\"
2434 compile_rpath="$rpath"
2438 for libdir in $finalize_rpath; do
2439 if test -n "$hardcode_libdir_flag_spec"; then
2440 if test -n "$hardcode_libdir_separator"; then
2441 if test -z "$hardcode_libdirs"; then
2442 hardcode_libdirs="$libdir"
2444 # Just accumulate the unique libdirs.
2445 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2446 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2449 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2454 eval flag=\"$hardcode_libdir_flag_spec\"
2455 rpath="$rpath $flag"
2457 elif test -n "$runpath_var"; then
2458 case "$finalize_perm_rpath " in
2460 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2464 # Substitute the hardcoded libdirs into the rpath.
2465 if test -n "$hardcode_libdir_separator" &&
2466 test -n "$hardcode_libdirs"; then
2467 libdir="$hardcode_libdirs"
2468 eval rpath=\" $hardcode_libdir_flag_spec\"
2470 finalize_rpath="$rpath"
2472 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2473 if test "X$output_objdir" = "X$output"; then
2474 output_objdir="$objdir"
2476 output_objdir="$output_objdir/$objdir"
2479 # Create the binary in the object directory, then wrap it.
2480 if test ! -d $output_objdir; then
2481 $show "$mkdir $output_objdir"
2482 $run $mkdir $output_objdir
2484 if test $status -ne 0 && test ! -d $output_objdir; then
2489 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2490 # Transform all the library objects into standard objects.
2491 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2492 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2496 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2497 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2498 dlsyms="${outputname}S.c"
2500 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2504 if test -n "$dlsyms"; then
2508 # Discover the nlist of each of the dlfiles.
2509 nlist="$output_objdir/${outputname}.nm"
2511 $show "$rm $nlist ${nlist}S ${nlist}T"
2512 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2514 # Parse the name list into a source file.
2515 $show "creating $output_objdir/$dlsyms"
2517 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2518 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2519 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2525 /* Prevent the only kind of declaration conflicts we can make. */
2526 #define lt_preloaded_symbols some_other_symbol
2528 /* External symbol declarations for the compiler. */\
2531 if test "$dlself" = yes; then
2532 $show "generating symbol list for \`$output'"
2534 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2536 # Add our own program objects to the symbol list.
2537 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2538 for arg in $progfiles; do
2539 $show "extracting global C symbols from \`$arg'"
2540 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2543 if test -n "$exclude_expsyms"; then
2544 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2545 $run eval '$mv "$nlist"T "$nlist"'
2548 if test -n "$export_symbols_regex"; then
2549 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2550 $run eval '$mv "$nlist"T "$nlist"'
2553 # Prepare the list of exported symbols
2554 if test -z "$export_symbols"; then
2555 export_symbols="$output_objdir/$output.exp"
2556 $run $rm $export_symbols
2557 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2559 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2560 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2561 $run eval 'mv "$nlist"T "$nlist"'
2565 for arg in $dlprefiles; do
2566 $show "extracting global C symbols from \`$arg'"
2567 name=`echo "$arg" | sed -e 's%^.*/%%'`
2568 $run eval 'echo ": $name " >> "$nlist"'
2569 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2572 if test -z "$run"; then
2573 # Make sure we have at least an empty file.
2574 test -f "$nlist" || : > "$nlist"
2576 if test -n "$exclude_expsyms"; then
2577 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2578 $mv "$nlist"T "$nlist"
2581 # Try sorting and uniquifying the output.
2582 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2585 grep -v "^: " < "$nlist" > "$nlist"S
2588 if test -f "$nlist"S; then
2589 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2591 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2594 $echo >> "$output_objdir/$dlsyms" "\
2596 #undef lt_preloaded_symbols
2598 #if defined (__STDC__) && __STDC__
2599 # define lt_ptr_t void *
2601 # define lt_ptr_t char *
2605 /* The mapping between symbol names and symbols. */
2610 lt_preloaded_symbols[] =
2614 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2615 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2616 < "$nlist" >> "$output_objdir/$dlsyms"
2618 $echo >> "$output_objdir/$dlsyms" "\
2622 /* This works around a problem in FreeBSD linker */
2623 #ifdef FREEBSD_WORKAROUND
2624 static const void *lt_preloaded_setup() {
2625 return lt_preloaded_symbols;
2635 pic_flag_for_symtable=
2637 # compiling the symbol table file with pic_flag works around
2638 # a FreeBSD bug that causes programs to crash when -lm is
2639 # linked before any other PIC object. But we must not use
2640 # pic_flag when linking with -static. The problem exists in
2641 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2642 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
\r
2643 case "$compile_command " in
2645 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2648 case "$compile_command " in
2650 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2654 # Now compile the dynamic symbol file.
2655 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2656 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2658 # Clean up the generated files.
2659 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2660 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2662 # Transform the symbol file into the correct name.
2663 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2664 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2667 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2672 # We keep going just in case the user didn't refer to
2673 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2674 # really was required.
2676 # Nullify the symbol file.
2677 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2678 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2681 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2682 # Replace the output file specification.
2683 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2684 link_command="$compile_command$compile_rpath"
2686 # We have no uninstalled library dependencies, so finalize right now.
2687 $show "$link_command"
2688 $run eval "$link_command"
2691 # Delete the generated files.
2692 if test -n "$dlsyms"; then
2693 $show "$rm $output_objdir/${outputname}S.${objext}"
2694 $run $rm "$output_objdir/${outputname}S.${objext}"
2700 if test -n "$shlibpath_var"; then
2701 # We should set the shlibpath_var
2703 for dir in $temp_rpath; do
2705 [\\/]* | [A-Za-z]:[\\/]*)
2710 # Relative path: add a thisdir entry.
2711 rpath="$rpath\$thisdir/$dir:"
2718 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2719 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2721 if test -n "$finalize_shlibpath"; then
2722 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2727 if test -n "$runpath_var"; then
2728 if test -n "$perm_rpath"; then
2729 # We should set the runpath_var.
2731 for dir in $perm_rpath; do
2734 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2736 if test -n "$finalize_perm_rpath"; then
2737 # We should set the runpath_var.
2739 for dir in $finalize_perm_rpath; do
2742 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2746 if test "$hardcode_action" = relink; then
2747 # Fast installation is not supported
2748 link_command="$compile_var$compile_command$compile_rpath"
2749 relink_command="$finalize_var$finalize_command$finalize_rpath"
2751 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2752 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2754 if test "$fast_install" != no; then
2755 link_command="$finalize_var$compile_command$finalize_rpath"
2756 if test "$fast_install" = yes; then
2757 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2759 # fast_install is set to needless
2763 link_command="$compile_var$compile_command$compile_rpath"
2764 relink_command="$finalize_var$finalize_command$finalize_rpath"
2768 # Replace the output file specification.
2769 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2771 # Delete the old output files.
2772 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2774 $show "$link_command"
2775 $run eval "$link_command" || exit $?
2777 # Now create the wrapper script.
2778 $show "creating $output"
2780 # Quote the relink command for shipping.
2781 if test -n "$relink_command"; then
2782 # Preserve any variables that may affect compiler behavior
2783 variables_saved_for_relink="GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
2784 for var in $variables_saved_for_relink; do
2785 relink_command="$var=\""`eval \$echo \"X'$'$var\" | $Xsed -e "$sed_quote_subst"`"\"; export $var; $relink_command"
2787 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2790 # Quote $echo for shipping.
2791 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2793 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2794 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2796 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2798 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2801 # Only actually do things if our run command is non-null.
2802 if test -z "$run"; then
2803 # win32 will think the script is a binary if it has
2804 # a .exe suffix, so we strip it off here.
2806 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2809 trap "$rm $output; exit 1" 1 2 15
2814 # $output - temporary wrapper script for $objdir/$outputname
2815 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2817 # The $output program cannot be directly executed until all the libtool
2818 # libraries that it depends on are installed.
2820 # This wrapper script should never be moved out of the build directory.
2821 # If it is, it will not operate correctly.
2823 # Sed substitution that helps us do robust quoting. It backslashifies
2824 # metacharacters that are still active within double-quoted strings.
2825 Xsed='sed -e 1s/^X//'
2826 sed_quote_subst='$sed_quote_subst'
2828 # The HP-UX ksh and POSIX shell print the target directory to stdout
2830 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2832 relink_command=\"$relink_command\"
2834 # This environment variable determines our operation mode.
2835 if test \"\$libtool_install_magic\" = \"$magic\"; then
2836 # install mode needs the following variable:
2837 link_against_libtool_libs='$link_against_libtool_libs'
2839 # When we are sourced in execute mode, \$file and \$echo are already set.
2840 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2843 # Make sure echo works.
2844 if test \"X\$1\" = X--no-reexec; then
2845 # Discard the --no-reexec flag, and continue.
2847 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2848 # Yippee, \$echo works!
2851 # Restart under the correct shell, and then maybe \$echo will work.
2852 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2858 # Find the directory that this script lives in.
2859 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2860 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2862 # Follow symbolic links until we get to the real thisdir.
2863 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2864 while test -n \"\$file\"; do
2865 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2867 # If there was a directory component, then change thisdir.
2868 if test \"x\$destdir\" != \"x\$file\"; then
2869 case \"\$destdir\" in
2870 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2871 *) thisdir=\"\$thisdir/\$destdir\" ;;
2875 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2876 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2879 # Try to get the absolute directory name.
2880 absdir=\`cd \"\$thisdir\" && pwd\`
2881 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2884 if test "$fast_install" = yes; then
2886 program=lt-'$outputname'
2887 progdir=\"\$thisdir/$objdir\"
2889 if test ! -f \"\$progdir/\$program\" || \\
2890 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2891 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2893 file=\"\$\$-\$program\"
2895 if test ! -d \"\$progdir\"; then
2896 $mkdir \"\$progdir\"
2898 $rm \"\$progdir/\$file\"
2903 # relink executable if necessary
2904 if test -n \"\$relink_command\"; then
2905 if (cd \"\$thisdir\" && eval \$relink_command); then :
2907 $rm \"\$progdir/\$file\"
2912 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2913 { $rm \"\$progdir/\$program\";
2914 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2915 $rm \"\$progdir/\$file\"
2919 program='$outputname'
2920 progdir=\"\$thisdir/$objdir\"
2926 if test -f \"\$progdir/\$program\"; then"
2928 # Export our shlibpath_var if we have one.
2929 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2931 # Add our own library path to $shlibpath_var
2932 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2934 # Some systems cannot cope with colon-terminated $shlibpath_var
2935 # The second colon is a workaround for a bug in BeOS R4 sed
2936 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2938 export $shlibpath_var
2942 # fixup the dll searchpath if we need to.
2943 if test -n "$dllsearchpath"; then
2945 # Add the dll search path components to the executable PATH
2946 PATH=$dllsearchpath:\$PATH
2951 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2952 # Run the actual program with our arguments.
2955 *-*-cygwin* | *-*-mingw | *-*-os2*)
2956 # win32 systems need to use the prog path for dll
2959 exec \$progdir\\\\\$program \${1+\"\$@\"}
2964 # Export the path to the program.
2965 PATH=\"\$progdir:\$PATH\"
2968 exec \$program \${1+\"\$@\"}
2973 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2977 # The program doesn't exist.
2978 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2979 \$echo \"This script is just a wrapper for \$program.\" 1>&2
2980 echo \"See the $PACKAGE documentation for more information.\" 1>&2
2991 # See if we need to build an old-fashioned archive.
2992 for oldlib in $oldlibs; do
2994 if test "$build_libtool_libs" = convenience; then
2995 oldobjs="$libobjs_save"
2996 addlibs="$convenience"
2997 build_libtool_libs=no
2999 if test "$build_libtool_libs" = module; then
3000 oldobjs="$libobjs_save"
3001 build_libtool_libs=no
3003 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3005 addlibs="$old_convenience"
3008 if test -n "$addlibs"; then
3009 gentop="$output_objdir/${outputname}x"
3010 $show "${rm}r $gentop"
3011 $run ${rm}r "$gentop"
3012 $show "mkdir $gentop"
3013 $run mkdir "$gentop"
3015 if test $status -ne 0 && test ! -d "$gentop"; then
3018 generated="$generated $gentop"
3020 # Add in members from convenience archives.
3021 for xlib in $addlibs; do
3022 # Extract the objects.
3024 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3025 *) xabs=`pwd`"/$xlib" ;;
3027 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3028 xdir="$gentop/$xlib"
3030 $show "${rm}r $xdir"
3035 if test $status -ne 0 && test ! -d "$xdir"; then
3038 $show "(cd $xdir && $AR x $xabs)"
3039 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3041 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3045 # Do each command in the archive commands.
3046 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3047 eval cmds=\"$old_archive_from_new_cmds\"
3049 # Ensure that we have .o objects in place in case we decided
3050 # not to build a shared library, and have fallen back to building
3051 # static libs even though --disable-static was passed!
3052 for oldobj in $oldobjs; do
3053 if test ! -f $oldobj; then
3054 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3055 if test "X$xdir" = "X$oldobj"; then
3060 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3061 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3062 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3063 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3067 eval cmds=\"$old_archive_cmds\"
3069 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3070 for cmd in $cmds; do
3073 $run eval "$cmd" || exit $?
3078 if test -n "$generated"; then
3079 $show "${rm}r$generated"
3080 $run ${rm}r$generated
3083 # Now create the libtool archive.
3087 test "$build_old_libs" = yes && old_library="$libname.$libext"
3088 $show "creating $output"
3090 if test -n "$xrpath"; then
3092 for libdir in $xrpath; do
3093 temp_xrpath="$temp_xrpath -R$libdir"
3095 dependency_libs="$temp_xrpath $dependency_libs"
3098 # Only create the output if not a dry run.
3099 if test -z "$run"; then
3100 for installed in no yes; do
3101 if test "$installed" = yes; then
3102 if test -z "$install_libdir"; then
3105 output="$output_objdir/$outputname"i
3109 # $outputname - a libtool library file
3110 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3112 # Please DO NOT delete this file!
3113 # It is necessary for linking the library.
3115 # The name that we can dlopen(3).
3118 # Names of this library.
3119 library_names='$library_names'
3121 # The name of the static archive.
3122 old_library='$old_library'
3124 # Libraries that this one depends upon.
3125 dependency_libs='$dependency_libs'
3127 # Version information for $libname.
3132 # Is this an already installed library?
3133 installed=$installed
3135 # Directory that this library needs to be installed in:
3136 libdir='$install_libdir'\
3141 # Do a symbolic link so that the libtool archive can be found in
3142 # LD_LIBRARY_PATH before the program is installed.
3143 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3144 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3150 # libtool install mode
3152 modename="$modename: install"
3154 # There may be an optional sh(1) argument at the beginning of
3155 # install_prog (especially on Windows NT).
3156 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3157 # Aesthetically quote it.
3158 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3160 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3164 install_prog="$arg "
3172 # The real first argument should be the name of the installation program.
3173 # Aesthetically quote it.
3174 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3176 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3180 install_prog="$install_prog$arg"
3182 # We need to accept at least all the BSD install flags.
3192 if test -n "$dest"; then
3193 files="$files $dest"
3211 # If the previous option needed an argument, then skip it.
3212 if test -n "$prev"; then
3221 # Aesthetically quote the argument.
3222 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3224 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3228 install_prog="$install_prog $arg"
3231 if test -z "$install_prog"; then
3232 $echo "$modename: you must specify an install program" 1>&2
3237 if test -n "$prev"; then
3238 $echo "$modename: the \`$prev' option requires an argument" 1>&2
3243 if test -z "$files"; then
3244 if test -z "$dest"; then
3245 $echo "$modename: no file or destination specified" 1>&2
3247 $echo "$modename: you must specify a destination" 1>&2
3253 # Strip any trailing slash from the destination.
3254 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3256 # Check to see that the destination is a directory.
3257 test -d "$dest" && isdir=yes
3258 if test "$isdir" = yes; then
3262 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3263 test "X$destdir" = "X$dest" && destdir=.
3264 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3266 # Not a directory, so check to see that there is only one file specified.
3268 if test $# -gt 2; then
3269 $echo "$modename: \`$dest' is not a directory" 1>&2
3275 [\\/]* | [A-Za-z]:[\\/]*) ;;
3277 for file in $files; do
3281 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3290 # This variable tells wrapper scripts just to set variables rather
3291 # than running their programs.
3292 libtool_install_magic="$magic"
3297 for file in $files; do
3299 # Do each installation.
3302 # Do the static libraries later.
3303 staticlibs="$staticlibs $file"
3307 # Check to see that this really is a libtool archive.
3308 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3310 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3317 # If there is no directory component, then add one.
3319 */* | *\\*) . $file ;;
3323 # Add the libdir to current_libdirs if it is the destination.
3324 if test "X$destdir" = "X$libdir"; then
3325 case "$current_libdirs " in
3327 *) current_libdirs="$current_libdirs $libdir" ;;
3330 # Note the libdir as a future libdir.
3331 case "$future_libdirs " in
3333 *) future_libdirs="$future_libdirs $libdir" ;;
3337 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3338 test "X$dir" = "X$file/" && dir=
3341 # See the names of the shared library.
3342 set dummy $library_names
3343 if test -n "$2"; then
3348 # Install the shared library and build the symlinks.
3349 $show "$install_prog $dir/$realname $destdir/$realname"
3350 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3352 if test $# -gt 0; then
3353 # Delete the old symlinks, and create new ones.
3356 if test "$linkname" != "$realname"; then
3357 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3358 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3363 # Do each command in the postinstall commands.
3364 lib="$destdir/$realname"
3365 eval cmds=\"$postinstall_cmds\"
3366 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3367 for cmd in $cmds; do
3370 $run eval "$cmd" || exit $?
3375 # Install the pseudo-library for information purposes.
3376 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3377 instname="$dir/$name"i
3378 $show "$install_prog $instname $destdir/$name"
3379 $run eval "$install_prog $instname $destdir/$name" || exit $?
3381 # Maybe install the static library, too.
3382 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3386 # Install (i.e. copy) a libtool object.
3388 # Figure out destination file name, if it wasn't already specified.
3389 if test -n "$destname"; then
3390 destfile="$destdir/$destname"
3392 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3393 destfile="$destdir/$destfile"
3396 # Deduce the name of the destination old-style object file.
3399 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3402 staticdest="$destfile"
3406 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3412 # Install the libtool object if requested.
3413 if test -n "$destfile"; then
3414 $show "$install_prog $file $destfile"
3415 $run eval "$install_prog $file $destfile" || exit $?
3418 # Install the old object if enabled.
3419 if test "$build_old_libs" = yes; then
3420 # Deduce the name of the old-style object file.
3421 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3423 $show "$install_prog $staticobj $staticdest"
3424 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3430 # Figure out destination file name, if it wasn't already specified.
3431 if test -n "$destname"; then
3432 destfile="$destdir/$destname"
3434 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3435 destfile="$destdir/$destfile"
3438 # Do a test to see if this is really a libtool program.
3439 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3440 link_against_libtool_libs=
3443 # If there is no directory component, then add one.
3445 */* | *\\*) . $file ;;
3449 # Check the variables that should have been set.
3450 if test -z "$link_against_libtool_libs"; then
3451 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3456 for lib in $link_against_libtool_libs; do
3457 # Check to see that each library is installed.
3459 if test -f "$lib"; then
3460 # If there is no directory component, then add one.
3462 */* | *\\*) . $lib ;;
3466 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3467 if test -n "$libdir" && test ! -f "$libfile"; then
3468 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3474 if test "$fast_install" = no && test -n "$relink_command"; then
3475 if test "$finalize" = yes && test -z "$run"; then
3477 test -n "$TMPDIR" && tmpdir="$TMPDIR"
3478 tmpdir="$tmpdir/libtool-$$"
3479 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3481 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3484 outputname="$tmpdir/$file"
3485 # Replace the output file specification.
3486 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3488 $show "$relink_command"
3489 if $run eval "$relink_command"; then :
3491 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3497 $echo "$modename: warning: cannot relink \`$file'" 1>&2
3500 # Install the binary that we compiled earlier.
3501 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`