ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/pxys2-2.0.0/libopas/ltmain.sh
Revision: 3252
Committed: Wed Apr 2 20:41:43 2014 UTC (9 years, 11 months ago) by michael
Content type: text/x-sh
File size: 185215 byte(s)
Log Message:
- Imported pxys2-2.0.0

File Contents

# Content
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 #
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
33 :
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
36 :
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
40 fi
41
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
46 $*
47 EOF
48 exit 0
49 fi
50
51 # The name of this program.
52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53 modename="$progname"
54
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.5
59 TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"
60
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
67
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed="${SED}"' -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 # test EBCDIC or ASCII
73 case `echo A|od -x` in
74 *[Cc]1*) # EBCDIC based system
75 SP2NL="tr '\100' '\n'"
76 NL2SP="tr '\r\n' '\100\100'"
77 ;;
78 *) # Assume ASCII based system
79 SP2NL="tr '\040' '\012'"
80 NL2SP="tr '\015\012' '\040\040'"
81 ;;
82 esac
83
84 # NLS nuisances.
85 # Only set LANG and LC_ALL to C if already set.
86 # These must not be set unconditionally because not all systems understand
87 # e.g. LANG=C (notably SCO).
88 # We save the old values to restore during execute mode.
89 if test "${LC_ALL+set}" = set; then
90 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91 fi
92 if test "${LANG+set}" = set; then
93 save_LANG="$LANG"; LANG=C; export LANG
94 fi
95
96 # Make sure IFS has a sensible default
97 : ${IFS=" "}
98
99 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100 $echo "$modename: not configured to build any kind of library" 1>&2
101 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
102 exit 1
103 fi
104
105 # Global variables.
106 mode=$default_mode
107 nonopt=
108 prev=
109 prevopt=
110 run=
111 show="$echo"
112 show_help=
113 execute_dlfiles=
114 lo2o="s/\\.lo\$/.${objext}/"
115 o2lo="s/\\.${objext}\$/.lo/"
116
117 #####################################
118 # Shell function definitions:
119 # This seems to be the best place for them
120
121 # Need a lot of goo to handle *both* DLLs and import libs
122 # Has to be a shell function in order to 'eat' the argument
123 # that is supplied when $file_magic_command is called.
124 win32_libid () {
125 win32_libid_type="unknown"
126 win32_fileres=`file -L $1 2>/dev/null`
127 case $win32_fileres in
128 *ar\ archive\ import\ library*) # definitely import
129 win32_libid_type="x86 archive import"
130 ;;
131 *ar\ archive*) # could be an import, or static
132 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134 win32_nmres=`eval $NM -f posix -A $1 | \
135 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136 if test "X$win32_nmres" = "Ximport" ; then
137 win32_libid_type="x86 archive import"
138 else
139 win32_libid_type="x86 archive static"
140 fi
141 fi
142 ;;
143 *DLL*)
144 win32_libid_type="x86 DLL"
145 ;;
146 *executable*) # but shell scripts are "executable" too...
147 case $win32_fileres in
148 *MS\ Windows\ PE\ Intel*)
149 win32_libid_type="x86 DLL"
150 ;;
151 esac
152 ;;
153 esac
154 $echo $win32_libid_type
155 }
156
157 # End of Shell function definitions
158 #####################################
159
160 # Parse our command line options once, thoroughly.
161 while test "$#" -gt 0
162 do
163 arg="$1"
164 shift
165
166 case $arg in
167 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
168 *) optarg= ;;
169 esac
170
171 # If the previous option needs an argument, assign it.
172 if test -n "$prev"; then
173 case $prev in
174 execute_dlfiles)
175 execute_dlfiles="$execute_dlfiles $arg"
176 ;;
177 tag)
178 tagname="$arg"
179
180 # Check whether tagname contains only valid characters
181 case $tagname in
182 *[!-_A-Za-z0-9,/]*)
183 $echo "$progname: invalid tag name: $tagname" 1>&2
184 exit 1
185 ;;
186 esac
187
188 case $tagname in
189 CC)
190 # Don't test for the "default" C tag, as we know, it's there, but
191 # not specially marked.
192 ;;
193 *)
194 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
195 taglist="$taglist $tagname"
196 # Evaluate the configuration.
197 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
198 else
199 $echo "$progname: ignoring unknown tag $tagname" 1>&2
200 fi
201 ;;
202 esac
203 ;;
204 *)
205 eval "$prev=\$arg"
206 ;;
207 esac
208
209 prev=
210 prevopt=
211 continue
212 fi
213
214 # Have we seen a non-optional argument yet?
215 case $arg in
216 --help)
217 show_help=yes
218 ;;
219
220 --version)
221 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222 $echo
223 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
224 $echo "This is free software; see the source for copying conditions. There is NO"
225 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226 exit 0
227 ;;
228
229 --config)
230 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
231 # Now print the configurations for the tags.
232 for tagname in $taglist; do
233 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
234 done
235 exit 0
236 ;;
237
238 --debug)
239 $echo "$progname: enabling shell trace mode"
240 set -x
241 ;;
242
243 --dry-run | -n)
244 run=:
245 ;;
246
247 --features)
248 $echo "host: $host"
249 if test "$build_libtool_libs" = yes; then
250 $echo "enable shared libraries"
251 else
252 $echo "disable shared libraries"
253 fi
254 if test "$build_old_libs" = yes; then
255 $echo "enable static libraries"
256 else
257 $echo "disable static libraries"
258 fi
259 exit 0
260 ;;
261
262 --finish) mode="finish" ;;
263
264 --mode) prevopt="--mode" prev=mode ;;
265 --mode=*) mode="$optarg" ;;
266
267 --preserve-dup-deps) duplicate_deps="yes" ;;
268
269 --quiet | --silent)
270 show=:
271 ;;
272
273 --tag) prevopt="--tag" prev=tag ;;
274 --tag=*)
275 set tag "$optarg" ${1+"$@"}
276 shift
277 prev=tag
278 ;;
279
280 -dlopen)
281 prevopt="-dlopen"
282 prev=execute_dlfiles
283 ;;
284
285 -*)
286 $echo "$modename: unrecognized option \`$arg'" 1>&2
287 $echo "$help" 1>&2
288 exit 1
289 ;;
290
291 *)
292 nonopt="$arg"
293 break
294 ;;
295 esac
296 done
297
298 if test -n "$prevopt"; then
299 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
300 $echo "$help" 1>&2
301 exit 1
302 fi
303
304 # If this variable is set in any of the actions, the command in it
305 # will be execed at the end. This prevents here-documents from being
306 # left over by shells.
307 exec_cmd=
308
309 if test -z "$show_help"; then
310 archargs=
311 case $host in
312 *-*-darwin*)
313 # For darwin, separate arch arguments and apply them to all compile/link
314 # commands
315 doarch=
316 for arg; do
317 if test -n "$doarch"; then
318 archargs="$archargs -arch $arg"
319 doarch=
320 continue
321 fi
322 case $arg in
323 -arch) doarch=y;;
324 esac
325 done
326 esac
327
328 # Infer the operation mode.
329 if test -z "$mode"; then
330 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
331 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
332 case $nonopt in
333 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
334 mode=link
335 for arg
336 do
337 case $arg in
338 -c)
339 mode=compile
340 break
341 ;;
342 esac
343 done
344 ;;
345 *db | *dbx | *strace | *truss)
346 mode=execute
347 ;;
348 *install*|cp|mv)
349 mode=install
350 ;;
351 *rm)
352 mode=uninstall
353 ;;
354 *)
355 # If we have no mode, but dlfiles were specified, then do execute mode.
356 test -n "$execute_dlfiles" && mode=execute
357
358 # Just use the default operation mode.
359 if test -z "$mode"; then
360 if test -n "$nonopt"; then
361 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
362 else
363 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
364 fi
365 fi
366 ;;
367 esac
368 fi
369
370 # Only execute mode is allowed to have -dlopen flags.
371 if test -n "$execute_dlfiles" && test "$mode" != execute; then
372 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
373 $echo "$help" 1>&2
374 exit 1
375 fi
376
377 # Change the help message to a mode-specific one.
378 generic_help="$help"
379 help="Try \`$modename --help --mode=$mode' for more information."
380
381 # These modes are in order of execution frequency so that they run quickly.
382 case $mode in
383 # libtool compile mode
384 compile)
385 modename="$modename: compile"
386 # Get the compilation command and the source file.
387 base_compile=
388 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
389 suppress_output=
390 arg_mode=normal
391 libobj=
392
393 for arg
394 do
395 case "$arg_mode" in
396 arg )
397 # do not "continue". Instead, add this to base_compile
398 lastarg="$arg"
399 arg_mode=normal
400 ;;
401
402 target )
403 libobj="$arg"
404 arg_mode=normal
405 continue
406 ;;
407
408 normal )
409 # Accept any command-line options.
410 case $arg in
411 -o)
412 if test -n "$libobj" ; then
413 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
414 exit 1
415 fi
416 arg_mode=target
417 continue
418 ;;
419
420 -static)
421 build_old_libs=yes
422 continue
423 ;;
424
425 -prefer-pic)
426 pic_mode=yes
427 continue
428 ;;
429
430 -prefer-non-pic)
431 pic_mode=no
432 continue
433 ;;
434
435 -Xcompiler)
436 arg_mode=arg # the next one goes into the "base_compile" arg list
437 continue # The current "srcfile" will either be retained or
438 ;; # replaced later. I would guess that would be a bug.
439
440 -Wc,*)
441 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
442 lastarg=
443 save_ifs="$IFS"; IFS=','
444 for arg in $args; do
445 IFS="$save_ifs"
446
447 # Double-quote args containing other shell metacharacters.
448 # Many Bourne shells cannot handle close brackets correctly
449 # in scan sets, so we specify it separately.
450 case $arg in
451 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
452 arg="\"$arg\""
453 ;;
454 esac
455 lastarg="$lastarg $arg"
456 done
457 IFS="$save_ifs"
458 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
459
460 # Add the arguments to base_compile.
461 base_compile="$base_compile $lastarg"
462 continue
463 ;;
464
465 * )
466 # Accept the current argument as the source file.
467 # The previous "srcfile" becomes the current argument.
468 #
469 lastarg="$srcfile"
470 srcfile="$arg"
471 ;;
472 esac # case $arg
473 ;;
474 esac # case $arg_mode
475
476 # Aesthetically quote the previous argument.
477 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
478
479 case $lastarg in
480 # Double-quote args containing other shell metacharacters.
481 # Many Bourne shells cannot handle close brackets correctly
482 # in scan sets, so we specify it separately.
483 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
484 lastarg="\"$lastarg\""
485 ;;
486 esac
487
488 base_compile="$base_compile $lastarg"
489 done # for arg
490
491 case $arg_mode in
492 arg)
493 $echo "$modename: you must specify an argument for -Xcompile"
494 exit 1
495 ;;
496 target)
497 $echo "$modename: you must specify a target with \`-o'" 1>&2
498 exit 1
499 ;;
500 *)
501 # Get the name of the library object.
502 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
503 ;;
504 esac
505
506 # Recognize several different file suffixes.
507 # If the user specifies -o file.o, it is replaced with file.lo
508 xform='[cCFSifmso]'
509 case $libobj in
510 *.ada) xform=ada ;;
511 *.adb) xform=adb ;;
512 *.ads) xform=ads ;;
513 *.asm) xform=asm ;;
514 *.c++) xform=c++ ;;
515 *.cc) xform=cc ;;
516 *.ii) xform=ii ;;
517 *.class) xform=class ;;
518 *.cpp) xform=cpp ;;
519 *.cxx) xform=cxx ;;
520 *.f90) xform=f90 ;;
521 *.for) xform=for ;;
522 *.java) xform=java ;;
523 esac
524
525 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
526
527 case $libobj in
528 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
529 *)
530 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
531 exit 1
532 ;;
533 esac
534
535 # Infer tagged configuration to use if any are available and
536 # if one wasn't chosen via the "--tag" command line option.
537 # Only attempt this if the compiler in the base compile
538 # command doesn't match the default compiler.
539 if test -n "$available_tags" && test -z "$tagname"; then
540 case $base_compile in
541 # Blanks in the command may have been stripped by the calling shell,
542 # but not from the CC environment variable when configure was run.
543 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
544 # Blanks at the start of $base_compile will cause this to fail
545 # if we don't check for them as well.
546 *)
547 for z in $available_tags; do
548 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
549 # Evaluate the configuration.
550 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
551 case "$base_compile " in
552 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
553 # The compiler in the base compile command matches
554 # the one in the tagged configuration.
555 # Assume this is the tagged configuration we want.
556 tagname=$z
557 break
558 ;;
559 esac
560 fi
561 done
562 # If $tagname still isn't set, then no tagged configuration
563 # was found and let the user know that the "--tag" command
564 # line option must be used.
565 if test -z "$tagname"; then
566 $echo "$modename: unable to infer tagged configuration"
567 $echo "$modename: specify a tag with \`--tag'" 1>&2
568 exit 1
569 # else
570 # $echo "$modename: using $tagname tagged configuration"
571 fi
572 ;;
573 esac
574 fi
575
576 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
577 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
578 if test "X$xdir" = "X$obj"; then
579 xdir=
580 else
581 xdir=$xdir/
582 fi
583 lobj=${xdir}$objdir/$objname
584
585 if test -z "$base_compile"; then
586 $echo "$modename: you must specify a compilation command" 1>&2
587 $echo "$help" 1>&2
588 exit 1
589 fi
590
591 # Delete any leftover library objects.
592 if test "$build_old_libs" = yes; then
593 removelist="$obj $lobj $libobj ${libobj}T"
594 else
595 removelist="$lobj $libobj ${libobj}T"
596 fi
597
598 $run $rm $removelist
599 trap "$run $rm $removelist; exit 1" 1 2 15
600
601 # On Cygwin there's no "real" PIC flag so we must build both object types
602 case $host_os in
603 cygwin* | mingw* | pw32* | os2*)
604 pic_mode=default
605 ;;
606 esac
607 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
608 # non-PIC code in shared libraries is not supported
609 pic_mode=default
610 fi
611
612 # Calculate the filename of the output object if compiler does
613 # not support -o with -c
614 if test "$compiler_c_o" = no; then
615 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
616 lockfile="$output_obj.lock"
617 removelist="$removelist $output_obj $lockfile"
618 trap "$run $rm $removelist; exit 1" 1 2 15
619 else
620 output_obj=
621 need_locks=no
622 lockfile=
623 fi
624
625 # Lock this critical section if it is needed
626 # We use this script file to make the link, it avoids creating a new file
627 if test "$need_locks" = yes; then
628 until $run ln "$0" "$lockfile" 2>/dev/null; do
629 $show "Waiting for $lockfile to be removed"
630 sleep 2
631 done
632 elif test "$need_locks" = warn; then
633 if test -f "$lockfile"; then
634 $echo "\
635 *** ERROR, $lockfile exists and contains:
636 `cat $lockfile 2>/dev/null`
637
638 This indicates that another process is trying to use the same
639 temporary object file, and libtool could not work around it because
640 your compiler does not support \`-c' and \`-o' together. If you
641 repeat this compilation, it may succeed, by chance, but you had better
642 avoid parallel builds (make -j) in this platform, or get a better
643 compiler."
644
645 $run $rm $removelist
646 exit 1
647 fi
648 $echo $srcfile > "$lockfile"
649 fi
650
651 if test -n "$fix_srcfile_path"; then
652 eval srcfile=\"$fix_srcfile_path\"
653 fi
654
655 $run $rm "$libobj" "${libobj}T"
656
657 # Create a libtool object file (analogous to a ".la" file),
658 # but don't create it if we're doing a dry run.
659 test -z "$run" && cat > ${libobj}T <<EOF
660 # $libobj - a libtool object file
661 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
662 #
663 # Please DO NOT delete this file!
664 # It is necessary for linking the library.
665
666 # Name of the PIC object.
667 EOF
668
669 # Only build a PIC object if we are building libtool libraries.
670 if test "$build_libtool_libs" = yes; then
671 # Without this assignment, base_compile gets emptied.
672 fbsd_hideous_sh_bug=$base_compile
673
674 if test "$pic_mode" != no; then
675 command="$base_compile $srcfile $pic_flag"
676 else
677 # Don't build PIC code
678 command="$base_compile $srcfile"
679 fi
680
681 if test ! -d "${xdir}$objdir"; then
682 $show "$mkdir ${xdir}$objdir"
683 $run $mkdir ${xdir}$objdir
684 status=$?
685 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
686 exit $status
687 fi
688 fi
689
690 if test -z "$output_obj"; then
691 # Place PIC objects in $objdir
692 command="$command -o $lobj"
693 fi
694
695 $run $rm "$lobj" "$output_obj"
696
697 $show "$command"
698 if $run eval "$command"; then :
699 else
700 test -n "$output_obj" && $run $rm $removelist
701 exit 1
702 fi
703
704 if test "$need_locks" = warn &&
705 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
706 $echo "\
707 *** ERROR, $lockfile contains:
708 `cat $lockfile 2>/dev/null`
709
710 but it should contain:
711 $srcfile
712
713 This indicates that another process is trying to use the same
714 temporary object file, and libtool could not work around it because
715 your compiler does not support \`-c' and \`-o' together. If you
716 repeat this compilation, it may succeed, by chance, but you had better
717 avoid parallel builds (make -j) in this platform, or get a better
718 compiler."
719
720 $run $rm $removelist
721 exit 1
722 fi
723
724 # Just move the object if needed, then go on to compile the next one
725 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
726 $show "$mv $output_obj $lobj"
727 if $run $mv $output_obj $lobj; then :
728 else
729 error=$?
730 $run $rm $removelist
731 exit $error
732 fi
733 fi
734
735 # Append the name of the PIC object to the libtool object file.
736 test -z "$run" && cat >> ${libobj}T <<EOF
737 pic_object='$objdir/$objname'
738
739 EOF
740
741 # Allow error messages only from the first compilation.
742 suppress_output=' >/dev/null 2>&1'
743 else
744 # No PIC object so indicate it doesn't exist in the libtool
745 # object file.
746 test -z "$run" && cat >> ${libobj}T <<EOF
747 pic_object=none
748
749 EOF
750 fi
751
752 # Only build a position-dependent object if we build old libraries.
753 if test "$build_old_libs" = yes; then
754 if test "$pic_mode" != yes; then
755 # Don't build PIC code
756 command="$base_compile $srcfile"
757 else
758 command="$base_compile $srcfile $pic_flag"
759 fi
760 if test "$compiler_c_o" = yes; then
761 command="$command -o $obj"
762 fi
763
764 # Suppress compiler output if we already did a PIC compilation.
765 command="$command$suppress_output"
766 $run $rm "$obj" "$output_obj"
767 $show "$command"
768 if $run eval "$command"; then :
769 else
770 $run $rm $removelist
771 exit 1
772 fi
773
774 if test "$need_locks" = warn &&
775 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
776 $echo "\
777 *** ERROR, $lockfile contains:
778 `cat $lockfile 2>/dev/null`
779
780 but it should contain:
781 $srcfile
782
783 This indicates that another process is trying to use the same
784 temporary object file, and libtool could not work around it because
785 your compiler does not support \`-c' and \`-o' together. If you
786 repeat this compilation, it may succeed, by chance, but you had better
787 avoid parallel builds (make -j) in this platform, or get a better
788 compiler."
789
790 $run $rm $removelist
791 exit 1
792 fi
793
794 # Just move the object if needed
795 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
796 $show "$mv $output_obj $obj"
797 if $run $mv $output_obj $obj; then :
798 else
799 error=$?
800 $run $rm $removelist
801 exit $error
802 fi
803 fi
804
805 # Append the name of the non-PIC object the libtool object file.
806 # Only append if the libtool object file exists.
807 test -z "$run" && cat >> ${libobj}T <<EOF
808 # Name of the non-PIC object.
809 non_pic_object='$objname'
810
811 EOF
812 else
813 # Append the name of the non-PIC object the libtool object file.
814 # Only append if the libtool object file exists.
815 test -z "$run" && cat >> ${libobj}T <<EOF
816 # Name of the non-PIC object.
817 non_pic_object=none
818
819 EOF
820 fi
821
822 $run $mv "${libobj}T" "${libobj}"
823
824 # Unlock the critical section if it was locked
825 if test "$need_locks" != no; then
826 $run $rm "$lockfile"
827 fi
828
829 exit 0
830 ;;
831
832 # libtool link mode
833 link | relink)
834 modename="$modename: link"
835 case $host in
836 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
837 # It is impossible to link a dll without this setting, and
838 # we shouldn't force the makefile maintainer to figure out
839 # which system we are compiling for in order to pass an extra
840 # flag for every libtool invocation.
841 # allow_undefined=no
842
843 # FIXME: Unfortunately, there are problems with the above when trying
844 # to make a dll which has undefined symbols, in which case not
845 # even a static library is built. For now, we need to specify
846 # -no-undefined on the libtool link line when we can be certain
847 # that all symbols are satisfied, otherwise we get a static library.
848 allow_undefined=yes
849 ;;
850 *)
851 allow_undefined=yes
852 ;;
853 esac
854 libtool_args="$nonopt"
855 base_compile="$nonopt"
856 compile_command="$nonopt"
857 finalize_command="$nonopt"
858
859 compile_rpath=
860 finalize_rpath=
861 compile_shlibpath=
862 finalize_shlibpath=
863 convenience=
864 old_convenience=
865 deplibs=
866 old_deplibs=
867 compiler_flags=
868 linker_flags=
869 dllsearchpath=
870 lib_search_path=`pwd`
871 inst_prefix_dir=
872
873 avoid_version=no
874 dlfiles=
875 dlprefiles=
876 dlself=no
877 export_dynamic=no
878 export_symbols=
879 export_symbols_regex=
880 generated=
881 libobjs=
882 ltlibs=
883 module=no
884 no_install=no
885 objs=
886 non_pic_objects=
887 prefer_static_libs=no
888 preload=no
889 prev=
890 prevarg=
891 release=
892 rpath=
893 xrpath=
894 perm_rpath=
895 temp_rpath=
896 thread_safe=no
897 vinfo=
898 vinfo_number=no
899
900 # We need to know -static, to get the right output filenames.
901 for arg
902 do
903 case $arg in
904 -all-static | -static)
905 if test "X$arg" = "X-all-static"; then
906 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
907 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
908 fi
909 if test -n "$link_static_flag"; then
910 dlopen_self=$dlopen_self_static
911 fi
912 else
913 if test -z "$pic_flag" && test -n "$link_static_flag"; then
914 dlopen_self=$dlopen_self_static
915 fi
916 fi
917 build_libtool_libs=no
918 build_old_libs=yes
919 prefer_static_libs=yes
920 break
921 ;;
922 esac
923 done
924
925 # See if our shared archives depend on static archives.
926 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
927
928 # Go through the arguments, transforming them on the way.
929 while test "$#" -gt 0; do
930 arg="$1"
931 base_compile="$base_compile $arg"
932 shift
933 case $arg in
934 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
935 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
936 ;;
937 *) qarg=$arg ;;
938 esac
939 libtool_args="$libtool_args $qarg"
940
941 # If the previous option needs an argument, assign it.
942 if test -n "$prev"; then
943 case $prev in
944 output)
945 compile_command="$compile_command @OUTPUT@"
946 finalize_command="$finalize_command @OUTPUT@"
947 ;;
948 esac
949
950 case $prev in
951 dlfiles|dlprefiles)
952 if test "$preload" = no; then
953 # Add the symbol object into the linking commands.
954 compile_command="$compile_command @SYMFILE@"
955 finalize_command="$finalize_command @SYMFILE@"
956 preload=yes
957 fi
958 case $arg in
959 *.la | *.lo) ;; # We handle these cases below.
960 force)
961 if test "$dlself" = no; then
962 dlself=needless
963 export_dynamic=yes
964 fi
965 prev=
966 continue
967 ;;
968 self)
969 if test "$prev" = dlprefiles; then
970 dlself=yes
971 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
972 dlself=yes
973 else
974 dlself=needless
975 export_dynamic=yes
976 fi
977 prev=
978 continue
979 ;;
980 *)
981 if test "$prev" = dlfiles; then
982 dlfiles="$dlfiles $arg"
983 else
984 dlprefiles="$dlprefiles $arg"
985 fi
986 prev=
987 continue
988 ;;
989 esac
990 ;;
991 expsyms)
992 export_symbols="$arg"
993 if test ! -f "$arg"; then
994 $echo "$modename: symbol file \`$arg' does not exist"
995 exit 1
996 fi
997 prev=
998 continue
999 ;;
1000 expsyms_regex)
1001 export_symbols_regex="$arg"
1002 prev=
1003 continue
1004 ;;
1005 inst_prefix)
1006 inst_prefix_dir="$arg"
1007 prev=
1008 continue
1009 ;;
1010 release)
1011 release="-$arg"
1012 prev=
1013 continue
1014 ;;
1015 objectlist)
1016 if test -f "$arg"; then
1017 save_arg=$arg
1018 moreargs=
1019 for fil in `cat $save_arg`
1020 do
1021 # moreargs="$moreargs $fil"
1022 arg=$fil
1023 # A libtool-controlled object.
1024
1025 # Check to see that this really is a libtool object.
1026 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1027 pic_object=
1028 non_pic_object=
1029
1030 # Read the .lo file
1031 # If there is no directory component, then add one.
1032 case $arg in
1033 */* | *\\*) . $arg ;;
1034 *) . ./$arg ;;
1035 esac
1036
1037 if test -z "$pic_object" || \
1038 test -z "$non_pic_object" ||
1039 test "$pic_object" = none && \
1040 test "$non_pic_object" = none; then
1041 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1042 exit 1
1043 fi
1044
1045 # Extract subdirectory from the argument.
1046 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1047 if test "X$xdir" = "X$arg"; then
1048 xdir=
1049 else
1050 xdir="$xdir/"
1051 fi
1052
1053 if test "$pic_object" != none; then
1054 # Prepend the subdirectory the object is found in.
1055 pic_object="$xdir$pic_object"
1056
1057 if test "$prev" = dlfiles; then
1058 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1059 dlfiles="$dlfiles $pic_object"
1060 prev=
1061 continue
1062 else
1063 # If libtool objects are unsupported, then we need to preload.
1064 prev=dlprefiles
1065 fi
1066 fi
1067
1068 # CHECK ME: I think I busted this. -Ossama
1069 if test "$prev" = dlprefiles; then
1070 # Preload the old-style object.
1071 dlprefiles="$dlprefiles $pic_object"
1072 prev=
1073 fi
1074
1075 # A PIC object.
1076 libobjs="$libobjs $pic_object"
1077 arg="$pic_object"
1078 fi
1079
1080 # Non-PIC object.
1081 if test "$non_pic_object" != none; then
1082 # Prepend the subdirectory the object is found in.
1083 non_pic_object="$xdir$non_pic_object"
1084
1085 # A standard non-PIC object
1086 non_pic_objects="$non_pic_objects $non_pic_object"
1087 if test -z "$pic_object" || test "$pic_object" = none ; then
1088 arg="$non_pic_object"
1089 fi
1090 fi
1091 else
1092 # Only an error if not doing a dry-run.
1093 if test -z "$run"; then
1094 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1095 exit 1
1096 else
1097 # Dry-run case.
1098
1099 # Extract subdirectory from the argument.
1100 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1101 if test "X$xdir" = "X$arg"; then
1102 xdir=
1103 else
1104 xdir="$xdir/"
1105 fi
1106
1107 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1108 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1109 libobjs="$libobjs $pic_object"
1110 non_pic_objects="$non_pic_objects $non_pic_object"
1111 fi
1112 fi
1113 done
1114 else
1115 $echo "$modename: link input file \`$save_arg' does not exist"
1116 exit 1
1117 fi
1118 arg=$save_arg
1119 prev=
1120 continue
1121 ;;
1122 rpath | xrpath)
1123 # We need an absolute path.
1124 case $arg in
1125 [\\/]* | [A-Za-z]:[\\/]*) ;;
1126 *)
1127 $echo "$modename: only absolute run-paths are allowed" 1>&2
1128 exit 1
1129 ;;
1130 esac
1131 if test "$prev" = rpath; then
1132 case "$rpath " in
1133 *" $arg "*) ;;
1134 *) rpath="$rpath $arg" ;;
1135 esac
1136 else
1137 case "$xrpath " in
1138 *" $arg "*) ;;
1139 *) xrpath="$xrpath $arg" ;;
1140 esac
1141 fi
1142 prev=
1143 continue
1144 ;;
1145 xcompiler)
1146 compiler_flags="$compiler_flags $qarg"
1147 prev=
1148 compile_command="$compile_command $qarg"
1149 finalize_command="$finalize_command $qarg"
1150 continue
1151 ;;
1152 xlinker)
1153 linker_flags="$linker_flags $qarg"
1154 compiler_flags="$compiler_flags $wl$qarg"
1155 prev=
1156 compile_command="$compile_command $wl$qarg"
1157 finalize_command="$finalize_command $wl$qarg"
1158 continue
1159 ;;
1160 xcclinker)
1161 linker_flags="$linker_flags $qarg"
1162 compiler_flags="$compiler_flags $qarg"
1163 prev=
1164 compile_command="$compile_command $qarg"
1165 finalize_command="$finalize_command $qarg"
1166 continue
1167 ;;
1168 *)
1169 eval "$prev=\"\$arg\""
1170 prev=
1171 continue
1172 ;;
1173 esac
1174 fi # test -n "$prev"
1175
1176 prevarg="$arg"
1177
1178 case $arg in
1179 -all-static)
1180 if test -n "$link_static_flag"; then
1181 compile_command="$compile_command $link_static_flag"
1182 finalize_command="$finalize_command $link_static_flag"
1183 fi
1184 continue
1185 ;;
1186
1187 -allow-undefined)
1188 # FIXME: remove this flag sometime in the future.
1189 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1190 continue
1191 ;;
1192
1193 -avoid-version)
1194 avoid_version=yes
1195 continue
1196 ;;
1197
1198 -dlopen)
1199 prev=dlfiles
1200 continue
1201 ;;
1202
1203 -dlpreopen)
1204 prev=dlprefiles
1205 continue
1206 ;;
1207
1208 -export-dynamic)
1209 export_dynamic=yes
1210 continue
1211 ;;
1212
1213 -export-symbols | -export-symbols-regex)
1214 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1215 $echo "$modename: more than one -exported-symbols argument is not allowed"
1216 exit 1
1217 fi
1218 if test "X$arg" = "X-export-symbols"; then
1219 prev=expsyms
1220 else
1221 prev=expsyms_regex
1222 fi
1223 continue
1224 ;;
1225
1226 -inst-prefix-dir)
1227 prev=inst_prefix
1228 continue
1229 ;;
1230
1231 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1232 # so, if we see these flags be careful not to treat them like -L
1233 -L[A-Z][A-Z]*:*)
1234 case $with_gcc/$host in
1235 no/*-*-irix* | /*-*-irix*)
1236 compile_command="$compile_command $arg"
1237 finalize_command="$finalize_command $arg"
1238 ;;
1239 esac
1240 continue
1241 ;;
1242
1243 -L*)
1244 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1245 # We need an absolute path.
1246 case $dir in
1247 [\\/]* | [A-Za-z]:[\\/]*) ;;
1248 *)
1249 absdir=`cd "$dir" && pwd`
1250 if test -z "$absdir"; then
1251 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1252 exit 1
1253 fi
1254 dir="$absdir"
1255 ;;
1256 esac
1257 case "$deplibs " in
1258 *" -L$dir "*) ;;
1259 *)
1260 deplibs="$deplibs -L$dir"
1261 lib_search_path="$lib_search_path $dir"
1262 ;;
1263 esac
1264 case $host in
1265 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1266 case :$dllsearchpath: in
1267 *":$dir:"*) ;;
1268 *) dllsearchpath="$dllsearchpath:$dir";;
1269 esac
1270 ;;
1271 esac
1272 continue
1273 ;;
1274
1275 -l*)
1276 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1277 case $host in
1278 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1279 # These systems don't actually have a C or math library (as such)
1280 continue
1281 ;;
1282 *-*-mingw* | *-*-os2*)
1283 # These systems don't actually have a C library (as such)
1284 test "X$arg" = "X-lc" && continue
1285 ;;
1286 *-*-openbsd* | *-*-freebsd*)
1287 # Do not include libc due to us having libc/libc_r.
1288 test "X$arg" = "X-lc" && continue
1289 ;;
1290 *-*-rhapsody* | *-*-darwin1.[012])
1291 # Rhapsody C and math libraries are in the System framework
1292 deplibs="$deplibs -framework System"
1293 continue
1294 esac
1295 elif test "X$arg" = "X-lc_r"; then
1296 case $host in
1297 *-*-openbsd* | *-*-freebsd*)
1298 # Do not include libc_r directly, use -pthread flag.
1299 continue
1300 ;;
1301 esac
1302 fi
1303 deplibs="$deplibs $arg"
1304 continue
1305 ;;
1306
1307 -module)
1308 module=yes
1309 continue
1310 ;;
1311
1312 # gcc -m* arguments should be passed to the linker via $compiler_flags
1313 # in order to pass architecture information to the linker
1314 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1315 # but this is not reliable with gcc because gcc may use -mfoo to
1316 # select a different linker, different libraries, etc, while
1317 # -Wl,-mfoo simply passes -mfoo to the linker.
1318 -m*)
1319 # Unknown arguments in both finalize_command and compile_command need
1320 # to be aesthetically quoted because they are evaled later.
1321 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1322 case $arg in
1323 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1324 arg="\"$arg\""
1325 ;;
1326 esac
1327 compile_command="$compile_command $arg"
1328 finalize_command="$finalize_command $arg"
1329 if test "$with_gcc" = "yes" ; then
1330 compiler_flags="$compiler_flags $arg"
1331 fi
1332 continue
1333 ;;
1334
1335 -shrext)
1336 prev=shrext
1337 continue
1338 ;;
1339
1340 -no-fast-install)
1341 fast_install=no
1342 continue
1343 ;;
1344
1345 -no-install)
1346 case $host in
1347 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1348 # The PATH hackery in wrapper scripts is required on Windows
1349 # in order for the loader to find any dlls it needs.
1350 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1351 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1352 fast_install=no
1353 ;;
1354 *) no_install=yes ;;
1355 esac
1356 continue
1357 ;;
1358
1359 -no-undefined)
1360 allow_undefined=no
1361 continue
1362 ;;
1363
1364 -objectlist)
1365 prev=objectlist
1366 continue
1367 ;;
1368
1369 -o) prev=output ;;
1370
1371 -release)
1372 prev=release
1373 continue
1374 ;;
1375
1376 -rpath)
1377 prev=rpath
1378 continue
1379 ;;
1380
1381 -R)
1382 prev=xrpath
1383 continue
1384 ;;
1385
1386 -R*)
1387 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1388 # We need an absolute path.
1389 case $dir in
1390 [\\/]* | [A-Za-z]:[\\/]*) ;;
1391 *)
1392 $echo "$modename: only absolute run-paths are allowed" 1>&2
1393 exit 1
1394 ;;
1395 esac
1396 case "$xrpath " in
1397 *" $dir "*) ;;
1398 *) xrpath="$xrpath $dir" ;;
1399 esac
1400 continue
1401 ;;
1402
1403 -static)
1404 # The effects of -static are defined in a previous loop.
1405 # We used to do the same as -all-static on platforms that
1406 # didn't have a PIC flag, but the assumption that the effects
1407 # would be equivalent was wrong. It would break on at least
1408 # Digital Unix and AIX.
1409 continue
1410 ;;
1411
1412 -thread-safe)
1413 thread_safe=yes
1414 continue
1415 ;;
1416
1417 -version-info)
1418 prev=vinfo
1419 continue
1420 ;;
1421 -version-number)
1422 prev=vinfo
1423 vinfo_number=yes
1424 continue
1425 ;;
1426
1427 -Wc,*)
1428 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1429 arg=
1430 save_ifs="$IFS"; IFS=','
1431 for flag in $args; do
1432 IFS="$save_ifs"
1433 case $flag in
1434 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1435 flag="\"$flag\""
1436 ;;
1437 esac
1438 arg="$arg $wl$flag"
1439 compiler_flags="$compiler_flags $flag"
1440 done
1441 IFS="$save_ifs"
1442 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1443 ;;
1444
1445 -Wl,*)
1446 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1447 arg=
1448 save_ifs="$IFS"; IFS=','
1449 for flag in $args; do
1450 IFS="$save_ifs"
1451 case $flag in
1452 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1453 flag="\"$flag\""
1454 ;;
1455 esac
1456 arg="$arg $wl$flag"
1457 compiler_flags="$compiler_flags $wl$flag"
1458 linker_flags="$linker_flags $flag"
1459 done
1460 IFS="$save_ifs"
1461 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1462 ;;
1463
1464 -Xcompiler)
1465 prev=xcompiler
1466 continue
1467 ;;
1468
1469 -Xlinker)
1470 prev=xlinker
1471 continue
1472 ;;
1473
1474 -XCClinker)
1475 prev=xcclinker
1476 continue
1477 ;;
1478
1479 # Some other compiler flag.
1480 -* | +*)
1481 # Unknown arguments in both finalize_command and compile_command need
1482 # to be aesthetically quoted because they are evaled later.
1483 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1484 case $arg in
1485 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1486 arg="\"$arg\""
1487 ;;
1488 esac
1489 ;;
1490
1491 *.$objext)
1492 # A standard object.
1493 objs="$objs $arg"
1494 ;;
1495
1496 *.lo)
1497 # A libtool-controlled object.
1498
1499 # Check to see that this really is a libtool object.
1500 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1501 pic_object=
1502 non_pic_object=
1503
1504 # Read the .lo file
1505 # If there is no directory component, then add one.
1506 case $arg in
1507 */* | *\\*) . $arg ;;
1508 *) . ./$arg ;;
1509 esac
1510
1511 if test -z "$pic_object" || \
1512 test -z "$non_pic_object" ||
1513 test "$pic_object" = none && \
1514 test "$non_pic_object" = none; then
1515 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1516 exit 1
1517 fi
1518
1519 # Extract subdirectory from the argument.
1520 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1521 if test "X$xdir" = "X$arg"; then
1522 xdir=
1523 else
1524 xdir="$xdir/"
1525 fi
1526
1527 if test "$pic_object" != none; then
1528 # Prepend the subdirectory the object is found in.
1529 pic_object="$xdir$pic_object"
1530
1531 if test "$prev" = dlfiles; then
1532 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1533 dlfiles="$dlfiles $pic_object"
1534 prev=
1535 continue
1536 else
1537 # If libtool objects are unsupported, then we need to preload.
1538 prev=dlprefiles
1539 fi
1540 fi
1541
1542 # CHECK ME: I think I busted this. -Ossama
1543 if test "$prev" = dlprefiles; then
1544 # Preload the old-style object.
1545 dlprefiles="$dlprefiles $pic_object"
1546 prev=
1547 fi
1548
1549 # A PIC object.
1550 libobjs="$libobjs $pic_object"
1551 arg="$pic_object"
1552 fi
1553
1554 # Non-PIC object.
1555 if test "$non_pic_object" != none; then
1556 # Prepend the subdirectory the object is found in.
1557 non_pic_object="$xdir$non_pic_object"
1558
1559 # A standard non-PIC object
1560 non_pic_objects="$non_pic_objects $non_pic_object"
1561 if test -z "$pic_object" || test "$pic_object" = none ; then
1562 arg="$non_pic_object"
1563 fi
1564 fi
1565 else
1566 # Only an error if not doing a dry-run.
1567 if test -z "$run"; then
1568 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1569 exit 1
1570 else
1571 # Dry-run case.
1572
1573 # Extract subdirectory from the argument.
1574 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1575 if test "X$xdir" = "X$arg"; then
1576 xdir=
1577 else
1578 xdir="$xdir/"
1579 fi
1580
1581 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1582 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1583 libobjs="$libobjs $pic_object"
1584 non_pic_objects="$non_pic_objects $non_pic_object"
1585 fi
1586 fi
1587 ;;
1588
1589 *.$libext)
1590 # An archive.
1591 deplibs="$deplibs $arg"
1592 old_deplibs="$old_deplibs $arg"
1593 continue
1594 ;;
1595
1596 *.la)
1597 # A libtool-controlled library.
1598
1599 if test "$prev" = dlfiles; then
1600 # This library was specified with -dlopen.
1601 dlfiles="$dlfiles $arg"
1602 prev=
1603 elif test "$prev" = dlprefiles; then
1604 # The library was specified with -dlpreopen.
1605 dlprefiles="$dlprefiles $arg"
1606 prev=
1607 else
1608 deplibs="$deplibs $arg"
1609 fi
1610 continue
1611 ;;
1612
1613 # Some other compiler argument.
1614 *)
1615 # Unknown arguments in both finalize_command and compile_command need
1616 # to be aesthetically quoted because they are evaled later.
1617 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1618 case $arg in
1619 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1620 arg="\"$arg\""
1621 ;;
1622 esac
1623 ;;
1624 esac # arg
1625
1626 # Now actually substitute the argument into the commands.
1627 if test -n "$arg"; then
1628 compile_command="$compile_command $arg"
1629 finalize_command="$finalize_command $arg"
1630 fi
1631 done # argument parsing loop
1632
1633 if test -n "$prev"; then
1634 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1635 $echo "$help" 1>&2
1636 exit 1
1637 fi
1638
1639 # Infer tagged configuration to use if any are available and
1640 # if one wasn't chosen via the "--tag" command line option.
1641 # Only attempt this if the compiler in the base link
1642 # command doesn't match the default compiler.
1643 if test -n "$available_tags" && test -z "$tagname"; then
1644 case $base_compile in
1645 # Blanks in the command may have been stripped by the calling shell,
1646 # but not from the CC environment variable when configure was run.
1647 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1648 # Blanks at the start of $base_compile will cause this to fail
1649 # if we don't check for them as well.
1650 *)
1651 for z in $available_tags; do
1652 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1653 # Evaluate the configuration.
1654 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1655 case $base_compile in
1656 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1657 # The compiler in $compile_command matches
1658 # the one in the tagged configuration.
1659 # Assume this is the tagged configuration we want.
1660 tagname=$z
1661 break
1662 ;;
1663 esac
1664 fi
1665 done
1666 # If $tagname still isn't set, then no tagged configuration
1667 # was found and let the user know that the "--tag" command
1668 # line option must be used.
1669 if test -z "$tagname"; then
1670 $echo "$modename: unable to infer tagged configuration"
1671 $echo "$modename: specify a tag with \`--tag'" 1>&2
1672 exit 1
1673 # else
1674 # $echo "$modename: using $tagname tagged configuration"
1675 fi
1676 ;;
1677 esac
1678 fi
1679
1680 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1681 eval arg=\"$export_dynamic_flag_spec\"
1682 compile_command="$compile_command $arg"
1683 finalize_command="$finalize_command $arg"
1684 fi
1685
1686 oldlibs=
1687 # calculate the name of the file, without its directory
1688 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1689 libobjs_save="$libobjs"
1690
1691 if test -n "$shlibpath_var"; then
1692 # get the directories listed in $shlibpath_var
1693 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1694 else
1695 shlib_search_path=
1696 fi
1697 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1698 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1699
1700 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1701 if test "X$output_objdir" = "X$output"; then
1702 output_objdir="$objdir"
1703 else
1704 output_objdir="$output_objdir/$objdir"
1705 fi
1706 # Create the object directory.
1707 if test ! -d "$output_objdir"; then
1708 $show "$mkdir $output_objdir"
1709 $run $mkdir $output_objdir
1710 status=$?
1711 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1712 exit $status
1713 fi
1714 fi
1715
1716 # Determine the type of output
1717 case $output in
1718 "")
1719 $echo "$modename: you must specify an output file" 1>&2
1720 $echo "$help" 1>&2
1721 exit 1
1722 ;;
1723 *.$libext) linkmode=oldlib ;;
1724 *.lo | *.$objext) linkmode=obj ;;
1725 *.la) linkmode=lib ;;
1726 *) linkmode=prog ;; # Anything else should be a program.
1727 esac
1728
1729 case $host in
1730 *cygwin* | *mingw* | *pw32*)
1731 # don't eliminate duplcations in $postdeps and $predeps
1732 duplicate_compiler_generated_deps=yes
1733 ;;
1734 *)
1735 duplicate_compiler_generated_deps=$duplicate_deps
1736 ;;
1737 esac
1738 specialdeplibs=
1739
1740 libs=
1741 # Find all interdependent deplibs by searching for libraries
1742 # that are linked more than once (e.g. -la -lb -la)
1743 for deplib in $deplibs; do
1744 if test "X$duplicate_deps" = "Xyes" ; then
1745 case "$libs " in
1746 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1747 esac
1748 fi
1749 libs="$libs $deplib"
1750 done
1751
1752 if test "$linkmode" = lib; then
1753 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1754
1755 # Compute libraries that are listed more than once in $predeps
1756 # $postdeps and mark them as special (i.e., whose duplicates are
1757 # not to be eliminated).
1758 pre_post_deps=
1759 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1760 for pre_post_dep in $predeps $postdeps; do
1761 case "$pre_post_deps " in
1762 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1763 esac
1764 pre_post_deps="$pre_post_deps $pre_post_dep"
1765 done
1766 fi
1767 pre_post_deps=
1768 fi
1769
1770 deplibs=
1771 newdependency_libs=
1772 newlib_search_path=
1773 need_relink=no # whether we're linking any uninstalled libtool libraries
1774 notinst_deplibs= # not-installed libtool libraries
1775 notinst_path= # paths that contain not-installed libtool libraries
1776 case $linkmode in
1777 lib)
1778 passes="conv link"
1779 for file in $dlfiles $dlprefiles; do
1780 case $file in
1781 *.la) ;;
1782 *)
1783 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1784 exit 1
1785 ;;
1786 esac
1787 done
1788 ;;
1789 prog)
1790 compile_deplibs=
1791 finalize_deplibs=
1792 alldeplibs=no
1793 newdlfiles=
1794 newdlprefiles=
1795 passes="conv scan dlopen dlpreopen link"
1796 ;;
1797 *) passes="conv"
1798 ;;
1799 esac
1800 for pass in $passes; do
1801 if test "$linkmode,$pass" = "lib,link" ||
1802 test "$linkmode,$pass" = "prog,scan"; then
1803 libs="$deplibs"
1804 deplibs=
1805 fi
1806 if test "$linkmode" = prog; then
1807 case $pass in
1808 dlopen) libs="$dlfiles" ;;
1809 dlpreopen) libs="$dlprefiles" ;;
1810 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1811 esac
1812 fi
1813 if test "$pass" = dlopen; then
1814 # Collect dlpreopened libraries
1815 save_deplibs="$deplibs"
1816 deplibs=
1817 fi
1818 for deplib in $libs; do
1819 lib=
1820 found=no
1821 case $deplib in
1822 -l*)
1823 if test "$linkmode" != lib && test "$linkmode" != prog; then
1824 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1825 continue
1826 fi
1827 if test "$pass" = conv; then
1828 deplibs="$deplib $deplibs"
1829 continue
1830 fi
1831 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1832 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1833 # Search the libtool library
1834 lib="$searchdir/lib${name}.la"
1835 if test -f "$lib"; then
1836 found=yes
1837 break
1838 fi
1839 done
1840 if test "$found" != yes; then
1841 # deplib doesn't seem to be a libtool library
1842 if test "$linkmode,$pass" = "prog,link"; then
1843 compile_deplibs="$deplib $compile_deplibs"
1844 finalize_deplibs="$deplib $finalize_deplibs"
1845 else
1846 deplibs="$deplib $deplibs"
1847 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1848 fi
1849 continue
1850 else # deplib is a libtool library
1851 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1852 # We need to do some special things here, and not later.
1853 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1854 case " $predeps $postdeps " in
1855 *" $deplib "*)
1856 if (${SED} -e '2q' $lib |
1857 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1858 library_names=
1859 old_library=
1860 case $lib in
1861 */* | *\\*) . $lib ;;
1862 *) . ./$lib ;;
1863 esac
1864 for l in $old_library $library_names; do
1865 ll="$l"
1866 done
1867 if test "X$ll" = "X$old_library" ; then # only static version available
1868 found=no
1869 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1870 test "X$ladir" = "X$lib" && ladir="."
1871 lib=$ladir/$old_library
1872 if test "$linkmode,$pass" = "prog,link"; then
1873 compile_deplibs="$deplib $compile_deplibs"
1874 finalize_deplibs="$deplib $finalize_deplibs"
1875 else
1876 deplibs="$deplib $deplibs"
1877 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1878 fi
1879 continue
1880 fi
1881 fi
1882 ;;
1883 *) ;;
1884 esac
1885 fi
1886 fi
1887 ;; # -l
1888 -L*)
1889 case $linkmode in
1890 lib)
1891 deplibs="$deplib $deplibs"
1892 test "$pass" = conv && continue
1893 newdependency_libs="$deplib $newdependency_libs"
1894 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1895 ;;
1896 prog)
1897 if test "$pass" = conv; then
1898 deplibs="$deplib $deplibs"
1899 continue
1900 fi
1901 if test "$pass" = scan; then
1902 deplibs="$deplib $deplibs"
1903 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1904 else
1905 compile_deplibs="$deplib $compile_deplibs"
1906 finalize_deplibs="$deplib $finalize_deplibs"
1907 fi
1908 ;;
1909 *)
1910 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1911 ;;
1912 esac # linkmode
1913 continue
1914 ;; # -L
1915 -R*)
1916 if test "$pass" = link; then
1917 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1918 # Make sure the xrpath contains only unique directories.
1919 case "$xrpath " in
1920 *" $dir "*) ;;
1921 *) xrpath="$xrpath $dir" ;;
1922 esac
1923 fi
1924 deplibs="$deplib $deplibs"
1925 continue
1926 ;;
1927 *.la) lib="$deplib" ;;
1928 *.$libext)
1929 if test "$pass" = conv; then
1930 deplibs="$deplib $deplibs"
1931 continue
1932 fi
1933 case $linkmode in
1934 lib)
1935 if test "$deplibs_check_method" != pass_all; then
1936 $echo
1937 $echo "*** Warning: Trying to link with static lib archive $deplib."
1938 $echo "*** I have the capability to make that library automatically link in when"
1939 $echo "*** you link to this library. But I can only do this if you have a"
1940 $echo "*** shared version of the library, which you do not appear to have"
1941 $echo "*** because the file extensions .$libext of this argument makes me believe"
1942 $echo "*** that it is just a static archive that I should not used here."
1943 else
1944 $echo
1945 $echo "*** Warning: Linking the shared library $output against the"
1946 $echo "*** static library $deplib is not portable!"
1947 deplibs="$deplib $deplibs"
1948 fi
1949 continue
1950 ;;
1951 prog)
1952 if test "$pass" != link; then
1953 deplibs="$deplib $deplibs"
1954 else
1955 compile_deplibs="$deplib $compile_deplibs"
1956 finalize_deplibs="$deplib $finalize_deplibs"
1957 fi
1958 continue
1959 ;;
1960 esac # linkmode
1961 ;; # *.$libext
1962 *.lo | *.$objext)
1963 if test "$pass" = conv; then
1964 deplibs="$deplib $deplibs"
1965 elif test "$linkmode" = prog; then
1966 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1967 # If there is no dlopen support or we're linking statically,
1968 # we need to preload.
1969 newdlprefiles="$newdlprefiles $deplib"
1970 compile_deplibs="$deplib $compile_deplibs"
1971 finalize_deplibs="$deplib $finalize_deplibs"
1972 else
1973 newdlfiles="$newdlfiles $deplib"
1974 fi
1975 fi
1976 continue
1977 ;;
1978 %DEPLIBS%)
1979 alldeplibs=yes
1980 continue
1981 ;;
1982 esac # case $deplib
1983 if test "$found" = yes || test -f "$lib"; then :
1984 else
1985 $echo "$modename: cannot find the library \`$lib'" 1>&2
1986 exit 1
1987 fi
1988
1989 # Check to see that this really is a libtool archive.
1990 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1991 else
1992 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1993 exit 1
1994 fi
1995
1996 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1997 test "X$ladir" = "X$lib" && ladir="."
1998
1999 dlname=
2000 dlopen=
2001 dlpreopen=
2002 libdir=
2003 library_names=
2004 old_library=
2005 # If the library was installed with an old release of libtool,
2006 # it will not redefine variables installed, or shouldnotlink
2007 installed=yes
2008 shouldnotlink=no
2009
2010 # Read the .la file
2011 case $lib in
2012 */* | *\\*) . $lib ;;
2013 *) . ./$lib ;;
2014 esac
2015
2016 if test "$linkmode,$pass" = "lib,link" ||
2017 test "$linkmode,$pass" = "prog,scan" ||
2018 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2019 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2020 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2021 fi
2022
2023 if test "$pass" = conv; then
2024 # Only check for convenience libraries
2025 deplibs="$lib $deplibs"
2026 if test -z "$libdir"; then
2027 if test -z "$old_library"; then
2028 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2029 exit 1
2030 fi
2031 # It is a libtool convenience library, so add in its objects.
2032 convenience="$convenience $ladir/$objdir/$old_library"
2033 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2034 tmp_libs=
2035 for deplib in $dependency_libs; do
2036 deplibs="$deplib $deplibs"
2037 if test "X$duplicate_deps" = "Xyes" ; then
2038 case "$tmp_libs " in
2039 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2040 esac
2041 fi
2042 tmp_libs="$tmp_libs $deplib"
2043 done
2044 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2045 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2046 exit 1
2047 fi
2048 continue
2049 fi # $pass = conv
2050
2051
2052 # Get the name of the library we link against.
2053 linklib=
2054 for l in $old_library $library_names; do
2055 linklib="$l"
2056 done
2057 if test -z "$linklib"; then
2058 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2059 exit 1
2060 fi
2061
2062 # This library was specified with -dlopen.
2063 if test "$pass" = dlopen; then
2064 if test -z "$libdir"; then
2065 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2066 exit 1
2067 fi
2068 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2069 # If there is no dlname, no dlopen support or we're linking
2070 # statically, we need to preload. We also need to preload any
2071 # dependent libraries so libltdl's deplib preloader doesn't
2072 # bomb out in the load deplibs phase.
2073 dlprefiles="$dlprefiles $lib $dependency_libs"
2074 else
2075 newdlfiles="$newdlfiles $lib"
2076 fi
2077 continue
2078 fi # $pass = dlopen
2079
2080 # We need an absolute path.
2081 case $ladir in
2082 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2083 *)
2084 abs_ladir=`cd "$ladir" && pwd`
2085 if test -z "$abs_ladir"; then
2086 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2087 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2088 abs_ladir="$ladir"
2089 fi
2090 ;;
2091 esac
2092 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2093
2094 # Find the relevant object directory and library name.
2095 if test "X$installed" = Xyes; then
2096 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2097 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2098 dir="$ladir"
2099 absdir="$abs_ladir"
2100 libdir="$abs_ladir"
2101 else
2102 dir="$libdir"
2103 absdir="$libdir"
2104 fi
2105 else
2106 dir="$ladir/$objdir"
2107 absdir="$abs_ladir/$objdir"
2108 # Remove this search path later
2109 notinst_path="$notinst_path $abs_ladir"
2110 fi # $installed = yes
2111 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2112
2113 # This library was specified with -dlpreopen.
2114 if test "$pass" = dlpreopen; then
2115 if test -z "$libdir"; then
2116 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2117 exit 1
2118 fi
2119 # Prefer using a static library (so that no silly _DYNAMIC symbols
2120 # are required to link).
2121 if test -n "$old_library"; then
2122 newdlprefiles="$newdlprefiles $dir/$old_library"
2123 # Otherwise, use the dlname, so that lt_dlopen finds it.
2124 elif test -n "$dlname"; then
2125 newdlprefiles="$newdlprefiles $dir/$dlname"
2126 else
2127 newdlprefiles="$newdlprefiles $dir/$linklib"
2128 fi
2129 fi # $pass = dlpreopen
2130
2131 if test -z "$libdir"; then
2132 # Link the convenience library
2133 if test "$linkmode" = lib; then
2134 deplibs="$dir/$old_library $deplibs"
2135 elif test "$linkmode,$pass" = "prog,link"; then
2136 compile_deplibs="$dir/$old_library $compile_deplibs"
2137 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2138 else
2139 deplibs="$lib $deplibs" # used for prog,scan pass
2140 fi
2141 continue
2142 fi
2143
2144
2145 if test "$linkmode" = prog && test "$pass" != link; then
2146 newlib_search_path="$newlib_search_path $ladir"
2147 deplibs="$lib $deplibs"
2148
2149 linkalldeplibs=no
2150 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2151 test "$build_libtool_libs" = no; then
2152 linkalldeplibs=yes
2153 fi
2154
2155 tmp_libs=
2156 for deplib in $dependency_libs; do
2157 case $deplib in
2158 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2159 esac
2160 # Need to link against all dependency_libs?
2161 if test "$linkalldeplibs" = yes; then
2162 deplibs="$deplib $deplibs"
2163 else
2164 # Need to hardcode shared library paths
2165 # or/and link against static libraries
2166 newdependency_libs="$deplib $newdependency_libs"
2167 fi
2168 if test "X$duplicate_deps" = "Xyes" ; then
2169 case "$tmp_libs " in
2170 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2171 esac
2172 fi
2173 tmp_libs="$tmp_libs $deplib"
2174 done # for deplib
2175 continue
2176 fi # $linkmode = prog...
2177
2178 if test "$linkmode,$pass" = "prog,link"; then
2179 if test -n "$library_names" &&
2180 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2181 # We need to hardcode the library path
2182 if test -n "$shlibpath_var"; then
2183 # Make sure the rpath contains only unique directories.
2184 case "$temp_rpath " in
2185 *" $dir "*) ;;
2186 *" $absdir "*) ;;
2187 *) temp_rpath="$temp_rpath $dir" ;;
2188 esac
2189 fi
2190
2191 # Hardcode the library path.
2192 # Skip directories that are in the system default run-time
2193 # search path.
2194 case " $sys_lib_dlsearch_path " in
2195 *" $absdir "*) ;;
2196 *)
2197 case "$compile_rpath " in
2198 *" $absdir "*) ;;
2199 *) compile_rpath="$compile_rpath $absdir"
2200 esac
2201 ;;
2202 esac
2203 case " $sys_lib_dlsearch_path " in
2204 *" $libdir "*) ;;
2205 *)
2206 case "$finalize_rpath " in
2207 *" $libdir "*) ;;
2208 *) finalize_rpath="$finalize_rpath $libdir"
2209 esac
2210 ;;
2211 esac
2212 fi # $linkmode,$pass = prog,link...
2213
2214 if test "$alldeplibs" = yes &&
2215 { test "$deplibs_check_method" = pass_all ||
2216 { test "$build_libtool_libs" = yes &&
2217 test -n "$library_names"; }; }; then
2218 # We only need to search for static libraries
2219 continue
2220 fi
2221 fi
2222
2223 link_static=no # Whether the deplib will be linked statically
2224 if test -n "$library_names" &&
2225 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2226 if test "$installed" = no; then
2227 notinst_deplibs="$notinst_deplibs $lib"
2228 need_relink=yes
2229 fi
2230 # This is a shared library
2231
2232 # Warn about portability, can't link against -module's on some systems (darwin)
2233 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2234 $echo
2235 if test "$linkmode" = prog; then
2236 $echo "*** Warning: Linking the executable $output against the loadable module"
2237 else
2238 $echo "*** Warning: Linking the shared library $output against the loadable module"
2239 fi
2240 $echo "*** $linklib is not portable!"
2241 fi
2242 if test "$linkmode" = lib &&
2243 test "$hardcode_into_libs" = yes; then
2244 # Hardcode the library path.
2245 # Skip directories that are in the system default run-time
2246 # search path.
2247 case " $sys_lib_dlsearch_path " in
2248 *" $absdir "*) ;;
2249 *)
2250 case "$compile_rpath " in
2251 *" $absdir "*) ;;
2252 *) compile_rpath="$compile_rpath $absdir"
2253 esac
2254 ;;
2255 esac
2256 case " $sys_lib_dlsearch_path " in
2257 *" $libdir "*) ;;
2258 *)
2259 case "$finalize_rpath " in
2260 *" $libdir "*) ;;
2261 *) finalize_rpath="$finalize_rpath $libdir"
2262 esac
2263 ;;
2264 esac
2265 fi
2266
2267 if test -n "$old_archive_from_expsyms_cmds"; then
2268 # figure out the soname
2269 set dummy $library_names
2270 realname="$2"
2271 shift; shift
2272 libname=`eval \\$echo \"$libname_spec\"`
2273 # use dlname if we got it. it's perfectly good, no?
2274 if test -n "$dlname"; then
2275 soname="$dlname"
2276 elif test -n "$soname_spec"; then
2277 # bleh windows
2278 case $host in
2279 *cygwin* | mingw*)
2280 major=`expr $current - $age`
2281 versuffix="-$major"
2282 ;;
2283 esac
2284 eval soname=\"$soname_spec\"
2285 else
2286 soname="$realname"
2287 fi
2288
2289 # Make a new name for the extract_expsyms_cmds to use
2290 soroot="$soname"
2291 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2292 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2293
2294 # If the library has no export list, then create one now
2295 if test -f "$output_objdir/$soname-def"; then :
2296 else
2297 $show "extracting exported symbol list from \`$soname'"
2298 save_ifs="$IFS"; IFS=$_S_
2299 eval cmds=\"$extract_expsyms_cmds\"
2300 for cmd in $cmds; do
2301 IFS="$save_ifs"
2302 $show "$cmd"
2303 $run eval "$cmd" || exit $?
2304 done
2305 IFS="$save_ifs"
2306 fi
2307
2308 # Create $newlib
2309 if test -f "$output_objdir/$newlib"; then :; else
2310 $show "generating import library for \`$soname'"
2311 save_ifs="$IFS"; IFS=$_S_
2312 eval cmds=\"$old_archive_from_expsyms_cmds\"
2313 for cmd in $cmds; do
2314 IFS="$save_ifs"
2315 $show "$cmd"
2316 $run eval "$cmd" || exit $?
2317 done
2318 IFS="$save_ifs"
2319 fi
2320 # make sure the library variables are pointing to the new library
2321 dir=$output_objdir
2322 linklib=$newlib
2323 fi # test -n "$old_archive_from_expsyms_cmds"
2324
2325 if test "$linkmode" = prog || test "$mode" != relink; then
2326 add_shlibpath=
2327 add_dir=
2328 add=
2329 lib_linked=yes
2330 case $hardcode_action in
2331 immediate | unsupported)
2332 if test "$hardcode_direct" = no; then
2333 add="$dir/$linklib"
2334 case $host in
2335 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2336 *-*-darwin* )
2337 # if the lib is a module then we can not link against it, someone
2338 # is ignoring the new warnings I added
2339 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2340 $echo "** Warning, lib $linklib is a module, not a shared library"
2341 if test -z "$old_library" ; then
2342 $echo
2343 $echo "** And there doesn't seem to be a static archive available"
2344 $echo "** The link will probably fail, sorry"
2345 else
2346 add="$dir/$old_library"
2347 fi
2348 fi
2349 esac
2350 elif test "$hardcode_minus_L" = no; then
2351 case $host in
2352 *-*-sunos*) add_shlibpath="$dir" ;;
2353 esac
2354 add_dir="-L$dir"
2355 add="-l$name"
2356 elif test "$hardcode_shlibpath_var" = no; then
2357 add_shlibpath="$dir"
2358 add="-l$name"
2359 else
2360 lib_linked=no
2361 fi
2362 ;;
2363 relink)
2364 if test "$hardcode_direct" = yes; then
2365 add="$dir/$linklib"
2366 elif test "$hardcode_minus_L" = yes; then
2367 add_dir="-L$dir"
2368 # Try looking first in the location we're being installed to.
2369 if test -n "$inst_prefix_dir"; then
2370 case "$libdir" in
2371 [\\/]*)
2372 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2373 ;;
2374 esac
2375 fi
2376 add="-l$name"
2377 elif test "$hardcode_shlibpath_var" = yes; then
2378 add_shlibpath="$dir"
2379 add="-l$name"
2380 else
2381 lib_linked=no
2382 fi
2383 ;;
2384 *) lib_linked=no ;;
2385 esac
2386
2387 if test "$lib_linked" != yes; then
2388 $echo "$modename: configuration error: unsupported hardcode properties"
2389 exit 1
2390 fi
2391
2392 if test -n "$add_shlibpath"; then
2393 case :$compile_shlibpath: in
2394 *":$add_shlibpath:"*) ;;
2395 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2396 esac
2397 fi
2398 if test "$linkmode" = prog; then
2399 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2400 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2401 else
2402 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2403 test -n "$add" && deplibs="$add $deplibs"
2404 if test "$hardcode_direct" != yes && \
2405 test "$hardcode_minus_L" != yes && \
2406 test "$hardcode_shlibpath_var" = yes; then
2407 case :$finalize_shlibpath: in
2408 *":$libdir:"*) ;;
2409 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2410 esac
2411 fi
2412 fi
2413 fi
2414
2415 if test "$linkmode" = prog || test "$mode" = relink; then
2416 add_shlibpath=
2417 add_dir=
2418 add=
2419 # Finalize command for both is simple: just hardcode it.
2420 if test "$hardcode_direct" = yes; then
2421 add="$libdir/$linklib"
2422 elif test "$hardcode_minus_L" = yes; then
2423 add_dir="-L$libdir"
2424 add="-l$name"
2425 elif test "$hardcode_shlibpath_var" = yes; then
2426 case :$finalize_shlibpath: in
2427 *":$libdir:"*) ;;
2428 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2429 esac
2430 add="-l$name"
2431 elif test "$hardcode_automatic" = yes; then
2432 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2433 add="$inst_prefix_dir$libdir/$linklib"
2434 else
2435 add="$libdir/$linklib"
2436 fi
2437 else
2438 # We cannot seem to hardcode it, guess we'll fake it.
2439 add_dir="-L$libdir"
2440 # Try looking first in the location we're being installed to.
2441 if test -n "$inst_prefix_dir"; then
2442 case "$libdir" in
2443 [\\/]*)
2444 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2445 ;;
2446 esac
2447 fi
2448 add="-l$name"
2449 fi
2450
2451 if test "$linkmode" = prog; then
2452 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2453 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2454 else
2455 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2456 test -n "$add" && deplibs="$add $deplibs"
2457 fi
2458 fi
2459 elif test "$linkmode" = prog; then
2460 # Here we assume that one of hardcode_direct or hardcode_minus_L
2461 # is not unsupported. This is valid on all known static and
2462 # shared platforms.
2463 if test "$hardcode_direct" != unsupported; then
2464 test -n "$old_library" && linklib="$old_library"
2465 compile_deplibs="$dir/$linklib $compile_deplibs"
2466 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2467 else
2468 compile_deplibs="-l$name -L$dir $compile_deplibs"
2469 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2470 fi
2471 elif test "$build_libtool_libs" = yes; then
2472 # Not a shared library
2473 if test "$deplibs_check_method" != pass_all; then
2474 # We're trying link a shared library against a static one
2475 # but the system doesn't support it.
2476
2477 # Just print a warning and add the library to dependency_libs so
2478 # that the program can be linked against the static library.
2479 $echo
2480 $echo "*** Warning: This system can not link to static lib archive $lib."
2481 $echo "*** I have the capability to make that library automatically link in when"
2482 $echo "*** you link to this library. But I can only do this if you have a"
2483 $echo "*** shared version of the library, which you do not appear to have."
2484 if test "$module" = yes; then
2485 $echo "*** But as you try to build a module library, libtool will still create "
2486 $echo "*** a static module, that should work as long as the dlopening application"
2487 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2488 if test -z "$global_symbol_pipe"; then
2489 $echo
2490 $echo "*** However, this would only work if libtool was able to extract symbol"
2491 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2492 $echo "*** not find such a program. So, this module is probably useless."
2493 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2494 fi
2495 if test "$build_old_libs" = no; then
2496 build_libtool_libs=module
2497 build_old_libs=yes
2498 else
2499 build_libtool_libs=no
2500 fi
2501 fi
2502 else
2503 convenience="$convenience $dir/$old_library"
2504 old_convenience="$old_convenience $dir/$old_library"
2505 deplibs="$dir/$old_library $deplibs"
2506 link_static=yes
2507 fi
2508 fi # link shared/static library?
2509
2510 if test "$linkmode" = lib; then
2511 if test -n "$dependency_libs" &&
2512 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2513 test "$link_static" = yes; }; then
2514 # Extract -R from dependency_libs
2515 temp_deplibs=
2516 for libdir in $dependency_libs; do
2517 case $libdir in
2518 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2519 case " $xrpath " in
2520 *" $temp_xrpath "*) ;;
2521 *) xrpath="$xrpath $temp_xrpath";;
2522 esac;;
2523 *) temp_deplibs="$temp_deplibs $libdir";;
2524 esac
2525 done
2526 dependency_libs="$temp_deplibs"
2527 fi
2528
2529 newlib_search_path="$newlib_search_path $absdir"
2530 # Link against this library
2531 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2532 # ... and its dependency_libs
2533 tmp_libs=
2534 for deplib in $dependency_libs; do
2535 newdependency_libs="$deplib $newdependency_libs"
2536 if test "X$duplicate_deps" = "Xyes" ; then
2537 case "$tmp_libs " in
2538 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2539 esac
2540 fi
2541 tmp_libs="$tmp_libs $deplib"
2542 done
2543
2544 if test "$link_all_deplibs" != no; then
2545 # Add the search paths of all dependency libraries
2546 for deplib in $dependency_libs; do
2547 case $deplib in
2548 -L*) path="$deplib" ;;
2549 *.la)
2550 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2551 test "X$dir" = "X$deplib" && dir="."
2552 # We need an absolute path.
2553 case $dir in
2554 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2555 *)
2556 absdir=`cd "$dir" && pwd`
2557 if test -z "$absdir"; then
2558 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2559 absdir="$dir"
2560 fi
2561 ;;
2562 esac
2563 if grep "^installed=no" $deplib > /dev/null; then
2564 path="$absdir/$objdir"
2565 else
2566 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2567 if test -z "$libdir"; then
2568 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2569 exit 1
2570 fi
2571 if test "$absdir" != "$libdir"; then
2572 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2573 fi
2574 path="$absdir"
2575 fi
2576 depdepl=
2577 case $host in
2578 *-*-darwin*)
2579 # we do not want to link against static libs, but need to link against shared
2580 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2581 if test -n "$deplibrary_names" ; then
2582 for tmp in $deplibrary_names ; do
2583 depdepl=$tmp
2584 done
2585 if test -f "$path/$depdepl" ; then
2586 depdepl="$path/$depdepl"
2587 fi
2588 newlib_search_path="$newlib_search_path $path"
2589 path=""
2590 fi
2591 ;;
2592 *)
2593 path="-L$path"
2594 ;;
2595 esac
2596
2597 ;;
2598 -l*)
2599 case $host in
2600 *-*-darwin*)
2601 # Again, we only want to link against shared libraries
2602 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2603 for tmp in $newlib_search_path ; do
2604 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2605 eval depdepl="$tmp/lib$tmp_libs.dylib"
2606 break
2607 fi
2608 done
2609 path=""
2610 ;;
2611 *) continue ;;
2612 esac
2613 ;;
2614 *) continue ;;
2615 esac
2616 case " $deplibs " in
2617 *" $depdepl "*) ;;
2618 *) deplibs="$deplibs $depdepl" ;;
2619 esac
2620 case " $deplibs " in
2621 *" $path "*) ;;
2622 *) deplibs="$deplibs $path" ;;
2623 esac
2624 done
2625 fi # link_all_deplibs != no
2626 fi # linkmode = lib
2627 done # for deplib in $libs
2628 dependency_libs="$newdependency_libs"
2629 if test "$pass" = dlpreopen; then
2630 # Link the dlpreopened libraries before other libraries
2631 for deplib in $save_deplibs; do
2632 deplibs="$deplib $deplibs"
2633 done
2634 fi
2635 if test "$pass" != dlopen; then
2636 if test "$pass" != conv; then
2637 # Make sure lib_search_path contains only unique directories.
2638 lib_search_path=
2639 for dir in $newlib_search_path; do
2640 case "$lib_search_path " in
2641 *" $dir "*) ;;
2642 *) lib_search_path="$lib_search_path $dir" ;;
2643 esac
2644 done
2645 newlib_search_path=
2646 fi
2647
2648 if test "$linkmode,$pass" != "prog,link"; then
2649 vars="deplibs"
2650 else
2651 vars="compile_deplibs finalize_deplibs"
2652 fi
2653 for var in $vars dependency_libs; do
2654 # Add libraries to $var in reverse order
2655 eval tmp_libs=\"\$$var\"
2656 new_libs=
2657 for deplib in $tmp_libs; do
2658 # FIXME: Pedantically, this is the right thing to do, so
2659 # that some nasty dependency loop isn't accidentally
2660 # broken:
2661 #new_libs="$deplib $new_libs"
2662 # Pragmatically, this seems to cause very few problems in
2663 # practice:
2664 case $deplib in
2665 -L*) new_libs="$deplib $new_libs" ;;
2666 -R*) ;;
2667 *)
2668 # And here is the reason: when a library appears more
2669 # than once as an explicit dependence of a library, or
2670 # is implicitly linked in more than once by the
2671 # compiler, it is considered special, and multiple
2672 # occurrences thereof are not removed. Compare this
2673 # with having the same library being listed as a
2674 # dependency of multiple other libraries: in this case,
2675 # we know (pedantically, we assume) the library does not
2676 # need to be listed more than once, so we keep only the
2677 # last copy. This is not always right, but it is rare
2678 # enough that we require users that really mean to play
2679 # such unportable linking tricks to link the library
2680 # using -Wl,-lname, so that libtool does not consider it
2681 # for duplicate removal.
2682 case " $specialdeplibs " in
2683 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2684 *)
2685 case " $new_libs " in
2686 *" $deplib "*) ;;
2687 *) new_libs="$deplib $new_libs" ;;
2688 esac
2689 ;;
2690 esac
2691 ;;
2692 esac
2693 done
2694 tmp_libs=
2695 for deplib in $new_libs; do
2696 case $deplib in
2697 -L*)
2698 case " $tmp_libs " in
2699 *" $deplib "*) ;;
2700 *) tmp_libs="$tmp_libs $deplib" ;;
2701 esac
2702 ;;
2703 *) tmp_libs="$tmp_libs $deplib" ;;
2704 esac
2705 done
2706 eval $var=\"$tmp_libs\"
2707 done # for var
2708 fi
2709 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2710 tmp_libs=
2711 for i in $dependency_libs ; do
2712 case " $predeps $postdeps $compiler_lib_search_path " in
2713 *" $i "*)
2714 i=""
2715 ;;
2716 esac
2717 if test -n "$i" ; then
2718 tmp_libs="$tmp_libs $i"
2719 fi
2720 done
2721 dependency_libs=$tmp_libs
2722 done # for pass
2723 if test "$linkmode" = prog; then
2724 dlfiles="$newdlfiles"
2725 dlprefiles="$newdlprefiles"
2726 fi
2727
2728 case $linkmode in
2729 oldlib)
2730 if test -n "$deplibs"; then
2731 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2732 fi
2733
2734 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2735 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2736 fi
2737
2738 if test -n "$rpath"; then
2739 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2740 fi
2741
2742 if test -n "$xrpath"; then
2743 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2744 fi
2745
2746 if test -n "$vinfo"; then
2747 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2748 fi
2749
2750 if test -n "$release"; then
2751 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2752 fi
2753
2754 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2755 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2756 fi
2757
2758 # Now set the variables for building old libraries.
2759 build_libtool_libs=no
2760 oldlibs="$output"
2761 objs="$objs$old_deplibs"
2762 ;;
2763
2764 lib)
2765 # Make sure we only generate libraries of the form `libNAME.la'.
2766 case $outputname in
2767 lib*)
2768 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2769 eval shared_ext=\"$shrext\"
2770 eval libname=\"$libname_spec\"
2771 ;;
2772 *)
2773 if test "$module" = no; then
2774 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2775 $echo "$help" 1>&2
2776 exit 1
2777 fi
2778 if test "$need_lib_prefix" != no; then
2779 # Add the "lib" prefix for modules if required
2780 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2781 eval shared_ext=\"$shrext\"
2782 eval libname=\"$libname_spec\"
2783 else
2784 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2785 fi
2786 ;;
2787 esac
2788
2789 if test -n "$objs"; then
2790 if test "$deplibs_check_method" != pass_all; then
2791 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2792 exit 1
2793 else
2794 $echo
2795 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2796 $echo "*** objects $objs is not portable!"
2797 libobjs="$libobjs $objs"
2798 fi
2799 fi
2800
2801 if test "$dlself" != no; then
2802 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2803 fi
2804
2805 set dummy $rpath
2806 if test "$#" -gt 2; then
2807 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2808 fi
2809 install_libdir="$2"
2810
2811 oldlibs=
2812 if test -z "$rpath"; then
2813 if test "$build_libtool_libs" = yes; then
2814 # Building a libtool convenience library.
2815 # Some compilers have problems with a `.al' extension so
2816 # convenience libraries should have the same extension an
2817 # archive normally would.
2818 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2819 build_libtool_libs=convenience
2820 build_old_libs=yes
2821 fi
2822
2823 if test -n "$vinfo"; then
2824 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2825 fi
2826
2827 if test -n "$release"; then
2828 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2829 fi
2830 else
2831
2832 # Parse the version information argument.
2833 save_ifs="$IFS"; IFS=':'
2834 set dummy $vinfo 0 0 0
2835 IFS="$save_ifs"
2836
2837 if test -n "$8"; then
2838 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2839 $echo "$help" 1>&2
2840 exit 1
2841 fi
2842
2843 # convert absolute version numbers to libtool ages
2844 # this retains compatibility with .la files and attempts
2845 # to make the code below a bit more comprehensible
2846
2847 case $vinfo_number in
2848 yes)
2849 number_major="$2"
2850 number_minor="$3"
2851 number_revision="$4"
2852 #
2853 # There are really only two kinds -- those that
2854 # use the current revision as the major version
2855 # and those that subtract age and use age as
2856 # a minor version. But, then there is irix
2857 # which has an extra 1 added just for fun
2858 #
2859 case $version_type in
2860 darwin|linux|osf|windows)
2861 current=`expr $number_major + $number_minor`
2862 age="$number_minor"
2863 revision="$number_revision"
2864 ;;
2865 freebsd-aout|freebsd-elf|sunos)
2866 current="$number_major"
2867 revision="$number_minor"
2868 age="0"
2869 ;;
2870 irix|nonstopux)
2871 current=`expr $number_major + $number_minor - 1`
2872 age="$number_minor"
2873 revision="$number_minor"
2874 ;;
2875 esac
2876 ;;
2877 no)
2878 current="$2"
2879 revision="$3"
2880 age="$4"
2881 ;;
2882 esac
2883
2884 # Check that each of the things are valid numbers.
2885 case $current in
2886 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2887 *)
2888 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2889 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2890 exit 1
2891 ;;
2892 esac
2893
2894 case $revision in
2895 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2896 *)
2897 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2898 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2899 exit 1
2900 ;;
2901 esac
2902
2903 case $age in
2904 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2905 *)
2906 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2907 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2908 exit 1
2909 ;;
2910 esac
2911
2912 if test "$age" -gt "$current"; then
2913 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2914 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2915 exit 1
2916 fi
2917
2918 # Calculate the version variables.
2919 major=
2920 versuffix=
2921 verstring=
2922 case $version_type in
2923 none) ;;
2924
2925 darwin)
2926 # Like Linux, but with the current version available in
2927 # verstring for coding it into the library header
2928 major=.`expr $current - $age`
2929 versuffix="$major.$age.$revision"
2930 # Darwin ld doesn't like 0 for these options...
2931 minor_current=`expr $current + 1`
2932 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2933 ;;
2934
2935 freebsd-aout)
2936 major=".$current"
2937 versuffix=".$current.$revision";
2938 ;;
2939
2940 freebsd-elf)
2941 major=".$current"
2942 versuffix=".$current";
2943 ;;
2944
2945 irix | nonstopux)
2946 major=`expr $current - $age + 1`
2947
2948 case $version_type in
2949 nonstopux) verstring_prefix=nonstopux ;;
2950 *) verstring_prefix=sgi ;;
2951 esac
2952 verstring="$verstring_prefix$major.$revision"
2953
2954 # Add in all the interfaces that we are compatible with.
2955 loop=$revision
2956 while test "$loop" -ne 0; do
2957 iface=`expr $revision - $loop`
2958 loop=`expr $loop - 1`
2959 verstring="$verstring_prefix$major.$iface:$verstring"
2960 done
2961
2962 # Before this point, $major must not contain `.'.
2963 major=.$major
2964 versuffix="$major.$revision"
2965 ;;
2966
2967 linux)
2968 major=.`expr $current - $age`
2969 versuffix="$major.$age.$revision"
2970 ;;
2971
2972 osf)
2973 major=.`expr $current - $age`
2974 versuffix=".$current.$age.$revision"
2975 verstring="$current.$age.$revision"
2976
2977 # Add in all the interfaces that we are compatible with.
2978 loop=$age
2979 while test "$loop" -ne 0; do
2980 iface=`expr $current - $loop`
2981 loop=`expr $loop - 1`
2982 verstring="$verstring:${iface}.0"
2983 done
2984
2985 # Make executables depend on our current version.
2986 verstring="$verstring:${current}.0"
2987 ;;
2988
2989 sunos)
2990 major=".$current"
2991 versuffix=".$current.$revision"
2992 ;;
2993
2994 windows)
2995 # Use '-' rather than '.', since we only want one
2996 # extension on DOS 8.3 filesystems.
2997 major=`expr $current - $age`
2998 versuffix="-$major"
2999 ;;
3000
3001 *)
3002 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3003 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3004 exit 1
3005 ;;
3006 esac
3007
3008 # Clear the version info if we defaulted, and they specified a release.
3009 if test -z "$vinfo" && test -n "$release"; then
3010 major=
3011 case $version_type in
3012 darwin)
3013 # we can't check for "0.0" in archive_cmds due to quoting
3014 # problems, so we reset it completely
3015 verstring=
3016 ;;
3017 *)
3018 verstring="0.0"
3019 ;;
3020 esac
3021 if test "$need_version" = no; then
3022 versuffix=
3023 else
3024 versuffix=".0.0"
3025 fi
3026 fi
3027
3028 # Remove version info from name if versioning should be avoided
3029 if test "$avoid_version" = yes && test "$need_version" = no; then
3030 major=
3031 versuffix=
3032 verstring=""
3033 fi
3034
3035 # Check to see if the archive will have undefined symbols.
3036 if test "$allow_undefined" = yes; then
3037 if test "$allow_undefined_flag" = unsupported; then
3038 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3039 build_libtool_libs=no
3040 build_old_libs=yes
3041 fi
3042 else
3043 # Don't allow undefined symbols.
3044 allow_undefined_flag="$no_undefined_flag"
3045 fi
3046 fi
3047
3048 if test "$mode" != relink; then
3049 # Remove our outputs, but don't remove object files since they
3050 # may have been created when compiling PIC objects.
3051 removelist=
3052 tempremovelist=`$echo "$output_objdir/*"`
3053 for p in $tempremovelist; do
3054 case $p in
3055 *.$objext)
3056 ;;
3057 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3058 removelist="$removelist $p"
3059 ;;
3060 *) ;;
3061 esac
3062 done
3063 if test -n "$removelist"; then
3064 $show "${rm}r $removelist"
3065 $run ${rm}r $removelist
3066 fi
3067 fi
3068
3069 # Now set the variables for building old libraries.
3070 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3071 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3072
3073 # Transform .lo files to .o files.
3074 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3075 fi
3076
3077 # Eliminate all temporary directories.
3078 for path in $notinst_path; do
3079 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3080 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3081 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3082 done
3083
3084 if test -n "$xrpath"; then
3085 # If the user specified any rpath flags, then add them.
3086 temp_xrpath=
3087 for libdir in $xrpath; do
3088 temp_xrpath="$temp_xrpath -R$libdir"
3089 case "$finalize_rpath " in
3090 *" $libdir "*) ;;
3091 *) finalize_rpath="$finalize_rpath $libdir" ;;
3092 esac
3093 done
3094 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3095 dependency_libs="$temp_xrpath $dependency_libs"
3096 fi
3097 fi
3098
3099 # Make sure dlfiles contains only unique files that won't be dlpreopened
3100 old_dlfiles="$dlfiles"
3101 dlfiles=
3102 for lib in $old_dlfiles; do
3103 case " $dlprefiles $dlfiles " in
3104 *" $lib "*) ;;
3105 *) dlfiles="$dlfiles $lib" ;;
3106 esac
3107 done
3108
3109 # Make sure dlprefiles contains only unique files
3110 old_dlprefiles="$dlprefiles"
3111 dlprefiles=
3112 for lib in $old_dlprefiles; do
3113 case "$dlprefiles " in
3114 *" $lib "*) ;;
3115 *) dlprefiles="$dlprefiles $lib" ;;
3116 esac
3117 done
3118
3119 if test "$build_libtool_libs" = yes; then
3120 if test -n "$rpath"; then
3121 case $host in
3122 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3123 # these systems don't actually have a c library (as such)!
3124 ;;
3125 *-*-rhapsody* | *-*-darwin1.[012])
3126 # Rhapsody C library is in the System framework
3127 deplibs="$deplibs -framework System"
3128 ;;
3129 *-*-netbsd*)
3130 # Don't link with libc until the a.out ld.so is fixed.
3131 ;;
3132 *-*-openbsd* | *-*-freebsd*)
3133 # Do not include libc due to us having libc/libc_r.
3134 test "X$arg" = "X-lc" && continue
3135 ;;
3136 *)
3137 # Add libc to deplibs on all other systems if necessary.
3138 if test "$build_libtool_need_lc" = "yes"; then
3139 deplibs="$deplibs -lc"
3140 fi
3141 ;;
3142 esac
3143 fi
3144
3145 # Transform deplibs into only deplibs that can be linked in shared.
3146 name_save=$name
3147 libname_save=$libname
3148 release_save=$release
3149 versuffix_save=$versuffix
3150 major_save=$major
3151 # I'm not sure if I'm treating the release correctly. I think
3152 # release should show up in the -l (ie -lgmp5) so we don't want to
3153 # add it in twice. Is that correct?
3154 release=""
3155 versuffix=""
3156 major=""
3157 newdeplibs=
3158 droppeddeps=no
3159 case $deplibs_check_method in
3160 pass_all)
3161 # Don't check for shared/static. Everything works.
3162 # This might be a little naive. We might want to check
3163 # whether the library exists or not. But this is on
3164 # osf3 & osf4 and I'm not really sure... Just
3165 # implementing what was already the behavior.
3166 newdeplibs=$deplibs
3167 ;;
3168 test_compile)
3169 # This code stresses the "libraries are programs" paradigm to its
3170 # limits. Maybe even breaks it. We compile a program, linking it
3171 # against the deplibs as a proxy for the library. Then we can check
3172 # whether they linked in statically or dynamically with ldd.
3173 $rm conftest.c
3174 cat > conftest.c <<EOF
3175 int main() { return 0; }
3176 EOF
3177 $rm conftest
3178 $LTCC $archargs -o conftest conftest.c $deplibs
3179 if test "$?" -eq 0 ; then
3180 ldd_output=`ldd conftest`
3181 for i in $deplibs; do
3182 name="`expr $i : '-l\(.*\)'`"
3183 # If $name is empty we are operating on a -L argument.
3184 if test "$name" != "" && test "$name" -ne "0"; then
3185 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3186 case " $predeps $postdeps " in
3187 *" $i "*)
3188 newdeplibs="$newdeplibs $i"
3189 i=""
3190 ;;
3191 esac
3192 fi
3193 if test -n "$i" ; then
3194 libname=`eval \\$echo \"$libname_spec\"`
3195 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3196 set dummy $deplib_matches
3197 deplib_match=$2
3198 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3199 newdeplibs="$newdeplibs $i"
3200 else
3201 droppeddeps=yes
3202 $echo
3203 $echo "*** Warning: dynamic linker does not accept needed library $i."
3204 $echo "*** I have the capability to make that library automatically link in when"
3205 $echo "*** you link to this library. But I can only do this if you have a"
3206 $echo "*** shared version of the library, which I believe you do not have"
3207 $echo "*** because a test_compile did reveal that the linker did not use it for"
3208 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3209 fi
3210 fi
3211 else
3212 newdeplibs="$newdeplibs $i"
3213 fi
3214 done
3215 else
3216 # Error occurred in the first compile. Let's try to salvage
3217 # the situation: Compile a separate program for each library.
3218 for i in $deplibs; do
3219 name="`expr $i : '-l\(.*\)'`"
3220 # If $name is empty we are operating on a -L argument.
3221 if test "$name" != "" && test "$name" != "0"; then
3222 $rm conftest
3223 $LTCC $archargs -o conftest conftest.c $i
3224 # Did it work?
3225 if test "$?" -eq 0 ; then
3226 ldd_output=`ldd conftest`
3227 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3228 case " $predeps $postdeps " in
3229 *" $i "*)
3230 newdeplibs="$newdeplibs $i"
3231 i=""
3232 ;;
3233 esac
3234 fi
3235 if test -n "$i" ; then
3236 libname=`eval \\$echo \"$libname_spec\"`
3237 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3238 set dummy $deplib_matches
3239 deplib_match=$2
3240 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3241 newdeplibs="$newdeplibs $i"
3242 else
3243 droppeddeps=yes
3244 $echo
3245 $echo "*** Warning: dynamic linker does not accept needed library $i."
3246 $echo "*** I have the capability to make that library automatically link in when"
3247 $echo "*** you link to this library. But I can only do this if you have a"
3248 $echo "*** shared version of the library, which you do not appear to have"
3249 $echo "*** because a test_compile did reveal that the linker did not use this one"
3250 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3251 fi
3252 fi
3253 else
3254 droppeddeps=yes
3255 $echo
3256 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3257 $echo "*** make it link in! You will probably need to install it or some"
3258 $echo "*** library that it depends on before this library will be fully"
3259 $echo "*** functional. Installing it before continuing would be even better."
3260 fi
3261 else
3262 newdeplibs="$newdeplibs $i"
3263 fi
3264 done
3265 fi
3266 ;;
3267 file_magic*)
3268 set dummy $deplibs_check_method
3269 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3270 for a_deplib in $deplibs; do
3271 name="`expr $a_deplib : '-l\(.*\)'`"
3272 # If $name is empty we are operating on a -L argument.
3273 if test "$name" != "" && test "$name" != "0"; then
3274 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3275 case " $predeps $postdeps " in
3276 *" $a_deplib "*)
3277 newdeplibs="$newdeplibs $a_deplib"
3278 a_deplib=""
3279 ;;
3280 esac
3281 fi
3282 if test -n "$a_deplib" ; then
3283 libname=`eval \\$echo \"$libname_spec\"`
3284 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3285 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3286 for potent_lib in $potential_libs; do
3287 # Follow soft links.
3288 if ls -lLd "$potent_lib" 2>/dev/null \
3289 | grep " -> " >/dev/null; then
3290 continue
3291 fi
3292 # The statement above tries to avoid entering an
3293 # endless loop below, in case of cyclic links.
3294 # We might still enter an endless loop, since a link
3295 # loop can be closed while we follow links,
3296 # but so what?
3297 potlib="$potent_lib"
3298 while test -h "$potlib" 2>/dev/null; do
3299 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3300 case $potliblink in
3301 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3302 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3303 esac
3304 done
3305 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3306 | ${SED} 10q \
3307 | $EGREP "$file_magic_regex" > /dev/null; then
3308 newdeplibs="$newdeplibs $a_deplib"
3309 a_deplib=""
3310 break 2
3311 fi
3312 done
3313 done
3314 fi
3315 if test -n "$a_deplib" ; then
3316 droppeddeps=yes
3317 $echo
3318 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3319 $echo "*** I have the capability to make that library automatically link in when"
3320 $echo "*** you link to this library. But I can only do this if you have a"
3321 $echo "*** shared version of the library, which you do not appear to have"
3322 $echo "*** because I did check the linker path looking for a file starting"
3323 if test -z "$potlib" ; then
3324 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3325 else
3326 $echo "*** with $libname and none of the candidates passed a file format test"
3327 $echo "*** using a file magic. Last file checked: $potlib"
3328 fi
3329 fi
3330 else
3331 # Add a -L argument.
3332 newdeplibs="$newdeplibs $a_deplib"
3333 fi
3334 done # Gone through all deplibs.
3335 ;;
3336 match_pattern*)
3337 set dummy $deplibs_check_method
3338 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3339 for a_deplib in $deplibs; do
3340 name="`expr $a_deplib : '-l\(.*\)'`"
3341 # If $name is empty we are operating on a -L argument.
3342 if test -n "$name" && test "$name" != "0"; then
3343 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3344 case " $predeps $postdeps " in
3345 *" $a_deplib "*)
3346 newdeplibs="$newdeplibs $a_deplib"
3347 a_deplib=""
3348 ;;
3349 esac
3350 fi
3351 if test -n "$a_deplib" ; then
3352 libname=`eval \\$echo \"$libname_spec\"`
3353 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3354 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3355 for potent_lib in $potential_libs; do
3356 potlib="$potent_lib" # see symlink-check above in file_magic test
3357 if eval $echo \"$potent_lib\" 2>/dev/null \
3358 | ${SED} 10q \
3359 | $EGREP "$match_pattern_regex" > /dev/null; then
3360 newdeplibs="$newdeplibs $a_deplib"
3361 a_deplib=""
3362 break 2
3363 fi
3364 done
3365 done
3366 fi
3367 if test -n "$a_deplib" ; then
3368 droppeddeps=yes
3369 $echo
3370 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3371 $echo "*** I have the capability to make that library automatically link in when"
3372 $echo "*** you link to this library. But I can only do this if you have a"
3373 $echo "*** shared version of the library, which you do not appear to have"
3374 $echo "*** because I did check the linker path looking for a file starting"
3375 if test -z "$potlib" ; then
3376 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3377 else
3378 $echo "*** with $libname and none of the candidates passed a file format test"
3379 $echo "*** using a regex pattern. Last file checked: $potlib"
3380 fi
3381 fi
3382 else
3383 # Add a -L argument.
3384 newdeplibs="$newdeplibs $a_deplib"
3385 fi
3386 done # Gone through all deplibs.
3387 ;;
3388 none | unknown | *)
3389 newdeplibs=""
3390 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3391 -e 's/ -[LR][^ ]*//g'`
3392 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3393 for i in $predeps $postdeps ; do
3394 # can't use Xsed below, because $i might contain '/'
3395 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3396 done
3397 fi
3398 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3399 | grep . >/dev/null; then
3400 $echo
3401 if test "X$deplibs_check_method" = "Xnone"; then
3402 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3403 else
3404 $echo "*** Warning: inter-library dependencies are not known to be supported."
3405 fi
3406 $echo "*** All declared inter-library dependencies are being dropped."
3407 droppeddeps=yes
3408 fi
3409 ;;
3410 esac
3411 versuffix=$versuffix_save
3412 major=$major_save
3413 release=$release_save
3414 libname=$libname_save
3415 name=$name_save
3416
3417 case $host in
3418 *-*-rhapsody* | *-*-darwin1.[012])
3419 # On Rhapsody replace the C library is the System framework
3420 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3421 ;;
3422 esac
3423
3424 if test "$droppeddeps" = yes; then
3425 if test "$module" = yes; then
3426 $echo
3427 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3428 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3429 $echo "*** a static module, that should work as long as the dlopening"
3430 $echo "*** application is linked with the -dlopen flag."
3431 if test -z "$global_symbol_pipe"; then
3432 $echo
3433 $echo "*** However, this would only work if libtool was able to extract symbol"
3434 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3435 $echo "*** not find such a program. So, this module is probably useless."
3436 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3437 fi
3438 if test "$build_old_libs" = no; then
3439 oldlibs="$output_objdir/$libname.$libext"
3440 build_libtool_libs=module
3441 build_old_libs=yes
3442 else
3443 build_libtool_libs=no
3444 fi
3445 else
3446 $echo "*** The inter-library dependencies that have been dropped here will be"
3447 $echo "*** automatically added whenever a program is linked with this library"
3448 $echo "*** or is declared to -dlopen it."
3449
3450 if test "$allow_undefined" = no; then
3451 $echo
3452 $echo "*** Since this library must not contain undefined symbols,"
3453 $echo "*** because either the platform does not support them or"
3454 $echo "*** it was explicitly requested with -no-undefined,"
3455 $echo "*** libtool will only create a static version of it."
3456 if test "$build_old_libs" = no; then
3457 oldlibs="$output_objdir/$libname.$libext"
3458 build_libtool_libs=module
3459 build_old_libs=yes
3460 else
3461 build_libtool_libs=no
3462 fi
3463 fi
3464 fi
3465 fi
3466 # Done checking deplibs!
3467 deplibs=$newdeplibs
3468 fi
3469
3470 # All the library-specific variables (install_libdir is set above).
3471 library_names=
3472 old_library=
3473 dlname=
3474
3475 # Test again, we may have decided not to build it any more
3476 if test "$build_libtool_libs" = yes; then
3477 if test "$hardcode_into_libs" = yes; then
3478 # Hardcode the library paths
3479 hardcode_libdirs=
3480 dep_rpath=
3481 rpath="$finalize_rpath"
3482 test "$mode" != relink && rpath="$compile_rpath$rpath"
3483 for libdir in $rpath; do
3484 if test -n "$hardcode_libdir_flag_spec"; then
3485 if test -n "$hardcode_libdir_separator"; then
3486 if test -z "$hardcode_libdirs"; then
3487 hardcode_libdirs="$libdir"
3488 else
3489 # Just accumulate the unique libdirs.
3490 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3491 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3492 ;;
3493 *)
3494 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3495 ;;
3496 esac
3497 fi
3498 else
3499 eval flag=\"$hardcode_libdir_flag_spec\"
3500 dep_rpath="$dep_rpath $flag"
3501 fi
3502 elif test -n "$runpath_var"; then
3503 case "$perm_rpath " in
3504 *" $libdir "*) ;;
3505 *) perm_rpath="$perm_rpath $libdir" ;;
3506 esac
3507 fi
3508 done
3509 # Substitute the hardcoded libdirs into the rpath.
3510 if test -n "$hardcode_libdir_separator" &&
3511 test -n "$hardcode_libdirs"; then
3512 libdir="$hardcode_libdirs"
3513 if test -n "$hardcode_libdir_flag_spec_ld"; then
3514 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3515 else
3516 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3517 fi
3518 fi
3519 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3520 # We should set the runpath_var.
3521 rpath=
3522 for dir in $perm_rpath; do
3523 rpath="$rpath$dir:"
3524 done
3525 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3526 fi
3527 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3528 fi
3529
3530 shlibpath="$finalize_shlibpath"
3531 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3532 if test -n "$shlibpath"; then
3533 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3534 fi
3535
3536 # Get the real and link names of the library.
3537 eval shared_ext=\"$shrext\"
3538 eval library_names=\"$library_names_spec\"
3539 set dummy $library_names
3540 realname="$2"
3541 shift; shift
3542
3543 if test -n "$soname_spec"; then
3544 eval soname=\"$soname_spec\"
3545 else
3546 soname="$realname"
3547 fi
3548 if test -z "$dlname"; then
3549 dlname=$soname
3550 fi
3551
3552 lib="$output_objdir/$realname"
3553 for link
3554 do
3555 linknames="$linknames $link"
3556 done
3557
3558 # Use standard objects if they are pic
3559 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3560
3561 # Prepare the list of exported symbols
3562 if test -z "$export_symbols"; then
3563 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3564 $show "generating symbol list for \`$libname.la'"
3565 export_symbols="$output_objdir/$libname.exp"
3566 $run $rm $export_symbols
3567 eval cmds=\"$export_symbols_cmds\"
3568 save_ifs="$IFS"; IFS=$_S_
3569 for cmd in $cmds; do
3570 IFS="$save_ifs"
3571 if len=`expr "X$cmd" : ".*"` &&
3572 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3573 $show "$cmd"
3574 $run eval "$cmd" || exit $?
3575 skipped_export=false
3576 else
3577 # The command line is too long to execute in one step.
3578 $show "using reloadable object file for export list..."
3579 skipped_export=:
3580 fi
3581 done
3582 IFS="$save_ifs"
3583 if test -n "$export_symbols_regex"; then
3584 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3585 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3586 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3587 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3588 fi
3589 fi
3590 fi
3591
3592 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3593 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3594 fi
3595
3596 tmp_deplibs=
3597 for test_deplib in $deplibs; do
3598 case " $convenience " in
3599 *" $test_deplib "*) ;;
3600 *)
3601 tmp_deplibs="$tmp_deplibs $test_deplib"
3602 ;;
3603 esac
3604 done
3605 deplibs="$tmp_deplibs"
3606
3607 if test -n "$convenience"; then
3608 if test -n "$whole_archive_flag_spec"; then
3609 save_libobjs=$libobjs
3610 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3611 else
3612 gentop="$output_objdir/${outputname}x"
3613 $show "${rm}r $gentop"
3614 $run ${rm}r "$gentop"
3615 $show "$mkdir $gentop"
3616 $run $mkdir "$gentop"
3617 status=$?
3618 if test "$status" -ne 0 && test ! -d "$gentop"; then
3619 exit $status
3620 fi
3621 generated="$generated $gentop"
3622
3623 for xlib in $convenience; do
3624 # Extract the objects.
3625 case $xlib in
3626 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3627 *) xabs=`pwd`"/$xlib" ;;
3628 esac
3629 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3630 xdir="$gentop/$xlib"
3631
3632 $show "${rm}r $xdir"
3633 $run ${rm}r "$xdir"
3634 $show "$mkdir $xdir"
3635 $run $mkdir "$xdir"
3636 status=$?
3637 if test "$status" -ne 0 && test ! -d "$xdir"; then
3638 exit $status
3639 fi
3640 case $host in
3641 *-*-darwin*)
3642 # ranlib-ed archives of fat binaries are converted to a fat xabs that
3643 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
3644 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
3645 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
3646 if test -n "$d_archs"; then
3647 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
3648 d_name=`basename $xabs`
3649 d_dir="/tmp/fat_ar.$$"
3650 d_files=''
3651
3652 for d_arch in $d_archs; do
3653 d_archdir="$d_dir/$d_arch"
3654 $show "$mkdir -p $d_archdir"
3655 $run $mkdir -p "$d_archdir"
3656
3657 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
3658 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
3659
3660 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
3661 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
3662
3663 $show "${rm} $d_dir/$d_name"
3664 $run ${rm} "$d_dir/$d_name"
3665 done
3666
3667 # Can't deal with blanks in file names
3668 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
3669
3670 for d_file in $d_files; do
3671 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
3672 $show "lipo -create $d_f -o $xdir/$d_file"
3673 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
3674 done
3675
3676 $show "${rm}r $d_dir"
3677 $run ${rm}r "$d_dir"
3678 else
3679 $show "(cd $xdir && $AR x $xabs)"
3680 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3681 fi
3682 ;;
3683 *)
3684 # We will extract separately just the conflicting names and we will no
3685 # longer touch any unique names. It is faster to leave these extract
3686 # automatically by $AR in one run.
3687 $show "(cd $xdir && $AR x $xabs)"
3688 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3689 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3690 :
3691 else
3692 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3693 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3694 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3695 do
3696 i=1
3697 while test "$i" -le "$count"
3698 do
3699 # Put our $i before any first dot (extension)
3700 # Never overwrite any file
3701 name_to="$name"
3702 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3703 do
3704 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3705 done
3706 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3707 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3708 i=`expr $i + 1`
3709 done
3710 done
3711 fi
3712 ;;
3713 esac
3714
3715 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3716 done
3717 fi
3718 fi
3719
3720 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3721 eval flag=\"$thread_safe_flag_spec\"
3722 linker_flags="$linker_flags $flag"
3723 fi
3724
3725 # Make a backup of the uninstalled library when relinking
3726 if test "$mode" = relink; then
3727 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3728 fi
3729
3730 # Do each of the archive commands.
3731 if test "$module" = yes && test -n "$module_cmds" ; then
3732 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3733 eval cmds=\"$module_expsym_cmds\"
3734 else
3735 eval cmds=\"$module_cmds\"
3736 fi
3737 else
3738 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3739 eval cmds=\"$archive_expsym_cmds\"
3740 else
3741 eval cmds=\"$archive_cmds\"
3742 fi
3743 fi
3744
3745 if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3746 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3747 :
3748 else
3749 # The command line is too long to link in one step, link piecewise.
3750 $echo "creating reloadable object files..."
3751
3752 # Save the value of $output and $libobjs because we want to
3753 # use them later. If we have whole_archive_flag_spec, we
3754 # want to use save_libobjs as it was before
3755 # whole_archive_flag_spec was expanded, because we can't
3756 # assume the linker understands whole_archive_flag_spec.
3757 # This may have to be revisited, in case too many
3758 # convenience libraries get linked in and end up exceeding
3759 # the spec.
3760 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3761 save_libobjs=$libobjs
3762 fi
3763 save_output=$output
3764
3765 # Clear the reloadable object creation command queue and
3766 # initialize k to one.
3767 test_cmds=
3768 concat_cmds=
3769 objlist=
3770 delfiles=
3771 last_robj=
3772 k=1
3773 output=$output_objdir/$save_output-${k}.$objext
3774 # Loop over the list of objects to be linked.
3775 for obj in $save_libobjs
3776 do
3777 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3778 if test "X$objlist" = X ||
3779 { len=`expr "X$test_cmds" : ".*"` &&
3780 test "$len" -le "$max_cmd_len"; }; then
3781 objlist="$objlist $obj"
3782 else
3783 # The command $test_cmds is almost too long, add a
3784 # command to the queue.
3785 if test "$k" -eq 1 ; then
3786 # The first file doesn't have a previous command to add.
3787 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3788 else
3789 # All subsequent reloadable object files will link in
3790 # the last one created.
3791 eval concat_cmds=\"\$concat_cmds${_S_}$reload_cmds $objlist $last_robj\"
3792 fi
3793 last_robj=$output_objdir/$save_output-${k}.$objext
3794 k=`expr $k + 1`
3795 output=$output_objdir/$save_output-${k}.$objext
3796 objlist=$obj
3797 len=1
3798 fi
3799 done
3800 # Handle the remaining objects by creating one last
3801 # reloadable object file. All subsequent reloadable object
3802 # files will link in the last one created.
3803 test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
3804 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3805
3806 if ${skipped_export-false}; then
3807 $show "generating symbol list for \`$libname.la'"
3808 export_symbols="$output_objdir/$libname.exp"
3809 $run $rm $export_symbols
3810 libobjs=$output
3811 # Append the command to create the export file.
3812 eval concat_cmds=\"\$concat_cmds${_S_}$export_symbols_cmds\"
3813 fi
3814
3815 # Set up a command to remove the reloadale object files
3816 # after they are used.
3817 i=0
3818 while test "$i" -lt "$k"
3819 do
3820 i=`expr $i + 1`
3821 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3822 done
3823
3824 $echo "creating a temporary reloadable object file: $output"
3825
3826 # Loop through the commands generated above and execute them.
3827 save_ifs="$IFS"; IFS=$_S_
3828 for cmd in $concat_cmds; do
3829 IFS="$save_ifs"
3830 $show "$cmd"
3831 $run eval "$cmd" || exit $?
3832 done
3833 IFS="$save_ifs"
3834
3835 libobjs=$output
3836 # Restore the value of output.
3837 output=$save_output
3838
3839 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3840 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3841 fi
3842 # Expand the library linking commands again to reset the
3843 # value of $libobjs for piecewise linking.
3844
3845 # Do each of the archive commands.
3846 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3847 eval cmds=\"$archive_expsym_cmds\"
3848 else
3849 eval cmds=\"$archive_cmds\"
3850 fi
3851
3852 # Append the command to remove the reloadable object files
3853 # to the just-reset $cmds.
3854 eval cmds=\"\$cmds${_S_}$rm $delfiles\"
3855 fi
3856 save_ifs="$IFS"; IFS=$_S_
3857 for cmd in $cmds; do
3858 IFS="$save_ifs"
3859 $show "$cmd"
3860 $run eval "$cmd" || exit $?
3861 done
3862 IFS="$save_ifs"
3863
3864 # Restore the uninstalled library and exit
3865 if test "$mode" = relink; then
3866 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3867 exit 0
3868 fi
3869
3870 # Create links to the real library.
3871 for linkname in $linknames; do
3872 if test "$realname" != "$linkname"; then
3873 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3874 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3875 fi
3876 done
3877
3878 # If -module or -export-dynamic was specified, set the dlname.
3879 if test "$module" = yes || test "$export_dynamic" = yes; then
3880 # On all known operating systems, these are identical.
3881 dlname="$soname"
3882 fi
3883 fi
3884 ;;
3885
3886 obj)
3887 if test -n "$deplibs"; then
3888 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3889 fi
3890
3891 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3892 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3893 fi
3894
3895 if test -n "$rpath"; then
3896 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3897 fi
3898
3899 if test -n "$xrpath"; then
3900 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3901 fi
3902
3903 if test -n "$vinfo"; then
3904 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3905 fi
3906
3907 if test -n "$release"; then
3908 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3909 fi
3910
3911 case $output in
3912 *.lo)
3913 if test -n "$objs$old_deplibs"; then
3914 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3915 exit 1
3916 fi
3917 libobj="$output"
3918 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3919 ;;
3920 *)
3921 libobj=
3922 obj="$output"
3923 ;;
3924 esac
3925
3926 # Delete the old objects.
3927 $run $rm $obj $libobj
3928
3929 # Objects from convenience libraries. This assumes
3930 # single-version convenience libraries. Whenever we create
3931 # different ones for PIC/non-PIC, this we'll have to duplicate
3932 # the extraction.
3933 reload_conv_objs=
3934 gentop=
3935 # reload_cmds runs $LD directly, so let us get rid of
3936 # -Wl from whole_archive_flag_spec
3937 wl=
3938
3939 if test -n "$convenience"; then
3940 if test -n "$whole_archive_flag_spec"; then
3941 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3942 else
3943 gentop="$output_objdir/${obj}x"
3944 $show "${rm}r $gentop"
3945 $run ${rm}r "$gentop"
3946 $show "$mkdir $gentop"
3947 $run $mkdir "$gentop"
3948 status=$?
3949 if test "$status" -ne 0 && test ! -d "$gentop"; then
3950 exit $status
3951 fi
3952 generated="$generated $gentop"
3953
3954 for xlib in $convenience; do
3955 # Extract the objects.
3956 case $xlib in
3957 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3958 *) xabs=`pwd`"/$xlib" ;;
3959 esac
3960 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3961 xdir="$gentop/$xlib"
3962
3963 $show "${rm}r $xdir"
3964 $run ${rm}r "$xdir"
3965 $show "$mkdir $xdir"
3966 $run $mkdir "$xdir"
3967 status=$?
3968 if test "$status" -ne 0 && test ! -d "$xdir"; then
3969 exit $status
3970 fi
3971 case $host in
3972 *-*-darwin*)
3973 # ranlib-ed archives of fat binaries are converted to a fat xabs that
3974 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
3975 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
3976 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
3977 if test -n "$d_archs"; then
3978 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
3979 d_name=`basename $xabs`
3980 d_dir="/tmp/fat_ar.$$"
3981 d_files=''
3982
3983 for d_arch in $d_archs; do
3984 d_archdir="$d_dir/$d_arch"
3985 $show "$mkdir -p $d_archdir"
3986 $run $mkdir -p "$d_archdir"
3987
3988 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
3989 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
3990
3991 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
3992 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
3993
3994 $show "${rm} $d_dir/$d_name"
3995 $run ${rm} "$d_dir/$d_name"
3996 done
3997
3998 # Can't deal with blanks in file names
3999 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
4000
4001 for d_file in $d_files; do
4002 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
4003 $show "lipo -create $d_f -o $xdir/$d_file"
4004 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
4005 done
4006
4007 $show "${rm}r $d_dir"
4008 $run ${rm}r "$d_dir"
4009 else
4010 $show "(cd $xdir && $AR x $xabs)"
4011 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4012 fi
4013 ;;
4014 *)
4015 # We will extract separately just the conflicting names and we will no
4016 # longer touch any unique names. It is faster to leave these extract
4017 # automatically by $AR in one run.
4018 $show "(cd $xdir && $AR x $xabs)"
4019 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4020 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4021 :
4022 else
4023 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4024 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4025 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4026 do
4027 i=1
4028 while test "$i" -le "$count"
4029 do
4030 # Put our $i before any first dot (extension)
4031 # Never overwrite any file
4032 name_to="$name"
4033 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4034 do
4035 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4036 done
4037 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4038 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4039 i=`expr $i + 1`
4040 done
4041 done
4042 fi
4043 ;;
4044 esac
4045
4046 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4047 done
4048 fi
4049 fi
4050
4051 # Create the old-style object.
4052 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4053
4054 output="$obj"
4055 eval cmds=\"$reload_cmds\"
4056 save_ifs="$IFS"; IFS=$_S_
4057 for cmd in $cmds; do
4058 IFS="$save_ifs"
4059 $show "$cmd"
4060 $run eval "$cmd" || exit $?
4061 done
4062 IFS="$save_ifs"
4063
4064 # Exit if we aren't doing a library object file.
4065 if test -z "$libobj"; then
4066 if test -n "$gentop"; then
4067 $show "${rm}r $gentop"
4068 $run ${rm}r $gentop
4069 fi
4070
4071 exit 0
4072 fi
4073
4074 if test "$build_libtool_libs" != yes; then
4075 if test -n "$gentop"; then
4076 $show "${rm}r $gentop"
4077 $run ${rm}r $gentop
4078 fi
4079
4080 # Create an invalid libtool object if no PIC, so that we don't
4081 # accidentally link it into a program.
4082 # $show "echo timestamp > $libobj"
4083 # $run eval "echo timestamp > $libobj" || exit $?
4084 exit 0
4085 fi
4086
4087 if test -n "$pic_flag" || test "$pic_mode" != default; then
4088 # Only do commands if we really have different PIC objects.
4089 reload_objs="$libobjs $reload_conv_objs"
4090 output="$libobj"
4091 eval cmds=\"$reload_cmds\"
4092 save_ifs="$IFS"; IFS=$_S_
4093 for cmd in $cmds; do
4094 IFS="$save_ifs"
4095 $show "$cmd"
4096 $run eval "$cmd" || exit $?
4097 done
4098 IFS="$save_ifs"
4099 fi
4100
4101 if test -n "$gentop"; then
4102 $show "${rm}r $gentop"
4103 $run ${rm}r $gentop
4104 fi
4105
4106 exit 0
4107 ;;
4108
4109 prog)
4110 case $host in
4111 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4112 esac
4113 if test -n "$vinfo"; then
4114 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4115 fi
4116
4117 if test -n "$release"; then
4118 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4119 fi
4120
4121 if test "$preload" = yes; then
4122 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4123 test "$dlopen_self_static" = unknown; then
4124 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4125 fi
4126 fi
4127
4128 case $host in
4129 *-*-rhapsody* | *-*-darwin1.[012])
4130 # On Rhapsody replace the C library is the System framework
4131 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4132 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4133 ;;
4134 esac
4135
4136 case $host in
4137 *darwin*)
4138 # Don't allow lazy linking, it breaks C++ global constructors
4139 if test "$tagname" = CXX ; then
4140 compile_command="$compile_command ${wl}-bind_at_load"
4141 finalize_command="$finalize_command ${wl}-bind_at_load"
4142 fi
4143 ;;
4144 esac
4145
4146 compile_command="$compile_command $compile_deplibs"
4147 finalize_command="$finalize_command $finalize_deplibs"
4148
4149 if test -n "$rpath$xrpath"; then
4150 # If the user specified any rpath flags, then add them.
4151 for libdir in $rpath $xrpath; do
4152 # This is the magic to use -rpath.
4153 case "$finalize_rpath " in
4154 *" $libdir "*) ;;
4155 *) finalize_rpath="$finalize_rpath $libdir" ;;
4156 esac
4157 done
4158 fi
4159
4160 # Now hardcode the library paths
4161 rpath=
4162 hardcode_libdirs=
4163 for libdir in $compile_rpath $finalize_rpath; do
4164 if test -n "$hardcode_libdir_flag_spec"; then
4165 if test -n "$hardcode_libdir_separator"; then
4166 if test -z "$hardcode_libdirs"; then
4167 hardcode_libdirs="$libdir"
4168 else
4169 # Just accumulate the unique libdirs.
4170 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4171 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4172 ;;
4173 *)
4174 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4175 ;;
4176 esac
4177 fi
4178 else
4179 eval flag=\"$hardcode_libdir_flag_spec\"
4180 rpath="$rpath $flag"
4181 fi
4182 elif test -n "$runpath_var"; then
4183 case "$perm_rpath " in
4184 *" $libdir "*) ;;
4185 *) perm_rpath="$perm_rpath $libdir" ;;
4186 esac
4187 fi
4188 case $host in
4189 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4190 case :$dllsearchpath: in
4191 *":$libdir:"*) ;;
4192 *) dllsearchpath="$dllsearchpath:$libdir";;
4193 esac
4194 ;;
4195 esac
4196 done
4197 # Substitute the hardcoded libdirs into the rpath.
4198 if test -n "$hardcode_libdir_separator" &&
4199 test -n "$hardcode_libdirs"; then
4200 libdir="$hardcode_libdirs"
4201 eval rpath=\" $hardcode_libdir_flag_spec\"
4202 fi
4203 compile_rpath="$rpath"
4204
4205 rpath=
4206 hardcode_libdirs=
4207 for libdir in $finalize_rpath; do
4208 if test -n "$hardcode_libdir_flag_spec"; then
4209 if test -n "$hardcode_libdir_separator"; then
4210 if test -z "$hardcode_libdirs"; then
4211 hardcode_libdirs="$libdir"
4212 else
4213 # Just accumulate the unique libdirs.
4214 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4215 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4216 ;;
4217 *)
4218 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4219 ;;
4220 esac
4221 fi
4222 else
4223 eval flag=\"$hardcode_libdir_flag_spec\"
4224 rpath="$rpath $flag"
4225 fi
4226 elif test -n "$runpath_var"; then
4227 case "$finalize_perm_rpath " in
4228 *" $libdir "*) ;;
4229 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4230 esac
4231 fi
4232 done
4233 # Substitute the hardcoded libdirs into the rpath.
4234 if test -n "$hardcode_libdir_separator" &&
4235 test -n "$hardcode_libdirs"; then
4236 libdir="$hardcode_libdirs"
4237 eval rpath=\" $hardcode_libdir_flag_spec\"
4238 fi
4239 finalize_rpath="$rpath"
4240
4241 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4242 # Transform all the library objects into standard objects.
4243 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4244 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4245 fi
4246
4247 dlsyms=
4248 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4249 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4250 dlsyms="${outputname}S.c"
4251 else
4252 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4253 fi
4254 fi
4255
4256 if test -n "$dlsyms"; then
4257 case $dlsyms in
4258 "") ;;
4259 *.c)
4260 # Discover the nlist of each of the dlfiles.
4261 nlist="$output_objdir/${outputname}.nm"
4262
4263 $show "$rm $nlist ${nlist}S ${nlist}T"
4264 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4265
4266 # Parse the name list into a source file.
4267 $show "creating $output_objdir/$dlsyms"
4268
4269 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4270 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4271 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4272
4273 #ifdef __cplusplus
4274 extern \"C\" {
4275 #endif
4276
4277 /* Prevent the only kind of declaration conflicts we can make. */
4278 #define lt_preloaded_symbols some_other_symbol
4279
4280 /* External symbol declarations for the compiler. */\
4281 "
4282
4283 if test "$dlself" = yes; then
4284 $show "generating symbol list for \`$output'"
4285
4286 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4287
4288 # Add our own program objects to the symbol list.
4289 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4290 for arg in $progfiles; do
4291 $show "extracting global C symbols from \`$arg'"
4292 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4293 done
4294
4295 if test -n "$exclude_expsyms"; then
4296 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4297 $run eval '$mv "$nlist"T "$nlist"'
4298 fi
4299
4300 if test -n "$export_symbols_regex"; then
4301 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4302 $run eval '$mv "$nlist"T "$nlist"'
4303 fi
4304
4305 # Prepare the list of exported symbols
4306 if test -z "$export_symbols"; then
4307 export_symbols="$output_objdir/$output.exp"
4308 $run $rm $export_symbols
4309 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4310 else
4311 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4312 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4313 $run eval 'mv "$nlist"T "$nlist"'
4314 fi
4315 fi
4316
4317 for arg in $dlprefiles; do
4318 $show "extracting global C symbols from \`$arg'"
4319 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4320 $run eval '$echo ": $name " >> "$nlist"'
4321 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4322 done
4323
4324 if test -z "$run"; then
4325 # Make sure we have at least an empty file.
4326 test -f "$nlist" || : > "$nlist"
4327
4328 if test -n "$exclude_expsyms"; then
4329 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4330 $mv "$nlist"T "$nlist"
4331 fi
4332
4333 # Try sorting and uniquifying the output.
4334 if grep -v "^: " < "$nlist" |
4335 if sort -k 3 </dev/null >/dev/null 2>&1; then
4336 sort -k 3
4337 else
4338 sort +2
4339 fi |
4340 uniq > "$nlist"S; then
4341 :
4342 else
4343 grep -v "^: " < "$nlist" > "$nlist"S
4344 fi
4345
4346 if test -f "$nlist"S; then
4347 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4348 else
4349 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4350 fi
4351
4352 $echo >> "$output_objdir/$dlsyms" "\
4353
4354 #undef lt_preloaded_symbols
4355
4356 #if defined (__STDC__) && __STDC__
4357 # define lt_ptr void *
4358 #else
4359 # define lt_ptr char *
4360 # define const
4361 #endif
4362
4363 /* The mapping between symbol names and symbols. */
4364 const struct {
4365 const char *name;
4366 lt_ptr address;
4367 }
4368 lt_preloaded_symbols[] =
4369 {\
4370 "
4371
4372 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4373
4374 $echo >> "$output_objdir/$dlsyms" "\
4375 {0, (lt_ptr) 0}
4376 };
4377
4378 /* This works around a problem in FreeBSD linker */
4379 #ifdef FREEBSD_WORKAROUND
4380 static const void *lt_preloaded_setup() {
4381 return lt_preloaded_symbols;
4382 }
4383 #endif
4384
4385 #ifdef __cplusplus
4386 }
4387 #endif\
4388 "
4389 fi
4390
4391 pic_flag_for_symtable=
4392 case $host in
4393 # compiling the symbol table file with pic_flag works around
4394 # a FreeBSD bug that causes programs to crash when -lm is
4395 # linked before any other PIC object. But we must not use
4396 # pic_flag when linking with -static. The problem exists in
4397 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4398 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4399 case "$compile_command " in
4400 *" -static "*) ;;
4401 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4402 esac;;
4403 *-*-hpux*)
4404 case "$compile_command " in
4405 *" -static "*) ;;
4406 *) pic_flag_for_symtable=" $pic_flag";;
4407 esac
4408 esac
4409
4410 # Now compile the dynamic symbol file.
4411 $show "(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4412 $run eval '(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4413
4414 # Clean up the generated files.
4415 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4416 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4417
4418 # Transform the symbol file into the correct name.
4419 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4420 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4421 ;;
4422 *)
4423 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4424 exit 1
4425 ;;
4426 esac
4427 else
4428 # We keep going just in case the user didn't refer to
4429 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4430 # really was required.
4431
4432 # Nullify the symbol file.
4433 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4434 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4435 fi
4436
4437 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4438 # Replace the output file specification.
4439 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4440 link_command="$compile_command$compile_rpath"
4441
4442 # We have no uninstalled library dependencies, so finalize right now.
4443 $show "$link_command"
4444 $run eval "$link_command"
4445 status=$?
4446
4447 # Delete the generated files.
4448 if test -n "$dlsyms"; then
4449 $show "$rm $output_objdir/${outputname}S.${objext}"
4450 $run $rm "$output_objdir/${outputname}S.${objext}"
4451 fi
4452
4453 exit $status
4454 fi
4455
4456 if test -n "$shlibpath_var"; then
4457 # We should set the shlibpath_var
4458 rpath=
4459 for dir in $temp_rpath; do
4460 case $dir in
4461 [\\/]* | [A-Za-z]:[\\/]*)
4462 # Absolute path.
4463 rpath="$rpath$dir:"
4464 ;;
4465 *)
4466 # Relative path: add a thisdir entry.
4467 rpath="$rpath\$thisdir/$dir:"
4468 ;;
4469 esac
4470 done
4471 temp_rpath="$rpath"
4472 fi
4473
4474 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4475 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4476 fi
4477 if test -n "$finalize_shlibpath"; then
4478 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4479 fi
4480
4481 compile_var=
4482 finalize_var=
4483 if test -n "$runpath_var"; then
4484 if test -n "$perm_rpath"; then
4485 # We should set the runpath_var.
4486 rpath=
4487 for dir in $perm_rpath; do
4488 rpath="$rpath$dir:"
4489 done
4490 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4491 fi
4492 if test -n "$finalize_perm_rpath"; then
4493 # We should set the runpath_var.
4494 rpath=
4495 for dir in $finalize_perm_rpath; do
4496 rpath="$rpath$dir:"
4497 done
4498 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4499 fi
4500 fi
4501
4502 if test "$no_install" = yes; then
4503 # We don't need to create a wrapper script.
4504 link_command="$compile_var$compile_command$compile_rpath"
4505 # Replace the output file specification.
4506 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4507 # Delete the old output file.
4508 $run $rm $output
4509 # Link the executable and exit
4510 $show "$link_command"
4511 $run eval "$link_command" || exit $?
4512 exit 0
4513 fi
4514
4515 if test "$hardcode_action" = relink; then
4516 # Fast installation is not supported
4517 link_command="$compile_var$compile_command$compile_rpath"
4518 relink_command="$finalize_var$finalize_command$finalize_rpath"
4519
4520 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4521 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4522 else
4523 if test "$fast_install" != no; then
4524 link_command="$finalize_var$compile_command$finalize_rpath"
4525 if test "$fast_install" = yes; then
4526 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4527 else
4528 # fast_install is set to needless
4529 relink_command=
4530 fi
4531 else
4532 link_command="$compile_var$compile_command$compile_rpath"
4533 relink_command="$finalize_var$finalize_command$finalize_rpath"
4534 fi
4535 fi
4536
4537 # Replace the output file specification.
4538 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4539
4540 # Delete the old output files.
4541 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4542
4543 $show "$link_command"
4544 $run eval "$link_command" || exit $?
4545
4546 # Now create the wrapper script.
4547 $show "creating $output"
4548
4549 # Quote the relink command for shipping.
4550 if test -n "$relink_command"; then
4551 # Preserve any variables that may affect compiler behavior
4552 for var in $variables_saved_for_relink; do
4553 if eval test -z \"\${$var+set}\"; then
4554 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4555 elif eval var_value=\$$var; test -z "$var_value"; then
4556 relink_command="$var=; export $var; $relink_command"
4557 else
4558 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4559 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4560 fi
4561 done
4562 relink_command="(cd `pwd`; $relink_command)"
4563 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4564 fi
4565
4566 # Quote $echo for shipping.
4567 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4568 case $0 in
4569 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4570 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4571 esac
4572 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4573 else
4574 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4575 fi
4576
4577 # Only actually do things if our run command is non-null.
4578 if test -z "$run"; then
4579 # win32 will think the script is a binary if it has
4580 # a .exe suffix, so we strip it off here.
4581 case $output in
4582 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4583 esac
4584 # test for cygwin because mv fails w/o .exe extensions
4585 case $host in
4586 *cygwin*)
4587 exeext=.exe
4588 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4589 *) exeext= ;;
4590 esac
4591 case $host in
4592 *cygwin* | *mingw* )
4593 cwrappersource=`$echo ${objdir}/lt-${output}.c`
4594 cwrapper=`$echo ${output}.exe`
4595 $rm $cwrappersource $cwrapper
4596 trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4597
4598 cat > $cwrappersource <<EOF
4599
4600 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4601 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4602
4603 The $output program cannot be directly executed until all the libtool
4604 libraries that it depends on are installed.
4605
4606 This wrapper executable should never be moved out of the build directory.
4607 If it is, it will not operate correctly.
4608
4609 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4610 but could eventually absorb all of the scripts functionality and
4611 exec $objdir/$outputname directly.
4612 */
4613 EOF
4614 cat >> $cwrappersource<<"EOF"
4615 #include <stdio.h>
4616 #include <stdlib.h>
4617 #include <unistd.h>
4618 #include <malloc.h>
4619 #include <stdarg.h>
4620 #include <assert.h>
4621
4622 #if defined(PATH_MAX)
4623 # define LT_PATHMAX PATH_MAX
4624 #elif defined(MAXPATHLEN)
4625 # define LT_PATHMAX MAXPATHLEN
4626 #else
4627 # define LT_PATHMAX 1024
4628 #endif
4629
4630 #ifndef DIR_SEPARATOR
4631 #define DIR_SEPARATOR '/'
4632 #endif
4633
4634 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4635 defined (__OS2__)
4636 #define HAVE_DOS_BASED_FILE_SYSTEM
4637 #ifndef DIR_SEPARATOR_2
4638 #define DIR_SEPARATOR_2 '\\'
4639 #endif
4640 #endif
4641
4642 #ifndef DIR_SEPARATOR_2
4643 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4644 #else /* DIR_SEPARATOR_2 */
4645 # define IS_DIR_SEPARATOR(ch) \
4646 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4647 #endif /* DIR_SEPARATOR_2 */
4648
4649 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4650 #define XFREE(stale) do { \
4651 if (stale) { free ((void *) stale); stale = 0; } \
4652 } while (0)
4653
4654 const char *program_name = NULL;
4655
4656 void * xmalloc (size_t num);
4657 char * xstrdup (const char *string);
4658 char * basename (const char *name);
4659 char * fnqualify(const char *path);
4660 char * strendzap(char *str, const char *pat);
4661 void lt_fatal (const char *message, ...);
4662
4663 int
4664 main (int argc, char *argv[])
4665 {
4666 char **newargz;
4667 int i;
4668
4669 program_name = (char *) xstrdup ((char *) basename (argv[0]));
4670 newargz = XMALLOC(char *, argc+2);
4671 EOF
4672
4673 cat >> $cwrappersource <<EOF
4674 newargz[0] = "$SHELL";
4675 EOF
4676
4677 cat >> $cwrappersource <<"EOF"
4678 newargz[1] = fnqualify(argv[0]);
4679 /* we know the script has the same name, without the .exe */
4680 /* so make sure newargz[1] doesn't end in .exe */
4681 strendzap(newargz[1],".exe");
4682 for (i = 1; i < argc; i++)
4683 newargz[i+1] = xstrdup(argv[i]);
4684 newargz[argc+1] = NULL;
4685 EOF
4686
4687 cat >> $cwrappersource <<EOF
4688 execv("$SHELL",newargz);
4689 EOF
4690
4691 cat >> $cwrappersource <<"EOF"
4692 }
4693
4694 void *
4695 xmalloc (size_t num)
4696 {
4697 void * p = (void *) malloc (num);
4698 if (!p)
4699 lt_fatal ("Memory exhausted");
4700
4701 return p;
4702 }
4703
4704 char *
4705 xstrdup (const char *string)
4706 {
4707 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4708 ;
4709 }
4710
4711 char *
4712 basename (const char *name)
4713 {
4714 const char *base;
4715
4716 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4717 /* Skip over the disk name in MSDOS pathnames. */
4718 if (isalpha (name[0]) && name[1] == ':')
4719 name += 2;
4720 #endif
4721
4722 for (base = name; *name; name++)
4723 if (IS_DIR_SEPARATOR (*name))
4724 base = name + 1;
4725 return (char *) base;
4726 }
4727
4728 char *
4729 fnqualify(const char *path)
4730 {
4731 size_t size;
4732 char *p;
4733 char tmp[LT_PATHMAX + 1];
4734
4735 assert(path != NULL);
4736
4737 /* Is it qualified already? */
4738 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4739 if (isalpha (path[0]) && path[1] == ':')
4740 return xstrdup (path);
4741 #endif
4742 if (IS_DIR_SEPARATOR (path[0]))
4743 return xstrdup (path);
4744
4745 /* prepend the current directory */
4746 /* doesn't handle '~' */
4747 if (getcwd (tmp, LT_PATHMAX) == NULL)
4748 lt_fatal ("getcwd failed");
4749 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4750 p = XMALLOC(char, size);
4751 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4752 return p;
4753 }
4754
4755 char *
4756 strendzap(char *str, const char *pat)
4757 {
4758 size_t len, patlen;
4759
4760 assert(str != NULL);
4761 assert(pat != NULL);
4762
4763 len = strlen(str);
4764 patlen = strlen(pat);
4765
4766 if (patlen <= len)
4767 {
4768 str += len - patlen;
4769 if (strcmp(str, pat) == 0)
4770 *str = '\0';
4771 }
4772 return str;
4773 }
4774
4775 static void
4776 lt_error_core (int exit_status, const char * mode,
4777 const char * message, va_list ap)
4778 {
4779 fprintf (stderr, "%s: %s: ", program_name, mode);
4780 vfprintf (stderr, message, ap);
4781 fprintf (stderr, ".\n");
4782
4783 if (exit_status >= 0)
4784 exit (exit_status);
4785 }
4786
4787 void
4788 lt_fatal (const char *message, ...)
4789 {
4790 va_list ap;
4791 va_start (ap, message);
4792 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4793 va_end (ap);
4794 }
4795 EOF
4796 # we should really use a build-platform specific compiler
4797 # here, but OTOH, the wrappers (shell script and this C one)
4798 # are only useful if you want to execute the "real" binary.
4799 # Since the "real" binary is built for $host, then this
4800 # wrapper might as well be built for $host, too.
4801 $run $LTCC $archargs -s -o $cwrapper $cwrappersource
4802 ;;
4803 esac
4804 $rm $output
4805 trap "$rm $output; exit 1" 1 2 15
4806
4807 $echo > $output "\
4808 #! $SHELL
4809
4810 # $output - temporary wrapper script for $objdir/$outputname
4811 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4812 #
4813 # The $output program cannot be directly executed until all the libtool
4814 # libraries that it depends on are installed.
4815 #
4816 # This wrapper script should never be moved out of the build directory.
4817 # If it is, it will not operate correctly.
4818
4819 # Sed substitution that helps us do robust quoting. It backslashifies
4820 # metacharacters that are still active within double-quoted strings.
4821 Xsed='${SED} -e 1s/^X//'
4822 sed_quote_subst='$sed_quote_subst'
4823
4824 # The HP-UX ksh and POSIX shell print the target directory to stdout
4825 # if CDPATH is set.
4826 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4827
4828 relink_command=\"$relink_command\"
4829
4830 # This environment variable determines our operation mode.
4831 if test \"\$libtool_install_magic\" = \"$magic\"; then
4832 # install mode needs the following variable:
4833 notinst_deplibs='$notinst_deplibs'
4834 else
4835 # When we are sourced in execute mode, \$file and \$echo are already set.
4836 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4837 echo=\"$qecho\"
4838 file=\"\$0\"
4839 # Make sure echo works.
4840 if test \"X\$1\" = X--no-reexec; then
4841 # Discard the --no-reexec flag, and continue.
4842 shift
4843 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4844 # Yippee, \$echo works!
4845 :
4846 else
4847 # Restart under the correct shell, and then maybe \$echo will work.
4848 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4849 fi
4850 fi\
4851 "
4852 $echo >> $output "\
4853
4854 # Find the directory that this script lives in.
4855 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4856 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4857
4858 # Follow symbolic links until we get to the real thisdir.
4859 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4860 while test -n \"\$file\"; do
4861 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4862
4863 # If there was a directory component, then change thisdir.
4864 if test \"x\$destdir\" != \"x\$file\"; then
4865 case \"\$destdir\" in
4866 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4867 *) thisdir=\"\$thisdir/\$destdir\" ;;
4868 esac
4869 fi
4870
4871 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4872 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4873 done
4874
4875 # Try to get the absolute directory name.
4876 absdir=\`cd \"\$thisdir\" && pwd\`
4877 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4878 "
4879
4880 if test "$fast_install" = yes; then
4881 $echo >> $output "\
4882 program=lt-'$outputname'$exeext
4883 progdir=\"\$thisdir/$objdir\"
4884
4885 if test ! -f \"\$progdir/\$program\" || \\
4886 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4887 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4888
4889 file=\"\$\$-\$program\"
4890
4891 if test ! -d \"\$progdir\"; then
4892 $mkdir \"\$progdir\"
4893 else
4894 $rm \"\$progdir/\$file\"
4895 fi"
4896
4897 $echo >> $output "\
4898
4899 # relink executable if necessary
4900 if test -n \"\$relink_command\"; then
4901 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4902 else
4903 $echo \"\$relink_command_output\" >&2
4904 $rm \"\$progdir/\$file\"
4905 exit 1
4906 fi
4907 fi
4908
4909 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4910 { $rm \"\$progdir/\$program\";
4911 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4912 $rm \"\$progdir/\$file\"
4913 fi"
4914 else
4915 $echo >> $output "\
4916 program='$outputname'
4917 progdir=\"\$thisdir/$objdir\"
4918 "
4919 fi
4920
4921 $echo >> $output "\
4922
4923 if test -f \"\$progdir/\$program\"; then"
4924
4925 # Export our shlibpath_var if we have one.
4926 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4927 $echo >> $output "\
4928 # Add our own library path to $shlibpath_var
4929 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4930
4931 # Some systems cannot cope with colon-terminated $shlibpath_var
4932 # The second colon is a workaround for a bug in BeOS R4 sed
4933 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4934
4935 export $shlibpath_var
4936 "
4937 fi
4938
4939 # fixup the dll searchpath if we need to.
4940 if test -n "$dllsearchpath"; then
4941 $echo >> $output "\
4942 # Add the dll search path components to the executable PATH
4943 PATH=$dllsearchpath:\$PATH
4944 "
4945 fi
4946
4947 $echo >> $output "\
4948 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4949 # Run the actual program with our arguments.
4950 "
4951 case $host in
4952 # Backslashes separate directories on plain windows
4953 *-*-mingw | *-*-os2*)
4954 $echo >> $output "\
4955 exec \$progdir\\\\\$program \${1+\"\$@\"}
4956 "
4957 ;;
4958
4959 *)
4960 $echo >> $output "\
4961 exec \$progdir/\$program \${1+\"\$@\"}
4962 "
4963 ;;
4964 esac
4965 $echo >> $output "\
4966 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4967 exit 1
4968 fi
4969 else
4970 # The program doesn't exist.
4971 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4972 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4973 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4974 exit 1
4975 fi
4976 fi\
4977 "
4978 chmod +x $output
4979 fi
4980 exit 0
4981 ;;
4982 esac
4983
4984 # See if we need to build an old-fashioned archive.
4985 for oldlib in $oldlibs; do
4986
4987 if test "$build_libtool_libs" = convenience; then
4988 oldobjs="$libobjs_save"
4989 addlibs="$convenience"
4990 build_libtool_libs=no
4991 else
4992 if test "$build_libtool_libs" = module; then
4993 oldobjs="$libobjs_save"
4994 build_libtool_libs=no
4995 else
4996 oldobjs="$old_deplibs $non_pic_objects"
4997 fi
4998 addlibs="$old_convenience"
4999 fi
5000
5001 if test -n "$addlibs"; then
5002 gentop="$output_objdir/${outputname}x"
5003 $show "${rm}r $gentop"
5004 $run ${rm}r "$gentop"
5005 $show "$mkdir $gentop"
5006 $run $mkdir "$gentop"
5007 status=$?
5008 if test "$status" -ne 0 && test ! -d "$gentop"; then
5009 exit $status
5010 fi
5011 generated="$generated $gentop"
5012
5013 # Add in members from convenience archives.
5014 for xlib in $addlibs; do
5015 # Extract the objects.
5016 case $xlib in
5017 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5018 *) xabs=`pwd`"/$xlib" ;;
5019 esac
5020 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5021 xdir="$gentop/$xlib"
5022
5023 $show "${rm}r $xdir"
5024 $run ${rm}r "$xdir"
5025 $show "$mkdir $xdir"
5026 $run $mkdir "$xdir"
5027 status=$?
5028 if test "$status" -ne 0 && test ! -d "$xdir"; then
5029 exit $status
5030 fi
5031 case $host in
5032 *-*-darwin*)
5033 # ranlib-ed archives of fat binaries are converted to a fat xabs that
5034 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
5035 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
5036 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
5037 if test -n "$d_archs"; then
5038 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
5039 d_name=`basename $xabs`
5040 d_dir="/tmp/fat_ar.$$"
5041 d_files=''
5042
5043 for d_arch in $d_archs; do
5044 d_archdir="$d_dir/$d_arch"
5045 $show "$mkdir -p $d_archdir"
5046 $run $mkdir -p "$d_archdir"
5047
5048 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
5049 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
5050
5051 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
5052 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
5053
5054 $show "${rm} $d_dir/$d_name"
5055 $run ${rm} "$d_dir/$d_name"
5056 done
5057
5058 # Can't deal with blanks in file names
5059 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
5060
5061 for d_file in $d_files; do
5062 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
5063 $show "lipo -create $d_f -o $xdir/$d_file"
5064 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
5065 done
5066
5067 $show "${rm}r $d_dir"
5068 $run ${rm}r "$d_dir"
5069 else
5070 $show "(cd $xdir && $AR x $xabs)"
5071 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5072 fi
5073 ;;
5074 *)
5075 # We will extract separately just the conflicting names and we will no
5076 # longer touch any unique names. It is faster to leave these extract
5077 # automatically by $AR in one run.
5078 $show "(cd $xdir && $AR x $xabs)"
5079 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5080 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5081 :
5082 else
5083 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5084 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5085 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5086 do
5087 i=1
5088 while test "$i" -le "$count"
5089 do
5090 # Put our $i before any first dot (extension)
5091 # Never overwrite any file
5092 name_to="$name"
5093 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5094 do
5095 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5096 done
5097 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5098 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5099 i=`expr $i + 1`
5100 done
5101 done
5102 fi
5103 ;;
5104 esac
5105
5106 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5107 done
5108 fi
5109
5110 # Do each command in the archive commands.
5111 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5112 eval cmds=\"$old_archive_from_new_cmds\"
5113 else
5114 eval cmds=\"$old_archive_cmds\"
5115
5116 if len=`expr "X$cmds" : ".*"` &&
5117 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5118 :
5119 else
5120 # the command line is too long to link in one step, link in parts
5121 $echo "using piecewise archive linking..."
5122 save_RANLIB=$RANLIB
5123 RANLIB=:
5124 objlist=
5125 concat_cmds=
5126 save_oldobjs=$oldobjs
5127 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5128 # encoded into archives. This makes 'ar r' malfunction in
5129 # this piecewise linking case whenever conflicting object
5130 # names appear in distinct ar calls; check, warn and compensate.
5131 if (for obj in $save_oldobjs
5132 do
5133 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5134 done | sort | sort -uc >/dev/null 2>&1); then
5135 :
5136 else
5137 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5138 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5139 AR_FLAGS=cq
5140 fi
5141 # Is there a better way of finding the last object in the list?
5142 for obj in $save_oldobjs
5143 do
5144 last_oldobj=$obj
5145 done
5146 for obj in $save_oldobjs
5147 do
5148 oldobjs="$objlist $obj"
5149 objlist="$objlist $obj"
5150 eval test_cmds=\"$old_archive_cmds\"
5151 if len=`expr "X$test_cmds" : ".*"` &&
5152 test "$len" -le "$max_cmd_len"; then
5153 :
5154 else
5155 # the above command should be used before it gets too long
5156 oldobjs=$objlist
5157 if test "$obj" = "$last_oldobj" ; then
5158 RANLIB=$save_RANLIB
5159 fi
5160 test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
5161 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5162 objlist=
5163 fi
5164 done
5165 RANLIB=$save_RANLIB
5166 oldobjs=$objlist
5167 if test "X$oldobjs" = "X" ; then
5168 eval cmds=\"\$concat_cmds\"
5169 else
5170 eval cmds=\"\$concat_cmds${_S_}$old_archive_cmds\"
5171 fi
5172 fi
5173 fi
5174 save_ifs="$IFS"; IFS=$_S_
5175 for cmd in $cmds; do
5176 IFS="$save_ifs"
5177 $show "$cmd"
5178 $run eval "$cmd" || exit $?
5179 done
5180 IFS="$save_ifs"
5181 done
5182
5183 if test -n "$generated"; then
5184 $show "${rm}r$generated"
5185 $run ${rm}r$generated
5186 fi
5187
5188 # Now create the libtool archive.
5189 case $output in
5190 *.la)
5191 old_library=
5192 test "$build_old_libs" = yes && old_library="$libname.$libext"
5193 $show "creating $output"
5194
5195 # Preserve any variables that may affect compiler behavior
5196 for var in $variables_saved_for_relink; do
5197 if eval test -z \"\${$var+set}\"; then
5198 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5199 elif eval var_value=\$$var; test -z "$var_value"; then
5200 relink_command="$var=; export $var; $relink_command"
5201 else
5202 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5203 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5204 fi
5205 done
5206 # Quote the link command for shipping.
5207 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5208 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5209
5210 # Only create the output if not a dry run.
5211 if test -z "$run"; then
5212 for installed in no yes; do
5213 if test "$installed" = yes; then
5214 if test -z "$install_libdir"; then
5215 break
5216 fi
5217 output="$output_objdir/$outputname"i
5218 # Replace all uninstalled libtool libraries with the installed ones
5219 newdependency_libs=
5220 for deplib in $dependency_libs; do
5221 case $deplib in
5222 *.la)
5223 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5224 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5225 if test -z "$libdir"; then
5226 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5227 exit 1
5228 fi
5229 newdependency_libs="$newdependency_libs $libdir/$name"
5230 ;;
5231 *) newdependency_libs="$newdependency_libs $deplib" ;;
5232 esac
5233 done
5234 dependency_libs="$newdependency_libs"
5235 newdlfiles=
5236 for lib in $dlfiles; do
5237 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5238 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5239 if test -z "$libdir"; then
5240 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5241 exit 1
5242 fi
5243 newdlfiles="$newdlfiles $libdir/$name"
5244 done
5245 dlfiles="$newdlfiles"
5246 newdlprefiles=
5247 for lib in $dlprefiles; do
5248 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5249 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5250 if test -z "$libdir"; then
5251 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5252 exit 1
5253 fi
5254 newdlprefiles="$newdlprefiles $libdir/$name"
5255 done
5256 dlprefiles="$newdlprefiles"
5257 fi
5258 $rm $output
5259 # place dlname in correct position for cygwin
5260 tdlname=$dlname
5261 case $host,$output,$installed,$module,$dlname in
5262 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5263 esac
5264 $echo > $output "\
5265 # $outputname - a libtool library file
5266 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5267 #
5268 # Please DO NOT delete this file!
5269 # It is necessary for linking the library.
5270
5271 # The name that we can dlopen(3).
5272 dlname='$tdlname'
5273
5274 # Names of this library.
5275 library_names='$library_names'
5276
5277 # The name of the static archive.
5278 old_library='$old_library'
5279
5280 # Libraries that this one depends upon.
5281 dependency_libs='$dependency_libs'
5282
5283 # Version information for $libname.
5284 current=$current
5285 age=$age
5286 revision=$revision
5287
5288 # Is this an already installed library?
5289 installed=$installed
5290
5291 # Should we warn about portability when linking against -modules?
5292 shouldnotlink=$module
5293
5294 # Files to dlopen/dlpreopen
5295 dlopen='$dlfiles'
5296 dlpreopen='$dlprefiles'
5297
5298 # Directory that this library needs to be installed in:
5299 libdir='$install_libdir'"
5300 if test "$installed" = no && test "$need_relink" = yes; then
5301 $echo >> $output "\
5302 relink_command=\"$relink_command\""
5303 fi
5304 done
5305 fi
5306
5307 # Do a symbolic link so that the libtool archive can be found in
5308 # LD_LIBRARY_PATH before the program is installed.
5309 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5310 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5311 ;;
5312 esac
5313 exit 0
5314 ;;
5315
5316 # libtool install mode
5317 install)
5318 modename="$modename: install"
5319
5320 # There may be an optional sh(1) argument at the beginning of
5321 # install_prog (especially on Windows NT).
5322 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5323 # Allow the use of GNU shtool's install command.
5324 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5325 # Aesthetically quote it.
5326 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5327 case $arg in
5328 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5329 arg="\"$arg\""
5330 ;;
5331 esac
5332 install_prog="$arg "
5333 arg="$1"
5334 shift
5335 else
5336 install_prog=
5337 arg="$nonopt"
5338 fi
5339
5340 # The real first argument should be the name of the installation program.
5341 # Aesthetically quote it.
5342 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5343 case $arg in
5344 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5345 arg="\"$arg\""
5346 ;;
5347 esac
5348 install_prog="$install_prog$arg"
5349
5350 # We need to accept at least all the BSD install flags.
5351 dest=
5352 files=
5353 opts=
5354 prev=
5355 install_type=
5356 isdir=no
5357 stripme=
5358 for arg
5359 do
5360 if test -n "$dest"; then
5361 files="$files $dest"
5362 dest="$arg"
5363 continue
5364 fi
5365
5366 case $arg in
5367 -d) isdir=yes ;;
5368 -f) prev="-f" ;;
5369 -g) prev="-g" ;;
5370 -m) prev="-m" ;;
5371 -o) prev="-o" ;;
5372 -s)
5373 stripme=" -s"
5374 continue
5375 ;;
5376 -*) ;;
5377
5378 *)
5379 # If the previous option needed an argument, then skip it.
5380 if test -n "$prev"; then
5381 prev=
5382 else
5383 dest="$arg"
5384 continue
5385 fi
5386 ;;
5387 esac
5388
5389 # Aesthetically quote the argument.
5390 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5391 case $arg in
5392 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5393 arg="\"$arg\""
5394 ;;
5395 esac
5396 install_prog="$install_prog $arg"
5397 done
5398
5399 if test -z "$install_prog"; then
5400 $echo "$modename: you must specify an install program" 1>&2
5401 $echo "$help" 1>&2
5402 exit 1
5403 fi
5404
5405 if test -n "$prev"; then
5406 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5407 $echo "$help" 1>&2
5408 exit 1
5409 fi
5410
5411 if test -z "$files"; then
5412 if test -z "$dest"; then
5413 $echo "$modename: no file or destination specified" 1>&2
5414 else
5415 $echo "$modename: you must specify a destination" 1>&2
5416 fi
5417 $echo "$help" 1>&2
5418 exit 1
5419 fi
5420
5421 # Strip any trailing slash from the destination.
5422 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5423
5424 # Check to see that the destination is a directory.
5425 test -d "$dest" && isdir=yes
5426 if test "$isdir" = yes; then
5427 destdir="$dest"
5428 destname=
5429 else
5430 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5431 test "X$destdir" = "X$dest" && destdir=.
5432 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5433
5434 # Not a directory, so check to see that there is only one file specified.
5435 set dummy $files
5436 if test "$#" -gt 2; then
5437 $echo "$modename: \`$dest' is not a directory" 1>&2
5438 $echo "$help" 1>&2
5439 exit 1
5440 fi
5441 fi
5442 case $destdir in
5443 [\\/]* | [A-Za-z]:[\\/]*) ;;
5444 *)
5445 for file in $files; do
5446 case $file in
5447 *.lo) ;;
5448 *)
5449 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5450 $echo "$help" 1>&2
5451 exit 1
5452 ;;
5453 esac
5454 done
5455 ;;
5456 esac
5457
5458 # This variable tells wrapper scripts just to set variables rather
5459 # than running their programs.
5460 libtool_install_magic="$magic"
5461
5462 staticlibs=
5463 future_libdirs=
5464 current_libdirs=
5465 for file in $files; do
5466
5467 # Do each installation.
5468 case $file in
5469 *.$libext)
5470 # Do the static libraries later.
5471 staticlibs="$staticlibs $file"
5472 ;;
5473
5474 *.la)
5475 # Check to see that this really is a libtool archive.
5476 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5477 else
5478 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5479 $echo "$help" 1>&2
5480 exit 1
5481 fi
5482
5483 library_names=
5484 old_library=
5485 relink_command=
5486 # If there is no directory component, then add one.
5487 case $file in
5488 */* | *\\*) . $file ;;
5489 *) . ./$file ;;
5490 esac
5491
5492 # Add the libdir to current_libdirs if it is the destination.
5493 if test "X$destdir" = "X$libdir"; then
5494 case "$current_libdirs " in
5495 *" $libdir "*) ;;
5496 *) current_libdirs="$current_libdirs $libdir" ;;
5497 esac
5498 else
5499 # Note the libdir as a future libdir.
5500 case "$future_libdirs " in
5501 *" $libdir "*) ;;
5502 *) future_libdirs="$future_libdirs $libdir" ;;
5503 esac
5504 fi
5505
5506 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5507 test "X$dir" = "X$file/" && dir=
5508 dir="$dir$objdir"
5509
5510 if test -n "$relink_command"; then
5511 # Determine the prefix the user has applied to our future dir.
5512 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5513
5514 # Don't allow the user to place us outside of our expected
5515 # location b/c this prevents finding dependent libraries that
5516 # are installed to the same prefix.
5517 # At present, this check doesn't affect windows .dll's that
5518 # are installed into $libdir/../bin (currently, that works fine)
5519 # but it's something to keep an eye on.
5520 if test "$inst_prefix_dir" = "$destdir"; then
5521 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5522 exit 1
5523 fi
5524
5525 if test -n "$inst_prefix_dir"; then
5526 # Stick the inst_prefix_dir data into the link command.
5527 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5528 else
5529 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5530 fi
5531
5532 $echo "$modename: warning: relinking \`$file'" 1>&2
5533 $show "$relink_command"
5534 if $run eval "$relink_command"; then :
5535 else
5536 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5537 exit 1
5538 fi
5539 fi
5540
5541 # See the names of the shared library.
5542 set dummy $library_names
5543 if test -n "$2"; then
5544 realname="$2"
5545 shift
5546 shift
5547
5548 srcname="$realname"
5549 test -n "$relink_command" && srcname="$realname"T
5550
5551 # Install the shared library and build the symlinks.
5552 $show "$install_prog $dir/$srcname $destdir/$realname"
5553 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5554 if test -n "$stripme" && test -n "$striplib"; then
5555 $show "$striplib $destdir/$realname"
5556 $run eval "$striplib $destdir/$realname" || exit $?
5557 fi
5558
5559 if test "$#" -gt 0; then
5560 # Delete the old symlinks, and create new ones.
5561 for linkname
5562 do
5563 if test "$linkname" != "$realname"; then
5564 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5565 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5566 fi
5567 done
5568 fi
5569
5570 # Do each command in the postinstall commands.
5571 lib="$destdir/$realname"
5572 eval cmds=\"$postinstall_cmds\"
5573 save_ifs="$IFS"; IFS=$_S_
5574 for cmd in $cmds; do
5575 IFS="$save_ifs"
5576 $show "$cmd"
5577 $run eval "$cmd" || exit $?
5578 done
5579 IFS="$save_ifs"
5580 fi
5581
5582 # Install the pseudo-library for information purposes.
5583 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5584 instname="$dir/$name"i
5585 $show "$install_prog $instname $destdir/$name"
5586 $run eval "$install_prog $instname $destdir/$name" || exit $?
5587
5588 # Maybe install the static library, too.
5589 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5590 ;;
5591
5592 *.lo)
5593 # Install (i.e. copy) a libtool object.
5594
5595 # Figure out destination file name, if it wasn't already specified.
5596 if test -n "$destname"; then
5597 destfile="$destdir/$destname"
5598 else
5599 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5600 destfile="$destdir/$destfile"
5601 fi
5602
5603 # Deduce the name of the destination old-style object file.
5604 case $destfile in
5605 *.lo)
5606 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5607 ;;
5608 *.$objext)
5609 staticdest="$destfile"
5610 destfile=
5611 ;;
5612 *)
5613 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5614 $echo "$help" 1>&2
5615 exit 1
5616 ;;
5617 esac
5618
5619 # Install the libtool object if requested.
5620 if test -n "$destfile"; then
5621 $show "$install_prog $file $destfile"
5622 $run eval "$install_prog $file $destfile" || exit $?
5623 fi
5624
5625 # Install the old object if enabled.
5626 if test "$build_old_libs" = yes; then
5627 # Deduce the name of the old-style object file.
5628 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5629
5630 $show "$install_prog $staticobj $staticdest"
5631 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5632 fi
5633 exit 0
5634 ;;
5635
5636 *)
5637 # Figure out destination file name, if it wasn't already specified.
5638 if test -n "$destname"; then
5639 destfile="$destdir/$destname"
5640 else
5641 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5642 destfile="$destdir/$destfile"
5643 fi
5644
5645 # If the file is missing, and there is a .exe on the end, strip it
5646 # because it is most likely a libtool script we actually want to
5647 # install
5648 stripped_ext=""
5649 case $file in
5650 *.exe)
5651 if test ! -f "$file"; then
5652 file=`$echo $file|${SED} 's,.exe$,,'`
5653 stripped_ext=".exe"
5654 fi
5655 ;;
5656 esac
5657
5658 # Do a test to see if this is really a libtool program.
5659 case $host in
5660 *cygwin*|*mingw*)
5661 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5662 ;;
5663 *)
5664 wrapper=$file
5665 ;;
5666 esac
5667 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5668 notinst_deplibs=
5669 relink_command=
5670
5671 # To insure that "foo" is sourced, and not "foo.exe",
5672 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5673 # which disallows the automatic-append-.exe behavior.
5674 case $build in
5675 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5676 *) wrapperdot=${wrapper} ;;
5677 esac
5678 # If there is no directory component, then add one.
5679 case $file in
5680 */* | *\\*) . ${wrapperdot} ;;
5681 *) . ./${wrapperdot} ;;
5682 esac
5683
5684 # Check the variables that should have been set.
5685 if test -z "$notinst_deplibs"; then
5686 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5687 exit 1
5688 fi
5689
5690 finalize=yes
5691 for lib in $notinst_deplibs; do
5692 # Check to see that each library is installed.
5693 libdir=
5694 if test -f "$lib"; then
5695 # If there is no directory component, then add one.
5696 case $lib in
5697 */* | *\\*) . $lib ;;
5698 *) . ./$lib ;;
5699 esac
5700 fi
5701 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5702 if test -n "$libdir" && test ! -f "$libfile"; then
5703 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5704 finalize=no
5705 fi
5706 done
5707
5708 relink_command=
5709 # To insure that "foo" is sourced, and not "foo.exe",
5710 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5711 # which disallows the automatic-append-.exe behavior.
5712 case $build in
5713 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5714 *) wrapperdot=${wrapper} ;;
5715 esac
5716 # If there is no directory component, then add one.
5717 case $file in
5718 */* | *\\*) . ${wrapperdot} ;;
5719 *) . ./${wrapperdot} ;;
5720 esac
5721
5722 outputname=
5723 if test "$fast_install" = no && test -n "$relink_command"; then
5724 if test "$finalize" = yes && test -z "$run"; then
5725 tmpdir="/tmp"
5726 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5727 tmpdir="$tmpdir/libtool-$$"
5728 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5729 else
5730 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5731 continue
5732 fi
5733 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5734 outputname="$tmpdir/$file"
5735 # Replace the output file specification.
5736 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5737
5738 $show "$relink_command"
5739 if $run eval "$relink_command"; then :
5740 else
5741 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5742 ${rm}r "$tmpdir"
5743 continue
5744 fi
5745 file="$outputname"
5746 else
5747 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5748 fi
5749 else
5750 # Install the binary that we compiled earlier.
5751 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5752 fi
5753 fi
5754
5755 # remove .exe since cygwin /usr/bin/install will append another
5756 # one anyways
5757 case $install_prog,$host in
5758 */usr/bin/install*,*cygwin*)
5759 case $file:$destfile in
5760 *.exe:*.exe)
5761 # this is ok
5762 ;;
5763 *.exe:*)
5764 destfile=$destfile.exe
5765 ;;
5766 *:*.exe)
5767 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5768 ;;
5769 esac
5770 ;;
5771 esac
5772 $show "$install_prog$stripme $file $destfile"
5773 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5774 test -n "$outputname" && ${rm}r "$tmpdir"
5775 ;;
5776 esac
5777 done
5778
5779 for file in $staticlibs; do
5780 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5781
5782 # Set up the ranlib parameters.
5783 oldlib="$destdir/$name"
5784
5785 $show "$install_prog $file $oldlib"
5786 $run eval "$install_prog \$file \$oldlib" || exit $?
5787
5788 if test -n "$stripme" && test -n "$striplib"; then
5789 $show "$old_striplib $oldlib"
5790 $run eval "$old_striplib $oldlib" || exit $?
5791 fi
5792
5793 # Do each command in the postinstall commands.
5794 eval cmds=\"$old_postinstall_cmds\"
5795 save_ifs="$IFS"; IFS=$_S_
5796 for cmd in $cmds; do
5797 IFS="$save_ifs"
5798 $show "$cmd"
5799 $run eval "$cmd" || exit $?
5800 done
5801 IFS="$save_ifs"
5802 done
5803
5804 if test -n "$future_libdirs"; then
5805 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5806 fi
5807
5808 if test -n "$current_libdirs"; then
5809 # Maybe just do a dry run.
5810 test -n "$run" && current_libdirs=" -n$current_libdirs"
5811 exec_cmd='$SHELL $0 --finish$current_libdirs'
5812 else
5813 exit 0
5814 fi
5815 ;;
5816
5817 # libtool finish mode
5818 finish)
5819 modename="$modename: finish"
5820 libdirs="$nonopt"
5821 admincmds=
5822
5823 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5824 for dir
5825 do
5826 libdirs="$libdirs $dir"
5827 done
5828
5829 for libdir in $libdirs; do
5830 if test -n "$finish_cmds"; then
5831 # Do each command in the finish commands.
5832 eval cmds=\"$finish_cmds\"
5833 save_ifs="$IFS"; IFS=$_S_
5834 for cmd in $cmds; do
5835 IFS="$save_ifs"
5836 $show "$cmd"
5837 $run eval "$cmd" || admincmds="$admincmds
5838 $cmd"
5839 done
5840 IFS="$save_ifs"
5841 fi
5842 if test -n "$finish_eval"; then
5843 # Do the single finish_eval.
5844 eval cmds=\"$finish_eval\"
5845 $run eval "$cmds" || admincmds="$admincmds
5846 $cmds"
5847 fi
5848 done
5849 fi
5850
5851 # Exit here if they wanted silent mode.
5852 test "$show" = : && exit 0
5853
5854 $echo "----------------------------------------------------------------------"
5855 $echo "Libraries have been installed in:"
5856 for libdir in $libdirs; do
5857 $echo " $libdir"
5858 done
5859 $echo
5860 $echo "If you ever happen to want to link against installed libraries"
5861 $echo "in a given directory, LIBDIR, you must either use libtool, and"
5862 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5863 $echo "flag during linking and do at least one of the following:"
5864 if test -n "$shlibpath_var"; then
5865 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5866 $echo " during execution"
5867 fi
5868 if test -n "$runpath_var"; then
5869 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
5870 $echo " during linking"
5871 fi
5872 if test -n "$hardcode_libdir_flag_spec"; then
5873 libdir=LIBDIR
5874 eval flag=\"$hardcode_libdir_flag_spec\"
5875
5876 $echo " - use the \`$flag' linker flag"
5877 fi
5878 if test -n "$admincmds"; then
5879 $echo " - have your system administrator run these commands:$admincmds"
5880 fi
5881 if test -f /etc/ld.so.conf; then
5882 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5883 fi
5884 $echo
5885 $echo "See any operating system documentation about shared libraries for"
5886 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5887 $echo "----------------------------------------------------------------------"
5888 exit 0
5889 ;;
5890
5891 # libtool execute mode
5892 execute)
5893 modename="$modename: execute"
5894
5895 # The first argument is the command name.
5896 cmd="$nonopt"
5897 if test -z "$cmd"; then
5898 $echo "$modename: you must specify a COMMAND" 1>&2
5899 $echo "$help"
5900 exit 1
5901 fi
5902
5903 # Handle -dlopen flags immediately.
5904 for file in $execute_dlfiles; do
5905 if test ! -f "$file"; then
5906 $echo "$modename: \`$file' is not a file" 1>&2
5907 $echo "$help" 1>&2
5908 exit 1
5909 fi
5910
5911 dir=
5912 case $file in
5913 *.la)
5914 # Check to see that this really is a libtool archive.
5915 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5916 else
5917 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5918 $echo "$help" 1>&2
5919 exit 1
5920 fi
5921
5922 # Read the libtool library.
5923 dlname=
5924 library_names=
5925
5926 # If there is no directory component, then add one.
5927 case $file in
5928 */* | *\\*) . $file ;;
5929 *) . ./$file ;;
5930 esac
5931
5932 # Skip this library if it cannot be dlopened.
5933 if test -z "$dlname"; then
5934 # Warn if it was a shared library.
5935 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5936 continue
5937 fi
5938
5939 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5940 test "X$dir" = "X$file" && dir=.
5941
5942 if test -f "$dir/$objdir/$dlname"; then
5943 dir="$dir/$objdir"
5944 else
5945 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5946 exit 1
5947 fi
5948 ;;
5949
5950 *.lo)
5951 # Just add the directory containing the .lo file.
5952 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5953 test "X$dir" = "X$file" && dir=.
5954 ;;
5955
5956 *)
5957 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5958 continue
5959 ;;
5960 esac
5961
5962 # Get the absolute pathname.
5963 absdir=`cd "$dir" && pwd`
5964 test -n "$absdir" && dir="$absdir"
5965
5966 # Now add the directory to shlibpath_var.
5967 if eval "test -z \"\$$shlibpath_var\""; then
5968 eval "$shlibpath_var=\"\$dir\""
5969 else
5970 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5971 fi
5972 done
5973
5974 # This variable tells wrapper scripts just to set shlibpath_var
5975 # rather than running their programs.
5976 libtool_execute_magic="$magic"
5977
5978 # Check if any of the arguments is a wrapper script.
5979 args=
5980 for file
5981 do
5982 case $file in
5983 -*) ;;
5984 *)
5985 # Do a test to see if this is really a libtool program.
5986 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5987 # If there is no directory component, then add one.
5988 case $file in
5989 */* | *\\*) . $file ;;
5990 *) . ./$file ;;
5991 esac
5992
5993 # Transform arg to wrapped name.
5994 file="$progdir/$program"
5995 fi
5996 ;;
5997 esac
5998 # Quote arguments (to preserve shell metacharacters).
5999 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6000 args="$args \"$file\""
6001 done
6002
6003 if test -z "$run"; then
6004 if test -n "$shlibpath_var"; then
6005 # Export the shlibpath_var.
6006 eval "export $shlibpath_var"
6007 fi
6008
6009 # Restore saved environment variables
6010 if test "${save_LC_ALL+set}" = set; then
6011 LC_ALL="$save_LC_ALL"; export LC_ALL
6012 fi
6013 if test "${save_LANG+set}" = set; then
6014 LANG="$save_LANG"; export LANG
6015 fi
6016
6017 # Now prepare to actually exec the command.
6018 exec_cmd="\$cmd$args"
6019 else
6020 # Display what would be done.
6021 if test -n "$shlibpath_var"; then
6022 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6023 $echo "export $shlibpath_var"
6024 fi
6025 $echo "$cmd$args"
6026 exit 0
6027 fi
6028 ;;
6029
6030 # libtool clean and uninstall mode
6031 clean | uninstall)
6032 modename="$modename: $mode"
6033 rm="$nonopt"
6034 files=
6035 rmforce=
6036 exit_status=0
6037
6038 # This variable tells wrapper scripts just to set variables rather
6039 # than running their programs.
6040 libtool_install_magic="$magic"
6041
6042 for arg
6043 do
6044 case $arg in
6045 -f) rm="$rm $arg"; rmforce=yes ;;
6046 -*) rm="$rm $arg" ;;
6047 *) files="$files $arg" ;;
6048 esac
6049 done
6050
6051 if test -z "$rm"; then
6052 $echo "$modename: you must specify an RM program" 1>&2
6053 $echo "$help" 1>&2
6054 exit 1
6055 fi
6056
6057 rmdirs=
6058
6059 origobjdir="$objdir"
6060 for file in $files; do
6061 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6062 if test "X$dir" = "X$file"; then
6063 dir=.
6064 objdir="$origobjdir"
6065 else
6066 objdir="$dir/$origobjdir"
6067 fi
6068 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6069 test "$mode" = uninstall && objdir="$dir"
6070
6071 # Remember objdir for removal later, being careful to avoid duplicates
6072 if test "$mode" = clean; then
6073 case " $rmdirs " in
6074 *" $objdir "*) ;;
6075 *) rmdirs="$rmdirs $objdir" ;;
6076 esac
6077 fi
6078
6079 # Don't error if the file doesn't exist and rm -f was used.
6080 if (test -L "$file") >/dev/null 2>&1 \
6081 || (test -h "$file") >/dev/null 2>&1 \
6082 || test -f "$file"; then
6083 :
6084 elif test -d "$file"; then
6085 exit_status=1
6086 continue
6087 elif test "$rmforce" = yes; then
6088 continue
6089 fi
6090
6091 rmfiles="$file"
6092
6093 case $name in
6094 *.la)
6095 # Possibly a libtool archive, so verify it.
6096 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6097 . $dir/$name
6098
6099 # Delete the libtool libraries and symlinks.
6100 for n in $library_names; do
6101 rmfiles="$rmfiles $objdir/$n"
6102 done
6103 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6104 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6105
6106 if test "$mode" = uninstall; then
6107 if test -n "$library_names"; then
6108 # Do each command in the postuninstall commands.
6109 eval cmds=\"$postuninstall_cmds\"
6110 save_ifs="$IFS"; IFS=$_S_
6111 for cmd in $cmds; do
6112 IFS="$save_ifs"
6113 $show "$cmd"
6114 $run eval "$cmd"
6115 if test "$?" -ne 0 && test "$rmforce" != yes; then
6116 exit_status=1
6117 fi
6118 done
6119 IFS="$save_ifs"
6120 fi
6121
6122 if test -n "$old_library"; then
6123 # Do each command in the old_postuninstall commands.
6124 eval cmds=\"$old_postuninstall_cmds\"
6125 save_ifs="$IFS"; IFS=$_S_
6126 for cmd in $cmds; do
6127 IFS="$save_ifs"
6128 $show "$cmd"
6129 $run eval "$cmd"
6130 if test "$?" -ne 0 && test "$rmforce" != yes; then
6131 exit_status=1
6132 fi
6133 done
6134 IFS="$save_ifs"
6135 fi
6136 # FIXME: should reinstall the best remaining shared library.
6137 fi
6138 fi
6139 ;;
6140
6141 *.lo)
6142 # Possibly a libtool object, so verify it.
6143 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6144
6145 # Read the .lo file
6146 . $dir/$name
6147
6148 # Add PIC object to the list of files to remove.
6149 if test -n "$pic_object" \
6150 && test "$pic_object" != none; then
6151 rmfiles="$rmfiles $dir/$pic_object"
6152 fi
6153
6154 # Add non-PIC object to the list of files to remove.
6155 if test -n "$non_pic_object" \
6156 && test "$non_pic_object" != none; then
6157 rmfiles="$rmfiles $dir/$non_pic_object"
6158 fi
6159 fi
6160 ;;
6161
6162 *)
6163 if test "$mode" = clean ; then
6164 noexename=$name
6165 case $file in
6166 *.exe)
6167 file=`$echo $file|${SED} 's,.exe$,,'`
6168 noexename=`$echo $name|${SED} 's,.exe$,,'`
6169 # $file with .exe has already been added to rmfiles,
6170 # add $file without .exe
6171 rmfiles="$rmfiles $file"
6172 ;;
6173 esac
6174 # Do a test to see if this is a libtool program.
6175 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6176 relink_command=
6177 . $dir/$noexename
6178
6179 # note $name still contains .exe if it was in $file originally
6180 # as does the version of $file that was added into $rmfiles
6181 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6182 if test "$fast_install" = yes && test -n "$relink_command"; then
6183 rmfiles="$rmfiles $objdir/lt-$name"
6184 fi
6185 if test "X$noexename" != "X$name" ; then
6186 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6187 fi
6188 fi
6189 fi
6190 ;;
6191 esac
6192 $show "$rm $rmfiles"
6193 $run $rm $rmfiles || exit_status=1
6194 done
6195 objdir="$origobjdir"
6196
6197 # Try to remove the ${objdir}s in the directories where we deleted files
6198 for dir in $rmdirs; do
6199 if test -d "$dir"; then
6200 $show "rmdir $dir"
6201 $run rmdir $dir >/dev/null 2>&1
6202 fi
6203 done
6204
6205 exit $exit_status
6206 ;;
6207
6208 "")
6209 $echo "$modename: you must specify a MODE" 1>&2
6210 $echo "$generic_help" 1>&2
6211 exit 1
6212 ;;
6213 esac
6214
6215 if test -z "$exec_cmd"; then
6216 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6217 $echo "$generic_help" 1>&2
6218 exit 1
6219 fi
6220 fi # test -z "$show_help"
6221
6222 if test -n "$exec_cmd"; then
6223 eval exec $exec_cmd
6224 exit 1
6225 fi
6226
6227 # We need to display help for each of the modes.
6228 case $mode in
6229 "") $echo \
6230 "Usage: $modename [OPTION]... [MODE-ARG]...
6231
6232 Provide generalized library-building support services.
6233
6234 --config show all configuration variables
6235 --debug enable verbose shell tracing
6236 -n, --dry-run display commands without modifying any files
6237 --features display basic configuration information and exit
6238 --finish same as \`--mode=finish'
6239 --help display this help message and exit
6240 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6241 --quiet same as \`--silent'
6242 --silent don't print informational messages
6243 --tag=TAG use configuration variables from tag TAG
6244 --version print version information
6245
6246 MODE must be one of the following:
6247
6248 clean remove files from the build directory
6249 compile compile a source file into a libtool object
6250 execute automatically set library path, then run a program
6251 finish complete the installation of libtool libraries
6252 install install libraries or executables
6253 link create a library or an executable
6254 uninstall remove libraries from an installed directory
6255
6256 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6257 a more detailed description of MODE.
6258
6259 Report bugs to <bug-libtool@gnu.org>."
6260 exit 0
6261 ;;
6262
6263 clean)
6264 $echo \
6265 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6266
6267 Remove files from the build directory.
6268
6269 RM is the name of the program to use to delete files associated with each FILE
6270 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6271 to RM.
6272
6273 If FILE is a libtool library, object or program, all the files associated
6274 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6275 ;;
6276
6277 compile)
6278 $echo \
6279 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6280
6281 Compile a source file into a libtool library object.
6282
6283 This mode accepts the following additional options:
6284
6285 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6286 -prefer-pic try to building PIC objects only
6287 -prefer-non-pic try to building non-PIC objects only
6288 -static always build a \`.o' file suitable for static linking
6289
6290 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6291 from the given SOURCEFILE.
6292
6293 The output file name is determined by removing the directory component from
6294 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6295 library object suffix, \`.lo'."
6296 ;;
6297
6298 execute)
6299 $echo \
6300 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6301
6302 Automatically set library path, then run a program.
6303
6304 This mode accepts the following additional options:
6305
6306 -dlopen FILE add the directory containing FILE to the library path
6307
6308 This mode sets the library path environment variable according to \`-dlopen'
6309 flags.
6310
6311 If any of the ARGS are libtool executable wrappers, then they are translated
6312 into their corresponding uninstalled binary, and any of their required library
6313 directories are added to the library path.
6314
6315 Then, COMMAND is executed, with ARGS as arguments."
6316 ;;
6317
6318 finish)
6319 $echo \
6320 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6321
6322 Complete the installation of libtool libraries.
6323
6324 Each LIBDIR is a directory that contains libtool libraries.
6325
6326 The commands that this mode executes may require superuser privileges. Use
6327 the \`--dry-run' option if you just want to see what would be executed."
6328 ;;
6329
6330 install)
6331 $echo \
6332 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6333
6334 Install executables or libraries.
6335
6336 INSTALL-COMMAND is the installation command. The first component should be
6337 either the \`install' or \`cp' program.
6338
6339 The rest of the components are interpreted as arguments to that command (only
6340 BSD-compatible install options are recognized)."
6341 ;;
6342
6343 link)
6344 $echo \
6345 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6346
6347 Link object files or libraries together to form another library, or to
6348 create an executable program.
6349
6350 LINK-COMMAND is a command using the C compiler that you would use to create
6351 a program from several object files.
6352
6353 The following components of LINK-COMMAND are treated specially:
6354
6355 -all-static do not do any dynamic linking at all
6356 -avoid-version do not add a version suffix if possible
6357 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6358 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6359 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6360 -export-symbols SYMFILE
6361 try to export only the symbols listed in SYMFILE
6362 -export-symbols-regex REGEX
6363 try to export only the symbols matching REGEX
6364 -LLIBDIR search LIBDIR for required installed libraries
6365 -lNAME OUTPUT-FILE requires the installed library libNAME
6366 -module build a library that can dlopened
6367 -no-fast-install disable the fast-install mode
6368 -no-install link a not-installable executable
6369 -no-undefined declare that a library does not refer to external symbols
6370 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6371 -objectlist FILE Use a list of object files found in FILE to specify objects
6372 -release RELEASE specify package release information
6373 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6374 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6375 -static do not do any dynamic linking of libtool libraries
6376 -version-info CURRENT[:REVISION[:AGE]]
6377 specify library version info [each variable defaults to 0]
6378
6379 All other options (arguments beginning with \`-') are ignored.
6380
6381 Every other argument is treated as a filename. Files ending in \`.la' are
6382 treated as uninstalled libtool libraries, other files are standard or library
6383 object files.
6384
6385 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6386 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6387 required, except when creating a convenience library.
6388
6389 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6390 using \`ar' and \`ranlib', or on Windows using \`lib'.
6391
6392 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6393 is created, otherwise an executable program is created."
6394 ;;
6395
6396 uninstall)
6397 $echo \
6398 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6399
6400 Remove libraries from an installation directory.
6401
6402 RM is the name of the program to use to delete files associated with each FILE
6403 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6404 to RM.
6405
6406 If FILE is a libtool library, all the files associated with it are deleted.
6407 Otherwise, only FILE itself is deleted using RM."
6408 ;;
6409
6410 *)
6411 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6412 $echo "$help" 1>&2
6413 exit 1
6414 ;;
6415 esac
6416
6417 $echo
6418 $echo "Try \`$modename --help' for more information about other modes."
6419
6420 exit 0
6421
6422 # The TAGs below are defined such that we never get into a situation
6423 # in which we disable both kinds of libraries. Given conflicting
6424 # choices, we go for a static library, that is the most portable,
6425 # since we can't tell whether shared libraries were disabled because
6426 # the user asked for that or because the platform doesn't support
6427 # them. This is particularly important on AIX, because we don't
6428 # support having both static and shared libraries enabled at the same
6429 # time on that platform, so we default to a shared-only configuration.
6430 # If a disable-shared tag is given, we'll fallback to a static-only
6431 # configuration. But we'll never go from static-only to shared-only.
6432
6433 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6434 build_libtool_libs=no
6435 build_old_libs=yes
6436 # ### END LIBTOOL TAG CONFIG: disable-shared
6437
6438 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6439 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6440 # ### END LIBTOOL TAG CONFIG: disable-static
6441
6442 # Local Variables:
6443 # mode:shell-script
6444 # sh-indentation:2
6445 # End: