* Makefile.in (PREPROCESSOR_DEFINES): New macro.
[official-gcc.git] / libffi / ltmain.sh
blob878787a3c1ef47556d2f60501ad992dfa8e3b3d9
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.
29 shift
30 elif test "X$1" = X--fallback-echo; then
31 # used as fallback echo
32 shift
33 cat <<EOF
35 EOF
36 exit 0
37 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
38 # Yippee, $echo works!
40 else
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%^.*/%%'`
47 modename="$progname"
49 # Constants.
50 PROGRAM=ltmain.sh
51 PACKAGE=libtool
52 VERSION=1.2f
53 TIMESTAMP=" (1.33 1999/04/26 16:28:53)"
55 default_mode=
56 help="Try \`$progname --help' for more information."
57 magic="%%%MAGIC variable%%%"
58 mkdir="mkdir"
59 mv="mv -f"
60 rm="rm -f"
62 # Sed substitution that helps us do robust quoting. It backslashifies
63 # metacharacters that are still active within double-quoted strings.
64 Xsed='sed -e 1s/^X//'
65 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
66 SP2NL='tr \040 \012'
67 NL2SP='tr \012 \040'
69 # NLS nuisances.
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
84 exit 1
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
90 exit 1
93 # Global variables.
94 mode=$default_mode
95 nonopt=
96 prev=
97 prevopt=
98 run=
99 show="$echo"
100 show_help=
101 execute_dlfiles=
102 lo2o="s/\\.lo\$/.${objext}/"
104 # Parse our command line options once, thoroughly.
105 while test $# -gt 0
107 arg="$1"
108 shift
110 case "$arg" in
111 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
112 *) optarg= ;;
113 esac
115 # If the previous option needs an argument, assign it.
116 if test -n "$prev"; then
117 case "$prev" in
118 execute_dlfiles)
119 eval "$prev=\"\$$prev \$arg\""
122 eval "$prev=\$arg"
124 esac
126 prev=
127 prevopt=
128 continue
131 # Have we seen a non-optional argument yet?
132 case "$arg" in
133 --help)
134 show_help=yes
137 --version)
138 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
139 exit 0
142 --config)
143 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
144 exit 0
147 --debug)
148 echo "$progname: enabling shell trace mode"
149 set -x
152 --dry-run | -n)
153 run=:
156 --features)
157 echo "host: $host"
158 if test "$build_libtool_libs" = yes; then
159 echo "enable shared libraries"
160 else
161 echo "disable shared libraries"
163 if test "$build_old_libs" = yes; then
164 echo "enable static libraries"
165 else
166 echo "disable static libraries"
168 exit 0
171 --finish) mode="finish" ;;
173 --mode) prevopt="--mode" prev=mode ;;
174 --mode=*) mode="$optarg" ;;
176 --quiet | --silent)
177 show=:
180 -dlopen)
181 prevopt="-dlopen"
182 prev=execute_dlfiles
186 $echo "$modename: unrecognized option \`$arg'" 1>&2
187 $echo "$help" 1>&2
188 exit 1
192 nonopt="$arg"
193 break
195 esac
196 done
198 if test -n "$prevopt"; then
199 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
200 $echo "$help" 1>&2
201 exit 1
204 if test -z "$show_help"; then
206 # Infer the operation mode.
207 if test -z "$mode"; then
208 case "$nonopt" in
209 *cc | *++ | gcc* | *-gcc*)
210 mode=link
211 for arg
213 case "$arg" in
215 mode=compile
216 break
218 esac
219 done
221 *db | *dbx | *strace | *truss)
222 mode=execute
224 *install*|cp|mv)
225 mode=install
227 *rm)
228 mode=uninstall
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
238 else
239 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
243 esac
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
249 $echo "$help" 1>&2
250 exit 1
253 # Change the help message to a mode-specific one.
254 generic_help="$help"
255 help="Try \`$modename --help --mode=$mode' for more information."
257 # These modes are in order of execution frequency so that they run quickly.
258 case "$mode" in
259 # libtool compile mode
260 compile)
261 modename="$modename: compile"
262 # Get the compilation command and the source file.
263 base_compile=
264 lastarg=
265 srcfile="$nonopt"
266 suppress_output=
268 user_target=no
269 for arg
271 # Accept any command-line options.
272 case "$arg" in
274 if test "$user_target" != "no"; then
275 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
276 exit 1
278 user_target=next
281 -static)
282 build_old_libs=yes
283 continue
285 esac
287 case "$user_target" in
288 next)
289 # The next one is the -o target name
290 user_target=yes
291 continue
293 yes)
294 # We got the output file
295 user_target=set
296 libobj="$arg"
297 continue
299 esac
301 # Accept the current argument as the source file.
302 lastarg="$srcfile"
303 srcfile="$arg"
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.
315 case "$lastarg" in
316 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
317 lastarg="\"$lastarg\""
319 esac
321 # Add the previous argument to base_compile.
322 if test -z "$base_compile"; then
323 base_compile="$lastarg"
324 else
325 base_compile="$base_compile $lastarg"
327 done
329 case "$user_target" in
330 set)
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
338 exit 1
340 esac
342 # Recognize several different file suffixes.
343 # If the user specifies -o file.o, it is replaced with file.lo
344 xform='[cCFSfmso]'
345 case "$libobj" in
346 *.ada) xform=ada ;;
347 *.adb) xform=adb ;;
348 *.ads) xform=ads ;;
349 *.asm) xform=asm ;;
350 *.c++) xform=c++ ;;
351 *.cc) xform=cc ;;
352 *.cpp) xform=cpp ;;
353 *.cxx) xform=cxx ;;
354 *.f90) xform=f90 ;;
355 *.for) xform=for ;;
356 esac
358 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
360 case "$libobj" in
361 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
363 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
364 exit 1
366 esac
368 if test -z "$base_compile"; then
369 $echo "$modename: you must specify a compilation command" 1>&2
370 $echo "$help" 1>&2
371 exit 1
374 # Delete any leftover library objects.
375 if test "$build_old_libs" = yes; then
376 removelist="$obj $libobj"
377 else
378 removelist="$libobj"
381 $run $rm $removelist
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
391 else
392 need_locks=no
393 lockfile=
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"
401 sleep 2
402 done
403 elif test "$need_locks" = warn; then
404 if test -f "$lockfile"; then
405 echo "\
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
414 compiler."
416 $run $rm $removelist
417 exit 1
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
434 lo_libobj="$libobj"
435 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
436 if test "X$dir" = "X$libobj"; then
437 dir="$objdir"
438 else
439 dir="$dir/$objdir"
441 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
443 if test -d "$dir"; then
444 $show "$rm $libobj"
445 $run $rm $libobj
446 else
447 $show "$mkdir $dir"
448 $run $mkdir $dir
449 status=$?
450 if test $status -ne 0 && test ! -d $dir; then
451 exit $status
455 if test "$compiler_o_lo" = yes; then
456 output_obj="$libobj"
457 command="$command -o $output_obj"
458 elif test "$compiler_c_o" = yes; then
459 output_obj="$obj"
460 command="$command -o $output_obj"
463 $show "$command"
464 if $run eval "$command"; then :
465 else
466 test -n "$output_obj" && $run $rm $removelist
467 exit 1
470 if test "$need_locks" = warn &&
471 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
472 echo "\
473 *** ERROR, $lockfile contains:
474 `cat $lockfile 2>/dev/null`
476 but it should contain:
477 $srcfile
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
484 compiler."
486 $run $rm $removelist
487 exit 1
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 :
494 else
495 error=$?
496 $run $rm $removelist
497 exit $error
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
505 $show $rm $obj
506 $run $rm $obj
509 $show "$mv $libobj $obj"
510 if $run $mv $libobj $obj; then :
511 else
512 error=$?
513 $run $rm $removelist
514 exit $error
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
520 exit 0
521 else
522 error=$?
523 $run $rm $removelist
524 exit $error
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"
537 output_obj="$obj"
540 # Suppress compiler output if we already did a PIC compilation.
541 command="$command$suppress_output"
542 $show "$command"
543 if $run eval "$command"; then :
544 else
545 $run $rm $removelist
546 exit 1
549 if test "$need_locks" = warn &&
550 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
551 echo "\
552 *** ERROR, $lockfile contains:
553 `cat $lockfile 2>/dev/null`
555 but it should contain:
556 $srcfile
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
563 compiler."
565 $run $rm $removelist
566 exit 1
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 :
573 else
574 error=$?
575 $run $rm $removelist
576 exit $error
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 $?
585 else
586 # Move the .lo from within objdir
587 $show "$mv $libobj $lo_libobj"
588 if $run $mv $libobj $lo_libobj; then :
589 else
590 error=$?
591 $run $rm $removelist
592 exit $error
597 # Unlock the critical section if it was locked
598 if test "$need_locks" != no; then
599 $rm "$lockfile"
602 exit 0
605 # libtool link mode
606 link)
607 modename="$modename: link"
608 C_compiler="$CC" # save it, to compile generated C sources
609 # CYGNUS LOCAL: tromey/java
610 # Always respect the CC configured in by ltconfig.
611 # CC="$nonopt"
612 # END CYGNUS LOCAL
613 case "$host" in
614 *-*-cygwin* | *-*-mingw* | *-*-os2*)
615 # It is impossible to link a dll without this setting, and
616 # we shouldn't force the makefile maintainer to figure out
617 # which system we are compiling for in order to pass an extra
618 # flag for every libtool invokation.
619 # allow_undefined=no
621 # FIXME: Unfortunately, there are problems with the above when trying
622 # to make a dll which has undefined symbols, in which case not
623 # even a static library is built. For now, we need to specify
624 # -no-undefined on the libtool link line when we can be certain
625 # that all symbols are satisfied, otherwise we get a static library.
626 allow_undefined=yes
628 # This is a source program that is used to create dlls on Windows
629 # Don't remove nor modify the starting and closing comments
630 # /* ltdll.c starts here */
631 # #define WIN32_LEAN_AND_MEAN
632 # #include <windows.h>
633 # #undef WIN32_LEAN_AND_MEAN
634 # #include <stdio.h>
636 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
638 # #include <cygwin/cygwin_dll.h>
639 # DECLARE_CYGWIN_DLL( DllMain );
640 # HINSTANCE __hDllInstance_base;
642 # BOOL APIENTRY
643 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
645 # __hDllInstance_base = hInst;
646 # return TRUE;
648 # /* ltdll.c ends here */
649 # This is a source program that is used to create import libraries
650 # on Windows for dlls which lack them. Don't remove nor modify the
651 # starting and closing comments
652 # /* impgen.c starts here */
653 # /* Copyright (C) 1999 Free Software Foundation, Inc.
655 # This file is part of GNU libtool.
657 # This program is free software; you can redistribute it and/or modify
658 # it under the terms of the GNU General Public License as published by
659 # the Free Software Foundation; either version 2 of the License, or
660 # (at your option) any later version.
662 # This program is distributed in the hope that it will be useful,
663 # but WITHOUT ANY WARRANTY; without even the implied warranty of
664 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
665 # GNU General Public License for more details.
667 # You should have received a copy of the GNU General Public License
668 # along with this program; if not, write to the Free Software
669 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
670 # */
672 # #include <stdio.h> /* for printf() */
673 # #include <unistd.h> /* for open(), lseek(), read() */
674 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
675 # #include <string.h> /* for strdup() */
677 # static unsigned int
678 # pe_get16 (fd, offset)
679 # int fd;
680 # int offset;
682 # unsigned char b[2];
683 # lseek (fd, offset, SEEK_SET);
684 # read (fd, b, 2);
685 # return b[0] + (b[1]<<8);
688 # static unsigned int
689 # pe_get32 (fd, offset)
690 # int fd;
691 # int offset;
693 # unsigned char b[4];
694 # lseek (fd, offset, SEEK_SET);
695 # read (fd, b, 4);
696 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
699 # static unsigned int
700 # pe_as32 (ptr)
701 # void *ptr;
703 # unsigned char *b = ptr;
704 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
707 # int
708 # main (argc, argv)
709 # int argc;
710 # char *argv[];
712 # int dll;
713 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
714 # unsigned long export_rva, export_size, nsections, secptr, expptr;
715 # unsigned long name_rvas, nexp;
716 # unsigned char *expdata, *erva;
717 # char *filename, *dll_name;
719 # filename = argv[1];
721 # dll = open(filename, O_RDONLY|O_BINARY);
722 # if (!dll)
723 # return 1;
725 # dll_name = filename;
727 # for (i=0; filename[i]; i++)
728 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
729 # dll_name = filename + i +1;
731 # pe_header_offset = pe_get32 (dll, 0x3c);
732 # opthdr_ofs = pe_header_offset + 4 + 20;
733 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
735 # if (num_entries < 1) /* no exports */
736 # return 1;
738 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
739 # export_size = pe_get32 (dll, opthdr_ofs + 100);
740 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
741 # secptr = (pe_header_offset + 4 + 20 +
742 # pe_get16 (dll, pe_header_offset + 4 + 16));
744 # expptr = 0;
745 # for (i = 0; i < nsections; i++)
747 # char sname[8];
748 # unsigned long secptr1 = secptr + 40 * i;
749 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
750 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
751 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
752 # lseek(dll, secptr1, SEEK_SET);
753 # read(dll, sname, 8);
754 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
756 # expptr = fptr + (export_rva - vaddr);
757 # if (export_rva + export_size > vaddr + vsize)
758 # export_size = vsize - (export_rva - vaddr);
759 # break;
763 # expdata = (unsigned char*)malloc(export_size);
764 # lseek (dll, expptr, SEEK_SET);
765 # read (dll, expdata, export_size);
766 # erva = expdata - export_rva;
768 # nexp = pe_as32 (expdata+24);
769 # name_rvas = pe_as32 (expdata+32);
771 # printf ("EXPORTS\n");
772 # for (i = 0; i<nexp; i++)
774 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
775 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
778 # return 0;
780 # /* impgen.c ends here */
783 allow_undefined=yes
785 esac
786 compile_command="$CC"
787 finalize_command="$CC"
789 compile_rpath=
790 finalize_rpath=
791 compile_shlibpath=
792 finalize_shlibpath=
793 convenience=
794 old_convenience=
795 deplibs=
796 linkopts=
798 if test -n "$shlibpath_var"; then
799 # get the directories listed in $shlibpath_var
800 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
801 else
802 lib_search_path=
804 # now prepend the system-specific ones
805 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
806 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
808 avoid_version=no
809 dlfiles=
810 dlprefiles=
811 dlself=no
812 export_dynamic=no
813 export_symbols=
814 export_symbols_regex=
815 generated=
816 libobjs=
817 link_against_libtool_libs=
818 ltlibs=
819 module=no
820 objs=
821 preload=no
822 prev=
823 prevarg=
824 release=
825 rpath=
826 xrpath=
827 perm_rpath=
828 temp_rpath=
829 thread_safe=no
830 vinfo=
832 # We need to know -static, to get the right output filenames.
833 for arg
835 case "$arg" in
836 -all-static | -static)
837 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
838 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
840 build_libtool_libs=no
841 build_old_libs=yes
842 break
844 esac
845 done
847 # See if our shared archives depend on static archives.
848 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
850 # Go through the arguments, transforming them on the way.
851 while test $# -gt 0; do
852 arg="$1"
853 shift
855 # If the previous option needs an argument, assign it.
856 if test -n "$prev"; then
857 case "$prev" in
858 output)
859 compile_command="$compile_command @OUTPUT@"
860 finalize_command="$finalize_command @OUTPUT@"
862 esac
864 case "$prev" in
865 dlfiles|dlprefiles)
866 if test "$preload" = no; then
867 # Add the symbol object into the linking commands.
868 compile_command="$compile_command @SYMFILE@"
869 finalize_command="$finalize_command @SYMFILE@"
870 preload=yes
872 case "$arg" in
873 *.la | *.lo) ;; # We handle these cases below.
874 self)
875 if test "$prev" = dlprefiles; then
876 dlself=yes
877 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
878 dlself=yes
880 prev=
881 continue
884 dlprefiles="$dlprefiles $arg"
885 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
886 prev=
888 esac
890 expsyms)
891 export_symbols="$arg"
892 if test ! -f "$arg"; then
893 $echo "$modename: symbol file \`$arg' does not exist"
894 exit 1
896 prev=
897 continue
899 expsyms_regex)
900 export_symbols_regex="$arg"
901 prev=
902 continue
904 release)
905 release="-$arg"
906 prev=
907 continue
909 rpath)
910 rpath="$rpath $arg"
911 prev=
912 continue
914 xrpath)
915 xrpath="$xrpath $arg"
916 prev=
917 continue
920 eval "$prev=\"\$arg\""
921 prev=
922 continue
924 esac
927 prevarg="$arg"
929 case "$arg" in
930 -all-static)
931 if test -n "$link_static_flag"; then
932 compile_command="$compile_command $link_static_flag"
933 finalize_command="$finalize_command $link_static_flag"
934 dlopen_self=$dlopen_self_static
936 continue
939 -allow-undefined)
940 # FIXME: remove this flag sometime in the future.
941 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
942 continue
945 -avoid-version)
946 avoid_version=yes
947 continue
950 -dlopen)
951 prev=dlfiles
952 continue
955 -dlpreopen)
956 prev=dlprefiles
957 continue
960 -export-dynamic)
961 if test "$export_dynamic" != yes; then
962 export_dynamic=yes
963 if test -n "$export_dynamic_flag_spec"; then
964 eval arg=\"$export_dynamic_flag_spec\"
965 else
966 arg=
971 -export-symbols | -export-symbols-regex)
972 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
973 $echo "$modename: cannot have more than one -exported-symbols"
974 exit 1
976 if test "$arg" = "-export-symbols"; then
977 prev=expsyms
978 else
979 prev=expsyms_regex
981 continue
984 -L*)
985 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
986 case "$dir" in
987 /* | [A-Za-z]:[/\\]*)
988 # Add the corresponding hardcode_libdir_flag, if it is not identical.
991 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
992 exit 1
994 esac
995 case " $deplibs " in
996 *" $arg "*) ;;
997 *) deplibs="$deplibs $arg";;
998 esac
999 case " $lib_search_path " in
1000 *" $dir "*) ;;
1001 *) lib_search_path="$lib_search_path $dir";;
1002 esac
1003 case "$host" in
1004 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1005 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1006 case ":$dllsearchpath:" in
1007 ::) dllsearchpath="$dllsearchdir";;
1008 *":$dllsearchdir:"*) ;;
1009 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1010 esac
1012 esac
1015 -l*)
1016 deplibs="$deplibs $arg"
1019 -module)
1020 if test "$module" != yes; then
1021 module=yes
1022 if test -n "$export_dynamic_flag_spec"; then
1023 eval arg=\"$export_dynamic_flag_spec\"
1024 else
1025 arg=
1030 -no-undefined)
1031 allow_undefined=no
1032 continue
1035 -o) prev=output ;;
1037 -release)
1038 prev=release
1039 continue
1042 -rpath)
1043 prev=rpath
1044 continue
1048 prev=xrpath
1049 continue
1052 -R*)
1053 xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'`
1054 continue
1057 -static)
1058 # If we have no pic_flag, then this is the same as -all-static.
1059 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1060 compile_command="$compile_command $link_static_flag"
1061 finalize_command="$finalize_command $link_static_flag"
1062 dlopen_self=$dlopen_self_static
1064 continue
1067 -thread-safe)
1068 thread_safe=yes
1069 continue
1072 -version-info)
1073 prev=vinfo
1074 continue
1077 # Some other compiler flag.
1078 -* | +*)
1079 # Unknown arguments in both finalize_command and compile_command need
1080 # to be aesthetically quoted because they are evaled later.
1081 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1082 case "$arg" in
1083 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1084 arg="\"$arg\""
1086 esac
1089 *.o | *.obj | *.a | *.lib)
1090 # A standard object.
1091 objs="$objs $arg"
1094 *.lo)
1095 # A library object.
1096 if test "$prev" = dlfiles; then
1097 dlfiles="$dlfiles $arg"
1098 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1099 prev=
1100 continue
1101 else
1102 # If libtool objects are unsupported, then we need to preload.
1103 prev=dlprefiles
1107 if test "$prev" = dlprefiles; then
1108 # Preload the old-style object.
1109 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1110 prev=
1112 libobjs="$libobjs $arg"
1115 *.la)
1116 # A libtool-controlled library.
1118 dlname=
1119 libdir=
1120 library_names=
1121 old_library=
1123 # Check to see that this really is a libtool archive.
1124 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1125 else
1126 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1127 exit 1
1130 # If the library was installed with an old release of libtool,
1131 # it will not redefine variable installed.
1132 installed=yes
1134 # If there is no directory component, then add one.
1135 case "$arg" in
1136 */* | *\\*) . $arg ;;
1137 *) . ./$arg ;;
1138 esac
1140 # Get the name of the library we link against.
1141 linklib=
1142 for l in $old_library $library_names; do
1143 linklib="$l"
1144 done
1146 if test -z "$linklib"; then
1147 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1148 exit 1
1151 # Find the relevant object directory and library name.
1152 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1154 if test "X$installed" = Xyes; then
1155 dir="$libdir"
1156 else
1157 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1158 if test "X$dir" = "X$arg"; then
1159 dir="$objdir"
1160 else
1161 dir="$dir/$objdir"
1165 if test -n "$dependency_libs"; then
1166 # Extract -R from dependency_libs
1167 temp_deplibs=
1168 for deplib in $dependency_libs; do
1169 case "$deplib" in
1170 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1171 case " $rpath $xrpath " in
1172 *" $temp_xrpath "*) ;;
1173 *) xrpath="$xrpath $temp_xrpath";;
1174 esac;;
1175 -L*) case "$compile_command $temp_deplibs " in
1176 *" $deplib "*) ;;
1177 *) temp_deplibs="$temp_deplibs $deplib";;
1178 esac;;
1179 *) temp_deplibs="$temp_deplibs $deplib";;
1180 esac
1181 done
1182 dependency_libs="$temp_deplibs"
1185 if test -z "$libdir"; then
1186 # It is a libtool convenience library, so add in its objects.
1187 convenience="$convenience $dir/$old_library"
1188 old_convenience="$old_convenience $dir/$old_library"
1189 deplibs="$deplibs$dependency_libs"
1190 compile_command="$compile_command $dir/$old_library$dependency_libs"
1191 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1192 continue
1195 # This library was specified with -dlopen.
1196 if test "$prev" = dlfiles; then
1197 dlfiles="$dlfiles $arg"
1198 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1199 # If there is no dlname, no dlopen support or we're linking statically,
1200 # we need to preload.
1201 prev=dlprefiles
1202 else
1203 # We should not create a dependency on this library, but we
1204 # may need any libraries it requires.
1205 compile_command="$compile_command$dependency_libs"
1206 finalize_command="$finalize_command$dependency_libs"
1207 prev=
1208 continue
1212 # The library was specified with -dlpreopen.
1213 if test "$prev" = dlprefiles; then
1214 # Prefer using a static library (so that no silly _DYNAMIC symbols
1215 # are required to link).
1216 if test -n "$old_library"; then
1217 dlprefiles="$dlprefiles $dir/$old_library"
1218 else
1219 dlprefiles="$dlprefiles $dir/$linklib"
1221 prev=
1224 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
1225 link_against_libtool_libs="$link_against_libtool_libs $arg"
1226 if test -n "$shlibpath_var"; then
1227 # Make sure the rpath contains only unique directories.
1228 case "$temp_rpath " in
1229 *" $dir "*) ;;
1230 *) temp_rpath="$temp_rpath $dir" ;;
1231 esac
1234 # We need an absolute path.
1235 case "$dir" in
1236 /* | [A-Za-z]:[/\\]*) absdir="$dir" ;;
1238 absdir=`cd "$dir" && pwd`
1239 if test -z "$absdir"; then
1240 $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
1241 exit 1
1244 esac
1246 # This is the magic to use -rpath.
1247 # Skip directories that are in the system default run-time
1248 # search path, unless they have been requested with -R.
1249 case " $sys_lib_dlsearch_path " in
1250 *" $absdir "*) ;;
1252 case "$compile_rpath " in
1253 *" $absdir "*) ;;
1254 *) compile_rpath="$compile_rpath $absdir"
1255 esac
1257 esac
1259 case " $sys_lib_dlsearch_path " in
1260 *" $libdir "*) ;;
1262 case "$finalize_rpath " in
1263 *" $libdir "*) ;;
1264 *) finalize_rpath="$finalize_rpath $libdir"
1265 esac
1267 esac
1269 lib_linked=yes
1270 case "$hardcode_action" in
1271 immediate | unsupported)
1272 if test "$hardcode_direct" = no; then
1273 compile_command="$compile_command $dir/$linklib"
1274 deplibs="$deplibs $dir/$linklib"
1275 case "$host" in
1276 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1277 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1278 if test -n "$dllsearchpath"; then
1279 dllsearchpath="$dllsearchpath:$dllsearchdir"
1280 else
1281 dllsearchpath="$dllsearchdir"
1284 esac
1285 elif test "$hardcode_minus_L" = no; then
1286 case "$host" in
1287 *-*-sunos*)
1288 compile_shlibpath="$compile_shlibpath$dir:"
1290 esac
1291 case "$compile_command " in
1292 *" -L$dir "*) ;;
1293 *) compile_command="$compile_command -L$dir";;
1294 esac
1295 compile_command="$compile_command -l$name"
1296 deplibs="$deplibs -L$dir -l$name"
1297 elif test "$hardcode_shlibpath_var" = no; then
1298 case ":$compile_shlibpath:" in
1299 *":$dir:"*) ;;
1300 *) compile_shlibpath="$compile_shlibpath$dir:";;
1301 esac
1302 compile_command="$compile_command -l$name"
1303 deplibs="$deplibs -l$name"
1304 else
1305 lib_linked=no
1309 relink)
1310 if test "$hardcode_direct" = yes; then
1311 compile_command="$compile_command $absdir/$linklib"
1312 deplibs="$deplibs $absdir/$linklib"
1313 elif test "$hardcode_minus_L" = yes; then
1314 case "$compile_command " in
1315 *" -L$absdir "*) ;;
1316 *) compile_command="$compile_command -L$absdir";;
1317 esac
1318 compile_command="$compile_command -l$name"
1319 deplibs="$deplibs -L$absdir -l$name"
1320 elif test "$hardcode_shlibpath_var" = yes; then
1321 case ":$compile_shlibpath:" in
1322 *":$absdir:"*) ;;
1323 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1324 esac
1325 compile_command="$compile_command -l$name"
1326 deplibs="$deplibs -l$name"
1327 else
1328 lib_linked=no
1333 lib_linked=no
1335 esac
1337 if test "$lib_linked" != yes; then
1338 $echo "$modename: configuration error: unsupported hardcode properties"
1339 exit 1
1342 # Finalize command for both is simple: just hardcode it.
1343 if test "$hardcode_direct" = yes; then
1344 finalize_command="$finalize_command $libdir/$linklib"
1345 elif test "$hardcode_minus_L" = yes; then
1346 case "$finalize_command " in
1347 *" -L$libdir "*) ;;
1348 *) finalize_command="$finalize_command -L$libdir";;
1349 esac
1350 finalize_command="$finalize_command -l$name"
1351 elif test "$hardcode_shlibpath_var" = yes; then
1352 case ":$finalize_shlibpath:" in
1353 *":$libdir:"*) ;;
1354 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1355 esac
1356 finalize_command="$finalize_command -l$name"
1357 else
1358 # We cannot seem to hardcode it, guess we'll fake it.
1359 case "$finalize_command " in
1360 *" -L$dir "*) ;;
1361 *) finalize_command="$finalize_command -L$libdir";;
1362 esac
1363 finalize_command="$finalize_command -l$name"
1365 else
1366 # Transform directly to old archives if we don't build new libraries.
1367 if test -n "$pic_flag" && test -z "$old_library"; then
1368 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1369 exit 1
1372 # Here we assume that one of hardcode_direct or hardcode_minus_L
1373 # is not unsupported. This is valid on all known static and
1374 # shared platforms.
1375 if test "$hardcode_direct" != unsupported; then
1376 test -n "$old_library" && linklib="$old_library"
1377 compile_command="$compile_command $dir/$linklib"
1378 finalize_command="$finalize_command $dir/$linklib"
1379 else
1380 case "$compile_command " in
1381 *" -L$dir "*) ;;
1382 *) compile_command="$compile_command -L$dir";;
1383 esac
1384 compile_command="$compile_command -l$name"
1385 case "$finalize_command " in
1386 *" -L$dir "*) ;;
1387 *) finalize_command="$finalize_command -L$dir";;
1388 esac
1389 finalize_command="$finalize_command -l$name"
1393 # Add in any libraries that this one depends upon.
1394 compile_command="$compile_command$dependency_libs"
1395 finalize_command="$finalize_command$dependency_libs"
1396 continue
1399 # Some other compiler argument.
1401 # Unknown arguments in both finalize_command and compile_command need
1402 # to be aesthetically quoted because they are evaled later.
1403 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1404 case "$arg" in
1405 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1406 arg="\"$arg\""
1408 esac
1410 esac
1412 # Now actually substitute the argument into the commands.
1413 if test -n "$arg"; then
1414 compile_command="$compile_command $arg"
1415 finalize_command="$finalize_command $arg"
1417 done
1419 if test -n "$prev"; then
1420 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1421 $echo "$help" 1>&2
1422 exit 1
1425 oldlibs=
1426 # calculate the name of the file, without its directory
1427 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1428 libobjs_save="$libobjs"
1430 case "$output" in
1432 $echo "$modename: you must specify an output file" 1>&2
1433 $echo "$help" 1>&2
1434 exit 1
1437 *.a | *.lib)
1438 if test -n "$link_against_libtool_libs"; then
1439 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1440 exit 1
1443 if test -n "$deplibs"; then
1444 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1447 if test -n "$dlfiles$dlprefiles"; then
1448 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1451 if test -n "$rpath"; then
1452 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1455 if test -n "$xrpath"; then
1456 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1459 if test -n "$vinfo"; then
1460 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1463 if test -n "$release"; then
1464 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1467 if test -n "$export_symbols"; then
1468 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1471 # Now set the variables for building old libraries.
1472 build_libtool_libs=no
1473 oldlibs="$output"
1476 *.la)
1477 # Make sure we only generate libraries of the form `libNAME.la'.
1478 case "$outputname" in
1479 lib*)
1480 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1481 eval libname=\"$libname_spec\"
1484 if test "$module" = no; then
1485 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1486 $echo "$help" 1>&2
1487 exit 1
1489 if test "$need_lib_prefix" != no; then
1490 # Add the "lib" prefix for modules if required
1491 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1492 eval libname=\"$libname_spec\"
1493 else
1494 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1497 esac
1499 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1500 if test "X$output_objdir" = "X$output"; then
1501 output_objdir="$objdir"
1502 else
1503 output_objdir="$output_objdir/$objdir"
1506 # All the library-specific variables (install_libdir is set above).
1507 library_names=
1508 old_library=
1509 dlname=
1511 if test -n "$objs"; then
1512 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1513 exit 1
1516 # How the heck are we supposed to write a wrapper for a shared library?
1517 if test -n "$link_against_libtool_libs"; then
1518 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1519 exit 1
1522 if test -n "$dlfiles$dlprefiles"; then
1523 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1526 set dummy $rpath
1527 if test $# -gt 2; then
1528 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1530 install_libdir="$2"
1532 oldlibs=
1533 if test -z "$rpath"; then
1534 if test "$build_libtool_libs" = yes; then
1535 # Building a libtool convenience library.
1536 libext=al
1537 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1538 build_libtool_libs=convenience
1539 build_old_libs=yes
1541 dependency_libs="$deplibs"
1543 if test -n "$vinfo"; then
1544 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1547 if test -n "$release"; then
1548 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1550 else
1552 # Parse the version information argument.
1553 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1554 set dummy $vinfo 0 0 0
1555 IFS="$save_ifs"
1557 if test -n "$8"; then
1558 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1559 $echo "$help" 1>&2
1560 exit 1
1563 current="$2"
1564 revision="$3"
1565 age="$4"
1567 # Check that each of the things are valid numbers.
1568 case "$current" in
1569 0 | [1-9] | [1-9][0-9]*) ;;
1571 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1572 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1573 exit 1
1575 esac
1577 case "$revision" in
1578 0 | [1-9] | [1-9][0-9]*) ;;
1580 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1581 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1582 exit 1
1584 esac
1586 case "$age" in
1587 0 | [1-9] | [1-9][0-9]*) ;;
1589 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1590 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1591 exit 1
1593 esac
1595 if test $age -gt $current; then
1596 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1597 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1598 exit 1
1601 # Calculate the version variables.
1602 major=
1603 versuffix=
1604 verstring=
1605 case "$version_type" in
1606 none) ;;
1608 irix)
1609 major=`expr $current - $age + 1`
1610 versuffix="$major.$revision"
1611 verstring="sgi$major.$revision"
1613 # Add in all the interfaces that we are compatible with.
1614 loop=$revision
1615 while test $loop != 0; do
1616 iface=`expr $revision - $loop`
1617 loop=`expr $loop - 1`
1618 verstring="sgi$major.$iface:$verstring"
1619 done
1622 linux)
1623 major=.`expr $current - $age`
1624 versuffix="$major.$age.$revision"
1627 osf)
1628 major=`expr $current - $age`
1629 versuffix=".$current.$age.$revision"
1630 verstring="$current.$age.$revision"
1632 # Add in all the interfaces that we are compatible with.
1633 loop=$age
1634 while test $loop != 0; do
1635 iface=`expr $current - $loop`
1636 loop=`expr $loop - 1`
1637 verstring="$verstring:${iface}.0"
1638 done
1640 # Make executables depend on our current version.
1641 verstring="$verstring:${current}.0"
1644 sunos)
1645 major=".$current"
1646 versuffix=".$current.$revision"
1649 freebsd-aout)
1650 major=".$current"
1651 versuffix=".$current.$revision";
1654 freebsd-elf)
1655 major=".$current"
1656 versuffix=".$current";
1659 windows)
1660 # Like Linux, but with '-' rather than '.', since we only
1661 # want one extension on Windows 95.
1662 major=`expr $current - $age`
1663 versuffix="-$major-$age-$revision"
1667 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1668 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1669 exit 1
1671 esac
1673 # Clear the version info if we defaulted, and they specified a release.
1674 if test -z "$vinfo" && test -n "$release"; then
1675 major=
1676 verstring="0.0"
1677 if test "$need_version" = no; then
1678 versuffix=
1679 else
1680 versuffix=".0.0"
1684 # Remove version info from name if versioning should be avoided
1685 if test "$avoid_version" = yes && test "$need_version" = no; then
1686 major=
1687 versuffix=
1688 verstring=""
1691 # Check to see if the archive will have undefined symbols.
1692 if test "$allow_undefined" = yes; then
1693 if test "$allow_undefined_flag" = unsupported; then
1694 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1695 build_libtool_libs=no
1696 build_old_libs=yes
1698 else
1699 # Don't allow undefined symbols.
1700 allow_undefined_flag="$no_undefined_flag"
1703 dependency_libs="$deplibs"
1704 case "$host" in
1705 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1706 # these systems don't actually have a c library (as such)!
1709 # Add libc to deplibs on all other systems.
1710 deplibs="$deplibs -lc"
1712 esac
1715 # Create the output directory, or remove our outputs if we need to.
1716 if test -d $output_objdir; then
1717 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1718 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1719 else
1720 $show "$mkdir $output_objdir"
1721 $run $mkdir $output_objdir
1722 status=$?
1723 if test $status -ne 0 && test ! -d $output_objdir; then
1724 exit $status
1728 # Now set the variables for building old libraries.
1729 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1730 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1732 # Transform .lo files to .o files.
1733 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1736 if test "$build_libtool_libs" = yes; then
1737 # Transform deplibs into only deplibs that can be linked in shared.
1738 name_save=$name
1739 libname_save=$libname
1740 release_save=$release
1741 versuffix_save=$versuffix
1742 major_save=$major
1743 # I'm not sure if I'm treating the release correctly. I think
1744 # release should show up in the -l (ie -lgmp5) so we don't want to
1745 # add it in twice. Is that correct?
1746 release=""
1747 versuffix=""
1748 major=""
1749 newdeplibs=
1750 droppeddeps=no
1751 case "$deplibs_check_method" in
1752 pass_all)
1753 newdeplibs=$deplibs
1754 ;; # Don't check for shared/static. Everything works.
1755 # This might be a little naive. We might want to check
1756 # whether the library exists or not. But this is on
1757 # osf3 & osf4 and I'm not really sure... Just
1758 # implementing what was already the behaviour.
1759 test_compile)
1760 # This code stresses the "libraries are programs" paradigm to its
1761 # limits. Maybe even breaks it. We compile a program, linking it
1762 # against the deplibs as a proxy for the library. Then we can check
1763 # whether they linked in statically or dynamically with ldd.
1764 $rm conftest.c
1765 cat > conftest.c <<EOF
1766 int main() { return 0; }
1768 $rm conftest
1769 $C_compiler -o conftest conftest.c $deplibs
1770 if test $? -eq 0 ; then
1771 ldd_output=`ldd conftest`
1772 for i in $deplibs; do
1773 name="`expr $i : '-l\(.*\)'`"
1774 # If $name is empty we are operating on a -L argument.
1775 if test "$name" != "" ; then
1776 libname=`eval \\$echo \"$libname_spec\"`
1777 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1778 set dummy $deplib_matches
1779 deplib_match=$2
1780 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1781 newdeplibs="$newdeplibs $i"
1782 else
1783 droppeddeps=yes
1784 echo
1785 echo "*** Warning: This library needs some functionality provided by $i."
1786 echo "*** I have the capability to make that library automatically link in when"
1787 echo "*** you link to this library. But I can only do this if you have a"
1788 echo "*** shared version of the library, which you do not appear to have."
1790 else
1791 newdeplibs="$newdeplibs $i"
1793 done
1794 else
1795 # Error occured in the first compile. Let's try to salvage the situation:
1796 # Compile a seperate program for each library.
1797 for i in $deplibs; do
1798 name="`expr $i : '-l\(.*\)'`"
1799 # If $name is empty we are operating on a -L argument.
1800 if test "$name" != "" ; then
1801 $rm conftest
1802 $C_compiler -o conftest conftest.c $i
1803 # Did it work?
1804 if test $? -eq 0 ; then
1805 ldd_output=`ldd conftest`
1806 libname=`eval \\$echo \"$libname_spec\"`
1807 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1808 set dummy $deplib_matches
1809 deplib_match=$2
1810 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1811 newdeplibs="$newdeplibs $i"
1812 else
1813 droppeddeps=yes
1814 echo
1815 echo "*** Warning: This library needs some functionality provided by $i."
1816 echo "*** I have the capability to make that library automatically link in when"
1817 echo "*** you link to this library. But I can only do this if you have a"
1818 echo "*** shared version of the library, which you do not appear to have."
1820 else
1821 droppeddeps=yes
1822 echo
1823 echo "*** Warning! Library $i is needed by this library but I was not able to"
1824 echo "*** make it link in! You will probably need to install it or some"
1825 echo "*** library that it depends on before this library will be fully"
1826 echo "*** functional. Installing it before continuing would be even better."
1828 else
1829 newdeplibs="$newdeplibs $i"
1831 done
1833 deplibs=$newdeplibs
1835 file_magic*)
1836 set dummy $deplibs_check_method
1837 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1838 for a_deplib in $deplibs; do
1839 name="`expr $a_deplib : '-l\(.*\)'`"
1840 # If $name is empty we are operating on a -L argument.
1841 if test "$name" != "" ; then
1842 libname=`eval \\$echo \"$libname_spec\"`
1843 for i in $lib_search_path; do
1844 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1845 for potent_lib in $potential_libs; do
1846 # Follow soft links.
1847 if ls -lLd "$potlib" 2>/dev/null \
1848 | grep " -> " >/dev/null; then
1849 continue
1851 # The statement above tries to avoid entering an
1852 # endless loop below, in case of cyclic links.
1853 # We might still enter an endless loop, since a link
1854 # loop can be closed while we follow links,
1855 # but so what?
1856 potlib="$potent_lib"
1857 while test -h "$potlib" 2>/dev/null; do
1858 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1859 case "$potliblink" in
1860 /*) potlib="$potliblink";;
1861 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1862 esac
1863 done
1864 if eval $file_magic_cmd \"\$potlib\" \
1865 | sed 10q \
1866 | egrep "$file_magic_regex" > /dev/null; then
1867 newdeplibs="$newdeplibs $a_deplib"
1868 a_deplib=""
1869 break 2
1871 done
1872 done
1873 if test -n "$a_deplib" ; then
1874 droppeddeps=yes
1875 echo
1876 echo "*** Warning: This library needs some functionality provided by $a_deplib."
1877 echo "*** I have the capability to make that library automatically link in when"
1878 echo "*** you link to this library. But I can only do this if you have a"
1879 echo "*** shared version of the library, which you do not appear to have."
1881 else
1882 # Add a -L argument.
1883 newdeplibs="$newdeplibs $a_deplib"
1885 done # Gone through all deplibs.
1887 none | unknown | *) newdeplibs=""
1888 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
1889 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
1890 grep . >/dev/null; then
1891 echo
1892 if test "X$deplibs_check_method" = "Xnone"; then
1893 echo "*** Warning: inter-library dependencies are not supported in this platform."
1894 else
1895 echo "*** Warning: inter-library dependencies are not known to be supported."
1897 echo "*** All declared inter-library dependencies are being dropped."
1898 droppeddeps=yes
1901 esac
1902 versuffix=$versuffix_save
1903 major=$major_save
1904 release=$release_save
1905 libname=$libname_save
1906 name=$name_save
1908 if test "$droppeddeps" = yes; then
1909 if test "$module" = yes; then
1910 echo
1911 echo "*** Warning: libtool could not satisfy all declared inter-library"
1912 echo "*** dependencies of module $libname. Therefore, libtool will create"
1913 echo "*** a static module, that should work as long as the dlopening"
1914 echo "*** application is linked with the -dlopen flag."
1915 if test -z "$global_symbol_pipe"; then
1916 echo
1917 echo "*** However, this would only work if libtool was able to extract symbol"
1918 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1919 echo "*** not find such a program. So, this module is probably useless."
1920 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1922 if test "$build_old_libs" = no; then
1923 oldlibs="$output_objdir/$libname.$libext"
1924 build_libtool_libs=module
1925 build_old_libs=yes
1926 else
1927 build_libtool_libs=no
1929 dlname=
1930 library_names=
1931 else
1932 echo "*** The inter-library dependencies that have been dropped here will be"
1933 echo "*** automatically added whenever a program is linked with this library"
1934 echo "*** or is declared to -dlopen it."
1939 # test again, we may have decided not to build it any more
1940 if test "$build_libtool_libs" = yes; then
1941 deplibs=$newdeplibs
1942 # Done checking deplibs!
1944 # Get the real and link names of the library.
1945 eval library_names=\"$library_names_spec\"
1946 set dummy $library_names
1947 realname="$2"
1948 shift; shift
1950 if test -n "$soname_spec"; then
1951 eval soname=\"$soname_spec\"
1952 else
1953 soname="$realname"
1956 lib="$output_objdir/$realname"
1957 for link
1959 linknames="$linknames $link"
1960 done
1962 # Ensure that we have .o objects for linkers which dislike .lo
1963 # (e.g. aix) incase we are running --disable-static
1964 for obj in $libobjs; do
1965 oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
1966 test -f $oldobj || ${LN_S} $obj $oldobj
1967 done
1969 # Use standard objects if they are pic
1970 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1972 if test -n "$whole_archive_flag_spec"; then
1973 if test -n "$convenience"; then
1974 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1976 else
1977 for xlib in $convenience; do
1978 # Extract the objects.
1979 xdir="$xlib"x
1980 generated="$generated $xdir"
1981 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
1983 $show "${rm}r $xdir"
1984 $run ${rm}r "$xdir"
1985 $show "mkdir $xdir"
1986 $run mkdir "$xdir"
1987 status=$?
1988 if test $status -ne 0 && test ! -d "$xdir"; then
1989 exit $status
1991 $show "(cd $xdir && $AR x ../$xlib)"
1992 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1994 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
1995 done
1998 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
1999 eval flag=\"$thread_safe_flag_spec\"
2001 linkopts="$linkopts $flag"
2004 # Prepare the list of exported symbols
2005 if test -z "$export_symbols"; then
2006 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2007 $show "generating symbol list for \`$libname.la'"
2008 export_symbols="$objdir/$libname.exp"
2009 $run $rm $export_symbols
2010 eval cmds=\"$export_symbols_cmds\"
2011 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2012 for cmd in $cmds; do
2013 IFS="$save_ifs"
2014 $show "$cmd"
2015 $run eval "$cmd" || exit $?
2016 done
2017 IFS="$save_ifs"
2018 if test -n "$export_symbols_regex"; then
2019 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2020 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2021 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2022 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2027 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2028 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2031 # Do each of the archive commands.
2032 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2033 eval cmds=\"$archive_expsym_cmds\"
2034 else
2035 eval cmds=\"$archive_cmds\"
2037 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2038 for cmd in $cmds; do
2039 IFS="$save_ifs"
2040 $show "$cmd"
2041 $run eval "$cmd" || exit $?
2042 done
2043 IFS="$save_ifs"
2045 # Create links to the real library.
2046 for linkname in $linknames; do
2047 if test "$realname" != "$linkname"; then
2048 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2049 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2051 done
2053 # If -module or -export-dynamic was specified, set the dlname.
2054 if test "$module" = yes || test "$export_dynamic" = yes; then
2055 # On all known operating systems, these are identical.
2056 dlname="$soname"
2061 *.lo | *.o | *.obj)
2062 if test -n "$link_against_libtool_libs"; then
2063 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2064 exit 1
2067 if test -n "$deplibs"; then
2068 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2071 if test -n "$dlfiles$dlprefiles"; then
2072 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2075 if test -n "$rpath"; then
2076 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2079 if test -n "$xrpath"; then
2080 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2083 if test -n "$vinfo"; then
2084 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2087 if test -n "$release"; then
2088 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2091 case "$output" in
2092 *.lo)
2093 if test -n "$objs"; then
2094 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2095 exit 1
2097 libobj="$output"
2098 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2101 libobj=
2102 obj="$output"
2104 esac
2106 # Delete the old objects.
2107 $run $rm $obj $libobj
2109 # Create the old-style object.
2110 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2112 output="$obj"
2113 eval cmds=\"$reload_cmds\"
2114 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2115 for cmd in $cmds; do
2116 IFS="$save_ifs"
2117 $show "$cmd"
2118 $run eval "$cmd" || exit $?
2119 done
2120 IFS="$save_ifs"
2122 # Exit if we aren't doing a library object file.
2123 test -z "$libobj" && exit 0
2125 if test "$build_libtool_libs" != yes; then
2126 # Create an invalid libtool object if no PIC, so that we don't
2127 # accidentally link it into a program.
2128 $show "echo timestamp > $libobj"
2129 $run eval "echo timestamp > $libobj" || exit $?
2130 exit 0
2133 if test -n "$pic_flag"; then
2134 # Only do commands if we really have different PIC objects.
2135 reload_objs="$libobjs"
2136 output="$libobj"
2137 eval cmds=\"$reload_cmds\"
2138 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2139 for cmd in $cmds; do
2140 IFS="$save_ifs"
2141 $show "$cmd"
2142 $run eval "$cmd" || exit $?
2143 done
2144 IFS="$save_ifs"
2145 else
2146 # Just create a symlink.
2147 $show $rm $libobj
2148 $run $rm $libobj
2149 $show "$LN_S $obj $libobj"
2150 $run $LN_S $obj $libobj || exit $?
2153 exit 0
2156 # Anything else should be a program.
2158 if test -n "$vinfo"; then
2159 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2162 if test -n "$release"; then
2163 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2166 if test "$preload" = yes; then
2167 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2168 test "$dlopen_self_static" = unknown; then
2169 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2173 if test "$dlself" = yes && test "$export_dynamic" = no; then
2174 $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
2175 exit 1
2178 if test -n "$rpath$xrpath"; then
2179 # If the user specified any rpath flags, then add them.
2180 for libdir in $rpath $xrpath; do
2181 # This is the magic to use -rpath.
2182 case "$compile_rpath " in
2183 *" $libdir "*) ;;
2184 *) compile_rpath="$compile_rpath $libdir" ;;
2185 esac
2186 case "$finalize_rpath " in
2187 *" $libdir "*) ;;
2188 *) finalize_rpath="$finalize_rpath $libdir" ;;
2189 esac
2190 done
2193 # Now hardcode the library paths
2194 rpath=
2195 hardcode_libdirs=
2196 for libdir in $compile_rpath $finalize_rpath; do
2197 if test -n "$hardcode_libdir_flag_spec"; then
2198 if test -n "$hardcode_libdir_separator"; then
2199 if test -z "$hardcode_libdirs"; then
2200 hardcode_libdirs="$libdir"
2201 else
2202 # Just accumulate the unique libdirs.
2203 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2204 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2207 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2209 esac
2211 else
2212 eval flag=\"$hardcode_libdir_flag_spec\"
2214 rpath="$rpath $flag"
2216 elif test -n "$runpath_var"; then
2217 case "$perm_rpath " in
2218 *" $libdir "*) ;;
2219 *) perm_rpath="$perm_rpath $libdir" ;;
2220 esac
2222 done
2223 # Substitute the hardcoded libdirs into the rpath.
2224 if test -n "$hardcode_libdir_separator" &&
2225 test -n "$hardcode_libdirs"; then
2226 libdir="$hardcode_libdirs"
2227 eval rpath=\" $hardcode_libdir_flag_spec\"
2229 compile_rpath="$rpath"
2231 rpath=
2232 hardcode_libdirs=
2233 for libdir in $finalize_rpath; do
2234 if test -n "$hardcode_libdir_flag_spec"; then
2235 if test -n "$hardcode_libdir_separator"; then
2236 if test -z "$hardcode_libdirs"; then
2237 hardcode_libdirs="$libdir"
2238 else
2239 # Just accumulate the unique libdirs.
2240 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2241 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2244 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2246 esac
2248 else
2249 eval flag=\"$hardcode_libdir_flag_spec\"
2251 rpath="$rpath $flag"
2253 elif test -n "$runpath_var"; then
2254 case "$finalize_perm_rpath " in
2255 *" $libdir "*) ;;
2256 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2257 esac
2259 done
2260 # Substitute the hardcoded libdirs into the rpath.
2261 if test -n "$hardcode_libdir_separator" &&
2262 test -n "$hardcode_libdirs"; then
2263 libdir="$hardcode_libdirs"
2264 eval rpath=\" $hardcode_libdir_flag_spec\"
2266 finalize_rpath="$rpath"
2268 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2269 if test "X$output_objdir" = "X$output"; then
2270 output_objdir="$objdir"
2271 else
2272 output_objdir="$output_objdir/$objdir"
2275 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2276 # Transform all the library objects into standard objects.
2277 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2278 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2281 dlsyms=
2282 if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
2283 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2284 dlsyms="${outputname}S.c"
2285 else
2286 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2290 if test -n "$dlsyms"; then
2291 case "$dlsyms" in
2292 "") ;;
2293 *.c)
2294 # Discover the nlist of each of the dlfiles.
2295 nlist="$objdir/${output}.nm"
2297 if test -d $objdir; then
2298 $show "$rm $nlist ${nlist}S ${nlist}T"
2299 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2300 else
2301 $show "$mkdir $objdir"
2302 $run $mkdir $objdir
2303 status=$?
2304 if test $status -ne 0 && test ! -d $objdir; then
2305 exit $status
2309 # Parse the name list into a source file.
2310 $show "creating $objdir/$dlsyms"
2312 $echo > "$objdir/$dlsyms" "\
2313 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2314 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2316 #ifdef __cplusplus
2317 extern \"C\" {
2318 #endif
2320 /* Prevent the only kind of declaration conflicts we can make. */
2321 #define lt_preloaded_symbols some_other_symbol
2323 /* External symbol declarations for the compiler. */\
2326 if test "$dlself" = yes; then
2327 $show "generating symbol list for \`$output'"
2329 echo ': @PROGRAM@ ' > "$nlist"
2331 # Add our own program objects to the symbol list.
2332 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2333 for arg in $progfiles; do
2334 $show "extracting global C symbols from \`$arg'"
2335 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2336 done
2338 if test -n "$exclude_expsyms"; then
2339 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2340 $run eval '$mv "$nlist"T "$nlist"'
2343 if test -n "$export_symbols_regex"; then
2344 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2345 $run eval '$mv "$nlist"T "$nlist"'
2348 # Prepare the list of exported symbols
2349 if test -z "$export_symbols"; then
2350 export_symbols="$objdir/$output.exp"
2351 $run $rm $export_symbols
2352 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2353 else
2354 $run $rm $export_symbols
2355 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
2356 $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
2357 $run eval 'mv "$nlist"T "$nlist"'
2361 for arg in $dlprefiles; do
2362 $show "extracting global C symbols from \`$arg'"
2363 name=`echo "$arg" | sed -e 's%^.*/%%'`
2364 $run eval 'echo ": $name " >> "$nlist"'
2365 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2366 done
2368 if test -z "$run"; then
2369 # Make sure we have at least an empty file.
2370 test -f "$nlist" || : > "$nlist"
2372 if test -n "$exclude_expsyms"; then
2373 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2374 $mv "$nlist"T "$nlist"
2377 # Try sorting and uniquifying the output.
2378 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2380 else
2381 grep -v "^: " < "$nlist" > "$nlist"S
2384 if test -f "$nlist"S; then
2385 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2386 else
2387 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2390 $echo >> "$output_objdir/$dlsyms" "\
2392 #undef lt_preloaded_symbols
2394 #if defined (__STDC__) && __STDC__
2395 # define lt_ptr_t void *
2396 #else
2397 # define lt_ptr_t char *
2398 # define const
2399 #endif
2401 /* The mapping between symbol names and symbols. */
2402 const struct {
2403 const char *name;
2404 lt_ptr_t address;
2406 lt_preloaded_symbols[] =
2410 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2411 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2412 < "$nlist" >> "$output_objdir/$dlsyms"
2414 $echo >> "$output_objdir/$dlsyms" "\
2415 {0, (lt_ptr_t) 0}
2418 /* This works around a problem in FreeBSD linker */
2419 #ifdef FREEBSD_WORKAROUND
2420 static const void *lt_preloaded_setup() {
2421 return lt_preloaded_symbols;
2423 #endif
2425 #ifdef __cplusplus
2427 #endif\
2431 pic_flag_for_symtable=
2432 case "$host" in
2433 # compiling the symbol table file with pic_flag works around
2434 # a FreeBSD bug that causes programs to crash when -lm is
2435 # linked before any other PIC object. But we must not use
2436 # pic_flag when linking with -static. The problem exists in
2437 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2438 *-*-freebsd2*|*-*-freebsd3.0*)
2439 case "$compile_command " in
2440 *" -static "*) ;;
2441 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2442 esac
2443 esac
2445 # Now compile the dynamic symbol file.
2446 $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2447 $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2449 # Transform the symbol file into the correct name.
2450 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2451 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2454 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2455 exit 1
2457 esac
2458 else
2459 # We keep going just in case the user didn't refer to
2460 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2461 # really was required.
2463 # Nullify the symbol file.
2464 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2465 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2468 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2469 # Replace the output file specification.
2470 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2471 link_command="$compile_command$compile_rpath"
2473 # We have no uninstalled library dependencies, so finalize right now.
2474 $show "$link_command"
2475 $run eval "$link_command"
2476 exit $?
2479 if test -n "$shlibpath_var"; then
2480 # We should set the shlibpath_var
2481 rpath=
2482 for dir in $temp_rpath; do
2483 case "$dir" in
2484 /* | [A-Za-z]:[/\\]*)
2485 # Absolute path.
2486 rpath="$rpath$dir:"
2489 # Relative path: add a thisdir entry.
2490 rpath="$rpath\$thisdir/$dir:"
2492 esac
2493 done
2494 temp_rpath="$rpath"
2497 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2498 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2500 if test -n "$finalize_shlibpath"; then
2501 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2504 compile_var=
2505 finalize_var=
2506 if test -n "$runpath_var"; then
2507 if test -n "$perm_rpath"; then
2508 # We should set the runpath_var.
2509 rpath=
2510 for dir in $perm_rpath; do
2511 rpath="$rpath$dir:"
2512 done
2513 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2515 if test -n "$finalize_perm_rpath"; then
2516 # We should set the runpath_var.
2517 rpath=
2518 for dir in $finalize_perm_rpath; do
2519 rpath="$rpath$dir:"
2520 done
2521 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2525 if test "$hardcode_action" = relink; then
2526 # Fast installation is not supported
2527 link_command="$compile_var$compile_command$compile_rpath"
2528 relink_command="$finalize_var$finalize_command$finalize_rpath"
2530 # AGH! Flame the AIX and HP-UX people for me, will ya?
2531 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2532 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2533 else
2534 if test "$fast_install" != no; then
2535 link_command="$finalize_var$compile_command$finalize_rpath"
2536 if test "$fast_install" = yes; then
2537 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2538 else
2539 # fast_install is set to needless
2540 relink_command=
2542 else
2543 link_command="$compile_var$compile_command$compile_rpath"
2544 relink_command="$finalize_var$finalize_command$finalize_rpath"
2548 # Replace the output file specification.
2549 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2551 # Create the binary in the object directory, then wrap it.
2552 if test ! -d $output_objdir; then
2553 $show "$mkdir $output_objdir"
2554 $run $mkdir $output_objdir
2555 status=$?
2556 if test $status -ne 0 && test ! -d $objdir; then
2557 exit $status
2561 # Delete the old output file.
2562 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2564 $show "$link_command"
2565 $run eval "$link_command" || exit $?
2567 # Now create the wrapper script.
2568 $show "creating $output"
2570 # Quote the relink command for shipping.
2571 if test -n "$relink_command"; then
2572 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2575 # Quote $echo for shipping.
2576 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2577 case "$0" in
2578 /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
2579 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2580 esac
2581 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2582 else
2583 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2586 # Only actually do things if our run command is non-null.
2587 if test -z "$run"; then
2588 # win32 will think the script is a binary if it has
2589 # a .exe suffix, so we strip it off here.
2590 case $output in
2591 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2592 esac
2593 $rm $output
2594 trap "$rm $output; exit 1" 1 2 15
2596 $echo > $output "\
2597 #! $SHELL
2599 # $output - temporary wrapper script for $objdir/$outputname
2600 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2602 # The $output program cannot be directly executed until all the libtool
2603 # libraries that it depends on are installed.
2605 # This wrapper script should never be moved out of the build directory.
2606 # If it is, it will not operate correctly.
2608 # Sed substitution that helps us do robust quoting. It backslashifies
2609 # metacharacters that are still active within double-quoted strings.
2610 Xsed='sed -e 1s/^X//'
2611 sed_quote_subst='$sed_quote_subst'
2613 # The HP-UX ksh and POSIX shell print the target directory to stdout
2614 # if CDPATH is set.
2615 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
2617 relink_command=\"$relink_command\"
2619 # This environment variable determines our operation mode.
2620 if test \"\$libtool_install_magic\" = \"$magic\"; then
2621 # install mode needs the following variable:
2622 link_against_libtool_libs='$link_against_libtool_libs'
2623 else
2624 # When we are sourced in execute mode, \$file and \$echo are already set.
2625 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2626 echo=\"$qecho\"
2627 file=\"\$0\"
2628 # Make sure echo works.
2629 if test \"X\$1\" = X--no-reexec; then
2630 # Discard the --no-reexec flag, and continue.
2631 shift
2632 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2633 # Yippee, \$echo works!
2635 else
2636 # Restart under the correct shell, and then maybe \$echo will work.
2637 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2641 $echo >> $output "\
2643 # Find the directory that this script lives in.
2644 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2645 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2647 # Follow symbolic links until we get to the real thisdir.
2648 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2649 while test -n \"\$file\"; do
2650 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2652 # If there was a directory component, then change thisdir.
2653 if test \"x\$destdir\" != \"x\$file\"; then
2654 case \"\$destdir\" in
2655 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
2656 *) thisdir=\"\$thisdir/\$destdir\" ;;
2657 esac
2660 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2661 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2662 done
2664 # Try to get the absolute directory name.
2665 absdir=\`cd \"\$thisdir\" && pwd\`
2666 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2669 if test "$fast_install" = yes; then
2670 echo >> $output "\
2671 program=lt-'$outputname'
2672 progdir=\"\$thisdir/$objdir\"
2674 if test ! -f \"\$progdir/\$program\" || \\
2675 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2676 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2678 file=\"\$\$-\$program\"
2680 if test ! -d \"\$progdir\"; then
2681 $mkdir \"\$progdir\"
2682 else
2683 $rm \"\$progdir/\$file\"
2686 echo >> $output "\
2688 # relink executable if necessary
2689 if test -n \"\$relink_command\"; then
2690 if (cd \"\$thisdir\" && eval \$relink_command); then :
2691 else
2692 $rm \"\$progdir/\$file\"
2693 exit 1
2697 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2698 { $rm \"\$progdir/\$program\";
2699 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2700 $rm \"\$progdir/\$file\"
2702 else
2703 echo >> $output "\
2704 program='$outputname'
2705 progdir=\"\$thisdir/$objdir\"
2709 echo >> $output "\
2711 if test -f \"\$progdir/\$program\"; then"
2713 # Export our shlibpath_var if we have one.
2714 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2715 $echo >> $output "\
2716 # Add our own library path to $shlibpath_var
2717 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2719 # Some systems cannot cope with colon-terminated $shlibpath_var
2720 # The second colon is a workaround for a bug in BeOS R4 sed
2721 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2723 export $shlibpath_var
2727 # fixup the dll searchpath if we need to.
2728 if test -n "$dllsearchpath"; then
2729 $echo >> $output "\
2730 # Add the dll search path components to the executable PATH
2731 PATH=$dllsearchpath:\$PATH
2735 $echo >> $output "\
2736 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2737 # Run the actual program with our arguments.
2739 case $host in
2740 *-*-cygwin* | *-*-mingw | *-*-os2*)
2741 # win32 systems need to use the prog path for dll
2742 # lookup to work
2743 $echo >> $output "\
2744 exec \$progdir\\\\\$program \${1+\"\$@\"}
2748 $echo >> $output "\
2749 # Export the path to the program.
2750 PATH=\"\$progdir:\$PATH\"
2751 export PATH
2753 exec \$program \${1+\"\$@\"}
2756 esac
2757 $echo >> $output "\
2758 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2759 exit 1
2761 else
2762 # The program doesn't exist.
2763 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2764 \$echo \"This script is just a wrapper for \$program.\" 1>&2
2765 echo \"See the $PACKAGE documentation for more information.\" 1>&2
2766 exit 1
2770 chmod +x $output
2772 exit 0
2774 esac
2776 # See if we need to build an old-fashioned archive.
2777 for oldlib in $oldlibs; do
2779 if test "$build_libtool_libs" = convenience; then
2780 oldobjs="$libobjs_save"
2781 addlibs="$convenience"
2782 build_libtool_libs=no
2783 else
2784 if test "$build_libtool_libs" = module; then
2785 oldobjs="$libobjs_save"
2786 build_libtool_libs=no
2787 else
2788 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2790 addlibs="$old_convenience"
2793 # Add in members from convenience archives.
2794 for xlib in $addlibs; do
2795 # Extract the objects.
2796 xdir="$xlib"x
2797 generated="$generated $xdir"
2798 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2800 $show "${rm}r $xdir"
2801 $run ${rm}r "$xdir"
2802 $show "mkdir $xdir"
2803 $run mkdir "$xdir"
2804 status=$?
2805 if test $status -ne 0 && test ! -d "$xdir"; then
2806 exit $status
2808 $show "(cd $xdir && $AR x ../$xlib)"
2809 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
2811 oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2812 done
2814 # Do each command in the archive commands.
2815 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
2816 eval cmds=\"$old_archive_from_new_cmds\"
2817 else
2818 eval cmds=\"$old_archive_cmds\"
2820 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2821 for cmd in $cmds; do
2822 IFS="$save_ifs"
2823 $show "$cmd"
2824 $run eval "$cmd" || exit $?
2825 done
2826 IFS="$save_ifs"
2827 done
2829 if test -n "$generated"; then
2830 $show "${rm}r$generated"
2831 $run ${rm}r$generated
2834 # Now create the libtool archive.
2835 case "$output" in
2836 *.la)
2837 old_library=
2838 test "$build_old_libs" = yes && old_library="$libname.$libext"
2839 $show "creating $output"
2841 if test -n "$xrpath"; then
2842 temp_xrpath=
2843 for libdir in $xrpath; do
2844 temp_xrpath="$temp_xrpath -R$libdir"
2845 done
2846 dependency_libs="$temp_xrpath $dependency_libs"
2849 # Only create the output if not a dry run.
2850 if test -z "$run"; then
2851 $echo > $output "\
2852 # $output - a libtool library file
2853 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2855 # The name that we can dlopen(3).
2856 dlname='$dlname'
2858 # Names of this library.
2859 library_names='$library_names'
2861 # The name of the static archive.
2862 old_library='$old_library'
2864 # Libraries that this one depends upon.
2865 dependency_libs='$dependency_libs'
2867 # Version information for $libname.
2868 current=$current
2869 age=$age
2870 revision=$revision
2872 # Is this an already installed library?
2873 installed=no
2875 # Directory that this library needs to be installed in:
2876 libdir='$install_libdir'\
2879 $rm "$output_objdir/$outputname"i
2880 sed 's/^installed=no$/installed=yes/' \
2881 < "$output" > "$output_objdir/$outputname"i || exit 1
2884 # Do a symbolic link so that the libtool archive can be found in
2885 # LD_LIBRARY_PATH before the program is installed.
2886 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
2887 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
2889 esac
2890 exit 0
2893 # libtool install mode
2894 install)
2895 modename="$modename: install"
2897 # There may be an optional sh(1) argument at the beginning of
2898 # install_prog (especially on Windows NT).
2899 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
2900 # Aesthetically quote it.
2901 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
2902 case "$arg" in
2903 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2904 arg="\"$arg\""
2906 esac
2907 install_prog="$arg "
2908 arg="$1"
2909 shift
2910 else
2911 install_prog=
2912 arg="$nonopt"
2915 # The real first argument should be the name of the installation program.
2916 # Aesthetically quote it.
2917 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2918 case "$arg" in
2919 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2920 arg="\"$arg\""
2922 esac
2923 install_prog="$install_prog$arg"
2925 # We need to accept at least all the BSD install flags.
2926 dest=
2927 files=
2928 opts=
2929 prev=
2930 install_type=
2931 isdir=no
2932 stripme=
2933 for arg
2935 if test -n "$dest"; then
2936 files="$files $dest"
2937 dest="$arg"
2938 continue
2941 case "$arg" in
2942 -d) isdir=yes ;;
2943 -f) prev="-f" ;;
2944 -g) prev="-g" ;;
2945 -m) prev="-m" ;;
2946 -o) prev="-o" ;;
2948 stripme=" -s"
2949 continue
2951 -*) ;;
2954 # If the previous option needed an argument, then skip it.
2955 if test -n "$prev"; then
2956 prev=
2957 else
2958 dest="$arg"
2959 continue
2962 esac
2964 # Aesthetically quote the argument.
2965 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2966 case "$arg" in
2967 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2968 arg="\"$arg\""
2970 esac
2971 install_prog="$install_prog $arg"
2972 done
2974 if test -z "$install_prog"; then
2975 $echo "$modename: you must specify an install program" 1>&2
2976 $echo "$help" 1>&2
2977 exit 1
2980 if test -n "$prev"; then
2981 $echo "$modename: the \`$prev' option requires an argument" 1>&2
2982 $echo "$help" 1>&2
2983 exit 1
2986 if test -z "$files"; then
2987 if test -z "$dest"; then
2988 $echo "$modename: no file or destination specified" 1>&2
2989 else
2990 $echo "$modename: you must specify a destination" 1>&2
2992 $echo "$help" 1>&2
2993 exit 1
2996 # Strip any trailing slash from the destination.
2997 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
2999 # Check to see that the destination is a directory.
3000 test -d "$dest" && isdir=yes
3001 if test "$isdir" = yes; then
3002 destdir="$dest"
3003 destname=
3004 else
3005 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3006 test "X$destdir" = "X$dest" && destdir=.
3007 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3009 # Not a directory, so check to see that there is only one file specified.
3010 set dummy $files
3011 if test $# -gt 2; then
3012 $echo "$modename: \`$dest' is not a directory" 1>&2
3013 $echo "$help" 1>&2
3014 exit 1
3017 case "$destdir" in
3018 /* | [A-Za-z]:[/\\]*) ;;
3020 for file in $files; do
3021 case "$file" in
3022 *.lo) ;;
3024 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3025 $echo "$help" 1>&2
3026 exit 1
3028 esac
3029 done
3031 esac
3033 # This variable tells wrapper scripts just to set variables rather
3034 # than running their programs.
3035 libtool_install_magic="$magic"
3037 staticlibs=
3038 future_libdirs=
3039 current_libdirs=
3040 for file in $files; do
3042 # Do each installation.
3043 case "$file" in
3044 *.a | *.lib)
3045 # Do the static libraries later.
3046 staticlibs="$staticlibs $file"
3049 *.la)
3050 # Check to see that this really is a libtool archive.
3051 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3052 else
3053 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3054 $echo "$help" 1>&2
3055 exit 1
3058 library_names=
3059 old_library=
3060 # If there is no directory component, then add one.
3061 case "$file" in
3062 */* | *\\*) . $file ;;
3063 *) . ./$file ;;
3064 esac
3066 # Add the libdir to current_libdirs if it is the destination.
3067 if test "X$destdir" = "X$libdir"; then
3068 case "$current_libdirs " in
3069 *" $libdir "*) ;;
3070 *) current_libdirs="$current_libdirs $libdir" ;;
3071 esac
3072 else
3073 # Note the libdir as a future libdir.
3074 case "$future_libdirs " in
3075 *" $libdir "*) ;;
3076 *) future_libdirs="$future_libdirs $libdir" ;;
3077 esac
3080 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3081 test "X$dir" = "X$file/" && dir=
3082 dir="$dir$objdir"
3084 # See the names of the shared library.
3085 set dummy $library_names
3086 if test -n "$2"; then
3087 realname="$2"
3088 shift
3089 shift
3091 # Install the shared library and build the symlinks.
3092 $show "$install_prog $dir/$realname $destdir/$realname"
3093 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3094 test "X$dlname" = "X$realname" && dlname=
3096 if test $# -gt 0; then
3097 # Delete the old symlinks, and create new ones.
3098 for linkname
3100 test "X$dlname" = "X$linkname" && dlname=
3101 if test "$linkname" != "$realname"; then
3102 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3103 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3105 done
3108 if test -n "$dlname"; then
3109 # Install the dynamically-loadable library.
3110 $show "$install_prog $dir/$dlname $destdir/$dlname"
3111 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
3114 # Do each command in the postinstall commands.
3115 lib="$destdir/$realname"
3116 eval cmds=\"$postinstall_cmds\"
3117 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3118 for cmd in $cmds; do
3119 IFS="$save_ifs"
3120 $show "$cmd"
3121 $run eval "$cmd" || exit $?
3122 done
3123 IFS="$save_ifs"
3126 # Install the pseudo-library for information purposes.
3127 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3128 instname="$dir/$name"i
3129 if test ! -f "$instname"; then
3130 # Just in case it was removed...
3131 $show "Creating $instname"
3132 $rm "$instname"
3133 sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
3135 $show "$install_prog $instname $destdir/$name"
3136 $run eval "$install_prog $instname $destdir/$name" || exit $?
3138 # Maybe install the static library, too.
3139 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3142 *.lo)
3143 # Install (i.e. copy) a libtool object.
3145 # Figure out destination file name, if it wasn't already specified.
3146 if test -n "$destname"; then
3147 destfile="$destdir/$destname"
3148 else
3149 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3150 destfile="$destdir/$destfile"
3153 # Deduce the name of the destination old-style object file.
3154 case "$destfile" in
3155 *.lo)
3156 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3158 *.o | *.obj)
3159 staticdest="$destfile"
3160 destfile=
3163 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3164 $echo "$help" 1>&2
3165 exit 1
3167 esac
3169 # Install the libtool object if requested.
3170 if test -n "$destfile"; then
3171 $show "$install_prog $file $destfile"
3172 $run eval "$install_prog $file $destfile" || exit $?
3175 # Install the old object if enabled.
3176 if test "$build_old_libs" = yes; then
3177 # Deduce the name of the old-style object file.
3178 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3180 $show "$install_prog $staticobj $staticdest"
3181 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3183 exit 0
3187 # Figure out destination file name, if it wasn't already specified.
3188 if test -n "$destname"; then
3189 destfile="$destdir/$destname"
3190 else
3191 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3192 destfile="$destdir/$destfile"
3195 # Do a test to see if this is really a libtool program.
3196 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3197 link_against_libtool_libs=
3198 relink_command=
3200 # If there is no directory component, then add one.
3201 case "$file" in
3202 */* | *\\*) . $file ;;
3203 *) . ./$file ;;
3204 esac
3206 # Check the variables that should have been set.
3207 if test -z "$link_against_libtool_libs"; then
3208 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3209 exit 1
3212 finalize=yes
3213 for lib in $link_against_libtool_libs; do
3214 # Check to see that each library is installed.
3215 libdir=
3216 if test -f "$lib"; then
3217 # If there is no directory component, then add one.
3218 case "$lib" in
3219 */* | *\\*) . $lib ;;
3220 *) . ./$lib ;;
3221 esac
3223 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3224 if test -n "$libdir" && test ! -f "$libfile"; then
3225 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3226 finalize=no
3228 done
3230 outputname=
3231 if test "$fast_install" = no && test -n "$relink_command"; then
3232 if test "$finalize" = yes; then
3233 outputname="/tmp/$$-$file"
3234 # Replace the output file specification.
3235 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3237 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
3238 $show "$relink_command"
3239 if $run eval "$relink_command"; then :
3240 else
3241 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3242 continue
3244 file="$outputname"
3245 else
3246 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
3248 else
3249 # Install the binary that we compiled earlier.
3250 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3254 $show "$install_prog$stripme $file $destfile"
3255 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3256 test -n "$outputname" && $rm $outputname
3258 esac
3259 done
3261 for file in $staticlibs; do
3262 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3264 # Set up the ranlib parameters.
3265 oldlib="$destdir/$name"
3267 $show "$install_prog $file $oldlib"
3268 $run eval "$install_prog \$file \$oldlib" || exit $?
3270 # Do each command in the postinstall commands.
3271 eval cmds=\"$old_postinstall_cmds\"
3272 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3273 for cmd in $cmds; do
3274 IFS="$save_ifs"
3275 $show "$cmd"
3276 $run eval "$cmd" || exit $?
3277 done
3278 IFS="$save_ifs"
3279 done
3281 if test -n "$future_libdirs"; then
3282 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3285 if test -n "$current_libdirs"; then
3286 # Maybe just do a dry run.
3287 test -n "$run" && current_libdirs=" -n$current_libdirs"
3288 exec $SHELL $0 --finish$current_libdirs
3289 exit 1
3292 exit 0
3295 # libtool finish mode
3296 finish)
3297 modename="$modename: finish"
3298 libdirs="$nonopt"
3299 admincmds=
3301 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3302 for dir
3304 libdirs="$libdirs $dir"
3305 done
3307 for libdir in $libdirs; do
3308 if test -n "$finish_cmds"; then
3309 # Do each command in the finish commands.
3310 eval cmds=\"$finish_cmds\"
3311 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3312 for cmd in $cmds; do
3313 IFS="$save_ifs"
3314 $show "$cmd"
3315 $run eval "$cmd" || admincmds="$admincmds
3316 $cmd"
3317 done
3318 IFS="$save_ifs"
3320 if test -n "$finish_eval"; then
3321 # Do the single finish_eval.
3322 eval cmds=\"$finish_eval\"
3323 $run eval "$cmds" || admincmds="$admincmds
3324 $cmds"
3326 done
3329 # Exit here if they wanted silent mode.
3330 test "$show" = : && exit 0
3332 echo "----------------------------------------------------------------------"
3333 echo "Libraries have been installed in:"
3334 for libdir in $libdirs; do
3335 echo " $libdir"
3336 done
3337 echo
3338 echo "If you ever happen to want to link against installed libraries"
3339 echo "in a given directory, LIBDIR, you must either use libtool, and"
3340 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3341 echo "flag during linking and do at least one of the following:"
3342 if test -n "$shlibpath_var"; then
3343 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3344 echo " during execution"
3346 if test -n "$runpath_var"; then
3347 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3348 echo " during linking"
3350 if test -n "$hardcode_libdir_flag_spec"; then
3351 libdir=LIBDIR
3352 eval flag=\"$hardcode_libdir_flag_spec\"
3354 echo " - use the \`$flag' linker flag"
3356 if test -n "$admincmds"; then
3357 echo " - have your system administrator run these commands:$admincmds"
3359 if test -f /etc/ld.so.conf; then
3360 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3362 echo
3363 echo "See any operating system documentation about shared libraries for"
3364 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3365 echo "----------------------------------------------------------------------"
3366 exit 0
3369 # libtool execute mode
3370 execute)
3371 modename="$modename: execute"
3373 # The first argument is the command name.
3374 cmd="$nonopt"
3375 if test -z "$cmd"; then
3376 $echo "$modename: you must specify a COMMAND" 1>&2
3377 $echo "$help"
3378 exit 1
3381 # Handle -dlopen flags immediately.
3382 for file in $execute_dlfiles; do
3383 if test ! -f "$file"; then
3384 $echo "$modename: \`$file' is not a file" 1>&2
3385 $echo "$help" 1>&2
3386 exit 1
3389 dir=
3390 case "$file" in
3391 *.la)
3392 # Check to see that this really is a libtool archive.
3393 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3394 else
3395 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3396 $echo "$help" 1>&2
3397 exit 1
3400 # Read the libtool library.
3401 dlname=
3402 library_names=
3404 # If there is no directory component, then add one.
3405 case "$file" in
3406 */* | *\\*) . $file ;;
3407 *) . ./$file ;;
3408 esac
3410 # Skip this library if it cannot be dlopened.
3411 if test -z "$dlname"; then
3412 # Warn if it was a shared library.
3413 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3414 continue
3417 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3418 test "X$dir" = "X$file" && dir=.
3420 if test -f "$dir/$objdir/$dlname"; then
3421 dir="$dir/$objdir"
3422 else
3423 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3424 exit 1
3428 *.lo)
3429 # Just add the directory containing the .lo file.
3430 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3431 test "X$dir" = "X$file" && dir=.
3435 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3436 continue
3438 esac
3440 # Get the absolute pathname.
3441 absdir=`cd "$dir" && pwd`
3442 test -n "$absdir" && dir="$absdir"
3444 # Now add the directory to shlibpath_var.
3445 if eval "test -z \"\$$shlibpath_var\""; then
3446 eval "$shlibpath_var=\"\$dir\""
3447 else
3448 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3450 done
3452 # This variable tells wrapper scripts just to set shlibpath_var
3453 # rather than running their programs.
3454 libtool_execute_magic="$magic"
3456 # Check if any of the arguments is a wrapper script.
3457 args=
3458 for file
3460 case "$file" in
3461 -*) ;;
3463 # Do a test to see if this is really a libtool program.
3464 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3465 # If there is no directory component, then add one.
3466 case "$file" in
3467 */* | *\\*) . $file ;;
3468 *) . ./$file ;;
3469 esac
3471 # Transform arg to wrapped name.
3472 file="$progdir/$program"
3475 esac
3476 # Quote arguments (to preserve shell metacharacters).
3477 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3478 args="$args \"$file\""
3479 done
3481 if test -z "$run"; then
3482 # Export the shlibpath_var.
3483 eval "export $shlibpath_var"
3485 # Restore saved enviroment variables
3486 if test "${save_LC_ALL+set}" = set; then
3487 LC_ALL="$save_LC_ALL"; export LC_ALL
3489 if test "${save_LANG+set}" = set; then
3490 LANG="$save_LANG"; export LANG
3493 # Now actually exec the command.
3494 eval "exec \$cmd$args"
3496 $echo "$modename: cannot exec \$cmd$args"
3497 exit 1
3498 else
3499 # Display what would be done.
3500 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3501 $echo "export $shlibpath_var"
3502 $echo "$cmd$args"
3503 exit 0
3507 # libtool uninstall mode
3508 uninstall)
3509 modename="$modename: uninstall"
3510 rm="$nonopt"
3511 files=
3513 for arg
3515 case "$arg" in
3516 -*) rm="$rm $arg" ;;
3517 *) files="$files $arg" ;;
3518 esac
3519 done
3521 if test -z "$rm"; then
3522 $echo "$modename: you must specify an RM program" 1>&2
3523 $echo "$help" 1>&2
3524 exit 1
3527 for file in $files; do
3528 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3529 test "X$dir" = "X$file" && dir=.
3530 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3532 rmfiles="$file"
3534 case "$name" in
3535 *.la)
3536 # Possibly a libtool archive, so verify it.
3537 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3538 . $dir/$name
3540 # Delete the libtool libraries and symlinks.
3541 for n in $library_names; do
3542 rmfiles="$rmfiles $dir/$n"
3543 test "X$n" = "X$dlname" && dlname=
3544 done
3545 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
3546 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3548 $show "$rm $rmfiles"
3549 $run $rm $rmfiles
3551 if test -n "$library_names"; then
3552 # Do each command in the postuninstall commands.
3553 eval cmds=\"$postuninstall_cmds\"
3554 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3555 for cmd in $cmds; do
3556 IFS="$save_ifs"
3557 $show "$cmd"
3558 $run eval "$cmd"
3559 done
3560 IFS="$save_ifs"
3563 if test -n "$old_library"; then
3564 # Do each command in the old_postuninstall commands.
3565 eval cmds=\"$old_postuninstall_cmds\"
3566 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3567 for cmd in $cmds; do
3568 IFS="$save_ifs"
3569 $show "$cmd"
3570 $run eval "$cmd"
3571 done
3572 IFS="$save_ifs"
3575 # FIXME: should reinstall the best remaining shared library.
3579 *.lo)
3580 if test "$build_old_libs" = yes; then
3581 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3582 rmfiles="$rmfiles $dir/$oldobj"
3584 $show "$rm $rmfiles"
3585 $run $rm $rmfiles
3589 $show "$rm $rmfiles"
3590 $run $rm $rmfiles
3592 esac
3593 done
3594 exit 0
3598 $echo "$modename: you must specify a MODE" 1>&2
3599 $echo "$generic_help" 1>&2
3600 exit 1
3602 esac
3604 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3605 $echo "$generic_help" 1>&2
3606 exit 1
3607 fi # test -z "$show_help"
3609 # We need to display help for each of the modes.
3610 case "$mode" in
3611 "") $echo \
3612 "Usage: $modename [OPTION]... [MODE-ARG]...
3614 Provide generalized library-building support services.
3616 --config show all configuration variables
3617 --debug enable verbose shell tracing
3618 -n, --dry-run display commands without modifying any files
3619 --features display basic configuration information and exit
3620 --finish same as \`--mode=finish'
3621 --help display this help message and exit
3622 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
3623 --quiet same as \`--silent'
3624 --silent don't print informational messages
3625 --version print version information
3627 MODE must be one of the following:
3629 compile compile a source file into a libtool object
3630 execute automatically set library path, then run a program
3631 finish complete the installation of libtool libraries
3632 install install libraries or executables
3633 link create a library or an executable
3634 uninstall remove libraries from an installed directory
3636 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3637 a more detailed description of MODE."
3638 exit 0
3641 compile)
3642 $echo \
3643 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3645 Compile a source file into a libtool library object.
3647 This mode accepts the following additional options:
3649 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3650 -static always build a \`.o' file suitable for static linking
3652 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3653 from the given SOURCEFILE.
3655 The output file name is determined by removing the directory component from
3656 SOURCEFILE, then substituting the C source code suffix \`.c' with the
3657 library object suffix, \`.lo'."
3660 execute)
3661 $echo \
3662 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3664 Automatically set library path, then run a program.
3666 This mode accepts the following additional options:
3668 -dlopen FILE add the directory containing FILE to the library path
3670 This mode sets the library path environment variable according to \`-dlopen'
3671 flags.
3673 If any of the ARGS are libtool executable wrappers, then they are translated
3674 into their corresponding uninstalled binary, and any of their required library
3675 directories are added to the library path.
3677 Then, COMMAND is executed, with ARGS as arguments."
3680 finish)
3681 $echo \
3682 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3684 Complete the installation of libtool libraries.
3686 Each LIBDIR is a directory that contains libtool libraries.
3688 The commands that this mode executes may require superuser privileges. Use
3689 the \`--dry-run' option if you just want to see what would be executed."
3692 install)
3693 $echo \
3694 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
3696 Install executables or libraries.
3698 INSTALL-COMMAND is the installation command. The first component should be
3699 either the \`install' or \`cp' program.
3701 The rest of the components are interpreted as arguments to that command (only
3702 BSD-compatible install options are recognized)."
3705 link)
3706 $echo \
3707 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
3709 Link object files or libraries together to form another library, or to
3710 create an executable program.
3712 LINK-COMMAND is a command using the C compiler that you would use to create
3713 a program from several object files.
3715 The following components of LINK-COMMAND are treated specially:
3717 -all-static do not do any dynamic linking at all
3718 -avoid-version do not add a version suffix if possible
3719 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
3720 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3721 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3722 -export-symbols SYMFILE
3723 try to export only the symbols listed in SYMFILE
3724 -LLIBDIR search LIBDIR for required installed libraries
3725 -lNAME OUTPUT-FILE requires the installed library libNAME
3726 -module build a library that can dlopened
3727 -no-undefined declare that a library does not refer to external symbols
3728 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3729 -release RELEASE specify package release information
3730 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3731 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3732 -static do not do any dynamic linking of libtool libraries
3733 -version-info CURRENT[:REVISION[:AGE]]
3734 specify library version info [each variable defaults to 0]
3736 All other options (arguments beginning with \`-') are ignored.
3738 Every other argument is treated as a filename. Files ending in \`.la' are
3739 treated as uninstalled libtool libraries, other files are standard or library
3740 object files.
3742 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
3743 only library objects (\`.lo' files) may be specified, and \`-rpath' is
3744 required, except when creating a convenience library.
3746 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
3747 using \`ar' and \`ranlib', or on Windows using \`lib'.
3749 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
3750 is created, otherwise an executable program is created."
3753 uninstall)
3754 $echo
3755 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3757 Remove libraries from an installation directory.
3759 RM is the name of the program to use to delete files associated with each FILE
3760 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
3761 to RM.
3763 If FILE is a libtool library, all the files associated with it are deleted.
3764 Otherwise, only FILE itself is deleted using RM."
3768 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3769 $echo "$help" 1>&2
3770 exit 1
3772 esac
3774 echo
3775 $echo "Try \`$modename --help' for more information about other modes."
3777 exit 0
3779 # Local Variables:
3780 # mode:shell-script
3781 # sh-indentation:2
3782 # End: