1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
3 #
4 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 #
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.
11 #
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.
16 #
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.
20 #
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 # Avoid inline document here, it may be left over
32 :
33 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
34 # Yippee, $echo works!
35 :
36 else
37 # Restart under the correct shell, and then maybe $echo will work.
38 exec $SHELL "$0" --no-reexec ${1+"$@"}
39 fi
41 if test "X$1" = X--fallback-echo; then
42 # used as fallback echo
43 shift
44 cat <<EOF
45 $*
46 EOF
47 exit 0
48 fi
50 # The name of this program.
51 progname=`$echo "$0" | sed 's%^.*/%%'`
52 modename="$progname"
54 # Constants.
55 PROGRAM=ltmain.sh
56 PACKAGE=libtool
57 VERSION=1.3.3-freebsd-ports
58 TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)"
60 default_mode=
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
63 mkdir="mkdir"
64 mv="mv -f"
65 rm="rm -f"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
69 Xsed='sed -e 1s/^X//'
70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71 SP2NL='tr \040 \012'
72 NL2SP='tr \015\012 \040\040'
74 # NLS nuisances.
75 # Only set LANG and LC_ALL to C if already set.
76 # These must not be set unconditionally because not all systems understand
77 # e.g. LANG=C (notably SCO).
78 # We save the old values to restore during execute mode.
79 if test "${LC_ALL+set}" = set; then
80 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
81 fi
82 if test "${LANG+set}" = set; then
83 save_LANG="$LANG"; LANG=C; export LANG
84 fi
86 if test "$LTCONFIG_VERSION" != "$VERSION"; then
87 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
89 exit 1
90 fi
92 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93 echo "$modename: not configured to build any kind of library" 1>&2
94 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
95 exit 1
96 fi
98 # Global variables.
99 mode=$default_mode
100 nonopt=
101 prev=
102 prevopt=
103 run=
104 show="$echo"
105 show_help=
106 execute_dlfiles=
107 lo2o="s/\\.lo\$/.${objext}/"
108 o2lo="s/\\.${objext}\$/.lo/"
110 # Parse our command line options once, thoroughly.
111 while test $# -gt 0
112 do
113 arg="$1"
114 shift
116 case "$arg" in
117 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118 *) optarg= ;;
119 esac
121 # If the previous option needs an argument, assign it.
122 if test -n "$prev"; then
123 case "$prev" in
124 execute_dlfiles)
125 eval "$prev=\"\$$prev \$arg\""
126 ;;
127 *)
128 eval "$prev=\$arg"
129 ;;
130 esac
132 prev=
133 prevopt=
134 continue
135 fi
137 # Have we seen a non-optional argument yet?
138 case "$arg" in
139 --help)
140 show_help=yes
141 ;;
143 --version)
144 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
145 exit 0
146 ;;
148 --config)
149 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
150 exit 0
151 ;;
153 --debug)
154 echo "$progname: enabling shell trace mode"
155 set -x
156 ;;
158 --dry-run | -n)
159 run=:
160 ;;
162 --features)
163 echo "host: $host"
164 if test "$build_libtool_libs" = yes; then
165 echo "enable shared libraries"
166 else
167 echo "disable shared libraries"
168 fi
169 if test "$build_old_libs" = yes; then
170 echo "enable static libraries"
171 else
172 echo "disable static libraries"
173 fi
174 exit 0
175 ;;
177 --finish) mode="finish" ;;
179 --mode) prevopt="--mode" prev=mode ;;
180 --mode=*) mode="$optarg" ;;
182 --quiet | --silent)
183 show=:
184 ;;
186 -dlopen)
187 prevopt="-dlopen"
188 prev=execute_dlfiles
189 ;;
191 -*)
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
193 $echo "$help" 1>&2
194 exit 1
195 ;;
197 *)
198 nonopt="$arg"
199 break
200 ;;
201 esac
202 done
204 if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206 $echo "$help" 1>&2
207 exit 1
208 fi
210 if test -z "$show_help"; then
212 # Infer the operation mode.
213 if test -z "$mode"; then
214 case "$nonopt" in
215 *cc | *++ | gcc* | *-gcc*)
216 mode=link
217 for arg
218 do
219 case "$arg" in
220 -c)
221 mode=compile
222 break
223 ;;
224 esac
225 done
226 ;;
227 *db | *dbx | *strace | *truss)
228 mode=execute
229 ;;
230 *install*|cp|mv)
231 mode=install
232 ;;
233 *rm)
234 mode=uninstall
235 ;;
236 *)
237 # If we have no mode, but dlfiles were specified, then do execute mode.
238 test -n "$execute_dlfiles" && mode=execute
240 # Just use the default operation mode.
241 if test -z "$mode"; then
242 if test -n "$nonopt"; then
243 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
244 else
245 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
246 fi
247 fi
248 ;;
249 esac
250 fi
252 # Only execute mode is allowed to have -dlopen flags.
253 if test -n "$execute_dlfiles" && test "$mode" != execute; then
254 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
255 $echo "$help" 1>&2
256 exit 1
257 fi
259 # Change the help message to a mode-specific one.
260 generic_help="$help"
261 help="Try \`$modename --help --mode=$mode' for more information."
263 # These modes are in order of execution frequency so that they run quickly.
264 case "$mode" in
265 # libtool compile mode
266 compile)
267 modename="$modename: compile"
268 # Get the compilation command and the source file.
269 base_compile=
270 lastarg=
271 srcfile="$nonopt"
272 suppress_output=
274 user_target=no
275 for arg
276 do
277 # Accept any command-line options.
278 case "$arg" in
279 -o)
280 if test "$user_target" != "no"; then
281 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
282 exit 1
283 fi
284 user_target=next
285 ;;
287 -static)
288 build_old_libs=yes
289 continue
290 ;;
291 esac
293 case "$user_target" in
294 next)
295 # The next one is the -o target name
296 user_target=yes
297 continue
298 ;;
299 yes)
300 # We got the output file
301 user_target=set
302 libobj="$arg"
303 continue
304 ;;
305 esac
307 # Accept the current argument as the source file.
308 lastarg="$srcfile"
309 srcfile="$arg"
311 # Aesthetically quote the previous argument.
313 # Backslashify any backslashes, double quotes, and dollar signs.
314 # These are the only characters that are still specially
315 # interpreted inside of double-quoted scrings.
316 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
318 # Double-quote args containing other shell metacharacters.
319 # Many Bourne shells cannot handle close brackets correctly in scan
320 # sets, so we specify it separately.
321 case "$lastarg" in
322 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
323 lastarg="\"$lastarg\""
324 ;;
325 esac
327 # Add the previous argument to base_compile.
328 if test -z "$base_compile"; then
329 base_compile="$lastarg"
330 else
331 base_compile="$base_compile $lastarg"
332 fi
333 done
335 case "$user_target" in
336 set)
337 ;;
338 no)
339 # Get the name of the library object.
340 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
341 ;;
342 *)
343 $echo "$modename: you must specify a target with \`-o'" 1>&2
344 exit 1
345 ;;
346 esac
348 # Recognize several different file suffixes.
349 # If the user specifies -o file.o, it is replaced with file.lo
350 xform='[cCFSfmso]'
351 case "$libobj" in
352 *.ada) xform=ada ;;
353 *.adb) xform=adb ;;
354 *.ads) xform=ads ;;
355 *.asm) xform=asm ;;
356 *.c++) xform=c++ ;;
357 *.cc) xform=cc ;;
358 *.cpp) xform=cpp ;;
359 *.cxx) xform=cxx ;;
360 *.f90) xform=f90 ;;
361 *.for) xform=for ;;
362 esac
364 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
366 case "$libobj" in
367 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
368 *)
369 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
370 exit 1
371 ;;
372 esac
374 if test -z "$base_compile"; then
375 $echo "$modename: you must specify a compilation command" 1>&2
376 $echo "$help" 1>&2
377 exit 1
378 fi
380 # Delete any leftover library objects.
381 if test "$build_old_libs" = yes; then
382 removelist="$obj $libobj"
383 else
384 removelist="$libobj"
385 fi
387 $run $rm $removelist
388 trap "$run $rm $removelist; exit 1" 1 2 15
390 # Calculate the filename of the output object if compiler does
391 # not support -o with -c
392 if test "$compiler_c_o" = no; then
393 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
394 lockfile="$output_obj.lock"
395 removelist="$removelist $output_obj $lockfile"
396 trap "$run $rm $removelist; exit 1" 1 2 15
397 else
398 need_locks=no
399 lockfile=
400 fi
402 # Lock this critical section if it is needed
403 # We use this script file to make the link, it avoids creating a new file
404 if test "$need_locks" = yes; then
405 until ln "$0" "$lockfile" 2>/dev/null; do
406 $show "Waiting for $lockfile to be removed"
407 sleep 2
408 done
409 elif test "$need_locks" = warn; then
410 if test -f "$lockfile"; then
411 echo "\
412 *** ERROR, $lockfile exists and contains:
413 `cat $lockfile 2>/dev/null`
415 This indicates that another process is trying to use the same
416 temporary object file, and libtool could not work around it because
417 your compiler does not support \`-c' and \`-o' together. If you
418 repeat this compilation, it may succeed, by chance, but you had better
419 avoid parallel builds (make -j) in this platform, or get a better
420 compiler."
422 $run $rm $removelist
423 exit 1
424 fi
425 echo $srcfile > "$lockfile"
426 fi
428 if test -n "$fix_srcfile_path"; then
429 eval srcfile=\"$fix_srcfile_path\"
430 fi
432 # Only build a PIC object if we are building libtool libraries.
433 if test "$build_libtool_libs" = yes; then
434 # Without this assignment, base_compile gets emptied.
435 fbsd_hideous_sh_bug=$base_compile
437 # All platforms use -DPIC, to notify preprocessed assembler code.
438 command="$base_compile $pic_flag -DPIC $srcfile"
439 if test "$build_old_libs" = yes; then
440 lo_libobj="$libobj"
441 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
442 if test "X$dir" = "X$libobj"; then
443 dir="$objdir"
444 else
445 dir="$dir/$objdir"
446 fi
447 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
449 if test -d "$dir"; then
450 $show "$rm $libobj"
451 $run $rm $libobj
452 else
453 $show "$mkdir $dir"
454 $run $mkdir $dir
455 status=$?
456 if test $status -ne 0 && test ! -d $dir; then
457 exit $status
458 fi
459 fi
460 fi
461 if test "$compiler_o_lo" = yes; then
462 output_obj="$libobj"
463 command="$command -o $output_obj"
464 elif test "$compiler_c_o" = yes; then
465 output_obj="$obj"
466 command="$command -o $output_obj"
467 fi
469 $run $rm "$output_obj"
470 $show "$command"
471 if $run eval "$command"; then :
472 else
473 test -n "$output_obj" && $run $rm $removelist
474 exit 1
475 fi
477 if test "$need_locks" = warn &&
478 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
479 echo "\
480 *** ERROR, $lockfile contains:
481 `cat $lockfile 2>/dev/null`
483 but it should contain:
484 $srcfile
486 This indicates that another process is trying to use the same
487 temporary object file, and libtool could not work around it because
488 your compiler does not support \`-c' and \`-o' together. If you
489 repeat this compilation, it may succeed, by chance, but you had better
490 avoid parallel builds (make -j) in this platform, or get a better
491 compiler."
493 $run $rm $removelist
494 exit 1
495 fi
497 # Just move the object if needed, then go on to compile the next one
498 if test x"$output_obj" != x"$libobj"; then
499 $show "$mv $output_obj $libobj"
500 if $run $mv $output_obj $libobj; then :
501 else
502 error=$?
503 $run $rm $removelist
504 exit $error
505 fi
506 fi
508 # If we have no pic_flag, then copy the object into place and finish.
509 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
510 # Rename the .lo from within objdir to obj
511 if test -f $obj; then
512 $show $rm $obj
513 $run $rm $obj
514 fi
516 $show "$mv $libobj $obj"
517 if $run $mv $libobj $obj; then :
518 else
519 error=$?
520 $run $rm $removelist
521 exit $error
522 fi
524 # Now arrange that obj and lo_libobj become the same file
525 $show "$LN_S $obj $lo_libobj"
526 if $run $LN_S $obj $lo_libobj; then
527 exit 0
528 else
529 error=$?
530 $run $rm $removelist
531 exit $error
532 fi
533 fi
535 # Allow error messages only from the first compilation.
536 suppress_output=' >/dev/null 2>&1'
537 fi
539 # Only build a position-dependent object if we build old libraries.
540 if test "$build_old_libs" = yes; then
541 command="$base_compile $srcfile"
542 if test "$compiler_c_o" = yes; then
543 command="$command -o $obj"
544 output_obj="$obj"
545 fi
547 # Suppress compiler output if we already did a PIC compilation.
548 command="$command$suppress_output"
549 $run $rm "$output_obj"
550 $show "$command"
551 if $run eval "$command"; then :
552 else
553 $run $rm $removelist
554 exit 1
555 fi
557 if test "$need_locks" = warn &&
558 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
559 echo "\
560 *** ERROR, $lockfile contains:
561 `cat $lockfile 2>/dev/null`
563 but it should contain:
564 $srcfile
566 This indicates that another process is trying to use the same
567 temporary object file, and libtool could not work around it because
568 your compiler does not support \`-c' and \`-o' together. If you
569 repeat this compilation, it may succeed, by chance, but you had better
570 avoid parallel builds (make -j) in this platform, or get a better
571 compiler."
573 $run $rm $removelist
574 exit 1
575 fi
577 # Just move the object if needed
578 if test x"$output_obj" != x"$obj"; then
579 $show "$mv $output_obj $obj"
580 if $run $mv $output_obj $obj; then :
581 else
582 error=$?
583 $run $rm $removelist
584 exit $error
585 fi
586 fi
588 # Create an invalid libtool object if no PIC, so that we do not
589 # accidentally link it into a program.
590 if test "$build_libtool_libs" != yes; then
591 $show "echo timestamp > $libobj"
592 $run eval "echo timestamp > \$libobj" || exit $?
593 else
594 # Move the .lo from within objdir
595 $show "$mv $libobj $lo_libobj"
596 if $run $mv $libobj $lo_libobj; then :
597 else
598 error=$?
599 $run $rm $removelist
600 exit $error
601 fi
602 fi
603 fi
605 # Unlock the critical section if it was locked
606 if test "$need_locks" != no; then
607 $rm "$lockfile"
608 fi
610 exit 0
611 ;;
613 # libtool link mode
614 link)
615 modename="$modename: link"
616 C_compiler="$CC" # save it, to compile generated C sources
617 CC="$nonopt"
618 case "$host" in
619 *-*-cygwin* | *-*-mingw* | *-*-os2*)
620 # It is impossible to link a dll without this setting, and
621 # we shouldn't force the makefile maintainer to figure out
622 # which system we are compiling for in order to pass an extra
623 # flag for every libtool invokation.
624 # allow_undefined=no
626 # FIXME: Unfortunately, there are problems with the above when trying
627 # to make a dll which has undefined symbols, in which case not
628 # even a static library is built. For now, we need to specify
629 # -no-undefined on the libtool link line when we can be certain
630 # that all symbols are satisfied, otherwise we get a static library.
631 allow_undefined=yes
633 # This is a source program that is used to create dlls on Windows
634 # Don't remove nor modify the starting and closing comments
635 # /* ltdll.c starts here */
636 # #define WIN32_LEAN_AND_MEAN
637 # #include <windows.h>
638 # #undef WIN32_LEAN_AND_MEAN
639 # #include <stdio.h>
640 #
641 # #ifndef __CYGWIN__
642 # # ifdef __CYGWIN32__
643 # # define __CYGWIN__ __CYGWIN32__
644 # # endif
645 # #endif
646 #
647 # #ifdef __cplusplus
648 # extern "C" {
649 # #endif
650 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
651 # #ifdef __cplusplus
652 # }
653 # #endif
654 #
655 # #ifdef __CYGWIN__
656 # #include <cygwin/cygwin_dll.h>
657 # DECLARE_CYGWIN_DLL( DllMain );
658 # #endif
659 # HINSTANCE __hDllInstance_base;
660 #
661 # BOOL APIENTRY
662 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
663 # {
664 # __hDllInstance_base = hInst;
665 # return TRUE;
666 # }
667 # /* ltdll.c ends here */
668 # This is a source program that is used to create import libraries
669 # on Windows for dlls which lack them. Don't remove nor modify the
670 # starting and closing comments
671 # /* impgen.c starts here */
672 # /* Copyright (C) 1999 Free Software Foundation, Inc.
673 #
674 # This file is part of GNU libtool.
675 #
676 # This program is free software; you can redistribute it and/or modify
677 # it under the terms of the GNU General Public License as published by
678 # the Free Software Foundation; either version 2 of the License, or
679 # (at your option) any later version.
680 #
681 # This program is distributed in the hope that it will be useful,
682 # but WITHOUT ANY WARRANTY; without even the implied warranty of
683 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
684 # GNU General Public License for more details.
685 #
686 # You should have received a copy of the GNU General Public License
687 # along with this program; if not, write to the Free Software
688 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
689 # */
690 #
691 # #include <stdio.h> /* for printf() */
692 # #include <unistd.h> /* for open(), lseek(), read() */
693 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
694 # #include <string.h> /* for strdup() */
695 #
696 # static unsigned int
697 # pe_get16 (fd, offset)
698 # int fd;
699 # int offset;
700 # {
701 # unsigned char b[2];
702 # lseek (fd, offset, SEEK_SET);
703 # read (fd, b, 2);
704 # return b[0] + (b[1]<<8);
705 # }
706 #
707 # static unsigned int
708 # pe_get32 (fd, offset)
709 # int fd;
710 # int offset;
711 # {
712 # unsigned char b[4];
713 # lseek (fd, offset, SEEK_SET);
714 # read (fd, b, 4);
715 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
716 # }
717 #
718 # static unsigned int
719 # pe_as32 (ptr)
720 # void *ptr;
721 # {
722 # unsigned char *b = ptr;
723 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
724 # }
725 #
726 # int
727 # main (argc, argv)
728 # int argc;
729 # char *argv[];
730 # {
731 # int dll;
732 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
733 # unsigned long export_rva, export_size, nsections, secptr, expptr;
734 # unsigned long name_rvas, nexp;
735 # unsigned char *expdata, *erva;
736 # char *filename, *dll_name;
737 #
738 # filename = argv[1];
739 #
740 # dll = open(filename, O_RDONLY|O_BINARY);
741 # if (!dll)
742 # return 1;
743 #
744 # dll_name = filename;
745 #
746 # for (i=0; filename[i]; i++)
747 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
748 # dll_name = filename + i +1;
749 #
750 # pe_header_offset = pe_get32 (dll, 0x3c);
751 # opthdr_ofs = pe_header_offset + 4 + 20;
752 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
753 #
754 # if (num_entries < 1) /* no exports */
755 # return 1;
756 #
757 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
758 # export_size = pe_get32 (dll, opthdr_ofs + 100);
759 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
760 # secptr = (pe_header_offset + 4 + 20 +
761 # pe_get16 (dll, pe_header_offset + 4 + 16));
762 #
763 # expptr = 0;
764 # for (i = 0; i < nsections; i++)
765 # {
766 # char sname[8];
767 # unsigned long secptr1 = secptr + 40 * i;
768 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
769 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
770 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
771 # lseek(dll, secptr1, SEEK_SET);
772 # read(dll, sname, 8);
773 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
774 # {
775 # expptr = fptr + (export_rva - vaddr);
776 # if (export_rva + export_size > vaddr + vsize)
777 # export_size = vsize - (export_rva - vaddr);
778 # break;
779 # }
780 # }
781 #
782 # expdata = (unsigned char*)malloc(export_size);
783 # lseek (dll, expptr, SEEK_SET);
784 # read (dll, expdata, export_size);
785 # erva = expdata - export_rva;
786 #
787 # nexp = pe_as32 (expdata+24);
788 # name_rvas = pe_as32 (expdata+32);
789 #
790 # printf ("EXPORTS\n");
791 # for (i = 0; i<nexp; i++)
792 # {
793 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
794 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
795 # }
796 #
797 # return 0;
798 # }
799 # /* impgen.c ends here */
800 ;;
801 *)
802 allow_undefined=yes
803 ;;
804 esac
805 compile_command="$CC"
806 finalize_command="$CC"
808 compile_rpath=
809 finalize_rpath=
810 compile_shlibpath=
811 finalize_shlibpath=
812 convenience=
813 old_convenience=
814 deplibs=
815 linkopts=
817 if test -n "$shlibpath_var"; then
818 # get the directories listed in $shlibpath_var
819 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
820 else
821 lib_search_path=
822 fi
823 # now prepend the system-specific ones
824 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
825 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
827 avoid_version=no
828 dlfiles=
829 dlprefiles=
830 dlself=no
831 export_dynamic=no
832 export_symbols=
833 export_symbols_regex=
834 generated=
835 libobjs=
836 link_against_libtool_libs=
837 ltlibs=
838 module=no
839 objs=
840 prefer_static_libs=no
841 preload=no
842 prev=
843 prevarg=
844 release=
845 rpath=
846 xrpath=
847 perm_rpath=
848 temp_rpath=
849 thread_safe=no
850 vinfo=
852 # We need to know -static, to get the right output filenames.
853 for arg
854 do
855 case "$arg" in
856 -all-static | -static)
857 if test "X$arg" = "X-all-static"; then
858 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
859 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
860 fi
861 if test -n "$link_static_flag"; then
862 dlopen_self=$dlopen_self_static
863 fi
864 else
865 if test -z "$pic_flag" && test -n "$link_static_flag"; then
866 dlopen_self=$dlopen_self_static
867 fi
868 fi
869 build_libtool_libs=no
870 build_old_libs=yes
871 prefer_static_libs=yes
872 break
873 ;;
874 esac
875 done
877 # See if our shared archives depend on static archives.
878 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
880 # Go through the arguments, transforming them on the way.
881 while test $# -gt 0; do
882 arg="$1"
883 shift
885 # If the previous option needs an argument, assign it.
886 if test -n "$prev"; then
887 case "$prev" in
888 output)
889 compile_command="$compile_command @OUTPUT@"
890 finalize_command="$finalize_command @OUTPUT@"
891 ;;
892 esac
894 case "$prev" in
895 dlfiles|dlprefiles)
896 if test "$preload" = no; then
897 # Add the symbol object into the linking commands.
898 compile_command="$compile_command @SYMFILE@"
899 finalize_command="$finalize_command @SYMFILE@"
900 preload=yes
901 fi
902 case "$arg" in
903 *.la | *.lo) ;; # We handle these cases below.
904 force)
905 if test "$dlself" = no; then
906 dlself=needless
907 export_dynamic=yes
908 fi
909 prev=
910 continue
911 ;;
912 self)
913 if test "$prev" = dlprefiles; then
914 dlself=yes
915 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
916 dlself=yes
917 else
918 dlself=needless
919 export_dynamic=yes
920 fi
921 prev=
922 continue
923 ;;
924 *)
925 if test "$prev" = dlfiles; then
926 dlfiles="$dlfiles $arg"
927 else
928 dlprefiles="$dlprefiles $arg"
929 fi
930 prev=
931 ;;
932 esac
933 ;;
934 expsyms)
935 export_symbols="$arg"
936 if test ! -f "$arg"; then
937 $echo "$modename: symbol file \`$arg' does not exist"
938 exit 1
939 fi
940 prev=
941 continue
942 ;;
943 expsyms_regex)
944 export_symbols_regex="$arg"
945 prev=
946 continue
947 ;;
948 release)
949 if test "$release_suffix" = all; then
950 release="$arg"
951 elif test "$release_suffix" = yes; then
952 release="-$arg"
953 fi
954 prev=
955 continue
956 ;;
957 rpath | xrpath)
958 # We need an absolute path.
959 case "$arg" in
960 [\\/]* | [A-Za-z]:[\\/]*) ;;
961 *)
962 $echo "$modename: only absolute run-paths are allowed" 1>&2
963 exit 1
964 ;;
965 esac
966 if test "$prev" = rpath; then
967 case "$rpath " in
968 *" $arg "*) ;;
969 *) rpath="$rpath $arg" ;;
970 esac
971 else
972 case "$xrpath " in
973 *" $arg "*) ;;
974 *) xrpath="$xrpath $arg" ;;
975 esac
976 fi
977 prev=
978 continue
979 ;;
980 *)
981 eval "$prev=\"\$arg\""
982 prev=
983 continue
984 ;;
985 esac
986 fi
988 prevarg="$arg"
990 case "$arg" in
991 -all-static)
992 if test -n "$link_static_flag"; then
993 compile_command="$compile_command $link_static_flag"
994 finalize_command="$finalize_command $link_static_flag"
995 fi
996 continue
997 ;;
999 -allow-undefined)
1000 # FIXME: remove this flag sometime in the future.
1001 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1002 continue
1003 ;;
1005 -avoid-version)
1006 build_old_libs=no
1007 avoid_version=yes
1008 continue
1009 ;;
1011 -dlopen)
1012 prev=dlfiles
1013 continue
1014 ;;
1016 -dlpreopen)
1017 prev=dlprefiles
1018 continue
1019 ;;
1021 -export-dynamic)
1022 export_dynamic=yes
1023 continue
1024 ;;
1026 -export-symbols | -export-symbols-regex)
1027 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1028 $echo "$modename: not more than one -exported-symbols argument allowed"
1029 exit 1
1030 fi
1031 if test "X$arg" = "X-export-symbols"; then
1032 prev=expsyms
1033 else
1034 prev=expsyms_regex
1035 fi
1036 continue
1037 ;;
1039 -L*)
1040 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1041 # We need an absolute path.
1042 case "$dir" in
1043 [\\/]* | [A-Za-z]:[\\/]*) ;;
1044 *)
1045 absdir=`cd "$dir" && pwd`
1046 if test -z "$absdir"; then
1047 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1048 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1049 absdir="$dir"
1050 fi
1051 dir="$absdir"
1052 ;;
1053 esac
1054 case " $deplibs " in
1055 *" $arg "*) ;;
1056 *) deplibs="$deplibs $arg";;
1057 esac
1058 case " $lib_search_path " in
1059 *" $dir "*) ;;
1060 *) lib_search_path="$lib_search_path $dir";;
1061 esac
1062 case "$host" in
1063 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1064 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1065 case ":$dllsearchpath:" in
1066 ::) dllsearchpath="$dllsearchdir";;
1067 *":$dllsearchdir:"*) ;;
1068 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1069 esac
1070 ;;
1071 esac
1072 ;;
1074 -l*)
1075 if test "$arg" = "-lc"; then
1076 case "$host" in
1077 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1078 # These systems don't actually have c library (as such)
1079 continue
1080 ;;
1081 esac
1082 elif test "$arg" = "-lm"; then
1083 case "$host" in
1084 *-*-cygwin* | *-*-beos*)
1085 # These systems don't actually have math library (as such)
1086 continue
1087 ;;
1088 esac
1089 fi
1090 deplibs="$deplibs $arg"
1091 ;;
1093 -?thread)
1094 deplibs="$deplibs $arg"
1095 ;;
1097 -module)
1098 module=yes
1099 continue
1100 ;;
1102 -no-undefined)
1103 allow_undefined=no
1104 continue
1105 ;;
1107 -o) prev=output ;;
1109 -release)
1110 prev=release
1111 continue
1112 ;;
1114 -rpath)
1115 prev=rpath
1116 continue
1117 ;;
1119 -R)
1120 prev=xrpath
1121 continue
1122 ;;
1124 -R*)
1125 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1126 # We need an absolute path.
1127 case "$dir" in
1128 [\\/]* | [A-Za-z]:[\\/]*) ;;
1129 *)
1130 $echo "$modename: only absolute run-paths are allowed" 1>&2
1131 exit 1
1132 ;;
1133 esac
1134 case "$xrpath " in
1135 *" $dir "*) ;;
1136 *) xrpath="$xrpath $dir" ;;
1137 esac
1138 continue
1139 ;;
1141 -static)
1142 # If we have no pic_flag, then this is the same as -all-static.
1143 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1144 compile_command="$compile_command $link_static_flag"
1145 finalize_command="$finalize_command $link_static_flag"
1146 fi
1147 continue
1148 ;;
1150 -thread-safe)
1151 thread_safe=yes
1152 continue
1153 ;;
1155 -version-info)
1156 prev=vinfo
1157 continue
1158 ;;
1160 # Some other compiler flag.
1161 -* | +*)
1162 # Unknown arguments in both finalize_command and compile_command need
1163 # to be aesthetically quoted because they are evaled later.
1164 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1165 case "$arg" in
1166 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1167 arg="\"$arg\""
1168 ;;
1169 esac
1170 ;;
1172 *.o | *.obj | *.a | *.lib)
1173 # A standard object.
1174 libobjs="$libobjs $arg"
1175 ;;
1177 *.lo)
1178 # A library object.
1179 if test "$prev" = dlfiles; then
1180 dlfiles="$dlfiles $arg"
1181 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1182 prev=
1183 continue
1184 else
1185 # If libtool objects are unsupported, then we need to preload.
1186 prev=dlprefiles
1187 fi
1188 fi
1190 if test "$prev" = dlprefiles; then
1191 # Preload the old-style object.
1192 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1193 prev=
1194 fi
1195 libobjs="$libobjs $arg"
1196 ;;
1198 *.la)
1199 # A libtool-controlled library.
1201 dlname=
1202 libdir=
1203 library_names=
1204 old_library=
1206 # Check to see that this really is a libtool archive.
1207 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1208 else
1209 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1210 exit 1
1211 fi
1213 # If the library was installed with an old release of libtool,
1214 # it will not redefine variable installed.
1215 installed=yes
1217 # Read the .la file
1218 # If there is no directory component, then add one.
1219 case "$arg" in
1220 */* | *\\*) . $arg ;;
1221 *) . ./$arg ;;
1222 esac
1224 # Get the name of the library we link against.
1225 linklib=
1226 for l in $old_library $library_names; do
1227 linklib="$l"
1228 done
1230 if test -z "$linklib"; then
1231 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1232 exit 1
1233 fi
1235 # Find the relevant object directory and library name.
1236 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1238 if test "X$installed" = Xyes; then
1239 dir="$libdir"
1240 else
1241 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1242 if test "X$dir" = "X$arg"; then
1243 dir="$objdir"
1244 else
1245 dir="$dir/$objdir"
1246 fi
1247 fi
1249 if test -n "$dependency_libs"; then
1250 # Extract -R and -L from dependency_libs
1251 temp_deplibs=
1252 for deplib in $dependency_libs; do
1253 case "$deplib" in
1254 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1255 case " $rpath $xrpath " in
1256 *" $temp_xrpath "*) ;;
1257 *) xrpath="$xrpath $temp_xrpath";;
1258 esac;;
1259 -L*) case "$compile_command $temp_deplibs " in
1260 *" $deplib "*) ;;
1261 *) temp_deplibs="$temp_deplibs $deplib";;
1262 esac
1263 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1264 case " $lib_search_path " in
1265 *" $temp_dir "*) ;;
1266 *) lib_search_path="$lib_search_path $temp_dir";;
1267 esac
1268 ;;
1269 *) temp_deplibs="$temp_deplibs $deplib";;
1270 esac
1271 done
1272 dependency_libs="$temp_deplibs"
1273 fi
1275 if test -z "$libdir"; then
1276 # It is a libtool convenience library, so add in its objects.
1277 convenience="$convenience $dir/$old_library"
1278 old_convenience="$old_convenience $dir/$old_library"
1279 deplibs="$deplibs$dependency_libs"
1280 compile_command="$compile_command $dir/$old_library$dependency_libs"
1281 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1282 continue
1283 fi
1285 # This library was specified with -dlopen.
1286 if test "$prev" = dlfiles; then
1287 dlfiles="$dlfiles $arg"
1288 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1289 # If there is no dlname, no dlopen support or we're linking statically,
1290 # we need to preload.
1291 prev=dlprefiles
1292 else
1293 # We should not create a dependency on this library, but we
1294 # may need any libraries it requires.
1295 compile_command="$compile_command$dependency_libs"
1296 finalize_command="$finalize_command$dependency_libs"
1297 prev=
1298 continue
1299 fi
1300 fi
1302 # The library was specified with -dlpreopen.
1303 if test "$prev" = dlprefiles; then
1304 # Prefer using a static library (so that no silly _DYNAMIC symbols
1305 # are required to link).
1306 if test -n "$old_library"; then
1307 dlprefiles="$dlprefiles $dir/$old_library"
1308 else
1309 dlprefiles="$dlprefiles $dir/$linklib"
1310 fi
1311 prev=
1312 fi
1314 if test -n "$library_names" &&
1315 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1316 link_against_libtool_libs="$link_against_libtool_libs $arg"
1317 if test -n "$shlibpath_var"; then
1318 # Make sure the rpath contains only unique directories.
1319 case "$temp_rpath " in
1320 *" $dir "*) ;;
1321 *) temp_rpath="$temp_rpath $dir" ;;
1322 esac
1323 fi
1325 # We need an absolute path.
1326 case "$dir" in
1327 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1328 *)
1329 absdir=`cd "$dir" && pwd`
1330 if test -z "$absdir"; then
1331 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1332 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1333 absdir="$dir"
1334 fi
1335 ;;
1336 esac
1338 # This is the magic to use -rpath.
1339 # Skip directories that are in the system default run-time
1340 # search path, unless they have been requested with -R.
1341 case " $sys_lib_dlsearch_path " in
1342 *" $absdir "*) ;;
1343 *)
1344 case "$compile_rpath " in
1345 *" $absdir "*) ;;
1346 *) compile_rpath="$compile_rpath $absdir"
1347 esac
1348 ;;
1349 esac
1351 case " $sys_lib_dlsearch_path " in
1352 *" $libdir "*) ;;
1353 *)
1354 case "$finalize_rpath " in
1355 *" $libdir "*) ;;
1356 *) finalize_rpath="$finalize_rpath $libdir"
1357 esac
1358 ;;
1359 esac
1361 lib_linked=yes
1362 case "$hardcode_action" in
1363 immediate | unsupported)
1364 if test "$hardcode_direct" = no; then
1365 compile_command="$compile_command $dir/$linklib"
1366 deplibs="$deplibs $dir/$linklib"
1367 case "$host" in
1368 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1369 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1370 if test -n "$dllsearchpath"; then
1371 dllsearchpath="$dllsearchpath:$dllsearchdir"
1372 else
1373 dllsearchpath="$dllsearchdir"
1374 fi
1375 ;;
1376 esac
1377 elif test "$hardcode_minus_L" = no; then
1378 case "$host" in
1379 *-*-sunos*)
1380 compile_shlibpath="$compile_shlibpath$dir:"
1381 ;;
1382 esac
1383 case "$compile_command " in
1384 *" -L$dir "*) ;;
1385 *) compile_command="$compile_command -L$dir";;
1386 esac
1387 compile_command="$compile_command -l$name"
1388 deplibs="$deplibs -L$dir -l$name"
1389 elif test "$hardcode_shlibpath_var" = no; then
1390 case ":$compile_shlibpath:" in
1391 *":$dir:"*) ;;
1392 *) compile_shlibpath="$compile_shlibpath$dir:";;
1393 esac
1394 compile_command="$compile_command -l$name"
1395 deplibs="$deplibs -l$name"
1396 else
1397 lib_linked=no
1398 fi
1399 ;;
1401 relink)
1402 if test "$hardcode_direct" = yes; then
1403 compile_command="$compile_command $absdir/$linklib"
1404 deplibs="$deplibs $absdir/$linklib"
1405 elif test "$hardcode_minus_L" = yes; then
1406 case "$compile_command " in
1407 *" -L$absdir "*) ;;
1408 *) compile_command="$compile_command -L$absdir";;
1409 esac
1410 compile_command="$compile_command -l$name"
1411 deplibs="$deplibs -L$absdir -l$name"
1412 elif test "$hardcode_shlibpath_var" = yes; then
1413 case ":$compile_shlibpath:" in
1414 *":$absdir:"*) ;;
1415 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1416 esac
1417 compile_command="$compile_command -l$name"
1418 deplibs="$deplibs -l$name"
1419 else
1420 lib_linked=no
1421 fi
1422 ;;
1424 *)
1425 lib_linked=no
1426 ;;
1427 esac
1429 if test "$lib_linked" != yes; then
1430 $echo "$modename: configuration error: unsupported hardcode properties"
1431 exit 1
1432 fi
1434 # Finalize command for both is simple: just hardcode it.
1435 if test "$hardcode_direct" = yes; then
1436 finalize_command="$finalize_command $libdir/$linklib"
1437 elif test "$hardcode_minus_L" = yes; then
1438 case "$finalize_command " in
1439 *" -L$libdir "*) ;;
1440 *) finalize_command="$finalize_command -L$libdir";;
1441 esac
1442 finalize_command="$finalize_command -l$name"
1443 elif test "$hardcode_shlibpath_var" = yes; then
1444 case ":$finalize_shlibpath:" in
1445 *":$libdir:"*) ;;
1446 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1447 esac
1448 finalize_command="$finalize_command -l$name"
1449 else
1450 # We cannot seem to hardcode it, guess we'll fake it.
1451 case "$finalize_command " in
1452 *" -L$dir "*) ;;
1453 *) finalize_command="$finalize_command -L$libdir";;
1454 esac
1455 finalize_command="$finalize_command -l$name"
1456 fi
1457 else
1458 # Transform directly to old archives if we don't build new libraries.
1459 if test -n "$pic_flag" && test -z "$old_library"; then
1460 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1461 exit 1
1462 fi
1464 # Here we assume that one of hardcode_direct or hardcode_minus_L
1465 # is not unsupported. This is valid on all known static and
1466 # shared platforms.
1467 if test "$hardcode_direct" != unsupported; then
1468 test -n "$old_library" && linklib="$old_library"
1469 compile_command="$compile_command $dir/$linklib"
1470 finalize_command="$finalize_command $dir/$linklib"
1471 else
1472 case "$compile_command " in
1473 *" -L$dir "*) ;;
1474 *) compile_command="$compile_command -L$dir";;
1475 esac
1476 compile_command="$compile_command -l$name"
1477 case "$finalize_command " in
1478 *" -L$dir "*) ;;
1479 *) finalize_command="$finalize_command -L$dir";;
1480 esac
1481 finalize_command="$finalize_command -l$name"
1482 fi
1483 fi
1485 # Add in any libraries that this one depends upon.
1486 compile_command="$compile_command$dependency_libs"
1487 finalize_command="$finalize_command$dependency_libs"
1488 continue
1489 ;;
1491 # Some other compiler argument.
1492 *)
1493 # Unknown arguments in both finalize_command and compile_command need
1494 # to be aesthetically quoted because they are evaled later.
1495 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1496 case "$arg" in
1497 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1498 arg="\"$arg\""
1499 ;;
1500 esac
1501 ;;
1502 esac
1504 # Now actually substitute the argument into the commands.
1505 if test -n "$arg"; then
1506 compile_command="$compile_command $arg"
1507 finalize_command="$finalize_command $arg"
1508 fi
1509 done
1511 if test -n "$prev"; then
1512 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1513 $echo "$help" 1>&2
1514 exit 1
1515 fi
1517 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1518 eval arg=\"$export_dynamic_flag_spec\"
1519 compile_command="$compile_command $arg"
1520 finalize_command="$finalize_command $arg"
1521 fi
1523 oldlibs=
1524 # calculate the name of the file, without its directory
1525 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1526 libobjs_save="$libobjs"
1528 case "$output" in
1529 "")
1530 $echo "$modename: you must specify an output file" 1>&2
1531 $echo "$help" 1>&2
1532 exit 1
1533 ;;
1535 *.a | *.lib)
1536 if test -n "$link_against_libtool_libs"; then
1537 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1538 exit 1
1539 fi
1541 if test -n "$deplibs"; then
1542 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1543 fi
1545 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1546 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1547 fi
1549 if test -n "$rpath"; then
1550 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1551 fi
1553 if test -n "$xrpath"; then
1554 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1555 fi
1557 if test -n "$vinfo"; then
1558 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1559 fi
1561 if test -n "$release"; then
1562 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1563 fi
1565 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1566 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1567 fi
1569 # Now set the variables for building old libraries.
1570 build_libtool_libs=no
1571 oldlibs="$output"
1572 ;;
1574 *.la)
1575 # Make sure we only generate libraries of the form `libNAME.la'.
1576 case "$outputname" in
1577 lib*)
1578 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1579 eval libname=\"$libname_spec\"
1580 ;;
1581 *)
1582 if test "$module" = no; then
1583 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1584 $echo "$help" 1>&2
1585 exit 1
1586 fi
1587 if test "$need_lib_prefix" != no; then
1588 # Add the "lib" prefix for modules if required
1589 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1590 eval libname=\"$libname_spec\"
1591 else
1592 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1593 fi
1594 ;;
1595 esac
1597 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1598 if test "X$output_objdir" = "X$output"; then
1599 output_objdir="$objdir"
1600 else
1601 output_objdir="$output_objdir/$objdir"
1602 fi
1604 if test -n "$objs"; then
1605 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1606 exit 1
1607 fi
1609 # How the heck are we supposed to write a wrapper for a shared library?
1610 if test -n "$link_against_libtool_libs"; then
1611 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1612 exit 1
1613 fi
1615 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1616 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1617 fi
1619 set dummy $rpath
1620 if test $# -gt 2; then
1621 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1622 fi
1623 install_libdir="$2"
1625 oldlibs=
1626 if test -z "$rpath"; then
1627 if test "$build_libtool_libs" = yes; then
1628 # Building a libtool convenience library.
1629 libext=al
1630 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1631 build_libtool_libs=convenience
1632 build_old_libs=yes
1633 fi
1634 dependency_libs="$deplibs"
1636 if test -n "$vinfo"; then
1637 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1638 fi
1640 if test -n "$release"; then
1641 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1642 fi
1643 else
1645 # Parse the version information argument.
1646 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1647 set dummy $vinfo 0 0 0
1648 IFS="$save_ifs"
1650 if test -n "$8"; then
1651 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1652 $echo "$help" 1>&2
1653 exit 1
1654 fi
1656 current="$2"
1657 revision="$3"
1658 age="$4"
1660 # Check that each of the things are valid numbers.
1661 case "$current" in
1662 0 | [1-9] | [1-9][0-9]*) ;;
1663 *)
1664 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1665 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1666 exit 1
1667 ;;
1668 esac
1670 case "$revision" in
1671 0 | [1-9] | [1-9][0-9]*) ;;
1672 *)
1673 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1674 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1675 exit 1
1676 ;;
1677 esac
1679 case "$age" in
1680 0 | [1-9] | [1-9][0-9]*) ;;
1681 *)
1682 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1683 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1684 exit 1
1685 ;;
1686 esac
1688 if test $age -gt $current; then
1689 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1690 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1691 exit 1
1692 fi
1694 # Calculate the version variables.
1695 major=
1696 versuffix=
1697 verstring=
1698 case "$version_type" in
1699 none) ;;
1701 irix)
1702 major=`expr $current - $age + 1`
1703 versuffix="$major.$revision"
1704 verstring="sgi$major.$revision"
1706 # Add in all the interfaces that we are compatible with.
1707 loop=$revision
1708 while test $loop != 0; do
1709 iface=`expr $revision - $loop`
1710 loop=`expr $loop - 1`
1711 verstring="sgi$major.$iface:$verstring"
1712 done
1713 ;;
1715 linux)
1716 major=.`expr $current - $age`
1717 versuffix="$major.$age.$revision"
1718 ;;
1720 osf)
1721 major=`expr $current - $age`
1722 versuffix=".$current.$age.$revision"
1723 verstring="$current.$age.$revision"
1725 # Add in all the interfaces that we are compatible with.
1726 loop=$age
1727 while test $loop != 0; do
1728 iface=`expr $current - $loop`
1729 loop=`expr $loop - 1`
1730 verstring="$verstring:${iface}.0"
1731 done
1733 # Make executables depend on our current version.
1734 verstring="$verstring:${current}.0"
1735 ;;
1737 sunos)
1738 major=".$current"
1739 versuffix=".$current.$revision"
1740 ;;
1742 freebsd-aout)
1743 major=".$current"
1744 versuffix=".$current.$revision";
1745 ;;
1747 freebsd-elf)
1748 major=".$current"
1749 versuffix=".$current";
1750 ;;
1752 windows)
1753 # Like Linux, but with '-' rather than '.', since we only
1754 # want one extension on Windows 95.
1755 major=`expr $current - $age`
1756 versuffix="-$major-$age-$revision"
1757 ;;
1759 *)
1760 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1761 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1762 exit 1
1763 ;;
1764 esac
1766 # Clear the version info if we defaulted, and they specified a release.
1767 if test -z "$vinfo" && test -n "$release"; then
1768 major=
1769 verstring="0.0"
1770 if test "$need_version" = no; then
1771 versuffix=
1772 else
1773 versuffix=".0.0"
1774 fi
1775 fi
1777 # Remove version info from name if versioning should be avoided
1778 if test "$avoid_version" = yes && test "$need_version" = no; then
1779 major=
1780 versuffix=
1781 verstring=""
1782 fi
1784 # Check to see if the archive will have undefined symbols.
1785 if test "$allow_undefined" = yes; then
1786 if test "$allow_undefined_flag" = unsupported; then
1787 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1788 build_libtool_libs=no
1789 build_old_libs=yes
1790 fi
1791 else
1792 # Don't allow undefined symbols.
1793 allow_undefined_flag="$no_undefined_flag"
1794 fi
1796 dependency_libs="$deplibs"
1797 case "$host" in
1798 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1799 # these systems don't actually have a c library (as such)!
1800 ;;
1801 *-*-freebsd*)
1802 # FreeBSD doesn't need this...
1803 ;;
1804 *)
1805 # Add libc to deplibs on all other systems.
1806 deplibs="$deplibs -lc"
1807 ;;
1808 esac
1809 fi
1811 if test -n "$rpath$xrpath"; then
1812 # If the user specified any rpath flags, then add them.
1813 for libdir in $rpath $xrpath; do
1814 # This is the magic to use -rpath.
1815 case "$compile_rpath " in
1816 *" $libdir "*) ;;
1817 *) compile_rpath="$compile_rpath $libdir" ;;
1818 esac
1819 case "$finalize_rpath " in
1820 *" $libdir "*) ;;
1821 *) finalize_rpath="$finalize_rpath $libdir" ;;
1822 esac
1823 done
1824 fi
1826 # Now hardcode the library paths
1827 rpath=
1828 hardcode_libdirs=
1829 for libdir in $compile_rpath; do
1830 if test -n "$hardcode_libdir_flag_spec"; then
1831 if test -n "$hardcode_libdir_separator"; then
1832 if test -z "$hardcode_libdirs"; then
1833 hardcode_libdirs="$libdir"
1834 else
1835 # Just accumulate the unique libdirs.
1836 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1837 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1838 ;;
1839 *)
1840 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1841 ;;
1842 esac
1843 fi
1844 else
1845 eval flag=\"$hardcode_libdir_flag_spec\"
1846 rpath="$rpath $flag"
1847 fi
1848 elif test -n "$runpath_var"; then
1849 case "$perm_rpath " in
1850 *" $libdir "*) ;;
1851 *) perm_rpath="$perm_rpath $libdir" ;;
1852 esac
1853 fi
1854 done
1855 # Substitute the hardcoded libdirs into the rpath.
1856 if test -n "$hardcode_libdir_separator" &&
1857 test -n "$hardcode_libdirs"; then
1858 libdir="$hardcode_libdirs"
1859 eval rpath=\" $hardcode_libdir_flag_spec\"
1860 fi
1861 compile_rpath="$rpath"
1863 rpath=
1864 hardcode_libdirs=
1865 for libdir in $finalize_rpath; do
1866 if test -n "$hardcode_libdir_flag_spec"; then
1867 if test -n "$hardcode_libdir_separator"; then
1868 if test -z "$hardcode_libdirs"; then
1869 hardcode_libdirs="$libdir"
1870 else
1871 # Just accumulate the unique libdirs.
1872 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1873 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1874 ;;
1875 *)
1876 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1877 ;;
1878 esac
1879 fi
1880 else
1881 eval flag=\"$hardcode_libdir_flag_spec\"
1882 rpath="$rpath $flag"
1883 fi
1884 elif test -n "$runpath_var"; then
1885 case "$finalize_perm_rpath " in
1886 *" $libdir "*) ;;
1887 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
1888 esac
1889 fi
1890 done
1891 # Substitute the hardcoded libdirs into the rpath.
1892 if test -n "$hardcode_libdir_separator" &&
1893 test -n "$hardcode_libdirs"; then
1894 libdir="$hardcode_libdirs"
1895 eval rpath=\" $hardcode_libdir_flag_spec\"
1896 fi
1897 finalize_rpath="$rpath"
1899 # Create the output directory, or remove our outputs if we need to.
1900 if test -d $output_objdir; then
1901 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1902 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1903 else
1904 $show "$mkdir $output_objdir"
1905 $run $mkdir $output_objdir
1906 status=$?
1907 if test $status -ne 0 && test ! -d $output_objdir; then
1908 exit $status
1909 fi
1910 fi
1912 # Now set the variables for building old libraries.
1913 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1914 if test "$release_suffix" = all; then
1915 oldlibs="$oldlibs $output_objdir/$libname$release.$libext"
1916 else
1917 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1918 fi
1920 # Transform .lo files to .o files.
1921 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1922 fi
1924 if test "$build_libtool_libs" = yes; then
1925 # Transform deplibs into only deplibs that can be linked in shared.
1926 name_save=$name
1927 libname_save=$libname
1928 release_save=$release
1929 versuffix_save=$versuffix
1930 major_save=$major
1931 # I'm not sure if I'm treating the release correctly. I think
1932 # release should show up in the -l (ie -lgmp5) so we don't want to
1933 # add it in twice. Is that correct?
1934 release=""
1935 versuffix=""
1936 major=""
1937 newdeplibs=
1938 droppeddeps=no
1939 case "$deplibs_check_method" in
1940 pass_all)
1941 # Don't check for shared/static. Everything works.
1942 # This might be a little naive. We might want to check
1943 # whether the library exists or not. But this is on
1944 # osf3 & osf4 and I'm not really sure... Just
1945 # implementing what was already the behaviour.
1946 newdeplibs=$deplibs
1947 ;;
1948 test_compile)
1949 # This code stresses the "libraries are programs" paradigm to its
1950 # limits. Maybe even breaks it. We compile a program, linking it
1951 # against the deplibs as a proxy for the library. Then we can check
1952 # whether they linked in statically or dynamically with ldd.
1953 $rm conftest.c
1954 cat > conftest.c <<EOF
1955 int main() { return 0; }
1956 EOF
1957 $rm conftest
1958 $C_compiler -o conftest conftest.c $deplibs
1959 if test $? -eq 0 ; then
1960 ldd_output=`ldd conftest`
1961 for i in $deplibs; do
1962 name="`expr $i : '-l\(.*\)'`"
1963 # If $name is empty we are operating on a -L argument.
1964 if test "$name" != "" ; then
1965 libname=`eval \\$echo \"$libname_spec\"`
1966 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1967 set dummy $deplib_matches
1968 deplib_match=$2
1969 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1970 newdeplibs="$newdeplibs $i"
1971 else
1972 droppeddeps=yes
1973 echo
1974 echo "*** Warning: This library needs some functionality provided by $i."
1975 echo "*** I have the capability to make that library automatically link in when"
1976 echo "*** you link to this library. But I can only do this if you have a"
1977 echo "*** shared version of the library, which you do not appear to have."
1978 fi
1979 else
1980 newdeplibs="$newdeplibs $i"
1981 fi
1982 done
1983 else
1984 # Error occured in the first compile. Let's try to salvage the situation:
1985 # Compile a seperate program for each library.
1986 for i in $deplibs; do
1987 name="`expr $i : '-l\(.*\)'`"
1988 # If $name is empty we are operating on a -L argument.
1989 if test "$name" != "" ; then
1990 $rm conftest
1991 $C_compiler -o conftest conftest.c $i
1992 # Did it work?
1993 if test $? -eq 0 ; then
1994 ldd_output=`ldd conftest`
1995 libname=`eval \\$echo \"$libname_spec\"`
1996 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1997 set dummy $deplib_matches
1998 deplib_match=$2
1999 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2000 newdeplibs="$newdeplibs $i"
2001 else
2002 droppeddeps=yes
2003 echo
2004 echo "*** Warning: This library needs some functionality provided by $i."
2005 echo "*** I have the capability to make that library automatically link in when"
2006 echo "*** you link to this library. But I can only do this if you have a"
2007 echo "*** shared version of the library, which you do not appear to have."
2008 fi
2009 else
2010 droppeddeps=yes
2011 echo
2012 echo "*** Warning! Library $i is needed by this library but I was not able to"
2013 echo "*** make it link in! You will probably need to install it or some"
2014 echo "*** library that it depends on before this library will be fully"
2015 echo "*** functional. Installing it before continuing would be even better."
2016 fi
2017 else
2018 newdeplibs="$newdeplibs $i"
2019 fi
2020 done
2021 fi
2022 ;;
2023 file_magic*)
2024 set dummy $deplibs_check_method
2025 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
2026 for a_deplib in $deplibs; do
2027 name="`expr $a_deplib : '-l\(.*\)'`"
2028 # If $name is empty we are operating on a -L argument.
2029 if test "$name" != "" ; then
2030 libname=`eval \\$echo \"$libname_spec\"`
2031 for i in $lib_search_path; do
2032 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2033 for potent_lib in $potential_libs; do
2034 # Follow soft links.
2035 if ls -lLd "$potent_lib" 2>/dev/null \
2036 | grep " -> " >/dev/null; then
2037 continue
2038 fi
2039 # The statement above tries to avoid entering an
2040 # endless loop below, in case of cyclic links.
2041 # We might still enter an endless loop, since a link
2042 # loop can be closed while we follow links,
2043 # but so what?
2044 potlib="$potent_lib"
2045 while test -h "$potlib" 2>/dev/null; do
2046 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2047 case "$potliblink" in
2048 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2049 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2050 esac
2051 done
2052 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2053 | sed 10q \
2054 | egrep "$file_magic_regex" > /dev/null; then
2055 newdeplibs="$newdeplibs $a_deplib"
2056 a_deplib=""
2057 break 2
2058 fi
2059 done
2060 done
2061 if test -n "$a_deplib" ; then
2062 droppeddeps=yes
2063 echo
2064 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2065 echo "*** I have the capability to make that library automatically link in when"
2066 echo "*** you link to this library. But I can only do this if you have a"
2067 echo "*** shared version of the library, which you do not appear to have."
2068 fi
2069 else
2070 # Add a -L argument.
2071 newdeplibs="$newdeplibs $a_deplib"
2072 fi
2073 done # Gone through all deplibs.
2074 ;;
2075 none | unknown | *)
2076 newdeplibs=""
2077 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2078 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2079 grep . >/dev/null; then
2080 echo
2081 if test "X$deplibs_check_method" = "Xnone"; then
2082 echo "*** Warning: inter-library dependencies are not supported in this platform."
2083 else
2084 echo "*** Warning: inter-library dependencies are not known to be supported."
2085 fi
2086 echo "*** All declared inter-library dependencies are being dropped."
2087 droppeddeps=yes
2088 fi
2089 ;;
2090 esac
2091 versuffix=$versuffix_save
2092 major=$major_save
2093 release=$release_save
2094 libname=$libname_save
2095 name=$name_save
2097 if test "$droppeddeps" = yes; then
2098 if test "$module" = yes; then
2099 echo
2100 echo "*** Warning: libtool could not satisfy all declared inter-library"
2101 echo "*** dependencies of module $libname. Therefore, libtool will create"
2102 echo "*** a static module, that should work as long as the dlopening"
2103 echo "*** application is linked with the -dlopen flag."
2104 if test -z "$global_symbol_pipe"; then
2105 echo
2106 echo "*** However, this would only work if libtool was able to extract symbol"
2107 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2108 echo "*** not find such a program. So, this module is probably useless."
2109 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2110 fi
2111 if test "$build_old_libs" = no; then
2112 if test "$release_suffix" = all; then
2113 oldlibs="$output_objdir/$libname$release.$libext"
2114 else
2115 oldlibs="$output_objdir/$libname.$libext"
2116 fi
2117 build_libtool_libs=module
2118 build_old_libs=yes
2119 else
2120 build_libtool_libs=no
2121 fi
2122 else
2123 echo "*** The inter-library dependencies that have been dropped here will be"
2124 echo "*** automatically added whenever a program is linked with this library"
2125 echo "*** or is declared to -dlopen it."
2126 fi
2127 fi
2128 # Done checking deplibs!
2129 deplibs=$newdeplibs
2130 fi
2132 # All the library-specific variables (install_libdir is set above).
2133 library_names=
2134 old_library=
2135 dlname=
2137 # Test again, we may have decided not to build it any more
2138 if test "$build_libtool_libs" = yes; then
2139 # Get the real and link names of the library.
2140 eval library_names=\"$library_names_spec\"
2141 set dummy $library_names
2142 realname="$2"
2143 shift; shift
2145 if test -n "$soname_spec"; then
2146 eval soname=\"$soname_spec\"
2147 else
2148 soname="$realname"
2149 fi
2151 lib="$output_objdir/$realname"
2152 for link
2153 do
2154 linknames="$linknames $link"
2155 done
2157 # Ensure that we have .o objects for linkers which dislike .lo
2158 # (e.g. aix) incase we are running --disable-static
2159 for obj in $libobjs; do
2160 oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
2161 if test ! -f $oldobj; then
2162 $show "${LN_S} $obj $oldobj"
2163 $run ${LN_S} $obj $oldobj || exit $?
2164 fi
2165 done
2167 # Use standard objects if they are pic
2168 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2170 # Prepare the list of exported symbols
2171 if test -z "$export_symbols"; then
2172 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2173 $show "generating symbol list for \`$libname.la'"
2174 export_symbols="$output_objdir/$libname.exp"
2175 $run $rm $export_symbols
2176 eval cmds=\"$export_symbols_cmds\"
2177 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2178 for cmd in $cmds; do
2179 IFS="$save_ifs"
2180 $show "$cmd"
2181 $run eval "$cmd" || exit $?
2182 done
2183 IFS="$save_ifs"
2184 if test -n "$export_symbols_regex"; then
2185 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2186 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2187 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2188 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2189 fi
2190 fi
2191 fi
2193 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2194 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2195 fi
2197 if test -n "$convenience"; then
2198 if test -n "$whole_archive_flag_spec"; then
2199 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2200 else
2201 gentop="$output_objdir/${outputname}x"
2202 $show "${rm}r $gentop"
2203 $run ${rm}r "$gentop"
2204 $show "mkdir $gentop"
2205 $run mkdir "$gentop"
2206 status=$?
2207 if test $status -ne 0 && test ! -d "$gentop"; then
2208 exit $status
2209 fi
2210 generated="$generated $gentop"
2212 for xlib in $convenience; do
2213 # Extract the objects.
2214 case "$xlib" in
2215 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2216 *) xabs=`pwd`"/$xlib" ;;
2217 esac
2218 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2219 xdir="$gentop/$xlib"
2221 $show "${rm}r $xdir"
2222 $run ${rm}r "$xdir"
2223 $show "mkdir $xdir"
2224 $run mkdir "$xdir"
2225 status=$?
2226 if test $status -ne 0 && test ! -d "$xdir"; then
2227 exit $status
2228 fi
2229 $show "(cd $xdir && $AR x $xabs)"
2230 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2232 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2233 done
2234 fi
2235 fi
2237 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2238 eval flag=\"$thread_safe_flag_spec\"
2239 linkopts="$linkopts $flag"
2240 fi
2242 # Do each of the archive commands.
2243 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2244 eval cmds=\"$archive_expsym_cmds\"
2245 else
2246 eval cmds=\"$archive_cmds\"
2247 fi
2248 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2249 for cmd in $cmds; do
2250 IFS="$save_ifs"
2251 $show "$cmd"
2252 $run eval "$cmd" || exit $?
2253 done
2254 IFS="$save_ifs"
2256 # Create links to the real library.
2257 for linkname in $linknames; do
2258 if test "$realname" != "$linkname"; then
2259 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2260 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2261 fi
2262 done
2264 # If -module or -export-dynamic was specified, set the dlname.
2265 if test "$module" = yes || test "$export_dynamic" = yes; then
2266 # On all known operating systems, these are identical.
2267 dlname="$soname"
2268 fi
2269 fi
2270 ;;
2272 *.lo | *.o | *.obj)
2273 if test -n "$link_against_libtool_libs"; then
2274 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2275 exit 1
2276 fi
2278 if test -n "$deplibs"; then
2279 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2280 fi
2282 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2283 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2284 fi
2286 if test -n "$rpath"; then
2287 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2288 fi
2290 if test -n "$xrpath"; then
2291 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2292 fi
2294 if test -n "$vinfo"; then
2295 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2296 fi
2298 if test -n "$release"; then
2299 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2300 fi
2302 case "$output" in
2303 *.lo)
2304 if test -n "$objs"; then
2305 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2306 exit 1
2307 fi
2308 libobj="$output"
2309 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2310 ;;
2311 *)
2312 libobj=
2313 obj="$output"
2314 ;;
2315 esac
2317 # Delete the old objects.
2318 $run $rm $obj $libobj
2320 # Objects from convenience libraries. This assumes
2321 # single-version convenience libraries. Whenever we create
2322 # different ones for PIC/non-PIC, this we'll have to duplicate
2323 # the extraction.
2324 reload_conv_objs=
2325 gentop=
2326 # reload_cmds runs $LD directly, so let us get rid of
2327 # -Wl from whole_archive_flag_spec
2328 wl=
2330 if test -n "$convenience"; then
2331 if test -n "$whole_archive_flag_spec"; then
2332 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2333 else
2334 gentop="$output_objdir/${obj}x"
2335 $show "${rm}r $gentop"
2336 $run ${rm}r "$gentop"
2337 $show "mkdir $gentop"
2338 $run mkdir "$gentop"
2339 status=$?
2340 if test $status -ne 0 && test ! -d "$gentop"; then
2341 exit $status
2342 fi
2343 generated="$generated $gentop"
2345 for xlib in $convenience; do
2346 # Extract the objects.
2347 case "$xlib" in
2348 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2349 *) xabs=`pwd`"/$xlib" ;;
2350 esac
2351 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2352 xdir="$gentop/$xlib"
2354 $show "${rm}r $xdir"
2355 $run ${rm}r "$xdir"
2356 $show "mkdir $xdir"
2357 $run mkdir "$xdir"
2358 status=$?
2359 if test $status -ne 0 && test ! -d "$xdir"; then
2360 exit $status
2361 fi
2362 $show "(cd $xdir && $AR x $xabs)"
2363 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2365 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2366 done
2367 fi
2368 fi
2370 # Create the old-style object.
2371 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2373 output="$obj"
2374 eval cmds=\"$reload_cmds\"
2375 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2376 for cmd in $cmds; do
2377 IFS="$save_ifs"
2378 $show "$cmd"
2379 $run eval "$cmd" || exit $?
2380 done
2381 IFS="$save_ifs"
2383 # Exit if we aren't doing a library object file.
2384 if test -z "$libobj"; then
2385 if test -n "$gentop"; then
2386 $show "${rm}r $gentop"
2387 $run ${rm}r $gentop
2388 fi
2390 exit 0
2391 fi
2393 if test "$build_libtool_libs" != yes; then
2394 if test -n "$gentop"; then
2395 $show "${rm}r $gentop"
2396 $run ${rm}r $gentop
2397 fi
2399 # Create an invalid libtool object if no PIC, so that we don't
2400 # accidentally link it into a program.
2401 $show "echo timestamp > $libobj"
2402 $run eval "echo timestamp > $libobj" || exit $?
2403 exit 0
2404 fi
2406 if test -n "$pic_flag"; then
2407 # Only do commands if we really have different PIC objects.
2408 reload_objs="$libobjs $reload_conv_objs"
2409 output="$libobj"
2410 eval cmds=\"$reload_cmds\"
2411 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2412 for cmd in $cmds; do
2413 IFS="$save_ifs"
2414 $show "$cmd"
2415 $run eval "$cmd" || exit $?
2416 done
2417 IFS="$save_ifs"
2418 else
2419 # Just create a symlink.
2420 $show $rm $libobj
2421 $run $rm $libobj
2422 $show "$LN_S $obj $libobj"
2423 $run $LN_S $obj $libobj || exit $?
2424 fi
2426 if test -n "$gentop"; then
2427 $show "${rm}r $gentop"
2428 $run ${rm}r $gentop
2429 fi
2431 exit 0
2432 ;;
2434 # Anything else should be a program.
2435 *)
2436 if test -n "$vinfo"; then
2437 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2438 fi
2440 if test -n "$release"; then
2441 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2442 fi
2444 if test "$preload" = yes; then
2445 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2446 test "$dlopen_self_static" = unknown; then
2447 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2448 fi
2449 fi
2451 if test -n "$rpath$xrpath"; then
2452 # If the user specified any rpath flags, then add them.
2453 for libdir in $rpath $xrpath; do
2454 # This is the magic to use -rpath.
2455 case "$compile_rpath " in
2456 *" $libdir "*) ;;
2457 *) compile_rpath="$compile_rpath $libdir" ;;
2458 esac
2459 case "$finalize_rpath " in
2460 *" $libdir "*) ;;
2461 *) finalize_rpath="$finalize_rpath $libdir" ;;
2462 esac
2463 done
2464 fi
2466 # Now hardcode the library paths
2467 rpath=
2468 hardcode_libdirs=
2469 for libdir in $compile_rpath $finalize_rpath; do
2470 if test -n "$hardcode_libdir_flag_spec"; then
2471 if test -n "$hardcode_libdir_separator"; then
2472 if test -z "$hardcode_libdirs"; then
2473 hardcode_libdirs="$libdir"
2474 else
2475 # Just accumulate the unique libdirs.
2476 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2477 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2478 ;;
2479 *)
2480 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2481 ;;
2482 esac
2483 fi
2484 else
2485 eval flag=\"$hardcode_libdir_flag_spec\"
2486 rpath="$rpath $flag"
2487 fi
2488 elif test -n "$runpath_var"; then
2489 case "$perm_rpath " in
2490 *" $libdir "*) ;;
2491 *) perm_rpath="$perm_rpath $libdir" ;;
2492 esac
2493 fi
2494 done
2495 # Substitute the hardcoded libdirs into the rpath.
2496 if test -n "$hardcode_libdir_separator" &&
2497 test -n "$hardcode_libdirs"; then
2498 libdir="$hardcode_libdirs"
2499 eval rpath=\" $hardcode_libdir_flag_spec\"
2500 fi
2501 compile_rpath="$rpath"
2503 rpath=
2504 hardcode_libdirs=
2505 for libdir in $finalize_rpath; do
2506 if test -n "$hardcode_libdir_flag_spec"; then
2507 if test -n "$hardcode_libdir_separator"; then
2508 if test -z "$hardcode_libdirs"; then
2509 hardcode_libdirs="$libdir"
2510 else
2511 # Just accumulate the unique libdirs.
2512 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2513 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2514 ;;
2515 *)
2516 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2517 ;;
2518 esac
2519 fi
2520 else
2521 eval flag=\"$hardcode_libdir_flag_spec\"
2522 rpath="$rpath $flag"
2523 fi
2524 elif test -n "$runpath_var"; then
2525 case "$finalize_perm_rpath " in
2526 *" $libdir "*) ;;
2527 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2528 esac
2529 fi
2530 done
2531 # Substitute the hardcoded libdirs into the rpath.
2532 if test -n "$hardcode_libdir_separator" &&
2533 test -n "$hardcode_libdirs"; then
2534 libdir="$hardcode_libdirs"
2535 eval rpath=\" $hardcode_libdir_flag_spec\"
2536 fi
2537 finalize_rpath="$rpath"
2539 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2540 if test "X$output_objdir" = "X$output"; then
2541 output_objdir="$objdir"
2542 else
2543 output_objdir="$output_objdir/$objdir"
2544 fi
2546 # Create the binary in the object directory, then wrap it.
2547 if test ! -d $output_objdir; then
2548 $show "$mkdir $output_objdir"
2549 $run $mkdir $output_objdir
2550 status=$?
2551 if test $status -ne 0 && test ! -d $output_objdir; then
2552 exit $status
2553 fi
2554 fi
2556 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2557 # Transform all the library objects into standard objects.
2558 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2559 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2560 fi
2562 dlsyms=
2563 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2564 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2565 dlsyms="${outputname}S.c"
2566 else
2567 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2568 fi
2569 fi
2571 if test -n "$dlsyms"; then
2572 case "$dlsyms" in
2573 "") ;;
2574 *.c)
2575 # Discover the nlist of each of the dlfiles.
2576 nlist="$output_objdir/${outputname}.nm"
2578 $show "$rm $nlist ${nlist}S ${nlist}T"
2579 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2581 # Parse the name list into a source file.
2582 $show "creating $output_objdir/$dlsyms"
2584 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2585 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2586 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2588 #ifdef __cplusplus
2589 extern \"C\" {
2590 #endif
2592 /* Prevent the only kind of declaration conflicts we can make. */
2593 #define lt_preloaded_symbols some_other_symbol
2595 /* External symbol declarations for the compiler. */\
2596 "
2598 if test "$dlself" = yes; then
2599 $show "generating symbol list for \`$output'"
2601 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2603 # Add our own program objects to the symbol list.
2604 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2605 for arg in $progfiles; do
2606 $show "extracting global C symbols from \`$arg'"
2607 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2608 done
2610 if test -n "$exclude_expsyms"; then
2611 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2612 $run eval '$mv "$nlist"T "$nlist"'
2613 fi
2615 if test -n "$export_symbols_regex"; then
2616 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2617 $run eval '$mv "$nlist"T "$nlist"'
2618 fi
2620 # Prepare the list of exported symbols
2621 if test -z "$export_symbols"; then
2622 export_symbols="$output_objdir/$output.exp"
2623 $run $rm $export_symbols
2624 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2625 else
2626 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2627 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2628 $run eval 'mv "$nlist"T "$nlist"'
2629 fi
2630 fi
2632 for arg in $dlprefiles; do
2633 $show "extracting global C symbols from \`$arg'"
2634 name=`echo "$arg" | sed -e 's%^.*/%%'`
2635 $run eval 'echo ": $name " >> "$nlist"'
2636 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2637 done
2639 if test -z "$run"; then
2640 # Make sure we have at least an empty file.
2641 test -f "$nlist" || : > "$nlist"
2643 if test -n "$exclude_expsyms"; then
2644 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2645 $mv "$nlist"T "$nlist"
2646 fi
2648 # Try sorting and uniquifying the output.
2649 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2650 :
2651 else
2652 grep -v "^: " < "$nlist" > "$nlist"S
2653 fi
2655 if test -f "$nlist"S; then
2656 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2657 else
2658 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2659 fi
2661 $echo >> "$output_objdir/$dlsyms" "\
2663 #undef lt_preloaded_symbols
2665 #if defined (__STDC__) && __STDC__
2666 # define lt_ptr_t void *
2667 #else
2668 # define lt_ptr_t char *
2669 # define const
2670 #endif
2672 /* The mapping between symbol names and symbols. */
2673 const struct {
2674 const char *name;
2675 lt_ptr_t address;
2676 }
2677 lt_preloaded_symbols[] =
2678 {\
2679 "
2681 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2682 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2683 < "$nlist" >> "$output_objdir/$dlsyms"
2685 $echo >> "$output_objdir/$dlsyms" "\
2686 {0, (lt_ptr_t) 0}
2687 };
2689 /* This works around a problem in FreeBSD linker */
2690 #ifdef FREEBSD_WORKAROUND
2691 static const void *lt_preloaded_setup() {
2692 return lt_preloaded_symbols;
2693 }
2694 #endif
2696 #ifdef __cplusplus
2697 }
2698 #endif\
2699 "
2700 fi
2702 pic_flag_for_symtable=
2703 case "$host" in
2704 # compiling the symbol table file with pic_flag works around
2705 # a FreeBSD bug that causes programs to crash when -lm is
2706 # linked before any other PIC object. But we must not use
2707 # pic_flag when linking with -static. The problem exists in
2708 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2709 *-*-freebsd2*|*-*-freebsd3.0*)
2710 case "$compile_command " in
2711 *" -static "*) ;;
2712 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2713 esac
2714 esac
2716 # Now compile the dynamic symbol file.
2717 $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2718 $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2720 # Clean up the generated files.
2721 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2722 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2724 # Transform the symbol file into the correct name.
2725 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2726 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2727 ;;
2728 *)
2729 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2730 exit 1
2731 ;;
2732 esac
2733 else
2734 # We keep going just in case the user didn't refer to
2735 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2736 # really was required.
2738 # Nullify the symbol file.
2739 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2740 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2741 fi
2743 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2744 # Replace the output file specification.
2745 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2746 link_command="$compile_command$compile_rpath"
2748 # We have no uninstalled library dependencies, so finalize right now.
2749 $show "$link_command"
2750 $run eval "$link_command"
2751 status=$?
2753 # Delete the generated files.
2754 if test -n "$dlsyms"; then
2755 $show "$rm $output_objdir/${outputname}S.${objext}"
2756 $run $rm "$output_objdir/${outputname}S.${objext}"
2757 fi
2759 exit $status
2760 fi
2762 if test -n "$shlibpath_var"; then
2763 # We should set the shlibpath_var
2764 rpath=
2765 for dir in $temp_rpath; do
2766 case "$dir" in
2767 [\\/]* | [A-Za-z]:[\\/]*)
2768 # Absolute path.
2769 rpath="$rpath$dir:"
2770 ;;
2771 *)
2772 # Relative path: add a thisdir entry.
2773 rpath="$rpath\$thisdir/$dir:"
2774 ;;
2775 esac
2776 done
2777 temp_rpath="$rpath"
2778 fi
2780 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2781 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2782 fi
2783 if test -n "$finalize_shlibpath"; then
2784 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2785 fi
2787 compile_var=
2788 finalize_var=
2789 if test -n "$runpath_var"; then
2790 if test -n "$perm_rpath"; then
2791 # We should set the runpath_var.
2792 rpath=
2793 for dir in $perm_rpath; do
2794 rpath="$rpath$dir:"
2795 done
2796 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2797 fi
2798 if test -n "$finalize_perm_rpath"; then
2799 # We should set the runpath_var.
2800 rpath=
2801 for dir in $finalize_perm_rpath; do
2802 rpath="$rpath$dir:"
2803 done
2804 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2805 fi
2806 fi
2808 if test "$hardcode_action" = relink; then
2809 # Fast installation is not supported
2810 link_command="$compile_var$compile_command$compile_rpath"
2811 relink_command="$finalize_var$finalize_command$finalize_rpath"
2813 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2814 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2815 else
2816 if test "$fast_install" != no; then
2817 link_command="$finalize_var$compile_command$finalize_rpath"
2818 if test "$fast_install" = yes; then
2819 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2820 else
2821 # fast_install is set to needless
2822 relink_command=
2823 fi
2824 else
2825 link_command="$compile_var$compile_command$compile_rpath"
2826 relink_command="$finalize_var$finalize_command$finalize_rpath"
2827 fi
2828 fi
2830 # Replace the output file specification.
2831 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2833 # Delete the old output files.
2834 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2836 $show "$link_command"
2837 $run eval "$link_command" || exit $?
2839 # Now create the wrapper script.
2840 $show "creating $output"
2842 # Quote the relink command for shipping.
2843 if test -n "$relink_command"; then
2844 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2845 fi
2847 # Quote $echo for shipping.
2848 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2849 case "$0" in
2850 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2851 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2852 esac
2853 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2854 else
2855 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2856 fi
2858 # Only actually do things if our run command is non-null.
2859 if test -z "$run"; then
2860 # win32 will think the script is a binary if it has
2861 # a .exe suffix, so we strip it off here.
2862 case $output in
2863 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2864 esac
2865 $rm $output
2866 trap "$rm $output; exit 1" 1 2 15
2868 $echo > $output "\
2869 #! $SHELL
2871 # $output - temporary wrapper script for $objdir/$outputname
2872 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2873 #
2874 # The $output program cannot be directly executed until all the libtool
2875 # libraries that it depends on are installed.
2876 #
2877 # This wrapper script should never be moved out of the build directory.
2878 # If it is, it will not operate correctly.
2880 # Sed substitution that helps us do robust quoting. It backslashifies
2881 # metacharacters that are still active within double-quoted strings.
2882 Xsed='sed -e 1s/^X//'
2883 sed_quote_subst='$sed_quote_subst'
2885 # The HP-UX ksh and POSIX shell print the target directory to stdout
2886 # if CDPATH is set.
2887 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
2889 relink_command=\"$relink_command\"
2891 # This environment variable determines our operation mode.
2892 if test \"\$libtool_install_magic\" = \"$magic\"; then
2893 # install mode needs the following variable:
2894 link_against_libtool_libs='$link_against_libtool_libs'
2895 else
2896 # When we are sourced in execute mode, \$file and \$echo are already set.
2897 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2898 echo=\"$qecho\"
2899 file=\"\$0\"
2900 # Make sure echo works.
2901 if test \"X\$1\" = X--no-reexec; then
2902 # Discard the --no-reexec flag, and continue.
2903 shift
2904 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2905 # Yippee, \$echo works!
2906 :
2907 else
2908 # Restart under the correct shell, and then maybe \$echo will work.
2909 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2910 fi
2911 fi\
2912 "
2913 $echo >> $output "\
2915 # Find the directory that this script lives in.
2916 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2917 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2919 # Follow symbolic links until we get to the real thisdir.
2920 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2921 while test -n \"\$file\"; do
2922 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2924 # If there was a directory component, then change thisdir.
2925 if test \"x\$destdir\" != \"x\$file\"; then
2926 case \"\$destdir\" in
2927 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2928 *) thisdir=\"\$thisdir/\$destdir\" ;;
2929 esac
2930 fi
2932 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2933 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2934 done
2936 # Try to get the absolute directory name.
2937 absdir=\`cd \"\$thisdir\" && pwd\`
2938 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2939 "
2941 if test "$fast_install" = yes; then
2942 echo >> $output "\
2943 program=lt-'$outputname'
2944 progdir=\"\$thisdir/$objdir\"
2946 if test ! -f \"\$progdir/\$program\" || \\
2947 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2948 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2950 file=\"\$\$-\$program\"
2952 if test ! -d \"\$progdir\"; then
2953 $mkdir \"\$progdir\"
2954 else
2955 $rm \"\$progdir/\$file\"
2956 fi"
2958 echo >> $output "\
2960 # relink executable if necessary
2961 if test -n \"\$relink_command\"; then
2962 if (cd \"\$thisdir\" && eval \$relink_command); then :
2963 else
2964 $rm \"\$progdir/\$file\"
2965 exit 1
2966 fi
2967 fi
2969 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2970 { $rm \"\$progdir/\$program\";
2971 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2972 $rm \"\$progdir/\$file\"
2973 fi"
2974 else
2975 echo >> $output "\
2976 program='$outputname$exeext'
2977 progdir=\"\$thisdir/$objdir\"
2978 "
2979 fi
2981 echo >> $output "\
2983 if test -f \"\$progdir/\$program\"; then"
2985 # Export our shlibpath_var if we have one.
2986 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2987 $echo >> $output "\
2988 # Add our own library path to $shlibpath_var
2989 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2991 # Some systems cannot cope with colon-terminated $shlibpath_var
2992 # The second colon is a workaround for a bug in BeOS R4 sed
2993 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2995 export $shlibpath_var
2996 "
2997 fi
2999 # fixup the dll searchpath if we need to.
3000 if test -n "$dllsearchpath"; then
3001 $echo >> $output "\
3002 # Add the dll search path components to the executable PATH
3003 PATH=$dllsearchpath:\$PATH
3004 "
3005 fi
3007 $echo >> $output "\
3008 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3009 # Run the actual program with our arguments.
3010 "
3011 case $host in
3012 *-*-cygwin* | *-*-mingw | *-*-os2*)
3013 # win32 systems need to use the prog path for dll
3014 # lookup to work
3015 $echo >> $output "\
3016 exec \$progdir\\\\\$program \${1+\"\$@\"}
3017 "
3018 ;;
3019 *)
3020 $echo >> $output "\
3021 # Export the path to the program.
3022 PATH=\"\$progdir:\$PATH\"
3023 export PATH
3025 exec \$program \${1+\"\$@\"}
3026 "
3027 ;;
3028 esac
3029 $echo >> $output "\
3030 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3031 exit 1
3032 fi
3033 else
3034 # The program doesn't exist.
3035 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3036 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3037 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3038 exit 1
3039 fi
3040 fi\
3041 "
3042 chmod +x $output
3043 fi
3044 exit 0
3045 ;;
3046 esac
3048 # See if we need to build an old-fashioned archive.
3049 for oldlib in $oldlibs; do
3051 if test "$build_libtool_libs" = convenience; then
3052 oldobjs="$libobjs_save"
3053 addlibs="$convenience"
3054 build_libtool_libs=no
3055 else
3056 if test "$build_libtool_libs" = module; then
3057 oldobjs="$libobjs_save"
3058 build_libtool_libs=no
3059 else
3060 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3061 fi
3062 addlibs="$old_convenience"
3063 fi
3065 if test -n "$addlibs"; then
3066 gentop="$output_objdir/${outputname}x"
3067 $show "${rm}r $gentop"
3068 $run ${rm}r "$gentop"
3069 $show "mkdir $gentop"
3070 $run mkdir "$gentop"
3071 status=$?
3072 if test $status -ne 0 && test ! -d "$gentop"; then
3073 exit $status
3074 fi
3075 generated="$generated $gentop"
3077 # Add in members from convenience archives.
3078 for xlib in $addlibs; do
3079 # Extract the objects.
3080 case "$xlib" in
3081 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3082 *) xabs=`pwd`"/$xlib" ;;
3083 esac
3084 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3085 xdir="$gentop/$xlib"
3087 $show "${rm}r $xdir"
3088 $run ${rm}r "$xdir"
3089 $show "mkdir $xdir"
3090 $run mkdir "$xdir"
3091 status=$?
3092 if test $status -ne 0 && test ! -d "$xdir"; then
3093 exit $status
3094 fi
3095 $show "(cd $xdir && $AR x $xabs)"
3096 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3098 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3099 done
3100 fi
3102 # Do each command in the archive commands.
3103 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3104 eval cmds=\"$old_archive_from_new_cmds\"
3105 else
3106 # Ensure that we have .o objects in place incase we decided
3107 # not to build a shared library, and have fallen back to building
3108 # static libs even though --disable-static was passed!
3109 for oldobj in $oldobjs; do
3110 if test ! -f $oldobj; then
3111 obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"`
3112 $show "${LN_S} $obj $oldobj"
3113 $run ${LN_S} $obj $oldobj || exit $?
3114 fi
3115 done
3117 eval cmds=\"$old_archive_cmds\"
3118 fi
3119 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3120 for cmd in $cmds; do
3121 IFS="$save_ifs"
3122 $show "$cmd"
3123 $run eval "$cmd" || exit $?
3124 done
3125 IFS="$save_ifs"
3126 done
3128 if test -n "$generated"; then
3129 $show "${rm}r$generated"
3130 $run ${rm}r$generated
3131 fi
3133 # Now create the libtool archive.
3134 case "$output" in
3135 *.la)
3136 old_library=
3137 if test "$release_suffix" = all; then
3138 test "$build_old_libs" = yes && old_library="$libname$release.$libext"
3139 else
3140 test "$build_old_libs" = yes && old_library="$libname.$libext"
3141 fi
3142 $show "creating $output"
3144 if test -n "$xrpath"; then
3145 temp_xrpath=
3146 for libdir in $xrpath; do
3147 temp_xrpath="$temp_xrpath -R$libdir"
3148 done
3149 dependency_libs="$temp_xrpath $dependency_libs"
3150 fi
3152 # Only create the output if not a dry run.
3153 if test -z "$run"; then
3154 for installed in no yes; do
3155 if test "$installed" = yes; then
3156 if test -z "$install_libdir"; then
3157 break
3158 fi
3159 output="$output_objdir/$outputname"i
3160 fi
3161 $rm $output
3162 $echo > $output "\
3163 # $outputname - a libtool library file
3164 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3165 #
3166 # Please DO NOT delete this file!
3167 # It is necessary for linking the library.
3169 # The name that we can dlopen(3).
3170 dlname='$dlname'
3172 # Names of this library.
3173 library_names='$library_names'
3175 # The name of the static archive.
3176 old_library='$old_library'
3178 # Libraries that this one depends upon.
3179 dependency_libs='$dependency_libs'
3181 # Version information for $libname.
3182 current=$current
3183 age=$age
3184 revision=$revision
3186 # Is this an already installed library?
3187 installed=$installed
3189 # Directory that this library needs to be installed in:
3190 libdir='$install_libdir'\
3191 "
3192 done
3193 fi
3195 # Do a symbolic link so that the libtool archive can be found in
3196 # LD_LIBRARY_PATH before the program is installed.
3197 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3198 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3199 ;;
3200 esac
3201 exit 0
3202 ;;
3204 # libtool install mode
3205 install)
3206 modename="$modename: install"
3208 # There may be an optional sh(1) argument at the beginning of
3209 # install_prog (especially on Windows NT).
3210 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3211 # Aesthetically quote it.
3212 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3213 case "$arg" in
3214 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3215 arg="\"$arg\""
3216 ;;
3217 esac
3218 install_prog="$arg "
3219 arg="$1"
3220 shift
3221 else
3222 install_prog=
3223 arg="$nonopt"
3224 fi
3226 # The real first argument should be the name of the installation program.
3227 # Aesthetically quote it.
3228 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3229 case "$arg" in
3230 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3231 arg="\"$arg\""
3232 ;;
3233 esac
3234 install_prog="$install_prog$arg"
3236 # We need to accept at least all the BSD install flags.
3237 dest=
3238 files=
3239 opts=
3240 prev=
3241 install_type=
3242 isdir=no
3243 stripme=
3244 for arg
3245 do
3246 if test -n "$dest"; then
3247 files="$files $dest"
3248 dest="$arg"
3249 continue
3250 fi
3252 case "$arg" in
3253 -d) isdir=yes ;;
3254 -f) prev="-f" ;;
3255 -g) prev="-g" ;;
3256 -m) prev="-m" ;;
3257 -o) prev="-o" ;;
3258 -s)
3259 stripme=" -s"
3260 continue
3261 ;;
3262 -*) ;;
3264 *)
3265 # If the previous option needed an argument, then skip it.
3266 if test -n "$prev"; then
3267 prev=
3268 else
3269 dest="$arg"
3270 continue
3271 fi
3272 ;;
3273 esac
3275 # Aesthetically quote the argument.
3276 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3277 case "$arg" in
3278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3279 arg="\"$arg\""
3280 ;;
3281 esac
3282 install_prog="$install_prog $arg"
3283 done
3285 if test -z "$install_prog"; then
3286 $echo "$modename: you must specify an install program" 1>&2
3287 $echo "$help" 1>&2
3288 exit 1
3289 fi
3291 if test -n "$prev"; then
3292 $echo "$modename: the \`$prev' option requires an argument" 1>&2
3293 $echo "$help" 1>&2
3294 exit 1
3295 fi
3297 if test -z "$files"; then
3298 if test -z "$dest"; then
3299 $echo "$modename: no file or destination specified" 1>&2
3300 else
3301 $echo "$modename: you must specify a destination" 1>&2
3302 fi
3303 $echo "$help" 1>&2
3304 exit 1
3305 fi
3307 # Strip any trailing slash from the destination.
3308 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3310 # Check to see that the destination is a directory.
3311 test -d "$dest" && isdir=yes
3312 if test "$isdir" = yes; then
3313 destdir="$dest"
3314 destname=
3315 else
3316 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3317 test "X$destdir" = "X$dest" && destdir=.
3318 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3320 # Not a directory, so check to see that there is only one file specified.
3321 set dummy $files
3322 if test $# -gt 2; then
3323 $echo "$modename: \`$dest' is not a directory" 1>&2
3324 $echo "$help" 1>&2
3325 exit 1
3326 fi
3327 fi
3328 case "$destdir" in
3329 [\\/]* | [A-Za-z]:[\\/]*) ;;
3330 *)
3331 for file in $files; do
3332 case "$file" in
3333 *.lo) ;;
3334 *)
3335 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3336 $echo "$help" 1>&2
3337 exit 1
3338 ;;
3339 esac
3340 done
3341 ;;
3342 esac
3344 # This variable tells wrapper scripts just to set variables rather
3345 # than running their programs.
3346 libtool_install_magic="$magic"
3348 staticlibs=
3349 future_libdirs=
3350 current_libdirs=
3351 for file in $files; do
3353 # Do each installation.
3354 case "$file" in
3355 *.a | *.lib)
3356 # Do the static libraries later.
3357 staticlibs="$staticlibs $file"
3358 ;;
3360 *.la)
3361 # Check to see that this really is a libtool archive.
3362 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3363 else
3364 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3365 $echo "$help" 1>&2
3366 exit 1
3367 fi
3369 library_names=
3370 old_library=
3371 # If there is no directory component, then add one.
3372 case "$file" in
3373 */* | *\\*) . $file ;;
3374 *) . ./$file ;;
3375 esac
3377 # Add the libdir to current_libdirs if it is the destination.
3378 if test "X$destdir" = "X$libdir"; then
3379 case "$current_libdirs " in
3380 *" $libdir "*) ;;
3381 *) current_libdirs="$current_libdirs $libdir" ;;
3382 esac
3383 else
3384 # Note the libdir as a future libdir.
3385 case "$future_libdirs " in
3386 *" $libdir "*) ;;
3387 *) future_libdirs="$future_libdirs $libdir" ;;
3388 esac
3389 fi
3391 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3392 test "X$dir" = "X$file/" && dir=
3393 dir="$dir$objdir"
3395 # See the names of the shared library.
3396 set dummy $library_names
3397 if test -n "$2"; then
3398 realname="$2"
3399 shift
3400 shift
3402 # Install the shared library and build the symlinks.
3403 $show "$install_prog $dir/$realname $destdir/$realname"
3404 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3406 if test $# -gt 0; then
3407 # Delete the old symlinks, and create new ones.
3408 for linkname
3409 do
3410 if test "$linkname" != "$realname"; then
3411 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3412 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3413 fi
3414 done
3415 fi
3417 # Do each command in the postinstall commands.
3418 lib="$destdir/$realname"
3419 eval cmds=\"$postinstall_cmds\"
3420 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3421 for cmd in $cmds; do
3422 IFS="$save_ifs"
3423 $show "$cmd"
3424 $run eval "$cmd" || exit $?
3425 done
3426 IFS="$save_ifs"
3427 fi
3429 # Install the pseudo-library for information purposes.
3430 if test "$install_ltlibs" = yes; then
3431 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3432 instname="$dir/$name"i
3433 $show "$install_prog $instname $destdir/$name"
3434 $run eval "$install_prog $instname $destdir/$name" || exit $?
3435 fi
3437 # Maybe install the static library, too.
3438 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3439 ;;
3441 *.lo)
3442 # Install (i.e. copy) a libtool object.
3444 # Figure out destination file name, if it wasn't already specified.
3445 if test -n "$destname"; then
3446 destfile="$destdir/$destname"
3447 else
3448 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3449 destfile="$destdir/$destfile"
3450 fi
3452 # Deduce the name of the destination old-style object file.
3453 case "$destfile" in
3454 *.lo)
3455 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3456 ;;
3457 *.o | *.obj)
3458 staticdest="$destfile"
3459 destfile=
3460 ;;
3461 *)
3462 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3463 $echo "$help" 1>&2
3464 exit 1
3465 ;;
3466 esac
3468 # Install the libtool object if requested.
3469 if test -n "$destfile"; then
3470 $show "$install_prog $file $destfile"
3471 $run eval "$install_prog $file $destfile" || exit $?
3472 fi
3474 # Install the old object if enabled.
3475 if test "$build_old_libs" = yes; then
3476 # Deduce the name of the old-style object file.
3477 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3479 $show "$install_prog $staticobj $staticdest"
3480 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3481 fi
3482 exit 0
3483 ;;
3485 *)
3486 # Figure out destination file name, if it wasn't already specified.
3487 if test -n "$destname"; then
3488 destfile="$destdir/$destname"
3489 else
3490 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3491 destfile="$destdir/$destfile"
3492 fi
3494 # Do a test to see if this is really a libtool program.
3495 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3496 link_against_libtool_libs=
3497 relink_command=
3499 # If there is no directory component, then add one.
3500 case "$file" in
3501 */* | *\\*) . $file ;;
3502 *) . ./$file ;;
3503 esac
3505 # Check the variables that should have been set.
3506 if test -z "$link_against_libtool_libs"; then
3507 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3508 exit 1
3509 fi
3511 finalize=yes
3512 for lib in $link_against_libtool_libs; do
3513 # Check to see that each library is installed.
3514 libdir=
3515 if test -f "$lib"; then
3516 # If there is no directory component, then add one.
3517 case "$lib" in
3518 */* | *\\*) . $lib ;;
3519 *) . ./$lib ;;
3520 esac
3521 fi
3522 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3523 if test -n "$libdir" && test ! -f "$libfile"; then
3524 finalize=no
3525 fi
3526 done
3528 outputname=
3529 if test "$fast_install" = no && test -n "$relink_command"; then
3530 if test "$finalize" = yes && test -z "$run"; then
3531 tmpdir="/tmp"
3532 test -n "$TMPDIR" && tmpdir="$TMPDIR"
3533 tmpdir="$tmpdir/libtool-$$"
3534 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3535 else
3536 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3537 continue
3538 fi
3539 outputname="$tmpdir/$file"
3540 # Replace the output file specification.
3541 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3543 $show "$relink_command"
3544 if $run eval "$relink_command"; then :
3545 else
3546 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3547 ${rm}r "$tmpdir"
3548 continue
3549 fi
3550 file="$outputname"
3551 else
3552 $echo "$modename: warning: cannot relink \`$file'" 1>&2
3553 fi
3554 else
3555 # Install the binary that we compiled earlier.
3556 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3557 fi
3558 fi
3560 $show "$install_prog$stripme $file $destfile"
3561 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3562 test -n "$outputname" && ${rm}r "$tmpdir"
3563 ;;
3564 esac
3565 done
3567 for file in $staticlibs; do
3568 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3570 # Set up the ranlib parameters.
3571 oldlib="$destdir/$name"
3573 $show "$install_prog $file $oldlib"
3574 $run eval "$install_prog \$file \$oldlib" || exit $?
3576 # Do each command in the postinstall commands.
3577 eval cmds=\"$old_postinstall_cmds\"
3578 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3579 for cmd in $cmds; do
3580 IFS="$save_ifs"
3581 $show "$cmd"
3582 $run eval "$cmd" || exit $?
3583 done
3584 IFS="$save_ifs"
3585 done
3587 if test -n "$future_libdirs"; then
3588 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3589 fi
3591 if test -n "$current_libdirs"; then
3592 # Maybe just do a dry run.
3593 test -n "$run" && current_libdirs=" -n$current_libdirs"
3594 exec $SHELL $0 --finish$current_libdirs
3595 exit 1
3596 fi
3598 exit 0
3599 ;;
3601 # libtool finish mode
3602 finish)
3603 modename="$modename: finish"
3604 libdirs="$nonopt"
3605 admincmds=
3607 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3608 for dir
3609 do
3610 libdirs="$libdirs $dir"
3611 done
3613 for libdir in $libdirs; do
3614 if test -n "$finish_cmds"; then
3615 # Do each command in the finish commands.
3616 eval cmds=\"$finish_cmds\"
3617 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3618 for cmd in $cmds; do
3619 IFS="$save_ifs"
3620 $show "$cmd"
3621 $run eval "$cmd" || admincmds="$admincmds
3622 $cmd"
3623 done
3624 IFS="$save_ifs"
3625 fi
3626 if test -n "$finish_eval"; then
3627 # Do the single finish_eval.
3628 eval cmds=\"$finish_eval\"
3629 $run eval "$cmds" || admincmds="$admincmds
3630 $cmds"
3631 fi
3632 done
3633 fi
3635 # Exit here if they wanted silent mode.
3636 test "$show" = : && exit 0
3638 echo "----------------------------------------------------------------------"
3639 echo "Libraries have been installed in:"
3640 for libdir in $libdirs; do
3641 echo " $libdir"
3642 done
3643 echo
3644 echo "If you ever happen to want to link against installed libraries"
3645 echo "in a given directory, LIBDIR, you must either use libtool, and"
3646 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3647 echo "flag during linking and do at least one of the following:"
3648 if test -n "$shlibpath_var"; then
3649 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3650 echo " during execution"
3651 fi
3652 if test -n "$runpath_var"; then
3653 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3654 echo " during linking"
3655 fi
3656 if test -n "$hardcode_libdir_flag_spec"; then
3657 libdir=LIBDIR
3658 eval flag=\"$hardcode_libdir_flag_spec\"
3660 echo " - use the \`$flag' linker flag"
3661 fi
3662 if test -n "$admincmds"; then
3663 echo " - have your system administrator run these commands:$admincmds"
3664 fi
3665 if test -f /etc/ld.so.conf; then
3666 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3667 fi
3668 echo
3669 echo "See any operating system documentation about shared libraries for"
3670 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3671 echo "----------------------------------------------------------------------"
3672 exit 0
3673 ;;
3675 # libtool execute mode
3676 execute)
3677 modename="$modename: execute"
3679 # The first argument is the command name.
3680 cmd="$nonopt"
3681 if test -z "$cmd"; then
3682 $echo "$modename: you must specify a COMMAND" 1>&2
3683 $echo "$help"
3684 exit 1
3685 fi
3687 # Handle -dlopen flags immediately.
3688 for file in $execute_dlfiles; do
3689 if test ! -f "$file"; then
3690 $echo "$modename: \`$file' is not a file" 1>&2
3691 $echo "$help" 1>&2
3692 exit 1
3693 fi
3695 dir=
3696 case "$file" in
3697 *.la)
3698 # Check to see that this really is a libtool archive.
3699 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3700 else
3701 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3702 $echo "$help" 1>&2
3703 exit 1
3704 fi
3706 # Read the libtool library.
3707 dlname=
3708 library_names=
3710 # If there is no directory component, then add one.
3711 case "$file" in
3712 */* | *\\*) . $file ;;
3713 *) . ./$file ;;
3714 esac
3716 # Skip this library if it cannot be dlopened.
3717 if test -z "$dlname"; then
3718 # Warn if it was a shared library.
3719 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3720 continue
3721 fi
3723 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3724 test "X$dir" = "X$file" && dir=.
3726 if test -f "$dir/$objdir/$dlname"; then
3727 dir="$dir/$objdir"
3728 else
3729 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3730 exit 1
3731 fi
3732 ;;
3734 *.lo)
3735 # Just add the directory containing the .lo file.
3736 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3737 test "X$dir" = "X$file" && dir=.
3738 ;;
3740 *)
3741 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3742 continue
3743 ;;
3744 esac
3746 # Get the absolute pathname.
3747 absdir=`cd "$dir" && pwd`
3748 test -n "$absdir" && dir="$absdir"
3750 # Now add the directory to shlibpath_var.
3751 if eval "test -z \"\$$shlibpath_var\""; then
3752 eval "$shlibpath_var=\"\$dir\""
3753 else
3754 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3755 fi
3756 done
3758 # This variable tells wrapper scripts just to set shlibpath_var
3759 # rather than running their programs.
3760 libtool_execute_magic="$magic"
3762 # Check if any of the arguments is a wrapper script.
3763 args=
3764 for file
3765 do
3766 case "$file" in
3767 -*) ;;
3768 *)
3769 # Do a test to see if this is really a libtool program.
3770 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3771 # If there is no directory component, then add one.
3772 case "$file" in
3773 */* | *\\*) . $file ;;
3774 *) . ./$file ;;
3775 esac
3777 # Transform arg to wrapped name.
3778 file="$progdir/$program"
3779 fi
3780 ;;
3781 esac
3782 # Quote arguments (to preserve shell metacharacters).
3783 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3784 args="$args \"$file\""
3785 done
3787 if test -z "$run"; then
3788 # Export the shlibpath_var.
3789 eval "export $shlibpath_var"
3791 # Restore saved enviroment variables
3792 if test "${save_LC_ALL+set}" = set; then
3793 LC_ALL="$save_LC_ALL"; export LC_ALL
3794 fi
3795 if test "${save_LANG+set}" = set; then
3796 LANG="$save_LANG"; export LANG
3797 fi
3799 # Now actually exec the command.
3800 eval "exec \$cmd$args"
3802 $echo "$modename: cannot exec \$cmd$args"
3803 exit 1
3804 else
3805 # Display what would be done.
3806 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3807 $echo "export $shlibpath_var"
3808 $echo "$cmd$args"
3809 exit 0
3810 fi
3811 ;;
3813 # libtool uninstall mode
3814 uninstall)
3815 modename="$modename: uninstall"
3816 rm="$nonopt"
3817 files=
3819 for arg
3820 do
3821 case "$arg" in
3822 -*) rm="$rm $arg" ;;
3823 *) files="$files $arg" ;;
3824 esac
3825 done
3827 if test -z "$rm"; then
3828 $echo "$modename: you must specify an RM program" 1>&2
3829 $echo "$help" 1>&2
3830 exit 1
3831 fi
3833 for file in $files; do
3834 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3835 test "X$dir" = "X$file" && dir=.
3836 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3838 rmfiles="$file"
3840 case "$name" in
3841 *.la)
3842 # Possibly a libtool archive, so verify it.
3843 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3844 . $dir/$name
3846 # Delete the libtool libraries and symlinks.
3847 for n in $library_names; do
3848 rmfiles="$rmfiles $dir/$n"
3849 done
3850 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3852 $show "$rm $rmfiles"
3853 $run $rm $rmfiles
3855 if test -n "$library_names"; then
3856 # Do each command in the postuninstall commands.
3857 eval cmds=\"$postuninstall_cmds\"
3858 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3859 for cmd in $cmds; do
3860 IFS="$save_ifs"
3861 $show "$cmd"
3862 $run eval "$cmd"
3863 done
3864 IFS="$save_ifs"
3865 fi
3867 if test -n "$old_library"; then
3868 # Do each command in the old_postuninstall commands.
3869 eval cmds=\"$old_postuninstall_cmds\"
3870 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3871 for cmd in $cmds; do
3872 IFS="$save_ifs"
3873 $show "$cmd"
3874 $run eval "$cmd"
3875 done
3876 IFS="$save_ifs"
3877 fi
3879 # FIXME: should reinstall the best remaining shared library.
3880 fi
3881 ;;
3883 *.lo)
3884 if test "$build_old_libs" = yes; then
3885 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3886 rmfiles="$rmfiles $dir/$oldobj"
3887 fi
3888 $show "$rm $rmfiles"
3889 $run $rm $rmfiles
3890 ;;
3892 *)
3893 $show "$rm $rmfiles"
3894 $run $rm $rmfiles
3895 ;;
3896 esac
3897 done
3898 exit 0
3899 ;;
3901 "")
3902 $echo "$modename: you must specify a MODE" 1>&2
3903 $echo "$generic_help" 1>&2
3904 exit 1
3905 ;;
3906 esac
3908 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3909 $echo "$generic_help" 1>&2
3910 exit 1
3911 fi # test -z "$show_help"
3913 # We need to display help for each of the modes.
3914 case "$mode" in
3915 "") $echo \
3916 "Usage: $modename [OPTION]... [MODE-ARG]...
3918 Provide generalized library-building support services.
3920 --config show all configuration variables
3921 --debug enable verbose shell tracing
3922 -n, --dry-run display commands without modifying any files
3923 --features display basic configuration information and exit
3924 --finish same as \`--mode=finish'
3925 --help display this help message and exit
3926 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
3927 --quiet same as \`--silent'
3928 --silent don't print informational messages
3929 --version print version information
3931 MODE must be one of the following:
3933 compile compile a source file into a libtool object
3934 execute automatically set library path, then run a program
3935 finish complete the installation of libtool libraries
3936 install install libraries or executables
3937 link create a library or an executable
3938 uninstall remove libraries from an installed directory
3940 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3941 a more detailed description of MODE."
3942 exit 0
3943 ;;
3945 compile)
3946 $echo \
3947 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3949 Compile a source file into a libtool library object.
3951 This mode accepts the following additional options:
3953 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3954 -static always build a \`.o' file suitable for static linking
3956 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3957 from the given SOURCEFILE.
3959 The output file name is determined by removing the directory component from
3960 SOURCEFILE, then substituting the C source code suffix \`.c' with the
3961 library object suffix, \`.lo'."
3962 ;;
3964 execute)
3965 $echo \
3966 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3968 Automatically set library path, then run a program.
3970 This mode accepts the following additional options:
3972 -dlopen FILE add the directory containing FILE to the library path
3974 This mode sets the library path environment variable according to \`-dlopen'
3975 flags.
3977 If any of the ARGS are libtool executable wrappers, then they are translated
3978 into their corresponding uninstalled binary, and any of their required library
3979 directories are added to the library path.
3981 Then, COMMAND is executed, with ARGS as arguments."
3982 ;;
3984 finish)
3985 $echo \
3986 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3988 Complete the installation of libtool libraries.
3990 Each LIBDIR is a directory that contains libtool libraries.
3992 The commands that this mode executes may require superuser privileges. Use
3993 the \`--dry-run' option if you just want to see what would be executed."
3994 ;;
3996 install)
3997 $echo \
3998 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4000 Install executables or libraries.
4002 INSTALL-COMMAND is the installation command. The first component should be
4003 either the \`install' or \`cp' program.
4005 The rest of the components are interpreted as arguments to that command (only
4006 BSD-compatible install options are recognized)."
4007 ;;
4009 link)
4010 $echo \
4011 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4013 Link object files or libraries together to form another library, or to
4014 create an executable program.
4016 LINK-COMMAND is a command using the C compiler that you would use to create
4017 a program from several object files.
4019 The following components of LINK-COMMAND are treated specially:
4021 -all-static do not do any dynamic linking at all
4022 -avoid-version do not add a version suffix if possible
4023 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4024 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4025 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4026 -export-symbols SYMFILE
4027 try to export only the symbols listed in SYMFILE
4028 -export-symbols-regex REGEX
4029 try to export only the symbols matching REGEX
4030 -LLIBDIR search LIBDIR for required installed libraries
4031 -lNAME OUTPUT-FILE requires the installed library libNAME
4032 -module build a library that can dlopened
4033 -no-undefined declare that a library does not refer to external symbols
4034 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4035 -release RELEASE specify package release information
4036 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4037 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4038 -static do not do any dynamic linking of libtool libraries
4039 -version-info CURRENT[:REVISION[:AGE]]
4040 specify library version info [each variable defaults to 0]
4042 All other options (arguments beginning with \`-') are ignored.
4044 Every other argument is treated as a filename. Files ending in \`.la' are
4045 treated as uninstalled libtool libraries, other files are standard or library
4046 object files.
4048 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4049 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4050 required, except when creating a convenience library.
4052 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4053 using \`ar' and \`ranlib', or on Windows using \`lib'.
4055 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4056 is created, otherwise an executable program is created."
4057 ;;
4059 uninstall)
4060 $echo \
4061 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4063 Remove libraries from an installation directory.
4065 RM is the name of the program to use to delete files associated with each FILE
4066 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4067 to RM.
4069 If FILE is a libtool library, all the files associated with it are deleted.
4070 Otherwise, only FILE itself is deleted using RM."
4071 ;;
4073 *)
4074 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4075 $echo "$help" 1>&2
4076 exit 1
4077 ;;
4078 esac
4080 echo
4081 $echo "Try \`$modename --help' for more information about other modes."
4083 exit 0
4085 # Local Variables:
4086 # mode:shell-script
4087 # sh-indentation:2
4088 # End: