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