source: trunk/gc6.8/libtool@ 239

Last change on this file since 239 was 132, checked in by cinc, 19 years ago

Boehm-Demers-Weiser garbage collector. Single-threaded for OS/2.

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