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