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