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 Free Software Foundation, Inc.
5 # 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 # used as fallback echo
37 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
38 # Yippee, $echo works!
41 # Restart under the correct shell, and then maybe $echo will work.
42 exec $SHELL "$0" --no-reexec ${1+"$@"}
45 # The name of this program.
46 progname=`$echo "$0" | sed 's%^.*/%%'`
53 TIMESTAMP=" (1.385 1999/03/15 17:24:54)"
56 help="Try \`$progname --help' for more information."
57 magic="%%%MAGIC variable%%%"
62 # Sed substitution that helps us do robust quoting. It backslashifies
63 # metacharacters that are still active within double-quoted strings.
65 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
70 # Only set LANG and LC_ALL to C if already set.
71 # These must not be set unconditionally because not all systems understand
72 # e.g. LANG=C (notably SCO).
73 # We save the old values to restore during execute mode.
74 if test "${LC_ALL+set}" = set; then
75 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
77 if test "${LANG+set}" = set; then
78 save_LANG="$LANG"; LANG=C; export LANG
81 if test "$LTCONFIG_VERSION" != "$VERSION"; then
82 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
83 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
87 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88 echo "$modename: not configured to build any kind of library" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
102 lo2o="s/\\.lo\$/.${objext}/"
104 # Parse our command line options once, thoroughly.
111 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
115 # If the previous option needs an argument, assign it.
116 if test -n "$prev"; then
119 eval "$prev=\"\$$prev \$arg\""
131 # Have we seen a non-optional argument yet?
138 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
148 echo "$progname: enabling shell trace mode"
158 if test "$build_libtool_libs" = yes; then
159 echo "enable shared libraries"
161 echo "disable shared libraries"
163 if test "$build_old_libs" = yes; then
164 echo "enable static libraries"
166 echo "disable static libraries"
171 --finish) mode="finish" ;;
173 --mode) prevopt="--mode" prev=mode ;;
174 --mode=*) mode="$optarg" ;;
186 $echo "$modename: unrecognized option \`$arg'" 1>&2
198 if test -n "$prevopt"; then
199 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
204 if test -z "$show_help"; then
206 # Infer the operation mode.
207 if test -z "$mode"; then
209 *cc | *++ | gcc* | *-gcc*)
221 *db | *dbx | *strace | *truss)
231 # If we have no mode, but dlfiles were specified, then do execute mode.
232 test -n "$execute_dlfiles" && mode=execute
234 # Just use the default operation mode.
235 if test -z "$mode"; then
236 if test -n "$nonopt"; then
237 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
239 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
246 # Only execute mode is allowed to have -dlopen flags.
247 if test -n "$execute_dlfiles" && test "$mode" != execute; then
248 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
253 # Change the help message to a mode-specific one.
255 help="Try \`$modename --help --mode=$mode' for more information."
257 # These modes are in order of execution frequency so that they run quickly.
259 # libtool compile mode
261 modename="$modename: compile"
262 # Get the compilation command and the source file.
271 # Accept any command-line options.
274 if test "$user_target" != "no"; then
275 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
287 case "$user_target" in
289 # The next one is the -o target name
294 # We got the output file
301 # Accept the current argument as the source file.
305 # Aesthetically quote the previous argument.
307 # Backslashify any backslashes, double quotes, and dollar signs.
308 # These are the only characters that are still specially
309 # interpreted inside of double-quoted scrings.
310 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
312 # Double-quote args containing other shell metacharacters.
313 # Many Bourne shells cannot handle close brackets correctly in scan
314 # sets, so we specify it separately.
316 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
317 lastarg="\"$lastarg\""
321 # Add the previous argument to base_compile.
322 if test -z "$base_compile"; then
323 base_compile="$lastarg"
325 base_compile="$base_compile $lastarg"
329 case "$user_target" in
333 # Get the name of the library object.
334 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
337 $echo "$modename: you must specify a target with \`-o'" 1>&2
342 # Recognize several different file suffixes.
343 # If the user specifies -o file.o, it is replaced with file.lo
358 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
361 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
363 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
368 if test -z "$base_compile"; then
369 $echo "$modename: you must specify a compilation command" 1>&2
374 # Delete any leftover library objects.
375 if test "$build_old_libs" = yes; then
376 removelist="$obj $libobj"
382 trap "$run $rm $removelist; exit 1" 1 2 15
384 # Calculate the filename of the output object if compiler does
385 # not support -o with -c
386 if test "$compiler_c_o" = no; then
387 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
388 lockfile="$output_obj.lock"
389 removelist="$removelist $output_obj $lockfile"
390 trap "$run $rm $removelist; exit 1" 1 2 15
396 # Lock this critical section if it is needed
397 # We use this script file to make the link, it avoids creating a new file
398 if test "$need_locks" = yes; then
399 until ln "$0" "$lockfile" 2>/dev/null; do
400 $show "Waiting for $lockfile to be removed"
403 elif test "$need_locks" = warn; then
404 if test -f "$lockfile"; then
406 *** ERROR, $lockfile exists and contains:
407 `cat $lockfile 2>/dev/null`
409 This indicates that another process is trying to use the same
410 temporary object file, and libtool could not work around it because
411 your compiler does not support \`-c' and \`-o' together. If you
412 repeat this compilation, it may succeed, by chance, but you had better
413 avoid parallel builds (make -j) in this platform, or get a better
419 echo $srcfile > "$lockfile"
422 if test -n "$fix_srcfile_path"; then
423 eval srcfile=\"$fix_srcfile_path\"
426 # Only build a PIC object if we are building libtool libraries.
427 if test "$build_libtool_libs" = yes; then
428 # Without this assignment, base_compile gets emptied.
429 fbsd_hideous_sh_bug=$base_compile
431 # All platforms use -DPIC, to notify preprocessed assembler code.
432 command="$base_compile $pic_flag -DPIC $srcfile"
433 if test "$build_old_libs" = yes; then
435 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
436 if test "X$dir" = "X$libobj"; then
441 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
443 if test -d "$dir"; then
450 if test $status -ne 0 && test ! -d $dir; then
455 if test "$compiler_o_lo" = yes; then
457 command="$command -o $output_obj"
458 elif test "$compiler_c_o" = yes; then
460 command="$command -o $output_obj"
464 if $run eval "$command"; then :
466 test -n "$output_obj" && $run $rm $removelist
470 if test "$need_locks" = warn &&
471 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
473 *** ERROR, $lockfile contains:
474 `cat $lockfile 2>/dev/null`
476 but it should contain:
479 This indicates that another process is trying to use the same
480 temporary object file, and libtool could not work around it because
481 your compiler does not support \`-c' and \`-o' together. If you
482 repeat this compilation, it may succeed, by chance, but you had better
483 avoid parallel builds (make -j) in this platform, or get a better
490 # Just move the object if needed, then go on to compile the next one
491 if test x"$output_obj" != x"$libobj"; then
492 $show "$mv $output_obj $libobj"
493 if $run $mv $output_obj $libobj; then :
501 # If we have no pic_flag, then copy the object into place and finish.
502 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
503 # Rename the .lo from within objdir to obj
504 if test -f $obj; then
509 $show "$mv $libobj $obj"
510 if $run $mv $libobj $obj; then :
517 # Now arrange that obj and lo_libobj become the same file
518 $show "$LN_S $obj $lo_libobj"
519 if $run $LN_S $obj $lo_libobj; then
528 # Allow error messages only from the first compilation.
529 suppress_output=' >/dev/null 2>&1'
532 # Only build a position-dependent object if we build old libraries.
533 if test "$build_old_libs" = yes; then
534 command="$base_compile $srcfile"
535 if test "$compiler_c_o" = yes; then
536 command="$command -o $obj"
540 # Suppress compiler output if we already did a PIC compilation.
541 command="$command$suppress_output"
543 if $run eval "$command"; then :
549 if test "$need_locks" = warn &&
550 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
552 *** ERROR, $lockfile contains:
553 `cat $lockfile 2>/dev/null`
555 but it should contain:
558 This indicates that another process is trying to use the same
559 temporary object file, and libtool could not work around it because
560 your compiler does not support \`-c' and \`-o' together. If you
561 repeat this compilation, it may succeed, by chance, but you had better
562 avoid parallel builds (make -j) in this platform, or get a better
569 # Just move the object if needed
570 if test x"$output_obj" != x"$obj"; then
571 $show "$mv $output_obj $obj"
572 if $run $mv $output_obj $obj; then :
580 # Create an invalid libtool object if no PIC, so that we do not
581 # accidentally link it into a program.
582 if test "$build_libtool_libs" != yes; then
583 $show "echo timestamp > $libobj"
584 $run eval "echo timestamp > \$libobj" || exit $?
586 # Move the .lo from within objdir
587 $show "$mv $libobj $lo_libobj"
588 if $run $mv $libobj $lo_libobj; then :
597 # Unlock the critical section if it was locked
598 if test "$need_locks" != no; then
607 modename="$modename: link"
608 C_compiler="$CC" # save it, to compile generated C sources
611 *-*-cygwin* | *-*-mingw* | *-*-os2*)
612 # It is impossible to link a dll without this setting, and
613 # we shouldn't force the makefile maintainer to figure out
614 # which system we are compiling for in order to pass an extra
615 # flag for every libtool invokation.
618 # FIXME: Unfortunately, there are problems with the above when trying
619 # to make a dll which has undefined symbols, in which case not
620 # even a static library is built. For now, we need to specify
621 # -no-undefined on the libtool link line when we can be certain
622 # that all symbols are satisfied, otherwise we get a static library.
625 # This is a source program that is used to create dlls on Windows
626 # Don't remove nor modify the starting and closing comments
627 # /* ltdll.c starts here */
628 # #define WIN32_LEAN_AND_MEAN
629 # #include <windows.h>
630 # #undef WIN32_LEAN_AND_MEAN
633 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
635 # #include <cygwin/cygwin_dll.h>
636 # DECLARE_CYGWIN_DLL( DllMain );
637 # HINSTANCE __hDllInstance_base;
640 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
642 # __hDllInstance_base = hInst;
645 # /* ltdll.c ends here */
646 # This is a source program that is used to create import libraries
647 # on Windows for dlls which lack them. Don't remove nor modify the
648 # starting and closing comments
649 # /* impgen.c starts here */
650 # /* Copyright (C) 1999 Free Software Foundation, Inc.
652 # This file is part of GNU libtool.
654 # This program is free software; you can redistribute it and/or modify
655 # it under the terms of the GNU General Public License as published by
656 # the Free Software Foundation; either version 2 of the License, or
657 # (at your option) any later version.
659 # This program is distributed in the hope that it will be useful,
660 # but WITHOUT ANY WARRANTY; without even the implied warranty of
661 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
662 # GNU General Public License for more details.
664 # You should have received a copy of the GNU General Public License
665 # along with this program; if not, write to the Free Software
666 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
669 # #include <stdio.h> /* for printf() */
670 # #include <unistd.h> /* for open(), lseek(), read() */
671 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
672 # #include <string.h> /* for strdup() */
674 # static unsigned int
675 # pe_get16 (fd, offset)
679 # unsigned char b[2];
680 # lseek (fd, offset, SEEK_SET);
682 # return b[0] + (b[1]<<8);
685 # static unsigned int
686 # pe_get32 (fd, offset)
690 # unsigned char b[4];
691 # lseek (fd, offset, SEEK_SET);
693 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
696 # static unsigned int
700 # unsigned char *b = ptr;
701 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
710 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
711 # unsigned long export_rva, export_size, nsections, secptr, expptr;
712 # unsigned long name_rvas, nexp;
713 # unsigned char *expdata, *erva;
714 # char *filename, *dll_name;
716 # filename = argv[1];
718 # dll = open(filename, O_RDONLY|O_BINARY);
722 # dll_name = filename;
724 # for (i=0; filename[i]; i++)
725 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
726 # dll_name = filename + i +1;
728 # pe_header_offset = pe_get32 (dll, 0x3c);
729 # opthdr_ofs = pe_header_offset + 4 + 20;
730 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
732 # if (num_entries < 1) /* no exports */
735 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
736 # export_size = pe_get32 (dll, opthdr_ofs + 100);
737 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
738 # secptr = (pe_header_offset + 4 + 20 +
739 # pe_get16 (dll, pe_header_offset + 4 + 16));
742 # for (i = 0; i < nsections; i++)
745 # unsigned long secptr1 = secptr + 40 * i;
746 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
747 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
748 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
749 # lseek(dll, secptr1, SEEK_SET);
750 # read(dll, sname, 8);
751 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
753 # expptr = fptr + (export_rva - vaddr);
754 # if (export_rva + export_size > vaddr + vsize)
755 # export_size = vsize - (export_rva - vaddr);
760 # expdata = (unsigned char*)malloc(export_size);
761 # lseek (dll, expptr, SEEK_SET);
762 # read (dll, expdata, export_size);
763 # erva = expdata - export_rva;
765 # nexp = pe_as32 (expdata+24);
766 # name_rvas = pe_as32 (expdata+32);
768 # printf ("EXPORTS\n");
769 # for (i = 0; i<nexp; i++)
771 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
772 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
777 # /* impgen.c ends here */
783 compile_command="$CC"
784 finalize_command="$CC"
795 if test -n "$shlibpath_var"; then
796 # get the directories listed in $shlibpath_var
797 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
801 # now prepend the system-specific ones
802 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
803 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
811 export_symbols_regex=
814 link_against_libtool_libs=
829 # We need to know -static, to get the right output filenames.
833 -all-static | -static)
834 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
835 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
837 build_libtool_libs=no
844 # See if our shared archives depend on static archives.
845 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
847 # Go through the arguments, transforming them on the way.
848 while test $# -gt 0; do
852 # If the previous option needs an argument, assign it.
853 if test -n "$prev"; then
856 compile_command="$compile_command @OUTPUT@"
857 finalize_command="$finalize_command @OUTPUT@"
863 if test "$preload" = no; then
864 # Add the symbol object into the linking commands.
865 compile_command="$compile_command @SYMFILE@"
866 finalize_command="$finalize_command @SYMFILE@"
870 *.la | *.lo) ;; # We handle these cases below.
872 if test "$prev" = dlprefiles; then
874 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
881 dlprefiles="$dlprefiles $arg"
882 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
888 export_symbols="$arg"
889 if test ! -f "$arg"; then
890 $echo "$modename: symbol file \`$arg' does not exist"
897 export_symbols_regex="$arg"
912 xrpath="$xrpath $arg"
917 eval "$prev=\"\$arg\""
928 if test -n "$link_static_flag"; then
929 compile_command="$compile_command $link_static_flag"
930 finalize_command="$finalize_command $link_static_flag"
931 dlopen_self=$dlopen_self_static
937 # FIXME: remove this flag sometime in the future.
938 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
958 if test "$export_dynamic" != yes; then
960 if test -n "$export_dynamic_flag_spec"; then
961 eval arg=\"$export_dynamic_flag_spec\"
968 -export-symbols | -export-symbols-regex)
969 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
970 $echo "$modename: cannot have more than one -exported-symbols"
973 if test "$arg" = "-export-symbols"; then
982 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
984 /* | [A-Za-z]:[/\\]*)
985 # Add the corresponding hardcode_libdir_flag, if it is not identical.
988 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
994 *) deplibs="$deplibs $arg";;
996 case " $lib_search_path " in
998 *) lib_search_path="$lib_search_path $dir";;
1001 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1002 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1003 case ":$dllsearchpath:" in
1004 ::) dllsearchpath="$dllsearchdir";;
1005 *":$dllsearchdir:"*) ;;
1006 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1013 deplibs="$deplibs $arg"
1017 if test "$module" != yes; then
1019 if test -n "$export_dynamic_flag_spec"; then
1020 eval arg=\"$export_dynamic_flag_spec\"
1050 xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'`
1055 # If we have no pic_flag, then this is the same as -all-static.
1056 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1057 compile_command="$compile_command $link_static_flag"
1058 finalize_command="$finalize_command $link_static_flag"
1059 dlopen_self=$dlopen_self_static
1074 # Some other compiler flag.
1076 # Unknown arguments in both finalize_command and compile_command need
1077 # to be aesthetically quoted because they are evaled later.
1078 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1080 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1086 *.o | *.obj | *.a | *.lib)
1087 # A standard object.
1093 if test "$prev" = dlfiles; then
1094 dlfiles="$dlfiles $arg"
1095 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1099 # If libtool objects are unsupported, then we need to preload.
1104 if test "$prev" = dlprefiles; then
1105 # Preload the old-style object.
1106 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1109 libobjs="$libobjs $arg"
1113 # A libtool-controlled library.
1120 # Check to see that this really is a libtool archive.
1121 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1123 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1127 # If the library was installed with an old release of libtool,
1128 # it will not redefine variable installed.
1131 # If there is no directory component, then add one.
1133 */* | *\\*) . $arg ;;
1137 # Get the name of the library we link against.
1139 for l in $old_library $library_names; do
1143 if test -z "$linklib"; then
1144 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1148 # Find the relevant object directory and library name.
1149 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1151 if test "X$installed" = Xyes; then
1154 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1155 if test "X$dir" = "X$arg"; then
1162 if test -n "$dependency_libs"; then
1163 # Extract -R from dependency_libs
1165 for deplib in $dependency_libs; do
1167 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1168 case " $rpath $xrpath " in
1169 *" $temp_xrpath "*) ;;
1170 *) xrpath="$xrpath $temp_xrpath";;
1172 -L*) case "$compile_command $temp_deplibs " in
1174 *) temp_deplibs="$temp_deplibs $deplib";;
1176 *) temp_deplibs="$temp_deplibs $deplib";;
1179 dependency_libs="$temp_deplibs"
1182 if test -z "$libdir"; then
1183 # It is a libtool convenience library, so add in its objects.
1184 convenience="$convenience $dir/$old_library"
1185 old_convenience="$old_convenience $dir/$old_library"
1186 deplibs="$deplibs$dependency_libs"
1187 compile_command="$compile_command $dir/$old_library$dependency_libs"
1188 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1192 # This library was specified with -dlopen.
1193 if test "$prev" = dlfiles; then
1194 dlfiles="$dlfiles $arg"
1195 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1196 # If there is no dlname, no dlopen support or we're linking statically,
1197 # we need to preload.
1200 # We should not create a dependency on this library, but we
1201 # may need any libraries it requires.
1202 compile_command="$compile_command$dependency_libs"
1203 finalize_command="$finalize_command$dependency_libs"
1209 # The library was specified with -dlpreopen.
1210 if test "$prev" = dlprefiles; then
1211 # Prefer using a static library (so that no silly _DYNAMIC symbols
1212 # are required to link).
1213 if test -n "$old_library"; then
1214 dlprefiles="$dlprefiles $dir/$old_library"
1216 dlprefiles="$dlprefiles $dir/$linklib"
1221 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
1222 link_against_libtool_libs="$link_against_libtool_libs $arg"
1223 if test -n "$shlibpath_var"; then
1224 # Make sure the rpath contains only unique directories.
1225 case "$temp_rpath " in
1227 *) temp_rpath="$temp_rpath $dir" ;;
1231 # We need an absolute path.
1233 /* | [A-Za-z]:[/\\]*) absdir="$dir" ;;
1235 absdir=`cd "$dir" && pwd`
1236 if test -z "$absdir"; then
1237 $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
1243 # This is the magic to use -rpath.
1244 # Skip directories that are in the system default run-time
1245 # search path, unless they have been requested with -R.
1246 case " $sys_lib_dlsearch_path " in
1249 case "$compile_rpath " in
1251 *) compile_rpath="$compile_rpath $absdir"
1256 case " $sys_lib_dlsearch_path " in
1259 case "$finalize_rpath " in
1261 *) finalize_rpath="$finalize_rpath $libdir"
1267 case "$hardcode_action" in
1268 immediate | unsupported)
1269 if test "$hardcode_direct" = no; then
1270 compile_command="$compile_command $dir/$linklib"
1271 deplibs="$deplibs $dir/$linklib"
1273 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1274 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1275 if test -n "$dllsearchpath"; then
1276 dllsearchpath="$dllsearchpath:$dllsearchdir"
1278 dllsearchpath="$dllsearchdir"
1282 elif test "$hardcode_minus_L" = no; then
1285 compile_shlibpath="$compile_shlibpath$dir:"
1288 case "$compile_command " in
1290 *) compile_command="$compile_command -L$dir";;
1292 compile_command="$compile_command -l$name"
1293 deplibs="$deplibs -L$dir -l$name"
1294 elif test "$hardcode_shlibpath_var" = no; then
1295 case ":$compile_shlibpath:" in
1297 *) compile_shlibpath="$compile_shlibpath$dir:";;
1299 compile_command="$compile_command -l$name"
1300 deplibs="$deplibs -l$name"
1307 if test "$hardcode_direct" = yes; then
1308 compile_command="$compile_command $absdir/$linklib"
1309 deplibs="$deplibs $absdir/$linklib"
1310 elif test "$hardcode_minus_L" = yes; then
1311 case "$compile_command " in
1313 *) compile_command="$compile_command -L$absdir";;
1315 compile_command="$compile_command -l$name"
1316 deplibs="$deplibs -L$absdir -l$name"
1317 elif test "$hardcode_shlibpath_var" = yes; then
1318 case ":$compile_shlibpath:" in
1320 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1322 compile_command="$compile_command -l$name"
1323 deplibs="$deplibs -l$name"
1334 if test "$lib_linked" != yes; then
1335 $echo "$modename: configuration error: unsupported hardcode properties"
1339 # Finalize command for both is simple: just hardcode it.
1340 if test "$hardcode_direct" = yes; then
1341 finalize_command="$finalize_command $libdir/$linklib"
1342 elif test "$hardcode_minus_L" = yes; then
1343 case "$finalize_command " in
1345 *) finalize_command="$finalize_command -L$libdir";;
1347 finalize_command="$finalize_command -l$name"
1348 elif test "$hardcode_shlibpath_var" = yes; then
1349 case ":$finalize_shlibpath:" in
1351 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1353 finalize_command="$finalize_command -l$name"
1355 # We cannot seem to hardcode it, guess we'll fake it.
1356 case "$finalize_command " in
1358 *) finalize_command="$finalize_command -L$libdir";;
1360 finalize_command="$finalize_command -l$name"
1363 # Transform directly to old archives if we don't build new libraries.
1364 if test -n "$pic_flag" && test -z "$old_library"; then
1365 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1369 # Here we assume that one of hardcode_direct or hardcode_minus_L
1370 # is not unsupported. This is valid on all known static and
1372 if test "$hardcode_direct" != unsupported; then
1373 test -n "$old_library" && linklib="$old_library"
1374 compile_command="$compile_command $dir/$linklib"
1375 finalize_command="$finalize_command $dir/$linklib"
1377 case "$compile_command " in
1379 *) compile_command="$compile_command -L$dir";;
1381 compile_command="$compile_command -l$name"
1382 case "$finalize_command " in
1384 *) finalize_command="$finalize_command -L$dir";;
1386 finalize_command="$finalize_command -l$name"
1390 # Add in any libraries that this one depends upon.
1391 compile_command="$compile_command$dependency_libs"
1392 finalize_command="$finalize_command$dependency_libs"
1396 # Some other compiler argument.
1398 # Unknown arguments in both finalize_command and compile_command need
1399 # to be aesthetically quoted because they are evaled later.
1400 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1402 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1409 # Now actually substitute the argument into the commands.
1410 if test -n "$arg"; then
1411 compile_command="$compile_command $arg"
1412 finalize_command="$finalize_command $arg"
1416 if test -n "$prev"; then
1417 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1423 # calculate the name of the file, without its directory
1424 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1425 libobjs_save="$libobjs"
1429 $echo "$modename: you must specify an output file" 1>&2
1435 if test -n "$link_against_libtool_libs"; then
1436 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1440 if test -n "$deplibs"; then
1441 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1444 if test -n "$dlfiles$dlprefiles"; then
1445 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1448 if test -n "$rpath"; then
1449 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1452 if test -n "$xrpath"; then
1453 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1456 if test -n "$vinfo"; then
1457 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1460 if test -n "$release"; then
1461 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1464 if test -n "$export_symbols"; then
1465 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1468 # Now set the variables for building old libraries.
1469 build_libtool_libs=no
1474 # Make sure we only generate libraries of the form `libNAME.la'.
1475 case "$outputname" in
1477 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1478 eval libname=\"$libname_spec\"
1481 if test "$module" = no; then
1482 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1486 if test "$need_lib_prefix" != no; then
1487 # Add the "lib" prefix for modules if required
1488 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1489 eval libname=\"$libname_spec\"
1491 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1496 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1497 if test "X$output_objdir" = "X$output"; then
1498 output_objdir="$objdir"
1500 output_objdir="$output_objdir/$objdir"
1503 # All the library-specific variables (install_libdir is set above).
1508 if test -n "$objs"; then
1509 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1513 # How the heck are we supposed to write a wrapper for a shared library?
1514 if test -n "$link_against_libtool_libs"; then
1515 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1519 if test -n "$dlfiles$dlprefiles"; then
1520 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1524 if test $# -gt 2; then
1525 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1530 if test -z "$rpath"; then
1531 if test "$build_libtool_libs" = yes; then
1532 # Building a libtool convenience library.
1534 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1535 build_libtool_libs=convenience
1538 dependency_libs="$deplibs"
1540 if test -n "$vinfo"; then
1541 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1544 if test -n "$release"; then
1545 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1549 # Parse the version information argument.
1550 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1551 set dummy $vinfo 0 0 0
1554 if test -n "$8"; then
1555 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1564 # Check that each of the things are valid numbers.
1566 0 | [1-9] | [1-9][0-9]*) ;;
1568 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1569 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1575 0 | [1-9] | [1-9][0-9]*) ;;
1577 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1578 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1584 0 | [1-9] | [1-9][0-9]*) ;;
1586 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1587 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1592 if test $age -gt $current; then
1593 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1594 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1598 # Calculate the version variables.
1602 case "$version_type" in
1606 major=`expr $current - $age + 1`
1607 versuffix="$major.$revision"
1608 verstring="sgi$major.$revision"
1610 # Add in all the interfaces that we are compatible with.
1612 while test $loop != 0; do
1613 iface=`expr $revision - $loop`
1614 loop=`expr $loop - 1`
1615 verstring="sgi$major.$iface:$verstring"
1620 major=.`expr $current - $age`
1621 versuffix="$major.$age.$revision"
1625 major=`expr $current - $age`
1626 versuffix=".$current.$age.$revision"
1627 verstring="$current.$age.$revision"
1629 # Add in all the interfaces that we are compatible with.
1631 while test $loop != 0; do
1632 iface=`expr $current - $loop`
1633 loop=`expr $loop - 1`
1634 verstring="$verstring:${iface}.0"
1637 # Make executables depend on our current version.
1638 verstring="$verstring:${current}.0"
1643 versuffix=".$current.$revision"
1648 versuffix=".$current.$revision";
1653 versuffix=".$current";
1657 # Like Linux, but with '-' rather than '.', since we only
1658 # want one extension on Windows 95.
1659 major=`expr $current - $age`
1660 versuffix="-$major-$age-$revision"
1664 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1665 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1670 # Clear the version info if we defaulted, and they specified a release.
1671 if test -z "$vinfo" && test -n "$release"; then
1674 if test "$need_version" = no; then
1681 # Remove version info from name if versioning should be avoided
1682 if test "$avoid_version" = yes && test "$need_version" = no; then
1688 # Check to see if the archive will have undefined symbols.
1689 if test "$allow_undefined" = yes; then
1690 if test "$allow_undefined_flag" = unsupported; then
1691 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1692 build_libtool_libs=no
1696 # Don't allow undefined symbols.
1697 allow_undefined_flag="$no_undefined_flag"
1700 dependency_libs="$deplibs"
1702 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1703 # these systems don't actually have a c library (as such)!
1706 # Add libc to deplibs on all other systems.
1707 deplibs="$deplibs -lc"
1712 # Create the output directory, or remove our outputs if we need to.
1713 if test -d $output_objdir; then
1714 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1715 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1717 $show "$mkdir $output_objdir"
1718 $run $mkdir $output_objdir
1720 if test $status -ne 0 && test ! -d $output_objdir; then
1725 # Now set the variables for building old libraries.
1726 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1727 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1729 # Transform .lo files to .o files.
1730 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1733 if test "$build_libtool_libs" = yes; then
1734 # Transform deplibs into only deplibs that can be linked in shared.
1736 libname_save=$libname
1737 release_save=$release
1738 versuffix_save=$versuffix
1740 # I'm not sure if I'm treating the release correctly. I think
1741 # release should show up in the -l (ie -lgmp5) so we don't want to
1742 # add it in twice. Is that correct?
1748 case "$deplibs_check_method" in
1751 ;; # Don't check for shared/static. Everything works.
1752 # This might be a little naive. We might want to check
1753 # whether the library exists or not. But this is on
1754 # osf3 & osf4 and I'm not really sure... Just
1755 # implementing what was already the behaviour.
1757 # This code stresses the "libraries are programs" paradigm to its
1758 # limits. Maybe even breaks it. We compile a program, linking it
1759 # against the deplibs as a proxy for the library. Then we can check
1760 # whether they linked in statically or dynamically with ldd.
1762 cat > conftest.c <<EOF
1763 int main() { return 0; }
1766 $C_compiler -o conftest conftest.c $deplibs
1767 if test $? -eq 0 ; then
1768 ldd_output=`ldd conftest`
1769 for i in $deplibs; do
1770 name="`expr $i : '-l\(.*\)'`"
1771 # If $name is empty we are operating on a -L argument.
1772 if test "$name" != "" ; then
1773 libname=`eval \\$echo \"$libname_spec\"`
1774 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1775 set dummy $deplib_matches
1777 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1778 newdeplibs="$newdeplibs $i"
1782 echo "*** Warning: This library needs some functionality provided by $i."
1783 echo "*** I have the capability to make that library automatically link in when"
1784 echo "*** you link to this library. But I can only do this if you have a"
1785 echo "*** shared version of the library, which you do not appear to have."
1788 newdeplibs="$newdeplibs $i"
1792 # Error occured in the first compile. Let's try to salvage the situation:
1793 # Compile a seperate program for each library.
1794 for i in $deplibs; do
1795 name="`expr $i : '-l\(.*\)'`"
1796 # If $name is empty we are operating on a -L argument.
1797 if test "$name" != "" ; then
1799 $C_compiler -o conftest conftest.c $i
1801 if test $? -eq 0 ; then
1802 ldd_output=`ldd conftest`
1803 libname=`eval \\$echo \"$libname_spec\"`
1804 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1805 set dummy $deplib_matches
1807 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1808 newdeplibs="$newdeplibs $i"
1812 echo "*** Warning: This library needs some functionality provided by $i."
1813 echo "*** I have the capability to make that library automatically link in when"
1814 echo "*** you link to this library. But I can only do this if you have a"
1815 echo "*** shared version of the library, which you do not appear to have."
1820 echo "*** Warning! Library $i is needed by this library but I was not able to"
1821 echo "*** make it link in! You will probably need to install it or some"
1822 echo "*** library that it depends on before this library will be fully"
1823 echo "*** functional. Installing it before continuing would be even better."
1826 newdeplibs="$newdeplibs $i"
1833 set dummy $deplibs_check_method
1834 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1835 for a_deplib in $deplibs; do
1836 name="`expr $a_deplib : '-l\(.*\)'`"
1837 # If $name is empty we are operating on a -L argument.
1838 if test "$name" != "" ; then
1839 libname=`eval \\$echo \"$libname_spec\"`
1840 for i in $lib_search_path; do
1841 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1842 for potent_lib in $potential_libs; do
1843 # Follow soft links.
1844 if ls -lLd "$potlib" 2>/dev/null \
1845 | grep " -> " >/dev/null; then
1848 # The statement above tries to avoid entering an
1849 # endless loop below, in case of cyclic links.
1850 # We might still enter an endless loop, since a link
1851 # loop can be closed while we follow links,
1853 potlib="$potent_lib"
1854 while test -h "$potlib" 2>/dev/null; do
1855 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1856 case "$potliblink" in
1857 /*) potlib="$potliblink";;
1858 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1861 if eval $file_magic_cmd \"\$potlib\" \
1863 | egrep "$file_magic_regex" > /dev/null; then
1864 newdeplibs="$newdeplibs $a_deplib"
1870 if test -n "$a_deplib" ; then
1873 echo "*** Warning: This library needs some functionality provided by $a_deplib."
1874 echo "*** I have the capability to make that library automatically link in when"
1875 echo "*** you link to this library. But I can only do this if you have a"
1876 echo "*** shared version of the library, which you do not appear to have."
1879 # Add a -L argument.
1880 newdeplibs="$newdeplibs $a_deplib"
1882 done # Gone through all deplibs.
1884 none | unknown | *) newdeplibs=""
1885 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
1886 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
1887 grep . >/dev/null; then
1889 if test "X$deplibs_check_method" = "Xnone"; then
1890 echo "*** Warning: inter-library dependencies are not supported in this platform."
1892 echo "*** Warning: inter-library dependencies are not known to be supported."
1894 echo "*** All declared inter-library dependencies are being dropped."
1899 versuffix=$versuffix_save
1901 release=$release_save
1902 libname=$libname_save
1905 if test "$droppeddeps" = yes; then
1906 if test "$module" = yes; then
1908 echo "*** Warning: libtool could not satisfy all declared inter-library"
1909 echo "*** dependencies of module $libname. Therefore, libtool will create"
1910 echo "*** a static module, that should work as long as the dlopening"
1911 echo "*** application is linked with the -dlopen flag."
1912 if test -z "$global_symbol_pipe"; then
1914 echo "*** However, this would only work if libtool was able to extract symbol"
1915 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1916 echo "*** not find such a program. So, this module is probably useless."
1917 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1919 if test "$build_old_libs" = no; then
1920 oldlibs="$output_objdir/$libname.$libext"
1921 build_libtool_libs=module
1924 build_libtool_libs=no
1929 echo "*** The inter-library dependencies that have been dropped here will be"
1930 echo "*** automatically added whenever a program is linked with this library"
1931 echo "*** or is declared to -dlopen it."
1936 # test again, we may have decided not to build it any more
1937 if test "$build_libtool_libs" = yes; then
1939 # Done checking deplibs!
1941 # Get the real and link names of the library.
1942 eval library_names=\"$library_names_spec\"
1943 set dummy $library_names
1947 if test -n "$soname_spec"; then
1948 eval soname=\"$soname_spec\"
1953 lib="$output_objdir/$realname"
1956 linknames="$linknames $link"
1959 # Ensure that we have .o objects for linkers which dislike .lo
1960 # (e.g. aix) incase we are running --disable-static
1961 for obj in $libobjs; do
1962 oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
1963 test -f $oldobj || ${LN_S} $obj $oldobj
1966 # Use standard objects if they are pic
1967 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1969 if test -n "$whole_archive_flag_spec"; then
1970 if test -n "$convenience"; then
1971 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1974 for xlib in $convenience; do
1975 # Extract the objects.
1977 generated="$generated $xdir"
1978 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
1980 $show "${rm}r $xdir"
1985 if test $status -ne 0 && test ! -d "$xdir"; then
1988 $show "(cd $xdir && $AR x ../$xlib)"
1989 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1991 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
1995 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
1996 eval flag=\"$thread_safe_flag_spec\"
1998 linkopts="$linkopts $flag"
2001 # Prepare the list of exported symbols
2002 if test -z "$export_symbols"; then
2003 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2004 $show "generating symbol list for \`$libname.la'"
2005 export_symbols="$objdir/$libname.exp"
2006 $run $rm $export_symbols
2007 eval cmds=\"$export_symbols_cmds\"
2008 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2009 for cmd in $cmds; do
2012 $run eval "$cmd" || exit $?
2015 if test -n "$export_symbols_regex"; then
2016 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2017 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2018 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2019 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2024 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2025 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2028 # Do each of the archive commands.
2029 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2030 eval cmds=\"$archive_expsym_cmds\"
2032 eval cmds=\"$archive_cmds\"
2034 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2035 for cmd in $cmds; do
2038 $run eval "$cmd" || exit $?
2042 # Create links to the real library.
2043 for linkname in $linknames; do
2044 if test "$realname" != "$linkname"; then
2045 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2046 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2050 # If -module or -export-dynamic was specified, set the dlname.
2051 if test "$module" = yes || test "$export_dynamic" = yes; then
2052 # On all known operating systems, these are identical.
2059 if test -n "$link_against_libtool_libs"; then
2060 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2064 if test -n "$deplibs"; then
2065 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2068 if test -n "$dlfiles$dlprefiles"; then
2069 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2072 if test -n "$rpath"; then
2073 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2076 if test -n "$xrpath"; then
2077 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2080 if test -n "$vinfo"; then
2081 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2084 if test -n "$release"; then
2085 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2090 if test -n "$objs"; then
2091 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2095 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2103 # Delete the old objects.
2104 $run $rm $obj $libobj
2106 # Create the old-style object.
2107 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2110 eval cmds=\"$reload_cmds\"
2111 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2112 for cmd in $cmds; do
2115 $run eval "$cmd" || exit $?
2119 # Exit if we aren't doing a library object file.
2120 test -z "$libobj" && exit 0
2122 if test "$build_libtool_libs" != yes; then
2123 # Create an invalid libtool object if no PIC, so that we don't
2124 # accidentally link it into a program.
2125 $show "echo timestamp > $libobj"
2126 $run eval "echo timestamp > $libobj" || exit $?
2130 if test -n "$pic_flag"; then
2131 # Only do commands if we really have different PIC objects.
2132 reload_objs="$libobjs"
2134 eval cmds=\"$reload_cmds\"
2135 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2136 for cmd in $cmds; do
2139 $run eval "$cmd" || exit $?
2143 # Just create a symlink.
2146 $show "$LN_S $obj $libobj"
2147 $run $LN_S $obj $libobj || exit $?
2153 # Anything else should be a program.
2155 if test -n "$vinfo"; then
2156 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2159 if test -n "$release"; then
2160 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2163 if test "$preload" = yes; then
2164 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2165 test "$dlopen_self_static" = unknown; then
2166 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2170 if test "$dlself" = yes && test "$export_dynamic" = no; then
2171 $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
2175 if test -n "$rpath$xrpath"; then
2176 # If the user specified any rpath flags, then add them.
2177 for libdir in $rpath $xrpath; do
2178 # This is the magic to use -rpath.
2179 case "$compile_rpath " in
2181 *) compile_rpath="$compile_rpath $libdir" ;;
2183 case "$finalize_rpath " in
2185 *) finalize_rpath="$finalize_rpath $libdir" ;;
2190 # Now hardcode the library paths
2193 for libdir in $compile_rpath $finalize_rpath; do
2194 if test -n "$hardcode_libdir_flag_spec"; then
2195 if test -n "$hardcode_libdir_separator"; then
2196 if test -z "$hardcode_libdirs"; then
2197 hardcode_libdirs="$libdir"
2199 # Just accumulate the unique libdirs.
2200 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2201 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2204 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2209 eval flag=\"$hardcode_libdir_flag_spec\"
2211 rpath="$rpath $flag"
2213 elif test -n "$runpath_var"; then
2214 case "$perm_rpath " in
2216 *) perm_rpath="$perm_rpath $libdir" ;;
2220 # Substitute the hardcoded libdirs into the rpath.
2221 if test -n "$hardcode_libdir_separator" &&
2222 test -n "$hardcode_libdirs"; then
2223 libdir="$hardcode_libdirs"
2224 eval rpath=\" $hardcode_libdir_flag_spec\"
2226 compile_rpath="$rpath"
2230 for libdir in $finalize_rpath; do
2231 if test -n "$hardcode_libdir_flag_spec"; then
2232 if test -n "$hardcode_libdir_separator"; then
2233 if test -z "$hardcode_libdirs"; then
2234 hardcode_libdirs="$libdir"
2236 # Just accumulate the unique libdirs.
2237 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2238 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2241 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2246 eval flag=\"$hardcode_libdir_flag_spec\"
2248 rpath="$rpath $flag"
2250 elif test -n "$runpath_var"; then
2251 case "$finalize_perm_rpath " in
2253 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2257 # Substitute the hardcoded libdirs into the rpath.
2258 if test -n "$hardcode_libdir_separator" &&
2259 test -n "$hardcode_libdirs"; then
2260 libdir="$hardcode_libdirs"
2261 eval rpath=\" $hardcode_libdir_flag_spec\"
2263 finalize_rpath="$rpath"
2265 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2266 if test "X$output_objdir" = "X$output"; then
2267 output_objdir="$objdir"
2269 output_objdir="$output_objdir/$objdir"
2272 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2273 # Transform all the library objects into standard objects.
2274 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2275 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2279 if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
2280 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2281 dlsyms="${outputname}S.c"
2283 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2287 if test -n "$dlsyms"; then
2291 # Discover the nlist of each of the dlfiles.
2292 nlist="$objdir/${output}.nm"
2294 if test -d $objdir; then
2295 $show "$rm $nlist ${nlist}S ${nlist}T"
2296 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2298 $show "$mkdir $objdir"
2301 if test $status -ne 0 && test ! -d $objdir; then
2306 # Parse the name list into a source file.
2307 $show "creating $objdir/$dlsyms"
2309 $echo > "$objdir/$dlsyms" "\
2310 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2311 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2317 /* Prevent the only kind of declaration conflicts we can make. */
2318 #define lt_preloaded_symbols some_other_symbol
2320 /* External symbol declarations for the compiler. */\
2323 if test "$dlself" = yes; then
2324 $show "generating symbol list for \`$output'"
2326 echo ': @PROGRAM@ ' > "$nlist"
2328 # Add our own program objects to the symbol list.
2329 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2330 for arg in $progfiles; do
2331 $show "extracting global C symbols from \`$arg'"
2332 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2335 if test -n "$exclude_expsyms"; then
2336 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2337 $run eval '$mv "$nlist"T "$nlist"'
2340 if test -n "$export_symbols_regex"; then
2341 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2342 $run eval '$mv "$nlist"T "$nlist"'
2345 # Prepare the list of exported symbols
2346 if test -z "$export_symbols"; then
2347 export_symbols="$objdir/$output.exp"
2348 $run $rm $export_symbols
2349 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2351 $run $rm $export_symbols
2352 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
2353 $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
2354 $run eval 'mv "$nlist"T "$nlist"'
2358 for arg in $dlprefiles; do
2359 $show "extracting global C symbols from \`$arg'"
2360 name=`echo "$arg" | sed -e 's%^.*/%%'`
2361 $run eval 'echo ": $name " >> "$nlist"'
2362 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2365 if test -z "$run"; then
2366 # Make sure we have at least an empty file.
2367 test -f "$nlist" || : > "$nlist"
2369 if test -n "$exclude_expsyms"; then
2370 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2371 $mv "$nlist"T "$nlist"
2374 # Try sorting and uniquifying the output.
2375 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2378 grep -v "^: " < "$nlist" > "$nlist"S
2381 if test -f "$nlist"S; then
2382 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2384 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2387 $echo >> "$output_objdir/$dlsyms" "\
2389 #undef lt_preloaded_symbols
2391 #if defined (__STDC__) && __STDC__
2392 # define lt_ptr_t void *
2394 # define lt_ptr_t char *
2398 /* The mapping between symbol names and symbols. */
2403 lt_preloaded_symbols[] =
2407 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2408 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2409 < "$nlist" >> "$output_objdir/$dlsyms"
2411 $echo >> "$output_objdir/$dlsyms" "\
2415 /* This works around a problem in FreeBSD linker */
2416 #ifdef FREEBSD_WORKAROUND
2417 static const void *lt_preloaded_setup() {
2418 return lt_preloaded_symbols;
2428 pic_flag_for_symtable=
2430 # compiling the symbol table file with pic_flag works around
2431 # a FreeBSD bug that causes programs to crash when -lm is
2432 # linked before any other PIC object. But we must not use
2433 # pic_flag when linking with -static. The problem exists in
2434 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2435 *-*-freebsd2*|*-*-freebsd3.0*)
2436 case "$compile_command " in
2438 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2442 # Now compile the dynamic symbol file.
2443 $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2444 $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2446 # Transform the symbol file into the correct name.
2447 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2448 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2451 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2456 # We keep going just in case the user didn't refer to
2457 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2458 # really was required.
2460 # Nullify the symbol file.
2461 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2462 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2465 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2466 # Replace the output file specification.
2467 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2468 link_command="$compile_command$compile_rpath"
2470 # We have no uninstalled library dependencies, so finalize right now.
2471 $show "$link_command"
2472 $run eval "$link_command"
2476 if test -n "$shlibpath_var"; then
2477 # We should set the shlibpath_var
2479 for dir in $temp_rpath; do
2481 /* | [A-Za-z]:[/\\]*)
2486 # Relative path: add a thisdir entry.
2487 rpath="$rpath\$thisdir/$dir:"
2494 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2495 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2497 if test -n "$finalize_shlibpath"; then
2498 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2503 if test -n "$runpath_var"; then
2504 if test -n "$perm_rpath"; then
2505 # We should set the runpath_var.
2507 for dir in $perm_rpath; do
2510 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2512 if test -n "$finalize_perm_rpath"; then
2513 # We should set the runpath_var.
2515 for dir in $finalize_perm_rpath; do
2518 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2522 if test "$hardcode_action" = relink; then
2523 # Fast installation is not supported
2524 link_command="$compile_var$compile_command$compile_rpath"
2525 relink_command="$finalize_var$finalize_command$finalize_rpath"
2527 # AGH! Flame the AIX and HP-UX people for me, will ya?
2528 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2529 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2531 if test "$fast_install" != no; then
2532 link_command="$finalize_var$compile_command$finalize_rpath"
2533 if test "$fast_install" = yes; then
2534 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2536 # fast_install is set to needless
2540 link_command="$compile_var$compile_command$compile_rpath"
2541 relink_command="$finalize_var$finalize_command$finalize_rpath"
2545 # Replace the output file specification.
2546 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2548 # Create the binary in the object directory, then wrap it.
2549 if test ! -d $output_objdir; then
2550 $show "$mkdir $output_objdir"
2551 $run $mkdir $output_objdir
2553 if test $status -ne 0 && test ! -d $objdir; then
2558 # Delete the old output file.
2559 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2561 $show "$link_command"
2562 $run eval "$link_command" || exit $?
2564 # Now create the wrapper script.
2565 $show "creating $output"
2567 # Quote the relink command for shipping.
2568 if test -n "$relink_command"; then
2569 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2572 # Quote $echo for shipping.
2573 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2575 /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
2576 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2578 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2580 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2583 # Only actually do things if our run command is non-null.
2584 if test -z "$run"; then
2585 # win32 will think the script is a binary if it has
2586 # a .exe suffix, so we strip it off here.
2588 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2591 trap "$rm $output; exit 1" 1 2 15
2596 # $output - temporary wrapper script for $objdir/$outputname
2597 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2599 # The $output program cannot be directly executed until all the libtool
2600 # libraries that it depends on are installed.
2602 # This wrapper script should never be moved out of the build directory.
2603 # If it is, it will not operate correctly.
2605 # Sed substitution that helps us do robust quoting. It backslashifies
2606 # metacharacters that are still active within double-quoted strings.
2607 Xsed='sed -e 1s/^X//'
2608 sed_quote_subst='$sed_quote_subst'
2610 # The HP-UX ksh and POSIX shell print the target directory to stdout
2612 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
2614 relink_command=\"$relink_command\"
2616 # This environment variable determines our operation mode.
2617 if test \"\$libtool_install_magic\" = \"$magic\"; then
2618 # install mode needs the following variable:
2619 link_against_libtool_libs='$link_against_libtool_libs'
2621 # When we are sourced in execute mode, \$file and \$echo are already set.
2622 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2625 # Make sure echo works.
2626 if test \"X\$1\" = X--no-reexec; then
2627 # Discard the --no-reexec flag, and continue.
2629 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2630 # Yippee, \$echo works!
2633 # Restart under the correct shell, and then maybe \$echo will work.
2634 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2640 # Find the directory that this script lives in.
2641 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2642 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2644 # Follow symbolic links until we get to the real thisdir.
2645 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2646 while test -n \"\$file\"; do
2647 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2649 # If there was a directory component, then change thisdir.
2650 if test \"x\$destdir\" != \"x\$file\"; then
2651 case \"\$destdir\" in
2652 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
2653 *) thisdir=\"\$thisdir/\$destdir\" ;;
2657 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2658 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2661 # Try to get the absolute directory name.
2662 absdir=\`cd \"\$thisdir\" && pwd\`
2663 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2666 if test "$fast_install" = yes; then
2668 program=lt-'$outputname'
2669 progdir=\"\$thisdir/$objdir\"
2671 if test ! -f \"\$progdir/\$program\" || \\
2672 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2673 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2675 file=\"\$\$-\$program\"
2677 if test ! -d \"\$progdir\"; then
2678 $mkdir \"\$progdir\"
2680 $rm \"\$progdir/\$file\"
2685 # relink executable if necessary
2686 if test -n \"\$relink_command\"; then
2687 if (cd \"\$thisdir\" && eval \$relink_command); then :
2689 $rm \"\$progdir/\$file\"
2694 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2695 { $rm \"\$progdir/\$program\";
2696 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2697 $rm \"\$progdir/\$file\"
2701 program='$outputname'
2702 progdir=\"\$thisdir/$objdir\"
2708 if test -f \"\$progdir/\$program\"; then"
2710 # Export our shlibpath_var if we have one.
2711 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2713 # Add our own library path to $shlibpath_var
2714 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2716 # Some systems cannot cope with colon-terminated $shlibpath_var
2717 # The second colon is a workaround for a bug in BeOS R4 sed
2718 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2720 export $shlibpath_var
2724 # fixup the dll searchpath if we need to.
2725 if test -n "$dllsearchpath"; then
2727 # Add the dll search path components to the executable PATH
2728 PATH=$dllsearchpath:\$PATH
2733 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2734 # Run the actual program with our arguments.
2737 *-*-cygwin* | *-*-mingw | *-*-os2*)
2738 # win32 systems need to use the prog path for dll
2741 exec \$progdir\\\\\$program \${1+\"\$@\"}
2746 # Export the path to the program.
2747 PATH=\"\$progdir:\$PATH\"
2750 exec \$program \${1+\"\$@\"}
2755 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2759 # The program doesn't exist.
2760 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2761 \$echo \"This script is just a wrapper for \$program.\" 1>&2
2762 echo \"See the $PACKAGE documentation for more information.\" 1>&2
2773 # See if we need to build an old-fashioned archive.
2774 for oldlib in $oldlibs; do
2776 if test "$build_libtool_libs" = convenience; then
2777 oldobjs="$libobjs_save"
2778 addlibs="$convenience"
2779 build_libtool_libs=no
2781 if test "$build_libtool_libs" = module; then
2782 oldobjs="$libobjs_save"
2783 build_libtool_libs=no
2785 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2787 addlibs="$old_convenience"
2790 # Add in members from convenience archives.
2791 for xlib in $addlibs; do
2792 # Extract the objects.
2794 generated="$generated $xdir"
2795 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2797 $show "${rm}r $xdir"
2802 if test $status -ne 0 && test ! -d "$xdir"; then
2805 $show "(cd $xdir && $AR x ../$xlib)"
2806 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
2808 oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2811 # Do each command in the archive commands.
2812 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
2813 eval cmds=\"$old_archive_from_new_cmds\"
2815 eval cmds=\"$old_archive_cmds\"
2817 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2818 for cmd in $cmds; do
2821 $run eval "$cmd" || exit $?
2826 if test -n "$generated"; then
2827 $show "${rm}r$generated"
2828 $run ${rm}r$generated
2831 # Now create the libtool archive.
2835 test "$build_old_libs" = yes && old_library="$libname.$libext"
2836 $show "creating $output"
2838 if test -n "$xrpath"; then
2840 for libdir in $xrpath; do
2841 temp_xrpath="$temp_xrpath -R$libdir"
2843 dependency_libs="$temp_xrpath $dependency_libs"
2846 # Only create the output if not a dry run.
2847 if test -z "$run"; then
2849 # $output - a libtool library file
2850 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2852 # The name that we can dlopen(3).
2855 # Names of this library.
2856 library_names='$library_names'
2858 # The name of the static archive.
2859 old_library='$old_library'
2861 # Libraries that this one depends upon.
2862 dependency_libs='$dependency_libs'
2864 # Version information for $libname.
2869 # Is this an already installed library?
2872 # Directory that this library needs to be installed in:
2873 libdir='$install_libdir'\
2876 $rm "$output_objdir/$outputname"i
2877 sed 's/^installed=no$/installed=yes/' \
2878 < "$output" > "$output_objdir/$outputname"i || exit 1
2881 # Do a symbolic link so that the libtool archive can be found in
2882 # LD_LIBRARY_PATH before the program is installed.
2883 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
2884 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
2890 # libtool install mode
2892 modename="$modename: install"
2894 # There may be an optional sh(1) argument at the beginning of
2895 # install_prog (especially on Windows NT).
2896 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
2897 # Aesthetically quote it.
2898 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
2900 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2904 install_prog="$arg "
2912 # The real first argument should be the name of the installation program.
2913 # Aesthetically quote it.
2914 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2916 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2920 install_prog="$install_prog$arg"
2922 # We need to accept at least all the BSD install flags.
2932 if test -n "$dest"; then
2933 files="$files $dest"
2951 # If the previous option needed an argument, then skip it.
2952 if test -n "$prev"; then
2961 # Aesthetically quote the argument.
2962 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2964 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2968 install_prog="$install_prog $arg"
2971 if test -z "$install_prog"; then
2972 $echo "$modename: you must specify an install program" 1>&2
2977 if test -n "$prev"; then
2978 $echo "$modename: the \`$prev' option requires an argument" 1>&2
2983 if test -z "$files"; then
2984 if test -z "$dest"; then
2985 $echo "$modename: no file or destination specified" 1>&2
2987 $echo "$modename: you must specify a destination" 1>&2
2993 # Strip any trailing slash from the destination.
2994 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
2996 # Check to see that the destination is a directory.
2997 test -d "$dest" && isdir=yes
2998 if test "$isdir" = yes; then
3002 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3003 test "X$destdir" = "X$dest" && destdir=.
3004 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3006 # Not a directory, so check to see that there is only one file specified.
3008 if test $# -gt 2; then
3009 $echo "$modename: \`$dest' is not a directory" 1>&2
3015 /* | [A-Za-z]:[/\\]*) ;;
3017 for file in $files; do
3021 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3030 # This variable tells wrapper scripts just to set variables rather
3031 # than running their programs.
3032 libtool_install_magic="$magic"
3037 for file in $files; do
3039 # Do each installation.
3042 # Do the static libraries later.
3043 staticlibs="$staticlibs $file"
3047 # Check to see that this really is a libtool archive.
3048 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3050 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3057 # If there is no directory component, then add one.
3059 */* | *\\*) . $file ;;
3063 # Add the libdir to current_libdirs if it is the destination.
3064 if test "X$destdir" = "X$libdir"; then
3065 case "$current_libdirs " in
3067 *) current_libdirs="$current_libdirs $libdir" ;;
3070 # Note the libdir as a future libdir.
3071 case "$future_libdirs " in
3073 *) future_libdirs="$future_libdirs $libdir" ;;
3077 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3078 test "X$dir" = "X$file/" && dir=
3081 # See the names of the shared library.
3082 set dummy $library_names
3083 if test -n "$2"; then
3088 # Install the shared library and build the symlinks.
3089 $show "$install_prog $dir/$realname $destdir/$realname"
3090 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3091 test "X$dlname" = "X$realname" && dlname=
3093 if test $# -gt 0; then
3094 # Delete the old symlinks, and create new ones.
3097 test "X$dlname" = "X$linkname" && dlname=
3098 if test "$linkname" != "$realname"; then
3099 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3100 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3105 if test -n "$dlname"; then
3106 # Install the dynamically-loadable library.
3107 $show "$install_prog $dir/$dlname $destdir/$dlname"
3108 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
3111 # Do each command in the postinstall commands.
3112 lib="$destdir/$realname"
3113 eval cmds=\"$postinstall_cmds\"
3114 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3115 for cmd in $cmds; do
3118 $run eval "$cmd" || exit $?
3123 # Install the pseudo-library for information purposes.
3124 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3125 instname="$dir/$name"i
3126 if test ! -f "$instname"; then
3127 # Just in case it was removed...
3128 $show "Creating $instname"
3130 sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
3132 $show "$install_prog $instname $destdir/$name"
3133 $run eval "$install_prog $instname $destdir/$name" || exit $?
3135 # Maybe install the static library, too.
3136 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3140 # Install (i.e. copy) a libtool object.
3142 # Figure out destination file name, if it wasn't already specified.
3143 if test -n "$destname"; then
3144 destfile="$destdir/$destname"
3146 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3147 destfile="$destdir/$destfile"
3150 # Deduce the name of the destination old-style object file.
3153 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3156 staticdest="$destfile"
3160 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3166 # Install the libtool object if requested.
3167 if test -n "$destfile"; then
3168 $show "$install_prog $file $destfile"
3169 $run eval "$install_prog $file $destfile" || exit $?
3172 # Install the old object if enabled.
3173 if test "$build_old_libs" = yes; then
3174 # Deduce the name of the old-style object file.
3175 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3177 $show "$install_prog $staticobj $staticdest"
3178 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3184 # Figure out destination file name, if it wasn't already specified.
3185 if test -n "$destname"; then
3186 destfile="$destdir/$destname"
3188 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3189 destfile="$destdir/$destfile"
3192 # Do a test to see if this is really a libtool program.
3193 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3194 link_against_libtool_libs=
3197 # If there is no directory component, then add one.
3199 */* | *\\*) . $file ;;
3203 # Check the variables that should have been set.
3204 if test -z "$link_against_libtool_libs"; then
3205 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3210 for lib in $link_against_libtool_libs; do
3211 # Check to see that each library is installed.
3213 if test -f "$lib"; then
3214 # If there is no directory component, then add one.
3216 */* | *\\*) . $lib ;;
3220 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3221 if test -n "$libdir" && test ! -f "$libfile"; then
3222 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3228 if test "$fast_install" = no && test -n "$relink_command"; then
3229 if test "$finalize" = yes; then
3230 outputname="/tmp/$$-$file"
3231 # Replace the output file specification.
3232 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3234 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
3235 $show "$relink_command"
3236 if $run eval "$relink_command"; then :
3238 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3243 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
3246 # Install the binary that we compiled earlier.
3247 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3251 $show "$install_prog$stripme $file $destfile"
3252 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3253 test -n "$outputname" && $rm $outputname
3258 for file in $staticlibs; do
3259 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3261 # Set up the ranlib parameters.
3262 oldlib="$destdir/$name"
3264 $show "$install_prog $file $oldlib"
3265 $run eval "$install_prog \$file \$oldlib" || exit $?
3267 # Do each command in the postinstall commands.
3268 eval cmds=\"$old_postinstall_cmds\"
3269 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3270 for cmd in $cmds; do
3273 $run eval "$cmd" || exit $?
3278 if test -n "$future_libdirs"; then
3279 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3282 if test -n "$current_libdirs"; then
3283 # Maybe just do a dry run.
3284 test -n "$run" && current_libdirs=" -n$current_libdirs"
3285 exec $SHELL $0 --finish$current_libdirs
3292 # libtool finish mode
3294 modename="$modename: finish"
3298 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3301 libdirs="$libdirs $dir"
3304 for libdir in $libdirs; do
3305 if test -n "$finish_cmds"; then
3306 # Do each command in the finish commands.
3307 eval cmds=\"$finish_cmds\"
3308 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3309 for cmd in $cmds; do
3312 $run eval "$cmd" || admincmds="$admincmds
3317 if test -n "$finish_eval"; then
3318 # Do the single finish_eval.
3319 eval cmds=\"$finish_eval\"
3320 $run eval "$cmds" || admincmds="$admincmds
3326 # Exit here if they wanted silent mode.
3327 test "$show" = : && exit 0
3329 echo "----------------------------------------------------------------------"
3330 echo "Libraries have been installed in:"
3331 for libdir in $libdirs; do
3335 echo "If you ever happen to want to link against installed libraries"
3336 echo "in a given directory, LIBDIR, you must either use libtool, and"
3337 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3338 echo "flag during linking and do at least one of the following:"
3339 if test -n "$shlibpath_var"; then
3340 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3341 echo " during execution"
3343 if test -n "$runpath_var"; then
3344 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3345 echo " during linking"
3347 if test -n "$hardcode_libdir_flag_spec"; then
3349 eval flag=\"$hardcode_libdir_flag_spec\"
3351 echo " - use the \`$flag' linker flag"
3353 if test -n "$admincmds"; then
3354 echo " - have your system administrator run these commands:$admincmds"
3356 if test -f /etc/ld.so.conf; then
3357 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3360 echo "See any operating system documentation about shared libraries for"
3361 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3362 echo "----------------------------------------------------------------------"
3366 # libtool execute mode
3368 modename="$modename: execute"
3370 # The first argument is the command name.
3372 if test -z "$cmd"; then
3373 $echo "$modename: you must specify a COMMAND" 1>&2
3378 # Handle -dlopen flags immediately.
3379 for file in $execute_dlfiles; do
3380 if test ! -f "$file"; then
3381 $echo "$modename: \`$file' is not a file" 1>&2
3389 # Check to see that this really is a libtool archive.
3390 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3392 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3397 # Read the libtool library.
3401 # If there is no directory component, then add one.
3403 */* | *\\*) . $file ;;
3407 # Skip this library if it cannot be dlopened.
3408 if test -z "$dlname"; then
3409 # Warn if it was a shared library.
3410 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3414 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3415 test "X$dir" = "X$file" && dir=.
3417 if test -f "$dir/$objdir/$dlname"; then
3420 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3426 # Just add the directory containing the .lo file.
3427 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3428 test "X$dir" = "X$file" && dir=.
3432 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3437 # Get the absolute pathname.
3438 absdir=`cd "$dir" && pwd`
3439 test -n "$absdir" && dir="$absdir"
3441 # Now add the directory to shlibpath_var.
3442 if eval "test -z \"\$$shlibpath_var\""; then
3443 eval "$shlibpath_var=\"\$dir\""
3445 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3449 # This variable tells wrapper scripts just to set shlibpath_var
3450 # rather than running their programs.
3451 libtool_execute_magic="$magic"
3453 # Check if any of the arguments is a wrapper script.
3460 # Do a test to see if this is really a libtool program.
3461 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3462 # If there is no directory component, then add one.
3464 */* | *\\*) . $file ;;
3468 # Transform arg to wrapped name.
3469 file="$progdir/$program"
3473 # Quote arguments (to preserve shell metacharacters).
3474 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3475 args="$args \"$file\""
3478 if test -z "$run"; then
3479 # Export the shlibpath_var.
3480 eval "export $shlibpath_var"
3482 # Restore saved enviroment variables
3483 if test "${save_LC_ALL+set}" = set; then
3484 LC_ALL="$save_LC_ALL"; export LC_ALL
3486 if test "${save_LANG+set}" = set; then
3487 LANG="$save_LANG"; export LANG
3490 # Now actually exec the command.
3491 eval "exec \$cmd$args"
3493 $echo "$modename: cannot exec \$cmd$args"
3496 # Display what would be done.
3497 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3498 $echo "export $shlibpath_var"
3504 # libtool uninstall mode
3506 modename="$modename: uninstall"
3513 -*) rm="$rm $arg" ;;
3514 *) files="$files $arg" ;;
3518 if test -z "$rm"; then
3519 $echo "$modename: you must specify an RM program" 1>&2