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