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