1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28: if test "X$1" = X--no-reexec; then
29:
30: shift
31: elif test "X$1" = X--fallback-echo; then
32:
33: :
34: elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35:
36: :
37: else
38:
39: exec $SHELL "$0" --no-reexec ${1+"$@"}
40: fi
41:
42: if test "X$1" = X--fallback-echo; then
43:
44: shift
45: cat <<EOF
46: $*
47: EOF
48: exit 0
49: fi
50:
51:
52: test -z "$SED" && SED=sed
53:
54:
55: progname=`$echo "$0" | ${SED} 's%^.*/%%'`
56: modename="$progname"
57:
58:
59: PROGRAM=ltmain.sh
60: PACKAGE=libtool
61: VERSION=1.4.3
62: TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
63:
64: default_mode=
65: help="Try \`$progname --help' for more information."
66: magic="%%%MAGIC variable%%%"
67: mkdir="mkdir"
68: mv="mv -f"
69: rm="rm -f"
70:
71:
72:
73: Xsed="${SED}"' -e 1s/^X//'
74: sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75:
76: case `echo A|od -x` in
77: *[Cc]1*)
78: SP2NL="tr '\100' '\n'"
79: NL2SP="tr '\r\n' '\100\100'"
80: ;;
81: *)
82: SP2NL="tr '\040' '\012'"
83: NL2SP="tr '\015\012' '\040\040'"
84: ;;
85: esac
86:
87:
88:
89:
90:
91:
92: if test "${LC_ALL+set}" = set; then
93: save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
94: fi
95: if test "${LANG+set}" = set; then
96: save_LANG="$LANG"; LANG=C; export LANG
97: fi
98:
99:
100: : ${IFS=" "}
101:
102: if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103: echo "$modename: not configured to build any kind of library" 1>&2
104: echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105: exit 1
106: fi
107:
108:
109: mode=$default_mode
110: nonopt=
111: prev=
112: prevopt=
113: run=
114: show="$echo"
115: show_help=
116: execute_dlfiles=
117: lo2o="s/\\.lo\$/.${objext}/"
118: o2lo="s/\\.${objext}\$/.lo/"
119:
120:
121: while test $# -gt 0
122: do
123: arg="$1"
124: shift
125:
126: case $arg in
127: -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
128: *) optarg= ;;
129: esac
130:
131:
132: if test -n "$prev"; then
133: case $prev in
134: execute_dlfiles)
135: execute_dlfiles="$execute_dlfiles $arg"
136: ;;
137: *)
138: eval "$prev=\$arg"
139: ;;
140: esac
141:
142: prev=
143: prevopt=
144: continue
145: fi
146:
147:
148: case $arg in
149: --help)
150: show_help=yes
151: ;;
152:
153: --version)
154: echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
155: exit 0
156: ;;
157:
158: --config)
159: ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
160: exit 0
161: ;;
162:
163: --debug)
164: echo "$progname: enabling shell trace mode"
165: set -x
166: ;;
167:
168: --dry-run | -n)
169: run=:
170: ;;
171:
172: --features)
173: echo "host: $host"
174: if test "$build_libtool_libs" = yes; then
175: echo "enable shared libraries"
176: else
177: echo "disable shared libraries"
178: fi
179: if test "$build_old_libs" = yes; then
180: echo "enable static libraries"
181: else
182: echo "disable static libraries"
183: fi
184: exit 0
185: ;;
186:
187: --finish) mode="finish" ;;
188:
189: --mode) prevopt="--mode" prev=mode ;;
190: --mode=*) mode="$optarg" ;;
191:
192: --preserve-dup-deps) duplicate_deps="yes" ;;
193:
194: --quiet | --silent)
195: show=:
196: ;;
197:
198: -dlopen)
199: prevopt="-dlopen"
200: prev=execute_dlfiles
201: ;;
202:
203: -*)
204: $echo "$modename: unrecognized option \`$arg'" 1>&2
205: $echo "$help" 1>&2
206: exit 1
207: ;;
208:
209: *)
210: nonopt="$arg"
211: break
212: ;;
213: esac
214: done
215:
216: if test -n "$prevopt"; then
217: $echo "$modename: option \`$prevopt' requires an argument" 1>&2
218: $echo "$help" 1>&2
219: exit 1
220: fi
221:
222:
223:
224:
225: exec_cmd=
226:
227: if test -z "$show_help"; then
228:
229:
230: if test -z "$mode"; then
231: case $nonopt in
232: *cc | *++ | gcc* | *-gcc* | xlc*)
233: mode=link
234: for arg
235: do
236: case $arg in
237: -c)
238: mode=compile
239: break
240: ;;
241: esac
242: done
243: ;;
244: *db | *dbx | *strace | *truss)
245: mode=execute
246: ;;
247: *install*|cp|mv)
248: mode=install
249: ;;
250: *rm)
251: mode=uninstall
252: ;;
253: *)
254:
255: test -n "$execute_dlfiles" && mode=execute
256:
257:
258: if test -z "$mode"; then
259: if test -n "$nonopt"; then
260: $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
261: else
262: $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
263: fi
264: fi
265: ;;
266: esac
267: fi
268:
269:
270: if test -n "$execute_dlfiles" && test "$mode" != execute; then
271: $echo "$modename: unrecognized option \`-dlopen'" 1>&2
272: $echo "$help" 1>&2
273: exit 1
274: fi
275:
276:
277: generic_help="$help"
278: help="Try \`$modename --help --mode=$mode' for more information."
279:
280:
281: case $mode in
282:
283: compile)
284: modename="$modename: compile"
285:
286: base_compile=
287: prev=
288: lastarg=
289: srcfile="$nonopt"
290: suppress_output=
291:
292: user_target=no
293: for arg
294: do
295: case $prev in
296: "") ;;
297: xcompiler)
298:
299: prev=
300: lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
301:
302: case $arg in
303:
304:
305:
306: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
307: arg="\"$arg\""
308: ;;
309: esac
310:
311:
312: if test -z "$base_compile"; then
313: base_compile="$lastarg"
314: else
315: base_compile="$base_compile $lastarg"
316: fi
317: continue
318: ;;
319: esac
320:
321:
322: case $arg in
323: -o)
324: if test "$user_target" != "no"; then
325: $echo "$modename: you cannot specify \`-o' more than once" 1>&2
326: exit 1
327: fi
328: user_target=next
329: ;;
330:
331: -static)
332: build_old_libs=yes
333: continue
334: ;;
335:
336: -prefer-pic)
337: pic_mode=yes
338: continue
339: ;;
340:
341: -prefer-non-pic)
342: pic_mode=no
343: continue
344: ;;
345:
346: -Xcompiler)
347: prev=xcompiler
348: continue
349: ;;
350:
351: -Wc,*)
352: args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
353: lastarg=
354: save_ifs="$IFS"; IFS=','
355: for arg in $args; do
356: IFS="$save_ifs"
357:
358:
359:
360:
361: case $arg in
362: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
363: arg="\"$arg\""
364: ;;
365: esac
366: lastarg="$lastarg $arg"
367: done
368: IFS="$save_ifs"
369: lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
370:
371:
372: if test -z "$base_compile"; then
373: base_compile="$lastarg"
374: else
375: base_compile="$base_compile $lastarg"
376: fi
377: continue
378: ;;
379: esac
380:
381: case $user_target in
382: next)
383:
384: user_target=yes
385: continue
386: ;;
387: yes)
388:
389: user_target=set
390: libobj="$arg"
391: continue
392: ;;
393: esac
394:
395:
396: lastarg="$srcfile"
397: srcfile="$arg"
398:
399:
400:
401:
402:
403:
404: lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
405:
406:
407:
408:
409: case $lastarg in
410: *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
411: lastarg="\"$lastarg\""
412: ;;
413: esac
414:
415:
416: if test -z "$base_compile"; then
417: base_compile="$lastarg"
418: else
419: base_compile="$base_compile $lastarg"
420: fi
421: done
422:
423: case $user_target in
424: set)
425: ;;
426: no)
427:
428: libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
429: ;;
430: *)
431: $echo "$modename: you must specify a target with \`-o'" 1>&2
432: exit 1
433: ;;
434: esac
435:
436:
437:
438: xform='[cCFSfmso]'
439: case $libobj in
440: *.ada) xform=ada ;;
441: *.adb) xform=adb ;;
442: *.ads) xform=ads ;;
443: *.asm) xform=asm ;;
444: *.c++) xform=c++ ;;
445: *.cc) xform=cc ;;
446: *.cpp) xform=cpp ;;
447: *.cxx) xform=cxx ;;
448: *.f90) xform=f90 ;;
449: *.for) xform=for ;;
450: esac
451:
452: libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
453:
454: case $libobj in
455: *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
456: *)
457: $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
458: exit 1
459: ;;
460: esac
461:
462: if test -z "$base_compile"; then
463: $echo "$modename: you must specify a compilation command" 1>&2
464: $echo "$help" 1>&2
465: exit 1
466: fi
467:
468:
469: if test "$build_old_libs" = yes; then
470: removelist="$obj $libobj"
471: else
472: removelist="$libobj"
473: fi
474:
475: $run $rm $removelist
476: trap "$run $rm $removelist; exit 1" 1 2 15
477:
478:
479: case $host_os in
480: cygwin* | mingw* | pw32* | os2*)
481: pic_mode=default
482: ;;
483: esac
484: if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
485:
486: pic_mode=default
487: fi
488:
489:
490:
491: if test "$compiler_c_o" = no; then
492: output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
493: lockfile="$output_obj.lock"
494: removelist="$removelist $output_obj $lockfile"
495: trap "$run $rm $removelist; exit 1" 1 2 15
496: else
497: need_locks=no
498: lockfile=
499: fi
500:
501:
502:
503: if test "$need_locks" = yes; then
504: until $run ln "$0" "$lockfile" 2>/dev/null; do
505: $show "Waiting for $lockfile to be removed"
506: sleep 2
507: done
508: elif test "$need_locks" = warn; then
509: if test -f "$lockfile"; then
510: echo "\
511: *** ERROR, $lockfile exists and contains:
512: `cat $lockfile 2>/dev/null`
513:
514: This indicates that another process is trying to use the same
515: temporary object file, and libtool could not work around it because
516: your compiler does not support \`-c' and \`-o' together. If you
517: repeat this compilation, it may succeed, by chance, but you had better
518: avoid parallel builds (make -j) in this platform, or get a better
519: compiler."
520:
521: $run $rm $removelist
522: exit 1
523: fi
524: echo $srcfile > "$lockfile"
525: fi
526:
527: if test -n "$fix_srcfile_path"; then
528: eval srcfile=\"$fix_srcfile_path\"
529: fi
530:
531:
532: if test "$build_libtool_libs" = yes; then
533:
534: fbsd_hideous_sh_bug=$base_compile
535:
536: if test "$pic_mode" != no; then
537:
538: command="$base_compile $srcfile $pic_flag -DPIC"
539: else
540:
541: command="$base_compile $srcfile"
542: fi
543: if test "$build_old_libs" = yes; then
544: lo_libobj="$libobj"
545: dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
546: if test "X$dir" = "X$libobj"; then
547: dir="$objdir"
548: else
549: dir="$dir/$objdir"
550: fi
551: libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
552:
553: if test -d "$dir"; then
554: $show "$rm $libobj"
555: $run $rm $libobj
556: else
557: $show "$mkdir $dir"
558: $run $mkdir $dir
559: status=$?
560: if test $status -ne 0 && test ! -d $dir; then
561: exit $status
562: fi
563: fi
564: fi
565: if test "$compiler_o_lo" = yes; then
566: output_obj="$libobj"
567: command="$command -o $output_obj"
568: elif test "$compiler_c_o" = yes; then
569: output_obj="$obj"
570: command="$command -o $output_obj"
571: fi
572:
573: $run $rm "$output_obj"
574: $show "$command"
575: if $run eval "$command"; then :
576: else
577: test -n "$output_obj" && $run $rm $removelist
578: exit 1
579: fi
580:
581: if test "$need_locks" = warn &&
582: test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
583: echo "\
584: *** ERROR, $lockfile contains:
585: `cat $lockfile 2>/dev/null`
586:
587: but it should contain:
588: $srcfile
589:
590: This indicates that another process is trying to use the same
591: temporary object file, and libtool could not work around it because
592: your compiler does not support \`-c' and \`-o' together. If you
593: repeat this compilation, it may succeed, by chance, but you had better
594: avoid parallel builds (make -j) in this platform, or get a better
595: compiler."
596:
597: $run $rm $removelist
598: exit 1
599: fi
600:
601:
602: if test x"$output_obj" != x"$libobj"; then
603: $show "$mv $output_obj $libobj"
604: if $run $mv $output_obj $libobj; then :
605: else
606: error=$?
607: $run $rm $removelist
608: exit $error
609: fi
610: fi
611:
612:
613: if (test -z "$pic_flag" || test "$pic_mode" != default) &&
614: test "$build_old_libs" = yes; then
615:
616: if