· 7 years ago · Sep 15, 2018, 03:00 AM
1#! /bin/sh
2# Generated automatically by config.status (mpich) 3.3b3
3# Libtool was configured on host 12amd64-FLANG:
4# NOTE: Changes made to this file will be lost: look at ltmain.sh.
5
6# Provide generalized library-building support services.
7# Written by Gordon Matzigkeit, 1996
8
9# Copyright (C) 2014 Free Software Foundation, Inc.
10# This is free software; see the source for copying conditions. There is NO
11# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13# GNU Libtool is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of of the License, or
16# (at your option) any later version.
17#
18# As a special exception to the GNU General Public License, if you
19# distribute this file as part of a program or library that is built
20# using GNU Libtool, you may include this file under the same
21# distribution terms that you use for the rest of that program.
22#
23# GNU Libtool is distributed in the hope that it will be useful, but
24# WITHOUT ANY WARRANTY; without even the implied warranty of
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26# GNU General Public License for more details.
27#
28# You should have received a copy of the GNU General Public License
29# along with this program. If not, see <http://www.gnu.org/licenses/>.
30
31
32# The names of the tagged configurations supported by this script.
33available_tags='CXX FC F77 '
34
35# Configured defaults for sys_lib_dlsearch_path munging.
36: ${LT_SYS_LIBRARY_PATH=""}
37
38# ### BEGIN LIBTOOL CONFIG
39
40# Which release of libtool.m4 was used?
41macro_version=2.4.6
42macro_revision=2.4.6
43
44# Whether or not to build shared libraries.
45build_libtool_libs=yes
46
47# Whether or not to build static libraries.
48build_old_libs=no
49
50# What type of objects to build.
51pic_mode=default
52
53# Whether or not to optimize for fast installation.
54fast_install=needless
55
56# Shared archive member basename,for filename based shared library versioning on AIX.
57shared_archive_member_spec=
58
59# Shell to use when invoking shell scripts.
60SHELL="/bin/sh"
61
62# An echo program that protects backslashes.
63ECHO="printf %s\\n"
64
65# The PATH separator for the build system.
66PATH_SEPARATOR=":"
67
68# The host system.
69host_alias=
70host=amd64-unknown-freebsd12.0
71host_os=freebsd12.0
72
73# The build system.
74build_alias=
75build=amd64-unknown-freebsd12.0
76build_os=freebsd12.0
77
78# A sed program that does not truncate output.
79SED="/usr/bin/sed"
80
81# Sed that helps us avoid accidentally triggering echo(1) options like -n.
82Xsed="$SED -e 1s/^X//"
83
84# A grep program that handles long lines.
85GREP="/usr/bin/grep"
86
87# An ERE matcher.
88EGREP="/usr/bin/grep -E"
89
90# A literal string matcher.
91FGREP="/usr/bin/grep -F"
92
93# A BSD- or MS-compatible name lister.
94NM="/usr/local/bin/nm -B"
95
96# Whether we need soft or hard links.
97LN_S="ln -s"
98
99# What is the maximum length of a command?
100max_cmd_len=196608
101
102# Object file suffix (normally "o").
103objext=o
104
105# Executable file suffix (normally "").
106exeext=
107
108# whether the shell understands "unset".
109lt_unset=unset
110
111# turn spaces into newlines.
112SP2NL="tr \\040 \\012"
113
114# turn newlines into spaces.
115NL2SP="tr \\015\\012 \\040\\040"
116
117# convert $build file names to $host format.
118to_host_file_cmd=func_convert_file_noop
119
120# convert $build files to toolchain format.
121to_tool_file_cmd=func_convert_file_noop
122
123# An object symbol dumper.
124OBJDUMP="objdump"
125
126# Method to check whether dependent libraries are shared objects.
127deplibs_check_method="pass_all"
128
129# Command to use when deplibs_check_method = "file_magic".
130file_magic_cmd="\$MAGIC_CMD"
131
132# How to find potential files when deplibs_check_method = "file_magic".
133file_magic_glob=""
134
135# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
136want_nocaseglob="no"
137
138# DLL creation program.
139DLLTOOL="false"
140
141# Command to associate shared and link libraries.
142sharedlib_from_linklib_cmd="printf %s\\n"
143
144# The archiver.
145AR="ar"
146
147# Flags to create an archive.
148AR_FLAGS="cr"
149
150# How to feed a file listing to the archiver.
151archiver_list_spec=""
152
153# A symbol stripping program.
154STRIP="strip"
155
156# Commands used to install an old-style archive.
157RANLIB="ranlib"
158old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
159old_postuninstall_cmds=""
160
161# Whether to use a lock for old archive extraction.
162lock_old_archive_extraction=no
163
164# A C compiler.
165LTCC="clang"
166
167# LTCC compiler flags.
168LTCFLAGS=" -O2"
169
170# Take the output of nm and produce a listing of raw symbols and C names.
171global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172
173# Transform the output of nm in a proper C declaration.
174global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175
176# Transform the output of nm into a list of symbols to manually relocate.
177global_symbol_to_import=""
178
179# Transform the output of nm in a C name address pair.
180global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
181
182# Transform the output of nm in a C name address pair when lib prefix is needed.
183global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
184
185# The name lister interface.
186nm_interface="BSD nm"
187
188# Specify filename containing input files for $NM.
189nm_file_list_spec="@"
190
191# The root where to search for dependent libraries,and where our libraries should be installed.
192lt_sysroot=
193
194# Command to truncate a binary pipe.
195lt_truncate_bin="/bin/dd bs=4096 count=1"
196
197# The name of the directory that contains temporary libtool files.
198objdir=.libs
199
200# Used to examine libraries when file_magic_cmd begins with "file".
201MAGIC_CMD=file
202
203# Must we lock files when doing compilation?
204need_locks="no"
205
206# Manifest tool.
207MANIFEST_TOOL=":"
208
209# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
210DSYMUTIL=""
211
212# Tool to change global to local symbols on Mac OS X.
213NMEDIT=""
214
215# Tool to manipulate fat objects and archives on Mac OS X.
216LIPO=""
217
218# ldd/readelf like tool for Mach-O binaries on Mac OS X.
219OTOOL=""
220
221# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
222OTOOL64=""
223
224# Old archive suffix (normally "a").
225libext=a
226
227# Shared library suffix (normally ".so").
228shrext_cmds=".so"
229
230# The commands to extract the exported symbol list from a shared archive.
231extract_expsyms_cmds=""
232
233# Variables whose values should be saved in libtool wrapper scripts and
234# restored at link time.
235variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH"
236
237# Do we need the "lib" prefix for modules?
238need_lib_prefix=no
239
240# Do we need a version for libraries?
241need_version=no
242
243# Library versioning type.
244version_type=freebsd-elf
245
246# Shared library runtime path variable.
247runpath_var=LD_RUN_PATH
248
249# Shared library path variable.
250shlibpath_var=LD_LIBRARY_PATH
251
252# Is shlibpath searched before the hard-coded library search path?
253shlibpath_overrides_runpath=yes
254
255# Format of library name prefix.
256libname_spec="lib\$name"
257
258# List of archive names. First name is the real one, the rest are links.
259# The last name is the one that the linker finds with -lNAME
260library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
261
262# The coded name of the library, if different from the real name.
263soname_spec="\$libname\$release\$shared_ext\$major"
264
265# Permission mode override for installation of shared libraries.
266install_override_mode=""
267
268# Command to use after installation of a shared archive.
269postinstall_cmds=""
270
271# Command to use after uninstallation of a shared archive.
272postuninstall_cmds=""
273
274# Commands used to finish a libtool library installation in a directory.
275finish_cmds=""
276
277# As "finish_cmds", except a single script fragment to be evaled but
278# not shown.
279finish_eval=""
280
281# Whether we should hardcode library paths into libraries.
282hardcode_into_libs=yes
283
284# Compile-time system search path for libraries.
285sys_lib_search_path_spec="/usr/lib/clang/5.0.1 /usr/lib "
286
287# Detected run-time system search path for libraries.
288sys_lib_dlsearch_path_spec="/lib /usr/lib"
289
290# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
291configure_time_lt_sys_library_path=""
292
293# Whether dlopen is supported.
294dlopen_support=unknown
295
296# Whether dlopen of programs is supported.
297dlopen_self=unknown
298
299# Whether dlopen of statically linked programs is supported.
300dlopen_self_static=unknown
301
302# Commands to strip libraries.
303old_striplib="strip --strip-debug"
304striplib="strip --strip-unneeded"
305
306
307# The linker used to build libraries.
308LD="/usr/bin/ld"
309
310# How to create reloadable object files.
311reload_flag=" -r"
312reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
313
314# Commands used to build an old-style archive.
315old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
316
317# A language specific compiler.
318CC="clang"
319
320# Is the compiler the GNU compiler?
321with_gcc=yes
322
323# Compiler flag to turn off builtin functions.
324no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions"
325
326# Additional compiler flags for building library objects.
327pic_flag=" -fPIC -DPIC"
328
329# How to pass a linker flag through the compiler.
330wl="-Wl,"
331
332# Compiler flag to prevent dynamic linking.
333link_static_flag="-static"
334
335# Does compiler simultaneously support -c and -o options?
336compiler_c_o="yes"
337
338# Whether or not to add -lc for building shared libraries.
339build_libtool_need_lc=no
340
341# Whether or not to disallow shared libs when runtime libs are static.
342allow_libtool_libs_with_static_runtimes=no
343
344# Compiler flag to allow reflexive dlopens.
345export_dynamic_flag_spec="\$wl--export-dynamic"
346
347# Compiler flag to generate shared objects directly from archives.
348whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
349
350# Whether the compiler copes with passing no objects directly.
351compiler_needs_object="no"
352
353# Create an old-style archive from a shared archive.
354old_archive_from_new_cmds=""
355
356# Create a temporary old-style archive to link instead of a shared archive.
357old_archive_from_expsyms_cmds=""
358
359# Commands used to build a shared archive.
360archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
361archive_expsym_cmds="echo \\\"{ global:\\\" > \$lib-ver~ sed -e \\\"s|\$|;|\\\" < \$export_symbols >> \$lib-ver~ echo \\\"local: *; };\\\" >> \$lib-ver~\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$lib-ver -o \$lib"
362
363# Commands used to build a loadable module if different from building
364# a shared archive.
365module_cmds=""
366module_expsym_cmds=""
367
368# Whether we are building with GNU ld or not.
369with_gnu_ld="yes"
370
371# Flag that allows shared libraries with undefined symbols to be built.
372allow_undefined_flag=""
373
374# Flag that enforces no undefined symbols.
375no_undefined_flag=""
376
377# Flag to hardcode $libdir into a binary during linking.
378# This must work even if $libdir does not exist
379hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
380
381# Whether we need a single "-rpath" flag with a separated argument.
382hardcode_libdir_separator=""
383
384# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
385# DIR into the resulting binary.
386hardcode_direct=no
387
388# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
389# DIR into the resulting binary and the resulting library dependency is
390# "absolute",i.e impossible to change by setting $shlibpath_var if the
391# library is relocated.
392hardcode_direct_absolute=no
393
394# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
395# into the resulting binary.
396hardcode_minus_L=no
397
398# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
399# into the resulting binary.
400hardcode_shlibpath_var=unsupported
401
402# Set to "yes" if building a shared library automatically hardcodes DIR
403# into the library and all subsequent libraries and executables linked
404# against it.
405hardcode_automatic=no
406
407# Set to yes if linker adds runtime paths of dependent libraries
408# to runtime path list.
409inherit_rpath=no
410
411# Whether libtool must link a program against all its dependency libraries.
412link_all_deplibs=no
413
414# Set to "yes" if exported symbols are required.
415always_export_symbols=no
416
417# The commands to list exported symbols.
418export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
419
420# Symbols that should not be listed in the preloaded symbols.
421exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
422
423# Symbols that must always be exported.
424include_expsyms=""
425
426# Commands necessary for linking programs (against libraries) with templates.
427prelink_cmds=""
428
429# Commands necessary for finishing linking programs.
430postlink_cmds=""
431
432# Specify filename containing input files.
433file_list_spec=""
434
435# How to hardcode a shared library path into an executable.
436hardcode_action=immediate
437
438# The directories searched by this compiler when creating a shared library.
439compiler_lib_search_dirs=""
440
441# Dependencies to place before and after the objects being linked to
442# create a shared library.
443predep_objects=""
444postdep_objects=""
445predeps=""
446postdeps=""
447
448# The library search path used internally by the compiler when linking
449# a shared library.
450compiler_lib_search_path=""
451
452# ### END LIBTOOL CONFIG
453
454
455# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
456
457# func_munge_path_list VARIABLE PATH
458# -----------------------------------
459# VARIABLE is name of variable containing _space_ separated list of
460# directories to be munged by the contents of PATH, which is string
461# having a format:
462# "DIR[:DIR]:"
463# string "DIR[ DIR]" will be prepended to VARIABLE
464# ":DIR[:DIR]"
465# string "DIR[ DIR]" will be appended to VARIABLE
466# "DIRP[:DIRP]::[DIRA:]DIRA"
467# string "DIRP[ DIRP]" will be prepended to VARIABLE and string
468# "DIRA[ DIRA]" will be appended to VARIABLE
469# "DIR[:DIR]"
470# VARIABLE will be replaced by "DIR[ DIR]"
471func_munge_path_list ()
472{
473 case x$2 in
474 x)
475 ;;
476 *:)
477 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
478 ;;
479 x:*)
480 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
481 ;;
482 *::*)
483 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
484 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
485 ;;
486 *)
487 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
488 ;;
489 esac
490}
491
492
493# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
494func_cc_basename ()
495{
496 for cc_temp in $*""; do
497 case $cc_temp in
498 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
499 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
500 \-*) ;;
501 *) break;;
502 esac
503 done
504 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
505}
506
507
508# ### END FUNCTIONS SHARED WITH CONFIGURE
509
510#! /bin/sh
511## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
512## by inline-source v2014-01-03.01
513
514# libtool (GNU libtool) 2.4.6
515# Provide generalized library-building support services.
516# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
517
518# Copyright (C) 1996-2015 Free Software Foundation, Inc.
519# This is free software; see the source for copying conditions. There is NO
520# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
521
522# GNU Libtool is free software; you can redistribute it and/or modify
523# it under the terms of the GNU General Public License as published by
524# the Free Software Foundation; either version 2 of the License, or
525# (at your option) any later version.
526#
527# As a special exception to the GNU General Public License,
528# if you distribute this file as part of a program or library that
529# is built using GNU Libtool, you may include this file under the
530# same distribution terms that you use for the rest of that program.
531#
532# GNU Libtool is distributed in the hope that it will be useful, but
533# WITHOUT ANY WARRANTY; without even the implied warranty of
534# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
535# General Public License for more details.
536#
537# You should have received a copy of the GNU General Public License
538# along with this program. If not, see <http://www.gnu.org/licenses/>.
539
540
541PROGRAM=libtool
542PACKAGE=libtool
543VERSION=2.4.6
544package_revision=2.4.6
545
546
547## ------ ##
548## Usage. ##
549## ------ ##
550
551# Run './libtool --help' for help with using this script from the
552# command line.
553
554
555## ------------------------------- ##
556## User overridable command paths. ##
557## ------------------------------- ##
558
559# After configure completes, it has a better idea of some of the
560# shell tools we need than the defaults used by the functions shared
561# with bootstrap, so set those here where they can still be over-
562# ridden by the user, but otherwise take precedence.
563
564: ${AUTOCONF="autoconf"}
565: ${AUTOMAKE="automake"}
566
567
568## -------------------------- ##
569## Source external libraries. ##
570## -------------------------- ##
571
572# Much of our low-level functionality needs to be sourced from external
573# libraries, which are installed to $pkgauxdir.
574
575# Set a version string for this script.
576scriptversion=2015-01-20.17; # UTC
577
578# General shell script boiler plate, and helper functions.
579# Written by Gary V. Vaughan, 2004
580
581# Copyright (C) 2004-2015 Free Software Foundation, Inc.
582# This is free software; see the source for copying conditions. There is NO
583# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
584
585# This program is free software; you can redistribute it and/or modify
586# it under the terms of the GNU General Public License as published by
587# the Free Software Foundation; either version 3 of the License, or
588# (at your option) any later version.
589
590# As a special exception to the GNU General Public License, if you distribute
591# this file as part of a program or library that is built using GNU Libtool,
592# you may include this file under the same distribution terms that you use
593# for the rest of that program.
594
595# This program is distributed in the hope that it will be useful,
596# but WITHOUT ANY WARRANTY; without even the implied warranty of
597# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
598# General Public License for more details.
599
600# You should have received a copy of the GNU General Public License
601# along with this program. If not, see <http://www.gnu.org/licenses/>.
602
603# Please report bugs or propose patches to gary@gnu.org.
604
605
606## ------ ##
607## Usage. ##
608## ------ ##
609
610# Evaluate this file near the top of your script to gain access to
611# the functions and variables defined here:
612#
613# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
614#
615# If you need to override any of the default environment variable
616# settings, do that before evaluating this file.
617
618
619## -------------------- ##
620## Shell normalisation. ##
621## -------------------- ##
622
623# Some shells need a little help to be as Bourne compatible as possible.
624# Before doing anything else, make sure all that help has been provided!
625
626DUALCASE=1; export DUALCASE # for MKS sh
627if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
628 emulate sh
629 NULLCMD=:
630 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
631 # is contrary to our usage. Disable this feature.
632 alias -g '${1+"$@"}'='"$@"'
633 setopt NO_GLOB_SUBST
634else
635 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
636fi
637
638# NLS nuisances: We save the old values in case they are required later.
639_G_user_locale=
640_G_safe_locale=
641for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
642do
643 eval "if test set = \"\${$_G_var+set}\"; then
644 save_$_G_var=\$$_G_var
645 $_G_var=C
646 export $_G_var
647 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
648 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
649 fi"
650done
651
652# CDPATH.
653(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
654
655# Make sure IFS has a sensible default
656sp=' '
657nl='
658'
659IFS="$sp $nl"
660
661# There are apparently some retarded systems that use ';' as a PATH separator!
662if test "${PATH_SEPARATOR+set}" != set; then
663 PATH_SEPARATOR=:
664 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
665 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
666 PATH_SEPARATOR=';'
667 }
668fi
669
670
671
672## ------------------------- ##
673## Locate command utilities. ##
674## ------------------------- ##
675
676
677# func_executable_p FILE
678# ----------------------
679# Check that FILE is an executable regular file.
680func_executable_p ()
681{
682 test -f "$1" && test -x "$1"
683}
684
685
686# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
687# --------------------------------------------
688# Search for either a program that responds to --version with output
689# containing "GNU", or else returned by CHECK_FUNC otherwise, by
690# trying all the directories in PATH with each of the elements of
691# PROGS_LIST.
692#
693# CHECK_FUNC should accept the path to a candidate program, and
694# set $func_check_prog_result if it truncates its output less than
695# $_G_path_prog_max characters.
696func_path_progs ()
697{
698 _G_progs_list=$1
699 _G_check_func=$2
700 _G_PATH=${3-"$PATH"}
701
702 _G_path_prog_max=0
703 _G_path_prog_found=false
704 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
705 for _G_dir in $_G_PATH; do
706 IFS=$_G_save_IFS
707 test -z "$_G_dir" && _G_dir=.
708 for _G_prog_name in $_G_progs_list; do
709 for _exeext in '' .EXE; do
710 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
711 func_executable_p "$_G_path_prog" || continue
712 case `"$_G_path_prog" --version 2>&1` in
713 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
714 *) $_G_check_func $_G_path_prog
715 func_path_progs_result=$func_check_prog_result
716 ;;
717 esac
718 $_G_path_prog_found && break 3
719 done
720 done
721 done
722 IFS=$_G_save_IFS
723 test -z "$func_path_progs_result" && {
724 echo "no acceptable sed could be found in \$PATH" >&2
725 exit 1
726 }
727}
728
729
730# We want to be able to use the functions in this file before configure
731# has figured out where the best binaries are kept, which means we have
732# to search for them ourselves - except when the results are already set
733# where we skip the searches.
734
735# Unless the user overrides by setting SED, search the path for either GNU
736# sed, or the sed that truncates its output the least.
737test -z "$SED" && {
738 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
739 for _G_i in 1 2 3 4 5 6 7; do
740 _G_sed_script=$_G_sed_script$nl$_G_sed_script
741 done
742 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
743 _G_sed_script=
744
745 func_check_prog_sed ()
746 {
747 _G_path_prog=$1
748
749 _G_count=0
750 printf 0123456789 >conftest.in
751 while :
752 do
753 cat conftest.in conftest.in >conftest.tmp
754 mv conftest.tmp conftest.in
755 cp conftest.in conftest.nl
756 echo '' >> conftest.nl
757 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
758 diff conftest.out conftest.nl >/dev/null 2>&1 || break
759 _G_count=`expr $_G_count + 1`
760 if test "$_G_count" -gt "$_G_path_prog_max"; then
761 # Best one so far, save it but keep looking for a better one
762 func_check_prog_result=$_G_path_prog
763 _G_path_prog_max=$_G_count
764 fi
765 # 10*(2^10) chars as input seems more than enough
766 test 10 -lt "$_G_count" && break
767 done
768 rm -f conftest.in conftest.tmp conftest.nl conftest.out
769 }
770
771 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
772 rm -f conftest.sed
773 SED=$func_path_progs_result
774}
775
776
777# Unless the user overrides by setting GREP, search the path for either GNU
778# grep, or the grep that truncates its output the least.
779test -z "$GREP" && {
780 func_check_prog_grep ()
781 {
782 _G_path_prog=$1
783
784 _G_count=0
785 _G_path_prog_max=0
786 printf 0123456789 >conftest.in
787 while :
788 do
789 cat conftest.in conftest.in >conftest.tmp
790 mv conftest.tmp conftest.in
791 cp conftest.in conftest.nl
792 echo 'GREP' >> conftest.nl
793 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
794 diff conftest.out conftest.nl >/dev/null 2>&1 || break
795 _G_count=`expr $_G_count + 1`
796 if test "$_G_count" -gt "$_G_path_prog_max"; then
797 # Best one so far, save it but keep looking for a better one
798 func_check_prog_result=$_G_path_prog
799 _G_path_prog_max=$_G_count
800 fi
801 # 10*(2^10) chars as input seems more than enough
802 test 10 -lt "$_G_count" && break
803 done
804 rm -f conftest.in conftest.tmp conftest.nl conftest.out
805 }
806
807 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
808 GREP=$func_path_progs_result
809}
810
811
812## ------------------------------- ##
813## User overridable command paths. ##
814## ------------------------------- ##
815
816# All uppercase variable names are used for environment variables. These
817# variables can be overridden by the user before calling a script that
818# uses them if a suitable command of that name is not already available
819# in the command search PATH.
820
821: ${CP="cp -f"}
822: ${ECHO="printf %s\n"}
823: ${EGREP="$GREP -E"}
824: ${FGREP="$GREP -F"}
825: ${LN_S="ln -s"}
826: ${MAKE="make"}
827: ${MKDIR="mkdir"}
828: ${MV="mv -f"}
829: ${RM="rm -f"}
830: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
831
832
833## -------------------- ##
834## Useful sed snippets. ##
835## -------------------- ##
836
837sed_dirname='s|/[^/]*$||'
838sed_basename='s|^.*/||'
839
840# Sed substitution that helps us do robust quoting. It backslashifies
841# metacharacters that are still active within double-quoted strings.
842sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
843
844# Same as above, but do not quote variable references.
845sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
846
847# Sed substitution that turns a string into a regex matching for the
848# string literally.
849sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
850
851# Sed substitution that converts a w32 file name or path
852# that contains forward slashes, into one that contains
853# (escaped) backslashes. A very naive implementation.
854sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
855
856# Re-'\' parameter expansions in output of sed_double_quote_subst that
857# were '\'-ed in input to the same. If an odd number of '\' preceded a
858# '$' in input to sed_double_quote_subst, that '$' was protected from
859# expansion. Since each input '\' is now two '\'s, look for any number
860# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
861_G_bs='\\'
862_G_bs2='\\\\'
863_G_bs4='\\\\\\\\'
864_G_dollar='\$'
865sed_double_backslash="\
866 s/$_G_bs4/&\\
867/g
868 s/^$_G_bs2$_G_dollar/$_G_bs&/
869 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
870 s/\n//g"
871
872
873## ----------------- ##
874## Global variables. ##
875## ----------------- ##
876
877# Except for the global variables explicitly listed below, the following
878# functions in the '^func_' namespace, and the '^require_' namespace
879# variables initialised in the 'Resource management' section, sourcing
880# this file will not pollute your global namespace with anything
881# else. There's no portable way to scope variables in Bourne shell
882# though, so actually running these functions will sometimes place
883# results into a variable named after the function, and often use
884# temporary variables in the '^_G_' namespace. If you are careful to
885# avoid using those namespaces casually in your sourcing script, things
886# should continue to work as you expect. And, of course, you can freely
887# overwrite any of the functions or variables defined here before
888# calling anything to customize them.
889
890EXIT_SUCCESS=0
891EXIT_FAILURE=1
892EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
893EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
894
895# Allow overriding, eg assuming that you follow the convention of
896# putting '$debug_cmd' at the start of all your functions, you can get
897# bash to show function call trace with:
898#
899# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
900debug_cmd=${debug_cmd-":"}
901exit_cmd=:
902
903# By convention, finish your script with:
904#
905# exit $exit_status
906#
907# so that you can set exit_status to non-zero if you want to indicate
908# something went wrong during execution without actually bailing out at
909# the point of failure.
910exit_status=$EXIT_SUCCESS
911
912# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
913# is ksh but when the shell is invoked as "sh" and the current value of
914# the _XPG environment variable is not equal to 1 (one), the special
915# positional parameter $0, within a function call, is the name of the
916# function.
917progpath=$0
918
919# The name of this program.
920progname=`$ECHO "$progpath" |$SED "$sed_basename"`
921
922# Make sure we have an absolute progpath for reexecution:
923case $progpath in
924 [\\/]*|[A-Za-z]:\\*) ;;
925 *[\\/]*)
926 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
927 progdir=`cd "$progdir" && pwd`
928 progpath=$progdir/$progname
929 ;;
930 *)
931 _G_IFS=$IFS
932 IFS=${PATH_SEPARATOR-:}
933 for progdir in $PATH; do
934 IFS=$_G_IFS
935 test -x "$progdir/$progname" && break
936 done
937 IFS=$_G_IFS
938 test -n "$progdir" || progdir=`pwd`
939 progpath=$progdir/$progname
940 ;;
941esac
942
943
944## ----------------- ##
945## Standard options. ##
946## ----------------- ##
947
948# The following options affect the operation of the functions defined
949# below, and should be set appropriately depending on run-time para-
950# meters passed on the command line.
951
952opt_dry_run=false
953opt_quiet=false
954opt_verbose=false
955
956# Categories 'all' and 'none' are always available. Append any others
957# you will pass as the first argument to func_warning from your own
958# code.
959warning_categories=
960
961# By default, display warnings according to 'opt_warning_types'. Set
962# 'warning_func' to ':' to elide all warnings, or func_fatal_error to
963# treat the next displayed warning as a fatal error.
964warning_func=func_warn_and_continue
965
966# Set to 'all' to display all warnings, 'none' to suppress all
967# warnings, or a space delimited list of some subset of
968# 'warning_categories' to display only the listed warnings.
969opt_warning_types=all
970
971
972## -------------------- ##
973## Resource management. ##
974## -------------------- ##
975
976# This section contains definitions for functions that each ensure a
977# particular resource (a file, or a non-empty configuration variable for
978# example) is available, and if appropriate to extract default values
979# from pertinent package files. Call them using their associated
980# 'require_*' variable to ensure that they are executed, at most, once.
981#
982# It's entirely deliberate that calling these functions can set
983# variables that don't obey the namespace limitations obeyed by the rest
984# of this file, in order that that they be as useful as possible to
985# callers.
986
987
988# require_term_colors
989# -------------------
990# Allow display of bold text on terminals that support it.
991require_term_colors=func_require_term_colors
992func_require_term_colors ()
993{
994 $debug_cmd
995
996 test -t 1 && {
997 # COLORTERM and USE_ANSI_COLORS environment variables take
998 # precedence, because most terminfo databases neglect to describe
999 # whether color sequences are supported.
1000 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
1001
1002 if test 1 = "$USE_ANSI_COLORS"; then
1003 # Standard ANSI escape sequences
1004 tc_reset='[0m'
1005 tc_bold='[1m'; tc_standout='[7m'
1006 tc_red='[31m'; tc_green='[32m'
1007 tc_blue='[34m'; tc_cyan='[36m'
1008 else
1009 # Otherwise trust the terminfo database after all.
1010 test -n "`tput sgr0 2>/dev/null`" && {
1011 tc_reset=`tput sgr0`
1012 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
1013 tc_standout=$tc_bold
1014 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
1015 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
1016 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
1017 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
1018 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
1019 }
1020 fi
1021 }
1022
1023 require_term_colors=:
1024}
1025
1026
1027## ----------------- ##
1028## Function library. ##
1029## ----------------- ##
1030
1031# This section contains a variety of useful functions to call in your
1032# scripts. Take note of the portable wrappers for features provided by
1033# some modern shells, which will fall back to slower equivalents on
1034# less featureful shells.
1035
1036
1037# func_append VAR VALUE
1038# ---------------------
1039# Append VALUE onto the existing contents of VAR.
1040
1041 # We should try to minimise forks, especially on Windows where they are
1042 # unreasonably slow, so skip the feature probes when bash or zsh are
1043 # being used:
1044 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1045 : ${_G_HAVE_ARITH_OP="yes"}
1046 : ${_G_HAVE_XSI_OPS="yes"}
1047 # The += operator was introduced in bash 3.1
1048 case $BASH_VERSION in
1049 [12].* | 3.0 | 3.0*) ;;
1050 *)
1051 : ${_G_HAVE_PLUSEQ_OP="yes"}
1052 ;;
1053 esac
1054 fi
1055
1056 # _G_HAVE_PLUSEQ_OP
1057 # Can be empty, in which case the shell is probed, "yes" if += is
1058 # useable or anything else if it does not work.
1059 test -z "$_G_HAVE_PLUSEQ_OP" \
1060 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
1061 && _G_HAVE_PLUSEQ_OP=yes
1062
1063if test yes = "$_G_HAVE_PLUSEQ_OP"
1064then
1065 # This is an XSI compatible shell, allowing a faster implementation...
1066 eval 'func_append ()
1067 {
1068 $debug_cmd
1069
1070 eval "$1+=\$2"
1071 }'
1072else
1073 # ...otherwise fall back to using expr, which is often a shell builtin.
1074 func_append ()
1075 {
1076 $debug_cmd
1077
1078 eval "$1=\$$1\$2"
1079 }
1080fi
1081
1082
1083# func_append_quoted VAR VALUE
1084# ----------------------------
1085# Quote VALUE and append to the end of shell variable VAR, separated
1086# by a space.
1087if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1088 eval 'func_append_quoted ()
1089 {
1090 $debug_cmd
1091
1092 func_quote_for_eval "$2"
1093 eval "$1+=\\ \$func_quote_for_eval_result"
1094 }'
1095else
1096 func_append_quoted ()
1097 {
1098 $debug_cmd
1099
1100 func_quote_for_eval "$2"
1101 eval "$1=\$$1\\ \$func_quote_for_eval_result"
1102 }
1103fi
1104
1105
1106# func_append_uniq VAR VALUE
1107# --------------------------
1108# Append unique VALUE onto the existing contents of VAR, assuming
1109# entries are delimited by the first character of VALUE. For example:
1110#
1111# func_append_uniq options " --another-option option-argument"
1112#
1113# will only append to $options if " --another-option option-argument "
1114# is not already present somewhere in $options already (note spaces at
1115# each end implied by leading space in second argument).
1116func_append_uniq ()
1117{
1118 $debug_cmd
1119
1120 eval _G_current_value='`$ECHO $'$1'`'
1121 _G_delim=`expr "$2" : '\(.\)'`
1122
1123 case $_G_delim$_G_current_value$_G_delim in
1124 *"$2$_G_delim"*) ;;
1125 *) func_append "$@" ;;
1126 esac
1127}
1128
1129
1130# func_arith TERM...
1131# ------------------
1132# Set func_arith_result to the result of evaluating TERMs.
1133 test -z "$_G_HAVE_ARITH_OP" \
1134 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
1135 && _G_HAVE_ARITH_OP=yes
1136
1137if test yes = "$_G_HAVE_ARITH_OP"; then
1138 eval 'func_arith ()
1139 {
1140 $debug_cmd
1141
1142 func_arith_result=$(( $* ))
1143 }'
1144else
1145 func_arith ()
1146 {
1147 $debug_cmd
1148
1149 func_arith_result=`expr "$@"`
1150 }
1151fi
1152
1153
1154# func_basename FILE
1155# ------------------
1156# Set func_basename_result to FILE with everything up to and including
1157# the last / stripped.
1158if test yes = "$_G_HAVE_XSI_OPS"; then
1159 # If this shell supports suffix pattern removal, then use it to avoid
1160 # forking. Hide the definitions single quotes in case the shell chokes
1161 # on unsupported syntax...
1162 _b='func_basename_result=${1##*/}'
1163 _d='case $1 in
1164 */*) func_dirname_result=${1%/*}$2 ;;
1165 * ) func_dirname_result=$3 ;;
1166 esac'
1167
1168else
1169 # ...otherwise fall back to using sed.
1170 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1171 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1172 if test "X$func_dirname_result" = "X$1"; then
1173 func_dirname_result=$3
1174 else
1175 func_append func_dirname_result "$2"
1176 fi'
1177fi
1178
1179eval 'func_basename ()
1180{
1181 $debug_cmd
1182
1183 '"$_b"'
1184}'
1185
1186
1187# func_dirname FILE APPEND NONDIR_REPLACEMENT
1188# -------------------------------------------
1189# Compute the dirname of FILE. If nonempty, add APPEND to the result,
1190# otherwise set result to NONDIR_REPLACEMENT.
1191eval 'func_dirname ()
1192{
1193 $debug_cmd
1194
1195 '"$_d"'
1196}'
1197
1198
1199# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1200# --------------------------------------------------------
1201# Perform func_basename and func_dirname in a single function
1202# call:
1203# dirname: Compute the dirname of FILE. If nonempty,
1204# add APPEND to the result, otherwise set result
1205# to NONDIR_REPLACEMENT.
1206# value returned in "$func_dirname_result"
1207# basename: Compute filename of FILE.
1208# value retuned in "$func_basename_result"
1209# For efficiency, we do not delegate to the functions above but instead
1210# duplicate the functionality here.
1211eval 'func_dirname_and_basename ()
1212{
1213 $debug_cmd
1214
1215 '"$_b"'
1216 '"$_d"'
1217}'
1218
1219
1220# func_echo ARG...
1221# ----------------
1222# Echo program name prefixed message.
1223func_echo ()
1224{
1225 $debug_cmd
1226
1227 _G_message=$*
1228
1229 func_echo_IFS=$IFS
1230 IFS=$nl
1231 for _G_line in $_G_message; do
1232 IFS=$func_echo_IFS
1233 $ECHO "$progname: $_G_line"
1234 done
1235 IFS=$func_echo_IFS
1236}
1237
1238
1239# func_echo_all ARG...
1240# --------------------
1241# Invoke $ECHO with all args, space-separated.
1242func_echo_all ()
1243{
1244 $ECHO "$*"
1245}
1246
1247
1248# func_echo_infix_1 INFIX ARG...
1249# ------------------------------
1250# Echo program name, followed by INFIX on the first line, with any
1251# additional lines not showing INFIX.
1252func_echo_infix_1 ()
1253{
1254 $debug_cmd
1255
1256 $require_term_colors
1257
1258 _G_infix=$1; shift
1259 _G_indent=$_G_infix
1260 _G_prefix="$progname: $_G_infix: "
1261 _G_message=$*
1262
1263 # Strip color escape sequences before counting printable length
1264 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1265 do
1266 test -n "$_G_tc" && {
1267 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1268 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1269 }
1270 done
1271 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1272
1273 func_echo_infix_1_IFS=$IFS
1274 IFS=$nl
1275 for _G_line in $_G_message; do
1276 IFS=$func_echo_infix_1_IFS
1277 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1278 _G_prefix=$_G_indent
1279 done
1280 IFS=$func_echo_infix_1_IFS
1281}
1282
1283
1284# func_error ARG...
1285# -----------------
1286# Echo program name prefixed message to standard error.
1287func_error ()
1288{
1289 $debug_cmd
1290
1291 $require_term_colors
1292
1293 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
1294}
1295
1296
1297# func_fatal_error ARG...
1298# -----------------------
1299# Echo program name prefixed message to standard error, and exit.
1300func_fatal_error ()
1301{
1302 $debug_cmd
1303
1304 func_error "$*"
1305 exit $EXIT_FAILURE
1306}
1307
1308
1309# func_grep EXPRESSION FILENAME
1310# -----------------------------
1311# Check whether EXPRESSION matches any line of FILENAME, without output.
1312func_grep ()
1313{
1314 $debug_cmd
1315
1316 $GREP "$1" "$2" >/dev/null 2>&1
1317}
1318
1319
1320# func_len STRING
1321# ---------------
1322# Set func_len_result to the length of STRING. STRING may not
1323# start with a hyphen.
1324 test -z "$_G_HAVE_XSI_OPS" \
1325 && (eval 'x=a/b/c;
1326 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1327 && _G_HAVE_XSI_OPS=yes
1328
1329if test yes = "$_G_HAVE_XSI_OPS"; then
1330 eval 'func_len ()
1331 {
1332 $debug_cmd
1333
1334 func_len_result=${#1}
1335 }'
1336else
1337 func_len ()
1338 {
1339 $debug_cmd
1340
1341 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1342 }
1343fi
1344
1345
1346# func_mkdir_p DIRECTORY-PATH
1347# ---------------------------
1348# Make sure the entire path to DIRECTORY-PATH is available.
1349func_mkdir_p ()
1350{
1351 $debug_cmd
1352
1353 _G_directory_path=$1
1354 _G_dir_list=
1355
1356 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1357
1358 # Protect directory names starting with '-'
1359 case $_G_directory_path in
1360 -*) _G_directory_path=./$_G_directory_path ;;
1361 esac
1362
1363 # While some portion of DIR does not yet exist...
1364 while test ! -d "$_G_directory_path"; do
1365 # ...make a list in topmost first order. Use a colon delimited
1366 # list incase some portion of path contains whitespace.
1367 _G_dir_list=$_G_directory_path:$_G_dir_list
1368
1369 # If the last portion added has no slash in it, the list is done
1370 case $_G_directory_path in */*) ;; *) break ;; esac
1371
1372 # ...otherwise throw away the child directory and loop
1373 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1374 done
1375 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1376
1377 func_mkdir_p_IFS=$IFS; IFS=:
1378 for _G_dir in $_G_dir_list; do
1379 IFS=$func_mkdir_p_IFS
1380 # mkdir can fail with a 'File exist' error if two processes
1381 # try to create one of the directories concurrently. Don't
1382 # stop in that case!
1383 $MKDIR "$_G_dir" 2>/dev/null || :
1384 done
1385 IFS=$func_mkdir_p_IFS
1386
1387 # Bail out if we (or some other process) failed to create a directory.
1388 test -d "$_G_directory_path" || \
1389 func_fatal_error "Failed to create '$1'"
1390 fi
1391}
1392
1393
1394# func_mktempdir [BASENAME]
1395# -------------------------
1396# Make a temporary directory that won't clash with other running
1397# libtool processes, and avoids race conditions if possible. If
1398# given, BASENAME is the basename for that directory.
1399func_mktempdir ()
1400{
1401 $debug_cmd
1402
1403 _G_template=${TMPDIR-/tmp}/${1-$progname}
1404
1405 if test : = "$opt_dry_run"; then
1406 # Return a directory name, but don't create it in dry-run mode
1407 _G_tmpdir=$_G_template-$$
1408 else
1409
1410 # If mktemp works, use that first and foremost
1411 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1412
1413 if test ! -d "$_G_tmpdir"; then
1414 # Failing that, at least try and use $RANDOM to avoid a race
1415 _G_tmpdir=$_G_template-${RANDOM-0}$$
1416
1417 func_mktempdir_umask=`umask`
1418 umask 0077
1419 $MKDIR "$_G_tmpdir"
1420 umask $func_mktempdir_umask
1421 fi
1422
1423 # If we're not in dry-run mode, bomb out on failure
1424 test -d "$_G_tmpdir" || \
1425 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
1426 fi
1427
1428 $ECHO "$_G_tmpdir"
1429}
1430
1431
1432# func_normal_abspath PATH
1433# ------------------------
1434# Remove doubled-up and trailing slashes, "." path components,
1435# and cancel out any ".." path components in PATH after making
1436# it an absolute path.
1437func_normal_abspath ()
1438{
1439 $debug_cmd
1440
1441 # These SED scripts presuppose an absolute path with a trailing slash.
1442 _G_pathcar='s|^/\([^/]*\).*$|\1|'
1443 _G_pathcdr='s|^/[^/]*||'
1444 _G_removedotparts=':dotsl
1445 s|/\./|/|g
1446 t dotsl
1447 s|/\.$|/|'
1448 _G_collapseslashes='s|/\{1,\}|/|g'
1449 _G_finalslash='s|/*$|/|'
1450
1451 # Start from root dir and reassemble the path.
1452 func_normal_abspath_result=
1453 func_normal_abspath_tpath=$1
1454 func_normal_abspath_altnamespace=
1455 case $func_normal_abspath_tpath in
1456 "")
1457 # Empty path, that just means $cwd.
1458 func_stripname '' '/' "`pwd`"
1459 func_normal_abspath_result=$func_stripname_result
1460 return
1461 ;;
1462 # The next three entries are used to spot a run of precisely
1463 # two leading slashes without using negated character classes;
1464 # we take advantage of case's first-match behaviour.
1465 ///*)
1466 # Unusual form of absolute path, do nothing.
1467 ;;
1468 //*)
1469 # Not necessarily an ordinary path; POSIX reserves leading '//'
1470 # and for example Cygwin uses it to access remote file shares
1471 # over CIFS/SMB, so we conserve a leading double slash if found.
1472 func_normal_abspath_altnamespace=/
1473 ;;
1474 /*)
1475 # Absolute path, do nothing.
1476 ;;
1477 *)
1478 # Relative path, prepend $cwd.
1479 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1480 ;;
1481 esac
1482
1483 # Cancel out all the simple stuff to save iterations. We also want
1484 # the path to end with a slash for ease of parsing, so make sure
1485 # there is one (and only one) here.
1486 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1487 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1488 while :; do
1489 # Processed it all yet?
1490 if test / = "$func_normal_abspath_tpath"; then
1491 # If we ascended to the root using ".." the result may be empty now.
1492 if test -z "$func_normal_abspath_result"; then
1493 func_normal_abspath_result=/
1494 fi
1495 break
1496 fi
1497 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1498 -e "$_G_pathcar"`
1499 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1500 -e "$_G_pathcdr"`
1501 # Figure out what to do with it
1502 case $func_normal_abspath_tcomponent in
1503 "")
1504 # Trailing empty path component, ignore it.
1505 ;;
1506 ..)
1507 # Parent dir; strip last assembled component from result.
1508 func_dirname "$func_normal_abspath_result"
1509 func_normal_abspath_result=$func_dirname_result
1510 ;;
1511 *)
1512 # Actual path component, append it.
1513 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1514 ;;
1515 esac
1516 done
1517 # Restore leading double-slash if one was found on entry.
1518 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1519}
1520
1521
1522# func_notquiet ARG...
1523# --------------------
1524# Echo program name prefixed message only when not in quiet mode.
1525func_notquiet ()
1526{
1527 $debug_cmd
1528
1529 $opt_quiet || func_echo ${1+"$@"}
1530
1531 # A bug in bash halts the script if the last line of a function
1532 # fails when set -e is in force, so we need another command to
1533 # work around that:
1534 :
1535}
1536
1537
1538# func_relative_path SRCDIR DSTDIR
1539# --------------------------------
1540# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1541func_relative_path ()
1542{
1543 $debug_cmd
1544
1545 func_relative_path_result=
1546 func_normal_abspath "$1"
1547 func_relative_path_tlibdir=$func_normal_abspath_result
1548 func_normal_abspath "$2"
1549 func_relative_path_tbindir=$func_normal_abspath_result
1550
1551 # Ascend the tree starting from libdir
1552 while :; do
1553 # check if we have found a prefix of bindir
1554 case $func_relative_path_tbindir in
1555 $func_relative_path_tlibdir)
1556 # found an exact match
1557 func_relative_path_tcancelled=
1558 break
1559 ;;
1560 $func_relative_path_tlibdir*)
1561 # found a matching prefix
1562 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1563 func_relative_path_tcancelled=$func_stripname_result
1564 if test -z "$func_relative_path_result"; then
1565 func_relative_path_result=.
1566 fi
1567 break
1568 ;;
1569 *)
1570 func_dirname $func_relative_path_tlibdir
1571 func_relative_path_tlibdir=$func_dirname_result
1572 if test -z "$func_relative_path_tlibdir"; then
1573 # Have to descend all the way to the root!
1574 func_relative_path_result=../$func_relative_path_result
1575 func_relative_path_tcancelled=$func_relative_path_tbindir
1576 break
1577 fi
1578 func_relative_path_result=../$func_relative_path_result
1579 ;;
1580 esac
1581 done
1582
1583 # Now calculate path; take care to avoid doubling-up slashes.
1584 func_stripname '' '/' "$func_relative_path_result"
1585 func_relative_path_result=$func_stripname_result
1586 func_stripname '/' '/' "$func_relative_path_tcancelled"
1587 if test -n "$func_stripname_result"; then
1588 func_append func_relative_path_result "/$func_stripname_result"
1589 fi
1590
1591 # Normalisation. If bindir is libdir, return '.' else relative path.
1592 if test -n "$func_relative_path_result"; then
1593 func_stripname './' '' "$func_relative_path_result"
1594 func_relative_path_result=$func_stripname_result
1595 fi
1596
1597 test -n "$func_relative_path_result" || func_relative_path_result=.
1598
1599 :
1600}
1601
1602
1603# func_quote_for_eval ARG...
1604# --------------------------
1605# Aesthetically quote ARGs to be evaled later.
1606# This function returns two values:
1607# i) func_quote_for_eval_result
1608# double-quoted, suitable for a subsequent eval
1609# ii) func_quote_for_eval_unquoted_result
1610# has all characters that are still active within double
1611# quotes backslashified.
1612func_quote_for_eval ()
1613{
1614 $debug_cmd
1615
1616 func_quote_for_eval_unquoted_result=
1617 func_quote_for_eval_result=
1618 while test 0 -lt $#; do
1619 case $1 in
1620 *[\\\`\"\$]*)
1621 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1622 *)
1623 _G_unquoted_arg=$1 ;;
1624 esac
1625 if test -n "$func_quote_for_eval_unquoted_result"; then
1626 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1627 else
1628 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1629 fi
1630
1631 case $_G_unquoted_arg in
1632 # Double-quote args containing shell metacharacters to delay
1633 # word splitting, command substitution and variable expansion
1634 # for a subsequent eval.
1635 # Many Bourne shells cannot handle close brackets correctly
1636 # in scan sets, so we specify it separately.
1637 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1638 _G_quoted_arg=\"$_G_unquoted_arg\"
1639 ;;
1640 *)
1641 _G_quoted_arg=$_G_unquoted_arg
1642 ;;
1643 esac
1644
1645 if test -n "$func_quote_for_eval_result"; then
1646 func_append func_quote_for_eval_result " $_G_quoted_arg"
1647 else
1648 func_append func_quote_for_eval_result "$_G_quoted_arg"
1649 fi
1650 shift
1651 done
1652}
1653
1654
1655# func_quote_for_expand ARG
1656# -------------------------
1657# Aesthetically quote ARG to be evaled later; same as above,
1658# but do not quote variable references.
1659func_quote_for_expand ()
1660{
1661 $debug_cmd
1662
1663 case $1 in
1664 *[\\\`\"]*)
1665 _G_arg=`$ECHO "$1" | $SED \
1666 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1667 *)
1668 _G_arg=$1 ;;
1669 esac
1670
1671 case $_G_arg in
1672 # Double-quote args containing shell metacharacters to delay
1673 # word splitting and command substitution for a subsequent eval.
1674 # Many Bourne shells cannot handle close brackets correctly
1675 # in scan sets, so we specify it separately.
1676 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1677 _G_arg=\"$_G_arg\"
1678 ;;
1679 esac
1680
1681 func_quote_for_expand_result=$_G_arg
1682}
1683
1684
1685# func_stripname PREFIX SUFFIX NAME
1686# ---------------------------------
1687# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1688# PREFIX and SUFFIX must not contain globbing or regex special
1689# characters, hashes, percent signs, but SUFFIX may contain a leading
1690# dot (in which case that matches only a dot).
1691if test yes = "$_G_HAVE_XSI_OPS"; then
1692 eval 'func_stripname ()
1693 {
1694 $debug_cmd
1695
1696 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1697 # positional parameters, so assign one to ordinary variable first.
1698 func_stripname_result=$3
1699 func_stripname_result=${func_stripname_result#"$1"}
1700 func_stripname_result=${func_stripname_result%"$2"}
1701 }'
1702else
1703 func_stripname ()
1704 {
1705 $debug_cmd
1706
1707 case $2 in
1708 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1709 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1710 esac
1711 }
1712fi
1713
1714
1715# func_show_eval CMD [FAIL_EXP]
1716# -----------------------------
1717# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1718# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1719# is given, then evaluate it.
1720func_show_eval ()
1721{
1722 $debug_cmd
1723
1724 _G_cmd=$1
1725 _G_fail_exp=${2-':'}
1726
1727 func_quote_for_expand "$_G_cmd"
1728 eval "func_notquiet $func_quote_for_expand_result"
1729
1730 $opt_dry_run || {
1731 eval "$_G_cmd"
1732 _G_status=$?
1733 if test 0 -ne "$_G_status"; then
1734 eval "(exit $_G_status); $_G_fail_exp"
1735 fi
1736 }
1737}
1738
1739
1740# func_show_eval_locale CMD [FAIL_EXP]
1741# ------------------------------------
1742# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1743# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1744# is given, then evaluate it. Use the saved locale for evaluation.
1745func_show_eval_locale ()
1746{
1747 $debug_cmd
1748
1749 _G_cmd=$1
1750 _G_fail_exp=${2-':'}
1751
1752 $opt_quiet || {
1753 func_quote_for_expand "$_G_cmd"
1754 eval "func_echo $func_quote_for_expand_result"
1755 }
1756
1757 $opt_dry_run || {
1758 eval "$_G_user_locale
1759 $_G_cmd"
1760 _G_status=$?
1761 eval "$_G_safe_locale"
1762 if test 0 -ne "$_G_status"; then
1763 eval "(exit $_G_status); $_G_fail_exp"
1764 fi
1765 }
1766}
1767
1768
1769# func_tr_sh
1770# ----------
1771# Turn $1 into a string suitable for a shell variable name.
1772# Result is stored in $func_tr_sh_result. All characters
1773# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1774# if $1 begins with a digit, a '_' is prepended as well.
1775func_tr_sh ()
1776{
1777 $debug_cmd
1778
1779 case $1 in
1780 [0-9]* | *[!a-zA-Z0-9_]*)
1781 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1782 ;;
1783 * )
1784 func_tr_sh_result=$1
1785 ;;
1786 esac
1787}
1788
1789
1790# func_verbose ARG...
1791# -------------------
1792# Echo program name prefixed message in verbose mode only.
1793func_verbose ()
1794{
1795 $debug_cmd
1796
1797 $opt_verbose && func_echo "$*"
1798
1799 :
1800}
1801
1802
1803# func_warn_and_continue ARG...
1804# -----------------------------
1805# Echo program name prefixed warning message to standard error.
1806func_warn_and_continue ()
1807{
1808 $debug_cmd
1809
1810 $require_term_colors
1811
1812 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1813}
1814
1815
1816# func_warning CATEGORY ARG...
1817# ----------------------------
1818# Echo program name prefixed warning message to standard error. Warning
1819# messages can be filtered according to CATEGORY, where this function
1820# elides messages where CATEGORY is not listed in the global variable
1821# 'opt_warning_types'.
1822func_warning ()
1823{
1824 $debug_cmd
1825
1826 # CATEGORY must be in the warning_categories list!
1827 case " $warning_categories " in
1828 *" $1 "*) ;;
1829 *) func_internal_error "invalid warning category '$1'" ;;
1830 esac
1831
1832 _G_category=$1
1833 shift
1834
1835 case " $opt_warning_types " in
1836 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1837 esac
1838}
1839
1840
1841# func_sort_ver VER1 VER2
1842# -----------------------
1843# 'sort -V' is not generally available.
1844# Note this deviates from the version comparison in automake
1845# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1846# but this should suffice as we won't be specifying old
1847# version formats or redundant trailing .0 in bootstrap.conf.
1848# If we did want full compatibility then we should probably
1849# use m4_version_compare from autoconf.
1850func_sort_ver ()
1851{
1852 $debug_cmd
1853
1854 printf '%s\n%s\n' "$1" "$2" \
1855 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1856}
1857
1858# func_lt_ver PREV CURR
1859# ---------------------
1860# Return true if PREV and CURR are in the correct order according to
1861# func_sort_ver, otherwise false. Use it like this:
1862#
1863# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1864func_lt_ver ()
1865{
1866 $debug_cmd
1867
1868 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1869}
1870
1871
1872# Local variables:
1873# mode: shell-script
1874# sh-indentation: 2
1875# eval: (add-hook 'before-save-hook 'time-stamp)
1876# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1877# time-stamp-time-zone: "UTC"
1878# End:
1879#! /bin/sh
1880
1881# Set a version string for this script.
1882scriptversion=2014-01-07.03; # UTC
1883
1884# A portable, pluggable option parser for Bourne shell.
1885# Written by Gary V. Vaughan, 2010
1886
1887# Copyright (C) 2010-2015 Free Software Foundation, Inc.
1888# This is free software; see the source for copying conditions. There is NO
1889# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1890
1891# This program is free software: you can redistribute it and/or modify
1892# it under the terms of the GNU General Public License as published by
1893# the Free Software Foundation, either version 3 of the License, or
1894# (at your option) any later version.
1895
1896# This program is distributed in the hope that it will be useful,
1897# but WITHOUT ANY WARRANTY; without even the implied warranty of
1898# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1899# GNU General Public License for more details.
1900
1901# You should have received a copy of the GNU General Public License
1902# along with this program. If not, see <http://www.gnu.org/licenses/>.
1903
1904# Please report bugs or propose patches to gary@gnu.org.
1905
1906
1907## ------ ##
1908## Usage. ##
1909## ------ ##
1910
1911# This file is a library for parsing options in your shell scripts along
1912# with assorted other useful supporting features that you can make use
1913# of too.
1914#
1915# For the simplest scripts you might need only:
1916#
1917# #!/bin/sh
1918# . relative/path/to/funclib.sh
1919# . relative/path/to/options-parser
1920# scriptversion=1.0
1921# func_options ${1+"$@"}
1922# eval set dummy "$func_options_result"; shift
1923# ...rest of your script...
1924#
1925# In order for the '--version' option to work, you will need to have a
1926# suitably formatted comment like the one at the top of this file
1927# starting with '# Written by ' and ending with '# warranty; '.
1928#
1929# For '-h' and '--help' to work, you will also need a one line
1930# description of your script's purpose in a comment directly above the
1931# '# Written by ' line, like the one at the top of this file.
1932#
1933# The default options also support '--debug', which will turn on shell
1934# execution tracing (see the comment above debug_cmd below for another
1935# use), and '--verbose' and the func_verbose function to allow your script
1936# to display verbose messages only when your user has specified
1937# '--verbose'.
1938#
1939# After sourcing this file, you can plug processing for additional
1940# options by amending the variables from the 'Configuration' section
1941# below, and following the instructions in the 'Option parsing'
1942# section further down.
1943
1944## -------------- ##
1945## Configuration. ##
1946## -------------- ##
1947
1948# You should override these variables in your script after sourcing this
1949# file so that they reflect the customisations you have added to the
1950# option parser.
1951
1952# The usage line for option parsing errors and the start of '-h' and
1953# '--help' output messages. You can embed shell variables for delayed
1954# expansion at the time the message is displayed, but you will need to
1955# quote other shell meta-characters carefully to prevent them being
1956# expanded when the contents are evaled.
1957usage='$progpath [OPTION]...'
1958
1959# Short help message in response to '-h' and '--help'. Add to this or
1960# override it after sourcing this library to reflect the full set of
1961# options your script accepts.
1962usage_message="\
1963 --debug enable verbose shell tracing
1964 -W, --warnings=CATEGORY
1965 report the warnings falling in CATEGORY [all]
1966 -v, --verbose verbosely report processing
1967 --version print version information and exit
1968 -h, --help print short or long help message and exit
1969"
1970
1971# Additional text appended to 'usage_message' in response to '--help'.
1972long_help_message="
1973Warning categories include:
1974 'all' show all warnings
1975 'none' turn off all the warnings
1976 'error' warnings are treated as fatal errors"
1977
1978# Help message printed before fatal option parsing errors.
1979fatal_help="Try '\$progname --help' for more information."
1980
1981
1982
1983## ------------------------- ##
1984## Hook function management. ##
1985## ------------------------- ##
1986
1987# This section contains functions for adding, removing, and running hooks
1988# to the main code. A hook is just a named list of of function, that can
1989# be run in order later on.
1990
1991# func_hookable FUNC_NAME
1992# -----------------------
1993# Declare that FUNC_NAME will run hooks added with
1994# 'func_add_hook FUNC_NAME ...'.
1995func_hookable ()
1996{
1997 $debug_cmd
1998
1999 func_append hookable_fns " $1"
2000}
2001
2002
2003# func_add_hook FUNC_NAME HOOK_FUNC
2004# ---------------------------------
2005# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
2006# first have been declared "hookable" by a call to 'func_hookable'.
2007func_add_hook ()
2008{
2009 $debug_cmd
2010
2011 case " $hookable_fns " in
2012 *" $1 "*) ;;
2013 *) func_fatal_error "'$1' does not accept hook functions." ;;
2014 esac
2015
2016 eval func_append ${1}_hooks '" $2"'
2017}
2018
2019
2020# func_remove_hook FUNC_NAME HOOK_FUNC
2021# ------------------------------------
2022# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
2023func_remove_hook ()
2024{
2025 $debug_cmd
2026
2027 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2028}
2029
2030
2031# func_run_hooks FUNC_NAME [ARG]...
2032# ---------------------------------
2033# Run all hook functions registered to FUNC_NAME.
2034# It is assumed that the list of hook functions contains nothing more
2035# than a whitespace-delimited list of legal shell function names, and
2036# no effort is wasted trying to catch shell meta-characters or preserve
2037# whitespace.
2038func_run_hooks ()
2039{
2040 $debug_cmd
2041
2042 case " $hookable_fns " in
2043 *" $1 "*) ;;
2044 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
2045 esac
2046
2047 eval _G_hook_fns=\$$1_hooks; shift
2048
2049 for _G_hook in $_G_hook_fns; do
2050 eval $_G_hook '"$@"'
2051
2052 # store returned options list back into positional
2053 # parameters for next 'cmd' execution.
2054 eval _G_hook_result=\$${_G_hook}_result
2055 eval set dummy "$_G_hook_result"; shift
2056 done
2057
2058 func_quote_for_eval ${1+"$@"}
2059 func_run_hooks_result=$func_quote_for_eval_result
2060}
2061
2062
2063
2064## --------------- ##
2065## Option parsing. ##
2066## --------------- ##
2067
2068# In order to add your own option parsing hooks, you must accept the
2069# full positional parameter list in your hook function, remove any
2070# options that you action, and then pass back the remaining unprocessed
2071# options in '<hooked_function_name>_result', escaped suitably for
2072# 'eval'. Like this:
2073#
2074# my_options_prep ()
2075# {
2076# $debug_cmd
2077#
2078# # Extend the existing usage message.
2079# usage_message=$usage_message'
2080# -s, --silent don'\''t print informational messages
2081# '
2082#
2083# func_quote_for_eval ${1+"$@"}
2084# my_options_prep_result=$func_quote_for_eval_result
2085# }
2086# func_add_hook func_options_prep my_options_prep
2087#
2088#
2089# my_silent_option ()
2090# {
2091# $debug_cmd
2092#
2093# # Note that for efficiency, we parse as many options as we can
2094# # recognise in a loop before passing the remainder back to the
2095# # caller on the first unrecognised argument we encounter.
2096# while test $# -gt 0; do
2097# opt=$1; shift
2098# case $opt in
2099# --silent|-s) opt_silent=: ;;
2100# # Separate non-argument short options:
2101# -s*) func_split_short_opt "$_G_opt"
2102# set dummy "$func_split_short_opt_name" \
2103# "-$func_split_short_opt_arg" ${1+"$@"}
2104# shift
2105# ;;
2106# *) set dummy "$_G_opt" "$*"; shift; break ;;
2107# esac
2108# done
2109#
2110# func_quote_for_eval ${1+"$@"}
2111# my_silent_option_result=$func_quote_for_eval_result
2112# }
2113# func_add_hook func_parse_options my_silent_option
2114#
2115#
2116# my_option_validation ()
2117# {
2118# $debug_cmd
2119#
2120# $opt_silent && $opt_verbose && func_fatal_help "\
2121# '--silent' and '--verbose' options are mutually exclusive."
2122#
2123# func_quote_for_eval ${1+"$@"}
2124# my_option_validation_result=$func_quote_for_eval_result
2125# }
2126# func_add_hook func_validate_options my_option_validation
2127#
2128# You'll alse need to manually amend $usage_message to reflect the extra
2129# options you parse. It's preferable to append if you can, so that
2130# multiple option parsing hooks can be added safely.
2131
2132
2133# func_options [ARG]...
2134# ---------------------
2135# All the functions called inside func_options are hookable. See the
2136# individual implementations for details.
2137func_hookable func_options
2138func_options ()
2139{
2140 $debug_cmd
2141
2142 func_options_prep ${1+"$@"}
2143 eval func_parse_options \
2144 ${func_options_prep_result+"$func_options_prep_result"}
2145 eval func_validate_options \
2146 ${func_parse_options_result+"$func_parse_options_result"}
2147
2148 eval func_run_hooks func_options \
2149 ${func_validate_options_result+"$func_validate_options_result"}
2150
2151 # save modified positional parameters for caller
2152 func_options_result=$func_run_hooks_result
2153}
2154
2155
2156# func_options_prep [ARG]...
2157# --------------------------
2158# All initialisations required before starting the option parse loop.
2159# Note that when calling hook functions, we pass through the list of
2160# positional parameters. If a hook function modifies that list, and
2161# needs to propogate that back to rest of this script, then the complete
2162# modified list must be put in 'func_run_hooks_result' before
2163# returning.
2164func_hookable func_options_prep
2165func_options_prep ()
2166{
2167 $debug_cmd
2168
2169 # Option defaults:
2170 opt_verbose=false
2171 opt_warning_types=
2172
2173 func_run_hooks func_options_prep ${1+"$@"}
2174
2175 # save modified positional parameters for caller
2176 func_options_prep_result=$func_run_hooks_result
2177}
2178
2179
2180# func_parse_options [ARG]...
2181# ---------------------------
2182# The main option parsing loop.
2183func_hookable func_parse_options
2184func_parse_options ()
2185{
2186 $debug_cmd
2187
2188 func_parse_options_result=
2189
2190 # this just eases exit handling
2191 while test $# -gt 0; do
2192 # Defer to hook functions for initial option parsing, so they
2193 # get priority in the event of reusing an option name.
2194 func_run_hooks func_parse_options ${1+"$@"}
2195
2196 # Adjust func_parse_options positional parameters to match
2197 eval set dummy "$func_run_hooks_result"; shift
2198
2199 # Break out of the loop if we already parsed every option.
2200 test $# -gt 0 || break
2201
2202 _G_opt=$1
2203 shift
2204 case $_G_opt in
2205 --debug|-x) debug_cmd='set -x'
2206 func_echo "enabling shell trace mode"
2207 $debug_cmd
2208 ;;
2209
2210 --no-warnings|--no-warning|--no-warn)
2211 set dummy --warnings none ${1+"$@"}
2212 shift
2213 ;;
2214
2215 --warnings|--warning|-W)
2216 test $# = 0 && func_missing_arg $_G_opt && break
2217 case " $warning_categories $1" in
2218 *" $1 "*)
2219 # trailing space prevents matching last $1 above
2220 func_append_uniq opt_warning_types " $1"
2221 ;;
2222 *all)
2223 opt_warning_types=$warning_categories
2224 ;;
2225 *none)
2226 opt_warning_types=none
2227 warning_func=:
2228 ;;
2229 *error)
2230 opt_warning_types=$warning_categories
2231 warning_func=func_fatal_error
2232 ;;
2233 *)
2234 func_fatal_error \
2235 "unsupported warning category: '$1'"
2236 ;;
2237 esac
2238 shift
2239 ;;
2240
2241 --verbose|-v) opt_verbose=: ;;
2242 --version) func_version ;;
2243 -\?|-h) func_usage ;;
2244 --help) func_help ;;
2245
2246 # Separate optargs to long options (plugins may need this):
2247 --*=*) func_split_equals "$_G_opt"
2248 set dummy "$func_split_equals_lhs" \
2249 "$func_split_equals_rhs" ${1+"$@"}
2250 shift
2251 ;;
2252
2253 # Separate optargs to short options:
2254 -W*)
2255 func_split_short_opt "$_G_opt"
2256 set dummy "$func_split_short_opt_name" \
2257 "$func_split_short_opt_arg" ${1+"$@"}
2258 shift
2259 ;;
2260
2261 # Separate non-argument short options:
2262 -\?*|-h*|-v*|-x*)
2263 func_split_short_opt "$_G_opt"
2264 set dummy "$func_split_short_opt_name" \
2265 "-$func_split_short_opt_arg" ${1+"$@"}
2266 shift
2267 ;;
2268
2269 --) break ;;
2270 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
2271 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2272 esac
2273 done
2274
2275 # save modified positional parameters for caller
2276 func_quote_for_eval ${1+"$@"}
2277 func_parse_options_result=$func_quote_for_eval_result
2278}
2279
2280
2281# func_validate_options [ARG]...
2282# ------------------------------
2283# Perform any sanity checks on option settings and/or unconsumed
2284# arguments.
2285func_hookable func_validate_options
2286func_validate_options ()
2287{
2288 $debug_cmd
2289
2290 # Display all warnings if -W was not given.
2291 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2292
2293 func_run_hooks func_validate_options ${1+"$@"}
2294
2295 # Bail if the options were screwed!
2296 $exit_cmd $EXIT_FAILURE
2297
2298 # save modified positional parameters for caller
2299 func_validate_options_result=$func_run_hooks_result
2300}
2301
2302
2303
2304## ----------------- ##
2305## Helper functions. ##
2306## ----------------- ##
2307
2308# This section contains the helper functions used by the rest of the
2309# hookable option parser framework in ascii-betical order.
2310
2311
2312# func_fatal_help ARG...
2313# ----------------------
2314# Echo program name prefixed message to standard error, followed by
2315# a help hint, and exit.
2316func_fatal_help ()
2317{
2318 $debug_cmd
2319
2320 eval \$ECHO \""Usage: $usage"\"
2321 eval \$ECHO \""$fatal_help"\"
2322 func_error ${1+"$@"}
2323 exit $EXIT_FAILURE
2324}
2325
2326
2327# func_help
2328# ---------
2329# Echo long help message to standard output and exit.
2330func_help ()
2331{
2332 $debug_cmd
2333
2334 func_usage_message
2335 $ECHO "$long_help_message"
2336 exit 0
2337}
2338
2339
2340# func_missing_arg ARGNAME
2341# ------------------------
2342# Echo program name prefixed message to standard error and set global
2343# exit_cmd.
2344func_missing_arg ()
2345{
2346 $debug_cmd
2347
2348 func_error "Missing argument for '$1'."
2349 exit_cmd=exit
2350}
2351
2352
2353# func_split_equals STRING
2354# ------------------------
2355# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2356# splitting STRING at the '=' sign.
2357test -z "$_G_HAVE_XSI_OPS" \
2358 && (eval 'x=a/b/c;
2359 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2360 && _G_HAVE_XSI_OPS=yes
2361
2362if test yes = "$_G_HAVE_XSI_OPS"
2363then
2364 # This is an XSI compatible shell, allowing a faster implementation...
2365 eval 'func_split_equals ()
2366 {
2367 $debug_cmd
2368
2369 func_split_equals_lhs=${1%%=*}
2370 func_split_equals_rhs=${1#*=}
2371 test "x$func_split_equals_lhs" = "x$1" \
2372 && func_split_equals_rhs=
2373 }'
2374else
2375 # ...otherwise fall back to using expr, which is often a shell builtin.
2376 func_split_equals ()
2377 {
2378 $debug_cmd
2379
2380 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2381 func_split_equals_rhs=
2382 test "x$func_split_equals_lhs" = "x$1" \
2383 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2384 }
2385fi #func_split_equals
2386
2387
2388# func_split_short_opt SHORTOPT
2389# -----------------------------
2390# Set func_split_short_opt_name and func_split_short_opt_arg shell
2391# variables after splitting SHORTOPT after the 2nd character.
2392if test yes = "$_G_HAVE_XSI_OPS"
2393then
2394 # This is an XSI compatible shell, allowing a faster implementation...
2395 eval 'func_split_short_opt ()
2396 {
2397 $debug_cmd
2398
2399 func_split_short_opt_arg=${1#??}
2400 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2401 }'
2402else
2403 # ...otherwise fall back to using expr, which is often a shell builtin.
2404 func_split_short_opt ()
2405 {
2406 $debug_cmd
2407
2408 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2409 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2410 }
2411fi #func_split_short_opt
2412
2413
2414# func_usage
2415# ----------
2416# Echo short help message to standard output and exit.
2417func_usage ()
2418{
2419 $debug_cmd
2420
2421 func_usage_message
2422 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2423 exit 0
2424}
2425
2426
2427# func_usage_message
2428# ------------------
2429# Echo short help message to standard output.
2430func_usage_message ()
2431{
2432 $debug_cmd
2433
2434 eval \$ECHO \""Usage: $usage"\"
2435 echo
2436 $SED -n 's|^# ||
2437 /^Written by/{
2438 x;p;x
2439 }
2440 h
2441 /^Written by/q' < "$progpath"
2442 echo
2443 eval \$ECHO \""$usage_message"\"
2444}
2445
2446
2447# func_version
2448# ------------
2449# Echo version message to standard output and exit.
2450func_version ()
2451{
2452 $debug_cmd
2453
2454 printf '%s\n' "$progname $scriptversion"
2455 $SED -n '
2456 /(C)/!b go
2457 :more
2458 /\./!{
2459 N
2460 s|\n# | |
2461 b more
2462 }
2463 :go
2464 /^# Written by /,/# warranty; / {
2465 s|^# ||
2466 s|^# *$||
2467 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2468 p
2469 }
2470 /^# Written by / {
2471 s|^# ||
2472 p
2473 }
2474 /^warranty; /q' < "$progpath"
2475
2476 exit $?
2477}
2478
2479
2480# Local variables:
2481# mode: shell-script
2482# sh-indentation: 2
2483# eval: (add-hook 'before-save-hook 'time-stamp)
2484# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2485# time-stamp-time-zone: "UTC"
2486# End:
2487
2488# Set a version string.
2489scriptversion='(GNU libtool) 2.4.6'
2490
2491
2492# func_echo ARG...
2493# ----------------
2494# Libtool also displays the current mode in messages, so override
2495# funclib.sh func_echo with this custom definition.
2496func_echo ()
2497{
2498 $debug_cmd
2499
2500 _G_message=$*
2501
2502 func_echo_IFS=$IFS
2503 IFS=$nl
2504 for _G_line in $_G_message; do
2505 IFS=$func_echo_IFS
2506 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2507 done
2508 IFS=$func_echo_IFS
2509}
2510
2511
2512# func_warning ARG...
2513# -------------------
2514# Libtool warnings are not categorized, so override funclib.sh
2515# func_warning with this simpler definition.
2516func_warning ()
2517{
2518 $debug_cmd
2519
2520 $warning_func ${1+"$@"}
2521}
2522
2523
2524## ---------------- ##
2525## Options parsing. ##
2526## ---------------- ##
2527
2528# Hook in the functions to make sure our own options are parsed during
2529# the option parsing loop.
2530
2531usage='$progpath [OPTION]... [MODE-ARG]...'
2532
2533# Short help message in response to '-h'.
2534usage_message="Options:
2535 --config show all configuration variables
2536 --debug enable verbose shell tracing
2537 -n, --dry-run display commands without modifying any files
2538 --features display basic configuration information and exit
2539 --mode=MODE use operation mode MODE
2540 --no-warnings equivalent to '-Wnone'
2541 --preserve-dup-deps don't remove duplicate dependency libraries
2542 --quiet, --silent don't print informational messages
2543 --tag=TAG use configuration variables from tag TAG
2544 -v, --verbose print more informational messages than default
2545 --version print version information
2546 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2547 -h, --help, --help-all print short, long, or detailed help message
2548"
2549
2550# Additional text appended to 'usage_message' in response to '--help'.
2551func_help ()
2552{
2553 $debug_cmd
2554
2555 func_usage_message
2556 $ECHO "$long_help_message
2557
2558MODE must be one of the following:
2559
2560 clean remove files from the build directory
2561 compile compile a source file into a libtool object
2562 execute automatically set library path, then run a program
2563 finish complete the installation of libtool libraries
2564 install install libraries or executables
2565 link create a library or an executable
2566 uninstall remove libraries from an installed directory
2567
2568MODE-ARGS vary depending on the MODE. When passed as first option,
2569'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2570Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2571
2572When reporting a bug, please describe a test case to reproduce it and
2573include the following information:
2574
2575 host-triplet: $host
2576 shell: $SHELL
2577 compiler: $LTCC
2578 compiler flags: $LTCFLAGS
2579 linker: $LD (gnu? $with_gnu_ld)
2580 version: $progname (GNU libtool) 2.4.6
2581 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2582 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2583
2584Report bugs to <bug-libtool@gnu.org>.
2585GNU libtool home page: <http://www.gnu.org/software/libtool/>.
2586General help using GNU software: <http://www.gnu.org/gethelp/>."
2587 exit 0
2588}
2589
2590
2591# func_lo2o OBJECT-NAME
2592# ---------------------
2593# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2594# object suffix.
2595
2596lo2o=s/\\.lo\$/.$objext/
2597o2lo=s/\\.$objext\$/.lo/
2598
2599if test yes = "$_G_HAVE_XSI_OPS"; then
2600 eval 'func_lo2o ()
2601 {
2602 case $1 in
2603 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2604 * ) func_lo2o_result=$1 ;;
2605 esac
2606 }'
2607
2608 # func_xform LIBOBJ-OR-SOURCE
2609 # ---------------------------
2610 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2611 # suffix to a '.lo' libtool-object suffix.
2612 eval 'func_xform ()
2613 {
2614 func_xform_result=${1%.*}.lo
2615 }'
2616else
2617 # ...otherwise fall back to using sed.
2618 func_lo2o ()
2619 {
2620 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2621 }
2622
2623 func_xform ()
2624 {
2625 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2626 }
2627fi
2628
2629
2630# func_fatal_configuration ARG...
2631# -------------------------------
2632# Echo program name prefixed message to standard error, followed by
2633# a configuration failure hint, and exit.
2634func_fatal_configuration ()
2635{
2636 func__fatal_error ${1+"$@"} \
2637 "See the $PACKAGE documentation for more information." \
2638 "Fatal configuration error."
2639}
2640
2641
2642# func_config
2643# -----------
2644# Display the configuration for all the tags in this script.
2645func_config ()
2646{
2647 re_begincf='^# ### BEGIN LIBTOOL'
2648 re_endcf='^# ### END LIBTOOL'
2649
2650 # Default configuration.
2651 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2652
2653 # Now print the configurations for the tags.
2654 for tagname in $taglist; do
2655 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2656 done
2657
2658 exit $?
2659}
2660
2661
2662# func_features
2663# -------------
2664# Display the features supported by this script.
2665func_features ()
2666{
2667 echo "host: $host"
2668 if test yes = "$build_libtool_libs"; then
2669 echo "enable shared libraries"
2670 else
2671 echo "disable shared libraries"
2672 fi
2673 if test yes = "$build_old_libs"; then
2674 echo "enable static libraries"
2675 else
2676 echo "disable static libraries"
2677 fi
2678
2679 exit $?
2680}
2681
2682
2683# func_enable_tag TAGNAME
2684# -----------------------
2685# Verify that TAGNAME is valid, and either flag an error and exit, or
2686# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2687# variable here.
2688func_enable_tag ()
2689{
2690 # Global variable:
2691 tagname=$1
2692
2693 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2694 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2695 sed_extractcf=/$re_begincf/,/$re_endcf/p
2696
2697 # Validate tagname.
2698 case $tagname in
2699 *[!-_A-Za-z0-9,/]*)
2700 func_fatal_error "invalid tag name: $tagname"
2701 ;;
2702 esac
2703
2704 # Don't test for the "default" C tag, as we know it's
2705 # there but not specially marked.
2706 case $tagname in
2707 CC) ;;
2708 *)
2709 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2710 taglist="$taglist $tagname"
2711
2712 # Evaluate the configuration. Be careful to quote the path
2713 # and the sed script, to avoid splitting on whitespace, but
2714 # also don't use non-portable quotes within backquotes within
2715 # quotes we have to do it in 2 steps:
2716 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2717 eval "$extractedcf"
2718 else
2719 func_error "ignoring unknown tag $tagname"
2720 fi
2721 ;;
2722 esac
2723}
2724
2725
2726# func_check_version_match
2727# ------------------------
2728# Ensure that we are using m4 macros, and libtool script from the same
2729# release of libtool.
2730func_check_version_match ()
2731{
2732 if test "$package_revision" != "$macro_revision"; then
2733 if test "$VERSION" != "$macro_version"; then
2734 if test -z "$macro_version"; then
2735 cat >&2 <<_LT_EOF
2736$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2737$progname: definition of this LT_INIT comes from an older release.
2738$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2739$progname: and run autoconf again.
2740_LT_EOF
2741 else
2742 cat >&2 <<_LT_EOF
2743$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2744$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2745$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2746$progname: and run autoconf again.
2747_LT_EOF
2748 fi
2749 else
2750 cat >&2 <<_LT_EOF
2751$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2752$progname: but the definition of this LT_INIT comes from revision $macro_revision.
2753$progname: You should recreate aclocal.m4 with macros from revision $package_revision
2754$progname: of $PACKAGE $VERSION and run autoconf again.
2755_LT_EOF
2756 fi
2757
2758 exit $EXIT_MISMATCH
2759 fi
2760}
2761
2762
2763# libtool_options_prep [ARG]...
2764# -----------------------------
2765# Preparation for options parsed by libtool.
2766libtool_options_prep ()
2767{
2768 $debug_mode
2769
2770 # Option defaults:
2771 opt_config=false
2772 opt_dlopen=
2773 opt_dry_run=false
2774 opt_help=false
2775 opt_mode=
2776 opt_preserve_dup_deps=false
2777 opt_quiet=false
2778
2779 nonopt=
2780 preserve_args=
2781
2782 # Shorthand for --mode=foo, only valid as the first argument
2783 case $1 in
2784 clean|clea|cle|cl)
2785 shift; set dummy --mode clean ${1+"$@"}; shift
2786 ;;
2787 compile|compil|compi|comp|com|co|c)
2788 shift; set dummy --mode compile ${1+"$@"}; shift
2789 ;;
2790 execute|execut|execu|exec|exe|ex|e)
2791 shift; set dummy --mode execute ${1+"$@"}; shift
2792 ;;
2793 finish|finis|fini|fin|fi|f)
2794 shift; set dummy --mode finish ${1+"$@"}; shift
2795 ;;
2796 install|instal|insta|inst|ins|in|i)
2797 shift; set dummy --mode install ${1+"$@"}; shift
2798 ;;
2799 link|lin|li|l)
2800 shift; set dummy --mode link ${1+"$@"}; shift
2801 ;;
2802 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2803 shift; set dummy --mode uninstall ${1+"$@"}; shift
2804 ;;
2805 esac
2806
2807 # Pass back the list of options.
2808 func_quote_for_eval ${1+"$@"}
2809 libtool_options_prep_result=$func_quote_for_eval_result
2810}
2811func_add_hook func_options_prep libtool_options_prep
2812
2813
2814# libtool_parse_options [ARG]...
2815# ---------------------------------
2816# Provide handling for libtool specific options.
2817libtool_parse_options ()
2818{
2819 $debug_cmd
2820
2821 # Perform our own loop to consume as many options as possible in
2822 # each iteration.
2823 while test $# -gt 0; do
2824 _G_opt=$1
2825 shift
2826 case $_G_opt in
2827 --dry-run|--dryrun|-n)
2828 opt_dry_run=:
2829 ;;
2830
2831 --config) func_config ;;
2832
2833 --dlopen|-dlopen)
2834 opt_dlopen="${opt_dlopen+$opt_dlopen
2835}$1"
2836 shift
2837 ;;
2838
2839 --preserve-dup-deps)
2840 opt_preserve_dup_deps=: ;;
2841
2842 --features) func_features ;;
2843
2844 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2845
2846 --help) opt_help=: ;;
2847
2848 --help-all) opt_help=': help-all' ;;
2849
2850 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2851 opt_mode=$1
2852 case $1 in
2853 # Valid mode arguments:
2854 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2855
2856 # Catch anything else as an error
2857 *) func_error "invalid argument for $_G_opt"
2858 exit_cmd=exit
2859 break
2860 ;;
2861 esac
2862 shift
2863 ;;
2864
2865 --no-silent|--no-quiet)
2866 opt_quiet=false
2867 func_append preserve_args " $_G_opt"
2868 ;;
2869
2870 --no-warnings|--no-warning|--no-warn)
2871 opt_warning=false
2872 func_append preserve_args " $_G_opt"
2873 ;;
2874
2875 --no-verbose)
2876 opt_verbose=false
2877 func_append preserve_args " $_G_opt"
2878 ;;
2879
2880 --silent|--quiet)
2881 opt_quiet=:
2882 opt_verbose=false
2883 func_append preserve_args " $_G_opt"
2884 ;;
2885
2886 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2887 opt_tag=$1
2888 func_append preserve_args " $_G_opt $1"
2889 func_enable_tag "$1"
2890 shift
2891 ;;
2892
2893 --verbose|-v) opt_quiet=false
2894 opt_verbose=:
2895 func_append preserve_args " $_G_opt"
2896 ;;
2897
2898 # An option not handled by this hook function:
2899 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2900 esac
2901 done
2902
2903
2904 # save modified positional parameters for caller
2905 func_quote_for_eval ${1+"$@"}
2906 libtool_parse_options_result=$func_quote_for_eval_result
2907}
2908func_add_hook func_parse_options libtool_parse_options
2909
2910
2911
2912# libtool_validate_options [ARG]...
2913# ---------------------------------
2914# Perform any sanity checks on option settings and/or unconsumed
2915# arguments.
2916libtool_validate_options ()
2917{
2918 # save first non-option argument
2919 if test 0 -lt $#; then
2920 nonopt=$1
2921 shift
2922 fi
2923
2924 # preserve --debug
2925 test : = "$debug_cmd" || func_append preserve_args " --debug"
2926
2927 case $host in
2928 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2929 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2930 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2931 # don't eliminate duplications in $postdeps and $predeps
2932 opt_duplicate_compiler_generated_deps=:
2933 ;;
2934 *)
2935 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2936 ;;
2937 esac
2938
2939 $opt_help || {
2940 # Sanity checks first:
2941 func_check_version_match
2942
2943 test yes != "$build_libtool_libs" \
2944 && test yes != "$build_old_libs" \
2945 && func_fatal_configuration "not configured to build any kind of library"
2946
2947 # Darwin sucks
2948 eval std_shrext=\"$shrext_cmds\"
2949
2950 # Only execute mode is allowed to have -dlopen flags.
2951 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2952 func_error "unrecognized option '-dlopen'"
2953 $ECHO "$help" 1>&2
2954 exit $EXIT_FAILURE
2955 fi
2956
2957 # Change the help message to a mode-specific one.
2958 generic_help=$help
2959 help="Try '$progname --help --mode=$opt_mode' for more information."
2960 }
2961
2962 # Pass back the unparsed argument list
2963 func_quote_for_eval ${1+"$@"}
2964 libtool_validate_options_result=$func_quote_for_eval_result
2965}
2966func_add_hook func_validate_options libtool_validate_options
2967
2968
2969# Process options as early as possible so that --help and --version
2970# can return quickly.
2971func_options ${1+"$@"}
2972eval set dummy "$func_options_result"; shift
2973
2974
2975
2976## ----------- ##
2977## Main. ##
2978## ----------- ##
2979
2980magic='%%%MAGIC variable%%%'
2981magic_exe='%%%MAGIC EXE variable%%%'
2982
2983# Global variables.
2984extracted_archives=
2985extracted_serial=0
2986
2987# If this variable is set in any of the actions, the command in it
2988# will be execed at the end. This prevents here-documents from being
2989# left over by shells.
2990exec_cmd=
2991
2992
2993# A function that is used when there is no print builtin or printf.
2994func_fallback_echo ()
2995{
2996 eval 'cat <<_LTECHO_EOF
2997$1
2998_LTECHO_EOF'
2999}
3000
3001# func_generated_by_libtool
3002# True iff stdin has been generated by Libtool. This function is only
3003# a basic sanity check; it will hardly flush out determined imposters.
3004func_generated_by_libtool_p ()
3005{
3006 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
3007}
3008
3009# func_lalib_p file
3010# True iff FILE is a libtool '.la' library or '.lo' object file.
3011# This function is only a basic sanity check; it will hardly flush out
3012# determined imposters.
3013func_lalib_p ()
3014{
3015 test -f "$1" &&
3016 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
3017}
3018
3019# func_lalib_unsafe_p file
3020# True iff FILE is a libtool '.la' library or '.lo' object file.
3021# This function implements the same check as func_lalib_p without
3022# resorting to external programs. To this end, it redirects stdin and
3023# closes it afterwards, without saving the original file descriptor.
3024# As a safety measure, use it only where a negative result would be
3025# fatal anyway. Works if 'file' does not exist.
3026func_lalib_unsafe_p ()
3027{
3028 lalib_p=no
3029 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3030 for lalib_p_l in 1 2 3 4
3031 do
3032 read lalib_p_line
3033 case $lalib_p_line in
3034 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3035 esac
3036 done
3037 exec 0<&5 5<&-
3038 fi
3039 test yes = "$lalib_p"
3040}
3041
3042# func_ltwrapper_script_p file
3043# True iff FILE is a libtool wrapper script
3044# This function is only a basic sanity check; it will hardly flush out
3045# determined imposters.
3046func_ltwrapper_script_p ()
3047{
3048 test -f "$1" &&
3049 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
3050}
3051
3052# func_ltwrapper_executable_p file
3053# True iff FILE is a libtool wrapper executable
3054# This function is only a basic sanity check; it will hardly flush out
3055# determined imposters.
3056func_ltwrapper_executable_p ()
3057{
3058 func_ltwrapper_exec_suffix=
3059 case $1 in
3060 *.exe) ;;
3061 *) func_ltwrapper_exec_suffix=.exe ;;
3062 esac
3063 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
3064}
3065
3066# func_ltwrapper_scriptname file
3067# Assumes file is an ltwrapper_executable
3068# uses $file to determine the appropriate filename for a
3069# temporary ltwrapper_script.
3070func_ltwrapper_scriptname ()
3071{
3072 func_dirname_and_basename "$1" "" "."
3073 func_stripname '' '.exe' "$func_basename_result"
3074 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3075}
3076
3077# func_ltwrapper_p file
3078# True iff FILE is a libtool wrapper script or wrapper executable
3079# This function is only a basic sanity check; it will hardly flush out
3080# determined imposters.
3081func_ltwrapper_p ()
3082{
3083 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
3084}
3085
3086
3087# func_execute_cmds commands fail_cmd
3088# Execute tilde-delimited COMMANDS.
3089# If FAIL_CMD is given, eval that upon failure.
3090# FAIL_CMD may read-access the current command in variable CMD!
3091func_execute_cmds ()
3092{
3093 $debug_cmd
3094
3095 save_ifs=$IFS; IFS='~'
3096 for cmd in $1; do
3097 IFS=$sp$nl
3098 eval cmd=\"$cmd\"
3099 IFS=$save_ifs
3100 func_show_eval "$cmd" "${2-:}"
3101 done
3102 IFS=$save_ifs
3103}
3104
3105
3106# func_source file
3107# Source FILE, adding directory component if necessary.
3108# Note that it is not necessary on cygwin/mingw to append a dot to
3109# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3110# behavior happens only for exec(3), not for open(2)! Also, sourcing
3111# 'FILE.' does not work on cygwin managed mounts.
3112func_source ()
3113{
3114 $debug_cmd
3115
3116 case $1 in
3117 */* | *\\*) . "$1" ;;
3118 *) . "./$1" ;;
3119 esac
3120}
3121
3122
3123# func_resolve_sysroot PATH
3124# Replace a leading = in PATH with a sysroot. Store the result into
3125# func_resolve_sysroot_result
3126func_resolve_sysroot ()
3127{
3128 func_resolve_sysroot_result=$1
3129 case $func_resolve_sysroot_result in
3130 =*)
3131 func_stripname '=' '' "$func_resolve_sysroot_result"
3132 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
3133 ;;
3134 esac
3135}
3136
3137# func_replace_sysroot PATH
3138# If PATH begins with the sysroot, replace it with = and
3139# store the result into func_replace_sysroot_result.
3140func_replace_sysroot ()
3141{
3142 case $lt_sysroot:$1 in
3143 ?*:"$lt_sysroot"*)
3144 func_stripname "$lt_sysroot" '' "$1"
3145 func_replace_sysroot_result='='$func_stripname_result
3146 ;;
3147 *)
3148 # Including no sysroot.
3149 func_replace_sysroot_result=$1
3150 ;;
3151 esac
3152}
3153
3154# func_infer_tag arg
3155# Infer tagged configuration to use if any are available and
3156# if one wasn't chosen via the "--tag" command line option.
3157# Only attempt this if the compiler in the base compile
3158# command doesn't match the default compiler.
3159# arg is usually of the form 'gcc ...'
3160func_infer_tag ()
3161{
3162 $debug_cmd
3163
3164 if test -n "$available_tags" && test -z "$tagname"; then
3165 CC_quoted=
3166 for arg in $CC; do
3167 func_append_quoted CC_quoted "$arg"
3168 done
3169 CC_expanded=`func_echo_all $CC`
3170 CC_quoted_expanded=`func_echo_all $CC_quoted`
3171 case $@ in
3172 # Blanks in the command may have been stripped by the calling shell,
3173 # but not from the CC environment variable when configure was run.
3174 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3175 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
3176 # Blanks at the start of $base_compile will cause this to fail
3177 # if we don't check for them as well.
3178 *)
3179 for z in $available_tags; do
3180 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
3181 # Evaluate the configuration.
3182 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3183 CC_quoted=
3184 for arg in $CC; do
3185 # Double-quote args containing other shell metacharacters.
3186 func_append_quoted CC_quoted "$arg"
3187 done
3188 CC_expanded=`func_echo_all $CC`
3189 CC_quoted_expanded=`func_echo_all $CC_quoted`
3190 case "$@ " in
3191 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3192 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
3193 # The compiler in the base compile command matches
3194 # the one in the tagged configuration.
3195 # Assume this is the tagged configuration we want.
3196 tagname=$z
3197 break
3198 ;;
3199 esac
3200 fi
3201 done
3202 # If $tagname still isn't set, then no tagged configuration
3203 # was found and let the user know that the "--tag" command
3204 # line option must be used.
3205 if test -z "$tagname"; then
3206 func_echo "unable to infer tagged configuration"
3207 func_fatal_error "specify a tag with '--tag'"
3208# else
3209# func_verbose "using $tagname tagged configuration"
3210 fi
3211 ;;
3212 esac
3213 fi
3214}
3215
3216
3217
3218# func_write_libtool_object output_name pic_name nonpic_name
3219# Create a libtool object file (analogous to a ".la" file),
3220# but don't create it if we're doing a dry run.
3221func_write_libtool_object ()
3222{
3223 write_libobj=$1
3224 if test yes = "$build_libtool_libs"; then
3225 write_lobj=\'$2\'
3226 else
3227 write_lobj=none
3228 fi
3229
3230 if test yes = "$build_old_libs"; then
3231 write_oldobj=\'$3\'
3232 else
3233 write_oldobj=none
3234 fi
3235
3236 $opt_dry_run || {
3237 cat >${write_libobj}T <<EOF
3238# $write_libobj - a libtool object file
3239# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3240#
3241# Please DO NOT delete this file!
3242# It is necessary for linking the library.
3243
3244# Name of the PIC object.
3245pic_object=$write_lobj
3246
3247# Name of the non-PIC object
3248non_pic_object=$write_oldobj
3249
3250EOF
3251 $MV "${write_libobj}T" "$write_libobj"
3252 }
3253}
3254
3255
3256##################################################
3257# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3258##################################################
3259
3260# func_convert_core_file_wine_to_w32 ARG
3261# Helper function used by file name conversion functions when $build is *nix,
3262# and $host is mingw, cygwin, or some other w32 environment. Relies on a
3263# correctly configured wine environment available, with the winepath program
3264# in $build's $PATH.
3265#
3266# ARG is the $build file name to be converted to w32 format.
3267# Result is available in $func_convert_core_file_wine_to_w32_result, and will
3268# be empty on error (or when ARG is empty)
3269func_convert_core_file_wine_to_w32 ()
3270{
3271 $debug_cmd
3272
3273 func_convert_core_file_wine_to_w32_result=$1
3274 if test -n "$1"; then
3275 # Unfortunately, winepath does not exit with a non-zero error code, so we
3276 # are forced to check the contents of stdout. On the other hand, if the
3277 # command is not found, the shell will set an exit code of 127 and print
3278 # *an error message* to stdout. So we must check for both error code of
3279 # zero AND non-empty stdout, which explains the odd construction:
3280 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3281 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3282 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3283 $SED -e "$sed_naive_backslashify"`
3284 else
3285 func_convert_core_file_wine_to_w32_result=
3286 fi
3287 fi
3288}
3289# end: func_convert_core_file_wine_to_w32
3290
3291
3292# func_convert_core_path_wine_to_w32 ARG
3293# Helper function used by path conversion functions when $build is *nix, and
3294# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3295# configured wine environment available, with the winepath program in $build's
3296# $PATH. Assumes ARG has no leading or trailing path separator characters.
3297#
3298# ARG is path to be converted from $build format to win32.
3299# Result is available in $func_convert_core_path_wine_to_w32_result.
3300# Unconvertible file (directory) names in ARG are skipped; if no directory names
3301# are convertible, then the result may be empty.
3302func_convert_core_path_wine_to_w32 ()
3303{
3304 $debug_cmd
3305
3306 # unfortunately, winepath doesn't convert paths, only file names
3307 func_convert_core_path_wine_to_w32_result=
3308 if test -n "$1"; then
3309 oldIFS=$IFS
3310 IFS=:
3311 for func_convert_core_path_wine_to_w32_f in $1; do
3312 IFS=$oldIFS
3313 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3314 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3315 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3316 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3317 else
3318 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3319 fi
3320 fi
3321 done
3322 IFS=$oldIFS
3323 fi
3324}
3325# end: func_convert_core_path_wine_to_w32
3326
3327
3328# func_cygpath ARGS...
3329# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3330# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3331# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3332# (2), returns the Cygwin file name or path in func_cygpath_result (input
3333# file name or path is assumed to be in w32 format, as previously converted
3334# from $build's *nix or MSYS format). In case (3), returns the w32 file name
3335# or path in func_cygpath_result (input file name or path is assumed to be in
3336# Cygwin format). Returns an empty string on error.
3337#
3338# ARGS are passed to cygpath, with the last one being the file name or path to
3339# be converted.
3340#
3341# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3342# environment variable; do not put it in $PATH.
3343func_cygpath ()
3344{
3345 $debug_cmd
3346
3347 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3348 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3349 if test "$?" -ne 0; then
3350 # on failure, ensure result is empty
3351 func_cygpath_result=
3352 fi
3353 else
3354 func_cygpath_result=
3355 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3356 fi
3357}
3358#end: func_cygpath
3359
3360
3361# func_convert_core_msys_to_w32 ARG
3362# Convert file name or path ARG from MSYS format to w32 format. Return
3363# result in func_convert_core_msys_to_w32_result.
3364func_convert_core_msys_to_w32 ()
3365{
3366 $debug_cmd
3367
3368 # awkward: cmd appends spaces to result
3369 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3370 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3371}
3372#end: func_convert_core_msys_to_w32
3373
3374
3375# func_convert_file_check ARG1 ARG2
3376# Verify that ARG1 (a file name in $build format) was converted to $host
3377# format in ARG2. Otherwise, emit an error message, but continue (resetting
3378# func_to_host_file_result to ARG1).
3379func_convert_file_check ()
3380{
3381 $debug_cmd
3382
3383 if test -z "$2" && test -n "$1"; then
3384 func_error "Could not determine host file name corresponding to"
3385 func_error " '$1'"
3386 func_error "Continuing, but uninstalled executables may not work."
3387 # Fallback:
3388 func_to_host_file_result=$1
3389 fi
3390}
3391# end func_convert_file_check
3392
3393
3394# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3395# Verify that FROM_PATH (a path in $build format) was converted to $host
3396# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3397# func_to_host_file_result to a simplistic fallback value (see below).
3398func_convert_path_check ()
3399{
3400 $debug_cmd
3401
3402 if test -z "$4" && test -n "$3"; then
3403 func_error "Could not determine the host path corresponding to"
3404 func_error " '$3'"
3405 func_error "Continuing, but uninstalled executables may not work."
3406 # Fallback. This is a deliberately simplistic "conversion" and
3407 # should not be "improved". See libtool.info.
3408 if test "x$1" != "x$2"; then
3409 lt_replace_pathsep_chars="s|$1|$2|g"
3410 func_to_host_path_result=`echo "$3" |
3411 $SED -e "$lt_replace_pathsep_chars"`
3412 else
3413 func_to_host_path_result=$3
3414 fi
3415 fi
3416}
3417# end func_convert_path_check
3418
3419
3420# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3421# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3422# and appending REPL if ORIG matches BACKPAT.
3423func_convert_path_front_back_pathsep ()
3424{
3425 $debug_cmd
3426
3427 case $4 in
3428 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3429 ;;
3430 esac
3431 case $4 in
3432 $2 ) func_append func_to_host_path_result "$3"
3433 ;;
3434 esac
3435}
3436# end func_convert_path_front_back_pathsep
3437
3438
3439##################################################
3440# $build to $host FILE NAME CONVERSION FUNCTIONS #
3441##################################################
3442# invoked via '$to_host_file_cmd ARG'
3443#
3444# In each case, ARG is the path to be converted from $build to $host format.
3445# Result will be available in $func_to_host_file_result.
3446
3447
3448# func_to_host_file ARG
3449# Converts the file name ARG from $build format to $host format. Return result
3450# in func_to_host_file_result.
3451func_to_host_file ()
3452{
3453 $debug_cmd
3454
3455 $to_host_file_cmd "$1"
3456}
3457# end func_to_host_file
3458
3459
3460# func_to_tool_file ARG LAZY
3461# converts the file name ARG from $build format to toolchain format. Return
3462# result in func_to_tool_file_result. If the conversion in use is listed
3463# in (the comma separated) LAZY, no conversion takes place.
3464func_to_tool_file ()
3465{
3466 $debug_cmd
3467
3468 case ,$2, in
3469 *,"$to_tool_file_cmd",*)
3470 func_to_tool_file_result=$1
3471 ;;
3472 *)
3473 $to_tool_file_cmd "$1"
3474 func_to_tool_file_result=$func_to_host_file_result
3475 ;;
3476 esac
3477}
3478# end func_to_tool_file
3479
3480
3481# func_convert_file_noop ARG
3482# Copy ARG to func_to_host_file_result.
3483func_convert_file_noop ()
3484{
3485 func_to_host_file_result=$1
3486}
3487# end func_convert_file_noop
3488
3489
3490# func_convert_file_msys_to_w32 ARG
3491# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3492# conversion to w32 is not available inside the cwrapper. Returns result in
3493# func_to_host_file_result.
3494func_convert_file_msys_to_w32 ()
3495{
3496 $debug_cmd
3497
3498 func_to_host_file_result=$1
3499 if test -n "$1"; then
3500 func_convert_core_msys_to_w32 "$1"
3501 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3502 fi
3503 func_convert_file_check "$1" "$func_to_host_file_result"
3504}
3505# end func_convert_file_msys_to_w32
3506
3507
3508# func_convert_file_cygwin_to_w32 ARG
3509# Convert file name ARG from Cygwin to w32 format. Returns result in
3510# func_to_host_file_result.
3511func_convert_file_cygwin_to_w32 ()
3512{
3513 $debug_cmd
3514
3515 func_to_host_file_result=$1
3516 if test -n "$1"; then
3517 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3518 # LT_CYGPATH in this case.
3519 func_to_host_file_result=`cygpath -m "$1"`
3520 fi
3521 func_convert_file_check "$1" "$func_to_host_file_result"
3522}
3523# end func_convert_file_cygwin_to_w32
3524
3525
3526# func_convert_file_nix_to_w32 ARG
3527# Convert file name ARG from *nix to w32 format. Requires a wine environment
3528# and a working winepath. Returns result in func_to_host_file_result.
3529func_convert_file_nix_to_w32 ()
3530{
3531 $debug_cmd
3532
3533 func_to_host_file_result=$1
3534 if test -n "$1"; then
3535 func_convert_core_file_wine_to_w32 "$1"
3536 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3537 fi
3538 func_convert_file_check "$1" "$func_to_host_file_result"
3539}
3540# end func_convert_file_nix_to_w32
3541
3542
3543# func_convert_file_msys_to_cygwin ARG
3544# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3545# Returns result in func_to_host_file_result.
3546func_convert_file_msys_to_cygwin ()
3547{
3548 $debug_cmd
3549
3550 func_to_host_file_result=$1
3551 if test -n "$1"; then
3552 func_convert_core_msys_to_w32 "$1"
3553 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3554 func_to_host_file_result=$func_cygpath_result
3555 fi
3556 func_convert_file_check "$1" "$func_to_host_file_result"
3557}
3558# end func_convert_file_msys_to_cygwin
3559
3560
3561# func_convert_file_nix_to_cygwin ARG
3562# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3563# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3564# in func_to_host_file_result.
3565func_convert_file_nix_to_cygwin ()
3566{
3567 $debug_cmd
3568
3569 func_to_host_file_result=$1
3570 if test -n "$1"; then
3571 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3572 func_convert_core_file_wine_to_w32 "$1"
3573 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3574 func_to_host_file_result=$func_cygpath_result
3575 fi
3576 func_convert_file_check "$1" "$func_to_host_file_result"
3577}
3578# end func_convert_file_nix_to_cygwin
3579
3580
3581#############################################
3582# $build to $host PATH CONVERSION FUNCTIONS #
3583#############################################
3584# invoked via '$to_host_path_cmd ARG'
3585#
3586# In each case, ARG is the path to be converted from $build to $host format.
3587# The result will be available in $func_to_host_path_result.
3588#
3589# Path separators are also converted from $build format to $host format. If
3590# ARG begins or ends with a path separator character, it is preserved (but
3591# converted to $host format) on output.
3592#
3593# All path conversion functions are named using the following convention:
3594# file name conversion function : func_convert_file_X_to_Y ()
3595# path conversion function : func_convert_path_X_to_Y ()
3596# where, for any given $build/$host combination the 'X_to_Y' value is the
3597# same. If conversion functions are added for new $build/$host combinations,
3598# the two new functions must follow this pattern, or func_init_to_host_path_cmd
3599# will break.
3600
3601
3602# func_init_to_host_path_cmd
3603# Ensures that function "pointer" variable $to_host_path_cmd is set to the
3604# appropriate value, based on the value of $to_host_file_cmd.
3605to_host_path_cmd=
3606func_init_to_host_path_cmd ()
3607{
3608 $debug_cmd
3609
3610 if test -z "$to_host_path_cmd"; then
3611 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3612 to_host_path_cmd=func_convert_path_$func_stripname_result
3613 fi
3614}
3615
3616
3617# func_to_host_path ARG
3618# Converts the path ARG from $build format to $host format. Return result
3619# in func_to_host_path_result.
3620func_to_host_path ()
3621{
3622 $debug_cmd
3623
3624 func_init_to_host_path_cmd
3625 $to_host_path_cmd "$1"
3626}
3627# end func_to_host_path
3628
3629
3630# func_convert_path_noop ARG
3631# Copy ARG to func_to_host_path_result.
3632func_convert_path_noop ()
3633{
3634 func_to_host_path_result=$1
3635}
3636# end func_convert_path_noop
3637
3638
3639# func_convert_path_msys_to_w32 ARG
3640# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3641# conversion to w32 is not available inside the cwrapper. Returns result in
3642# func_to_host_path_result.
3643func_convert_path_msys_to_w32 ()
3644{
3645 $debug_cmd
3646
3647 func_to_host_path_result=$1
3648 if test -n "$1"; then
3649 # Remove leading and trailing path separator characters from ARG. MSYS
3650 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3651 # and winepath ignores them completely.
3652 func_stripname : : "$1"
3653 func_to_host_path_tmp1=$func_stripname_result
3654 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3655 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3656 func_convert_path_check : ";" \
3657 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3658 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3659 fi
3660}
3661# end func_convert_path_msys_to_w32
3662
3663
3664# func_convert_path_cygwin_to_w32 ARG
3665# Convert path ARG from Cygwin to w32 format. Returns result in
3666# func_to_host_file_result.
3667func_convert_path_cygwin_to_w32 ()
3668{
3669 $debug_cmd
3670
3671 func_to_host_path_result=$1
3672 if test -n "$1"; then
3673 # See func_convert_path_msys_to_w32:
3674 func_stripname : : "$1"
3675 func_to_host_path_tmp1=$func_stripname_result
3676 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3677 func_convert_path_check : ";" \
3678 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3679 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3680 fi
3681}
3682# end func_convert_path_cygwin_to_w32
3683
3684
3685# func_convert_path_nix_to_w32 ARG
3686# Convert path ARG from *nix to w32 format. Requires a wine environment and
3687# a working winepath. Returns result in func_to_host_file_result.
3688func_convert_path_nix_to_w32 ()
3689{
3690 $debug_cmd
3691
3692 func_to_host_path_result=$1
3693 if test -n "$1"; then
3694 # See func_convert_path_msys_to_w32:
3695 func_stripname : : "$1"
3696 func_to_host_path_tmp1=$func_stripname_result
3697 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3698 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3699 func_convert_path_check : ";" \
3700 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3701 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3702 fi
3703}
3704# end func_convert_path_nix_to_w32
3705
3706
3707# func_convert_path_msys_to_cygwin ARG
3708# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3709# Returns result in func_to_host_file_result.
3710func_convert_path_msys_to_cygwin ()
3711{
3712 $debug_cmd
3713
3714 func_to_host_path_result=$1
3715 if test -n "$1"; then
3716 # See func_convert_path_msys_to_w32:
3717 func_stripname : : "$1"
3718 func_to_host_path_tmp1=$func_stripname_result
3719 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3720 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3721 func_to_host_path_result=$func_cygpath_result
3722 func_convert_path_check : : \
3723 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3724 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3725 fi
3726}
3727# end func_convert_path_msys_to_cygwin
3728
3729
3730# func_convert_path_nix_to_cygwin ARG
3731# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3732# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3733# func_to_host_file_result.
3734func_convert_path_nix_to_cygwin ()
3735{
3736 $debug_cmd
3737
3738 func_to_host_path_result=$1
3739 if test -n "$1"; then
3740 # Remove leading and trailing path separator characters from
3741 # ARG. msys behavior is inconsistent here, cygpath turns them
3742 # into '.;' and ';.', and winepath ignores them completely.
3743 func_stripname : : "$1"
3744 func_to_host_path_tmp1=$func_stripname_result
3745 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3746 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3747 func_to_host_path_result=$func_cygpath_result
3748 func_convert_path_check : : \
3749 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3750 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3751 fi
3752}
3753# end func_convert_path_nix_to_cygwin
3754
3755
3756# func_dll_def_p FILE
3757# True iff FILE is a Windows DLL '.def' file.
3758# Keep in sync with _LT_DLL_DEF_P in libtool.m4
3759func_dll_def_p ()
3760{
3761 $debug_cmd
3762
3763 func_dll_def_p_tmp=`$SED -n \
3764 -e 's/^[ ]*//' \
3765 -e '/^\(;.*\)*$/d' \
3766 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3767 -e q \
3768 "$1"`
3769 test DEF = "$func_dll_def_p_tmp"
3770}
3771
3772
3773# func_mode_compile arg...
3774func_mode_compile ()
3775{
3776 $debug_cmd
3777
3778 # Get the compilation command and the source file.
3779 base_compile=
3780 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3781 suppress_opt=yes
3782 suppress_output=
3783 arg_mode=normal
3784 libobj=
3785 later=
3786 pie_flag=
3787
3788 for arg
3789 do
3790 case $arg_mode in
3791 arg )
3792 # do not "continue". Instead, add this to base_compile
3793 lastarg=$arg
3794 arg_mode=normal
3795 ;;
3796
3797 target )
3798 libobj=$arg
3799 arg_mode=normal
3800 continue
3801 ;;
3802
3803 normal )
3804 # Accept any command-line options.
3805 case $arg in
3806 -o)
3807 test -n "$libobj" && \
3808 func_fatal_error "you cannot specify '-o' more than once"
3809 arg_mode=target
3810 continue
3811 ;;
3812
3813 -pie | -fpie | -fPIE)
3814 func_append pie_flag " $arg"
3815 continue
3816 ;;
3817
3818 -shared | -static | -prefer-pic | -prefer-non-pic)
3819 func_append later " $arg"
3820 continue
3821 ;;
3822
3823 -no-suppress)
3824 suppress_opt=no
3825 continue
3826 ;;
3827
3828 -Xcompiler)
3829 arg_mode=arg # the next one goes into the "base_compile" arg list
3830 continue # The current "srcfile" will either be retained or
3831 ;; # replaced later. I would guess that would be a bug.
3832
3833 -Wc,*)
3834 func_stripname '-Wc,' '' "$arg"
3835 args=$func_stripname_result
3836 lastarg=
3837 save_ifs=$IFS; IFS=,
3838 for arg in $args; do
3839 IFS=$save_ifs
3840 func_append_quoted lastarg "$arg"
3841 done
3842 IFS=$save_ifs
3843 func_stripname ' ' '' "$lastarg"
3844 lastarg=$func_stripname_result
3845
3846 # Add the arguments to base_compile.
3847 func_append base_compile " $lastarg"
3848 continue
3849 ;;
3850
3851 *)
3852 # Accept the current argument as the source file.
3853 # The previous "srcfile" becomes the current argument.
3854 #
3855 lastarg=$srcfile
3856 srcfile=$arg
3857 ;;
3858 esac # case $arg
3859 ;;
3860 esac # case $arg_mode
3861
3862 # Aesthetically quote the previous argument.
3863 func_append_quoted base_compile "$lastarg"
3864 done # for arg
3865
3866 case $arg_mode in
3867 arg)
3868 func_fatal_error "you must specify an argument for -Xcompile"
3869 ;;
3870 target)
3871 func_fatal_error "you must specify a target with '-o'"
3872 ;;
3873 *)
3874 # Get the name of the library object.
3875 test -z "$libobj" && {
3876 func_basename "$srcfile"
3877 libobj=$func_basename_result
3878 }
3879 ;;
3880 esac
3881
3882 # Recognize several different file suffixes.
3883 # If the user specifies -o file.o, it is replaced with file.lo
3884 case $libobj in
3885 *.[cCFSifmso] | \
3886 *.ada | *.adb | *.ads | *.asm | \
3887 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3888 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3889 func_xform "$libobj"
3890 libobj=$func_xform_result
3891 ;;
3892 esac
3893
3894 case $libobj in
3895 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3896 *)
3897 func_fatal_error "cannot determine name of library object from '$libobj'"
3898 ;;
3899 esac
3900
3901 func_infer_tag $base_compile
3902
3903 for arg in $later; do
3904 case $arg in
3905 -shared)
3906 test yes = "$build_libtool_libs" \
3907 || func_fatal_configuration "cannot build a shared library"
3908 build_old_libs=no
3909 continue
3910 ;;
3911
3912 -static)
3913 build_libtool_libs=no
3914 build_old_libs=yes
3915 continue
3916 ;;
3917
3918 -prefer-pic)
3919 pic_mode=yes
3920 continue
3921 ;;
3922
3923 -prefer-non-pic)
3924 pic_mode=no
3925 continue
3926 ;;
3927 esac
3928 done
3929
3930 func_quote_for_eval "$libobj"
3931 test "X$libobj" != "X$func_quote_for_eval_result" \
3932 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3933 && func_warning "libobj name '$libobj' may not contain shell special characters."
3934 func_dirname_and_basename "$obj" "/" ""
3935 objname=$func_basename_result
3936 xdir=$func_dirname_result
3937 lobj=$xdir$objdir/$objname
3938
3939 test -z "$base_compile" && \
3940 func_fatal_help "you must specify a compilation command"
3941
3942 # Delete any leftover library objects.
3943 if test yes = "$build_old_libs"; then
3944 removelist="$obj $lobj $libobj ${libobj}T"
3945 else
3946 removelist="$lobj $libobj ${libobj}T"
3947 fi
3948
3949 # On Cygwin there's no "real" PIC flag so we must build both object types
3950 case $host_os in
3951 cygwin* | mingw* | pw32* | os2* | cegcc*)
3952 pic_mode=default
3953 ;;
3954 esac
3955 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3956 # non-PIC code in shared libraries is not supported
3957 pic_mode=default
3958 fi
3959
3960 # Calculate the filename of the output object if compiler does
3961 # not support -o with -c
3962 if test no = "$compiler_c_o"; then
3963 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3964 lockfile=$output_obj.lock
3965 else
3966 output_obj=
3967 need_locks=no
3968 lockfile=
3969 fi
3970
3971 # Lock this critical section if it is needed
3972 # We use this script file to make the link, it avoids creating a new file
3973 if test yes = "$need_locks"; then
3974 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3975 func_echo "Waiting for $lockfile to be removed"
3976 sleep 2
3977 done
3978 elif test warn = "$need_locks"; then
3979 if test -f "$lockfile"; then
3980 $ECHO "\
3981*** ERROR, $lockfile exists and contains:
3982`cat $lockfile 2>/dev/null`
3983
3984This indicates that another process is trying to use the same
3985temporary object file, and libtool could not work around it because
3986your compiler does not support '-c' and '-o' together. If you
3987repeat this compilation, it may succeed, by chance, but you had better
3988avoid parallel builds (make -j) in this platform, or get a better
3989compiler."
3990
3991 $opt_dry_run || $RM $removelist
3992 exit $EXIT_FAILURE
3993 fi
3994 func_append removelist " $output_obj"
3995 $ECHO "$srcfile" > "$lockfile"
3996 fi
3997
3998 $opt_dry_run || $RM $removelist
3999 func_append removelist " $lockfile"
4000 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
4001
4002 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
4003 srcfile=$func_to_tool_file_result
4004 func_quote_for_eval "$srcfile"
4005 qsrcfile=$func_quote_for_eval_result
4006
4007 # Only build a PIC object if we are building libtool libraries.
4008 if test yes = "$build_libtool_libs"; then
4009 # Without this assignment, base_compile gets emptied.
4010 fbsd_hideous_sh_bug=$base_compile
4011
4012 if test no != "$pic_mode"; then
4013 command="$base_compile $qsrcfile $pic_flag"
4014 else
4015 # Don't build PIC code
4016 command="$base_compile $qsrcfile"
4017 fi
4018
4019 func_mkdir_p "$xdir$objdir"
4020
4021 if test -z "$output_obj"; then
4022 # Place PIC objects in $objdir
4023 func_append command " -o $lobj"
4024 fi
4025
4026 func_show_eval_locale "$command" \
4027 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4028
4029 if test warn = "$need_locks" &&
4030 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4031 $ECHO "\
4032*** ERROR, $lockfile contains:
4033`cat $lockfile 2>/dev/null`
4034
4035but it should contain:
4036$srcfile
4037
4038This indicates that another process is trying to use the same
4039temporary object file, and libtool could not work around it because
4040your compiler does not support '-c' and '-o' together. If you
4041repeat this compilation, it may succeed, by chance, but you had better
4042avoid parallel builds (make -j) in this platform, or get a better
4043compiler."
4044
4045 $opt_dry_run || $RM $removelist
4046 exit $EXIT_FAILURE
4047 fi
4048
4049 # Just move the object if needed, then go on to compile the next one
4050 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4051 func_show_eval '$MV "$output_obj" "$lobj"' \
4052 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4053 fi
4054
4055 # Allow error messages only from the first compilation.
4056 if test yes = "$suppress_opt"; then
4057 suppress_output=' >/dev/null 2>&1'
4058 fi
4059 fi
4060
4061 # Only build a position-dependent object if we build old libraries.
4062 if test yes = "$build_old_libs"; then
4063 if test yes != "$pic_mode"; then
4064 # Don't build PIC code
4065 command="$base_compile $qsrcfile$pie_flag"
4066 else
4067 command="$base_compile $qsrcfile $pic_flag"
4068 fi
4069 if test yes = "$compiler_c_o"; then
4070 func_append command " -o $obj"
4071 fi
4072
4073 # Suppress compiler output if we already did a PIC compilation.
4074 func_append command "$suppress_output"
4075 func_show_eval_locale "$command" \
4076 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4077
4078 if test warn = "$need_locks" &&
4079 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4080 $ECHO "\
4081*** ERROR, $lockfile contains:
4082`cat $lockfile 2>/dev/null`
4083
4084but it should contain:
4085$srcfile
4086
4087This indicates that another process is trying to use the same
4088temporary object file, and libtool could not work around it because
4089your compiler does not support '-c' and '-o' together. If you
4090repeat this compilation, it may succeed, by chance, but you had better
4091avoid parallel builds (make -j) in this platform, or get a better
4092compiler."
4093
4094 $opt_dry_run || $RM $removelist
4095 exit $EXIT_FAILURE
4096 fi
4097
4098 # Just move the object if needed
4099 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4100 func_show_eval '$MV "$output_obj" "$obj"' \
4101 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4102 fi
4103 fi
4104
4105 $opt_dry_run || {
4106 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
4107
4108 # Unlock the critical section if it was locked
4109 if test no != "$need_locks"; then
4110 removelist=$lockfile
4111 $RM "$lockfile"
4112 fi
4113 }
4114
4115 exit $EXIT_SUCCESS
4116}
4117
4118$opt_help || {
4119 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
4120}
4121
4122func_mode_help ()
4123{
4124 # We need to display help for each of the modes.
4125 case $opt_mode in
4126 "")
4127 # Generic help is extracted from the usage comments
4128 # at the start of this file.
4129 func_help
4130 ;;
4131
4132 clean)
4133 $ECHO \
4134"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4135
4136Remove files from the build directory.
4137
4138RM is the name of the program to use to delete files associated with each FILE
4139(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4140to RM.
4141
4142If FILE is a libtool library, object or program, all the files associated
4143with it are deleted. Otherwise, only FILE itself is deleted using RM."
4144 ;;
4145
4146 compile)
4147 $ECHO \
4148"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4149
4150Compile a source file into a libtool library object.
4151
4152This mode accepts the following additional options:
4153
4154 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4155 -no-suppress do not suppress compiler output for multiple passes
4156 -prefer-pic try to build PIC objects only
4157 -prefer-non-pic try to build non-PIC objects only
4158 -shared do not build a '.o' file suitable for static linking
4159 -static only build a '.o' file suitable for static linking
4160 -Wc,FLAG pass FLAG directly to the compiler
4161
4162COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4163from the given SOURCEFILE.
4164
4165The output file name is determined by removing the directory component from
4166SOURCEFILE, then substituting the C source code suffix '.c' with the
4167library object suffix, '.lo'."
4168 ;;
4169
4170 execute)
4171 $ECHO \
4172"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4173
4174Automatically set library path, then run a program.
4175
4176This mode accepts the following additional options:
4177
4178 -dlopen FILE add the directory containing FILE to the library path
4179
4180This mode sets the library path environment variable according to '-dlopen'
4181flags.
4182
4183If any of the ARGS are libtool executable wrappers, then they are translated
4184into their corresponding uninstalled binary, and any of their required library
4185directories are added to the library path.
4186
4187Then, COMMAND is executed, with ARGS as arguments."
4188 ;;
4189
4190 finish)
4191 $ECHO \
4192"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4193
4194Complete the installation of libtool libraries.
4195
4196Each LIBDIR is a directory that contains libtool libraries.
4197
4198The commands that this mode executes may require superuser privileges. Use
4199the '--dry-run' option if you just want to see what would be executed."
4200 ;;
4201
4202 install)
4203 $ECHO \
4204"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4205
4206Install executables or libraries.
4207
4208INSTALL-COMMAND is the installation command. The first component should be
4209either the 'install' or 'cp' program.
4210
4211The following components of INSTALL-COMMAND are treated specially:
4212
4213 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4214
4215The rest of the components are interpreted as arguments to that command (only
4216BSD-compatible install options are recognized)."
4217 ;;
4218
4219 link)
4220 $ECHO \
4221"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4222
4223Link object files or libraries together to form another library, or to
4224create an executable program.
4225
4226LINK-COMMAND is a command using the C compiler that you would use to create
4227a program from several object files.
4228
4229The following components of LINK-COMMAND are treated specially:
4230
4231 -all-static do not do any dynamic linking at all
4232 -avoid-version do not add a version suffix if possible
4233 -bindir BINDIR specify path to binaries directory (for systems where
4234 libraries must be found in the PATH setting at runtime)
4235 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4236 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4237 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4238 -export-symbols SYMFILE
4239 try to export only the symbols listed in SYMFILE
4240 -export-symbols-regex REGEX
4241 try to export only the symbols matching REGEX
4242 -LLIBDIR search LIBDIR for required installed libraries
4243 -lNAME OUTPUT-FILE requires the installed library libNAME
4244 -module build a library that can dlopened
4245 -no-fast-install disable the fast-install mode
4246 -no-install link a not-installable executable
4247 -no-undefined declare that a library does not refer to external symbols
4248 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4249 -objectlist FILE use a list of object files found in FILE to specify objects
4250 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4251 -precious-files-regex REGEX
4252 don't remove output files matching REGEX
4253 -release RELEASE specify package release information
4254 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4255 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4256 -shared only do dynamic linking of libtool libraries
4257 -shrext SUFFIX override the standard shared library file extension
4258 -static do not do any dynamic linking of uninstalled libtool libraries
4259 -static-libtool-libs
4260 do not do any dynamic linking of libtool libraries
4261 -version-info CURRENT[:REVISION[:AGE]]
4262 specify library version info [each variable defaults to 0]
4263 -weak LIBNAME declare that the target provides the LIBNAME interface
4264 -Wc,FLAG
4265 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4266 -Wl,FLAG
4267 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4268 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4269
4270All other options (arguments beginning with '-') are ignored.
4271
4272Every other argument is treated as a filename. Files ending in '.la' are
4273treated as uninstalled libtool libraries, other files are standard or library
4274object files.
4275
4276If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4277only library objects ('.lo' files) may be specified, and '-rpath' is
4278required, except when creating a convenience library.
4279
4280If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4281using 'ar' and 'ranlib', or on Windows using 'lib'.
4282
4283If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4284is created, otherwise an executable program is created."
4285 ;;
4286
4287 uninstall)
4288 $ECHO \
4289"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4290
4291Remove libraries from an installation directory.
4292
4293RM is the name of the program to use to delete files associated with each FILE
4294(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4295to RM.
4296
4297If FILE is a libtool library, all the files associated with it are deleted.
4298Otherwise, only FILE itself is deleted using RM."
4299 ;;
4300
4301 *)
4302 func_fatal_help "invalid operation mode '$opt_mode'"
4303 ;;
4304 esac
4305
4306 echo
4307 $ECHO "Try '$progname --help' for more information about other modes."
4308}
4309
4310# Now that we've collected a possible --mode arg, show help if necessary
4311if $opt_help; then
4312 if test : = "$opt_help"; then
4313 func_mode_help
4314 else
4315 {
4316 func_help noexit
4317 for opt_mode in compile link execute install finish uninstall clean; do
4318 func_mode_help
4319 done
4320 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4321 {
4322 func_help noexit
4323 for opt_mode in compile link execute install finish uninstall clean; do
4324 echo
4325 func_mode_help
4326 done
4327 } |
4328 $SED '1d
4329 /^When reporting/,/^Report/{
4330 H
4331 d
4332 }
4333 $x
4334 /information about other modes/d
4335 /more detailed .*MODE/d
4336 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4337 fi
4338 exit $?
4339fi
4340
4341
4342# func_mode_execute arg...
4343func_mode_execute ()
4344{
4345 $debug_cmd
4346
4347 # The first argument is the command name.
4348 cmd=$nonopt
4349 test -z "$cmd" && \
4350 func_fatal_help "you must specify a COMMAND"
4351
4352 # Handle -dlopen flags immediately.
4353 for file in $opt_dlopen; do
4354 test -f "$file" \
4355 || func_fatal_help "'$file' is not a file"
4356
4357 dir=
4358 case $file in
4359 *.la)
4360 func_resolve_sysroot "$file"
4361 file=$func_resolve_sysroot_result
4362
4363 # Check to see that this really is a libtool archive.
4364 func_lalib_unsafe_p "$file" \
4365 || func_fatal_help "'$lib' is not a valid libtool archive"
4366
4367 # Read the libtool library.
4368 dlname=
4369 library_names=
4370 func_source "$file"
4371
4372 # Skip this library if it cannot be dlopened.
4373 if test -z "$dlname"; then
4374 # Warn if it was a shared library.
4375 test -n "$library_names" && \
4376 func_warning "'$file' was not linked with '-export-dynamic'"
4377 continue
4378 fi
4379
4380 func_dirname "$file" "" "."
4381 dir=$func_dirname_result
4382
4383 if test -f "$dir/$objdir/$dlname"; then
4384 func_append dir "/$objdir"
4385 else
4386 if test ! -f "$dir/$dlname"; then
4387 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4388 fi
4389 fi
4390 ;;
4391
4392 *.lo)
4393 # Just add the directory containing the .lo file.
4394 func_dirname "$file" "" "."
4395 dir=$func_dirname_result
4396 ;;
4397
4398 *)
4399 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4400 continue
4401 ;;
4402 esac
4403
4404 # Get the absolute pathname.
4405 absdir=`cd "$dir" && pwd`
4406 test -n "$absdir" && dir=$absdir
4407
4408 # Now add the directory to shlibpath_var.
4409 if eval "test -z \"\$$shlibpath_var\""; then
4410 eval "$shlibpath_var=\"\$dir\""
4411 else
4412 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4413 fi
4414 done
4415
4416 # This variable tells wrapper scripts just to set shlibpath_var
4417 # rather than running their programs.
4418 libtool_execute_magic=$magic
4419
4420 # Check if any of the arguments is a wrapper script.
4421 args=
4422 for file
4423 do
4424 case $file in
4425 -* | *.la | *.lo ) ;;
4426 *)
4427 # Do a test to see if this is really a libtool program.
4428 if func_ltwrapper_script_p "$file"; then
4429 func_source "$file"
4430 # Transform arg to wrapped name.
4431 file=$progdir/$program
4432 elif func_ltwrapper_executable_p "$file"; then
4433 func_ltwrapper_scriptname "$file"
4434 func_source "$func_ltwrapper_scriptname_result"
4435 # Transform arg to wrapped name.
4436 file=$progdir/$program
4437 fi
4438 ;;
4439 esac
4440 # Quote arguments (to preserve shell metacharacters).
4441 func_append_quoted args "$file"
4442 done
4443
4444 if $opt_dry_run; then
4445 # Display what would be done.
4446 if test -n "$shlibpath_var"; then
4447 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4448 echo "export $shlibpath_var"
4449 fi
4450 $ECHO "$cmd$args"
4451 exit $EXIT_SUCCESS
4452 else
4453 if test -n "$shlibpath_var"; then
4454 # Export the shlibpath_var.
4455 eval "export $shlibpath_var"
4456 fi
4457
4458 # Restore saved environment variables
4459 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4460 do
4461 eval "if test \"\${save_$lt_var+set}\" = set; then
4462 $lt_var=\$save_$lt_var; export $lt_var
4463 else
4464 $lt_unset $lt_var
4465 fi"
4466 done
4467
4468 # Now prepare to actually exec the command.
4469 exec_cmd=\$cmd$args
4470 fi
4471}
4472
4473test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4474
4475
4476# func_mode_finish arg...
4477func_mode_finish ()
4478{
4479 $debug_cmd
4480
4481 libs=
4482 libdirs=
4483 admincmds=
4484
4485 for opt in "$nonopt" ${1+"$@"}
4486 do
4487 if test -d "$opt"; then
4488 func_append libdirs " $opt"
4489
4490 elif test -f "$opt"; then
4491 if func_lalib_unsafe_p "$opt"; then
4492 func_append libs " $opt"
4493 else
4494 func_warning "'$opt' is not a valid libtool archive"
4495 fi
4496
4497 else
4498 func_fatal_error "invalid argument '$opt'"
4499 fi
4500 done
4501
4502 if test -n "$libs"; then
4503 if test -n "$lt_sysroot"; then
4504 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4505 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4506 else
4507 sysroot_cmd=
4508 fi
4509
4510 # Remove sysroot references
4511 if $opt_dry_run; then
4512 for lib in $libs; do
4513 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4514 done
4515 else
4516 tmpdir=`func_mktempdir`
4517 for lib in $libs; do
4518 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4519 > $tmpdir/tmp-la
4520 mv -f $tmpdir/tmp-la $lib
4521 done
4522 ${RM}r "$tmpdir"
4523 fi
4524 fi
4525
4526 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4527 for libdir in $libdirs; do
4528 if test -n "$finish_cmds"; then
4529 # Do each command in the finish commands.
4530 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4531'"$cmd"'"'
4532 fi
4533 if test -n "$finish_eval"; then
4534 # Do the single finish_eval.
4535 eval cmds=\"$finish_eval\"
4536 $opt_dry_run || eval "$cmds" || func_append admincmds "
4537 $cmds"
4538 fi
4539 done
4540 fi
4541
4542 # Exit here if they wanted silent mode.
4543 $opt_quiet && exit $EXIT_SUCCESS
4544
4545 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4546 echo "----------------------------------------------------------------------"
4547 echo "Libraries have been installed in:"
4548 for libdir in $libdirs; do
4549 $ECHO " $libdir"
4550 done
4551 echo
4552 echo "If you ever happen to want to link against installed libraries"
4553 echo "in a given directory, LIBDIR, you must either use libtool, and"
4554 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4555 echo "flag during linking and do at least one of the following:"
4556 if test -n "$shlibpath_var"; then
4557 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4558 echo " during execution"
4559 fi
4560 if test -n "$runpath_var"; then
4561 echo " - add LIBDIR to the '$runpath_var' environment variable"
4562 echo " during linking"
4563 fi
4564 if test -n "$hardcode_libdir_flag_spec"; then
4565 libdir=LIBDIR
4566 eval flag=\"$hardcode_libdir_flag_spec\"
4567
4568 $ECHO " - use the '$flag' linker flag"
4569 fi
4570 if test -n "$admincmds"; then
4571 $ECHO " - have your system administrator run these commands:$admincmds"
4572 fi
4573 if test -f /etc/ld.so.conf; then
4574 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4575 fi
4576 echo
4577
4578 echo "See any operating system documentation about shared libraries for"
4579 case $host in
4580 solaris2.[6789]|solaris2.1[0-9])
4581 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4582 echo "pages."
4583 ;;
4584 *)
4585 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4586 ;;
4587 esac
4588 echo "----------------------------------------------------------------------"
4589 fi
4590 exit $EXIT_SUCCESS
4591}
4592
4593test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4594
4595
4596# func_mode_install arg...
4597func_mode_install ()
4598{
4599 $debug_cmd
4600
4601 # There may be an optional sh(1) argument at the beginning of
4602 # install_prog (especially on Windows NT).
4603 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4604 # Allow the use of GNU shtool's install command.
4605 case $nonopt in *shtool*) :;; *) false;; esac
4606 then
4607 # Aesthetically quote it.
4608 func_quote_for_eval "$nonopt"
4609 install_prog="$func_quote_for_eval_result "
4610 arg=$1
4611 shift
4612 else
4613 install_prog=
4614 arg=$nonopt
4615 fi
4616
4617 # The real first argument should be the name of the installation program.
4618 # Aesthetically quote it.
4619 func_quote_for_eval "$arg"
4620 func_append install_prog "$func_quote_for_eval_result"
4621 install_shared_prog=$install_prog
4622 case " $install_prog " in
4623 *[\\\ /]cp\ *) install_cp=: ;;
4624 *) install_cp=false ;;
4625 esac
4626
4627 # We need to accept at least all the BSD install flags.
4628 dest=
4629 files=
4630 opts=
4631 prev=
4632 install_type=
4633 isdir=false
4634 stripme=
4635 no_mode=:
4636 for arg
4637 do
4638 arg2=
4639 if test -n "$dest"; then
4640 func_append files " $dest"
4641 dest=$arg
4642 continue
4643 fi
4644
4645 case $arg in
4646 -d) isdir=: ;;
4647 -f)
4648 if $install_cp; then :; else
4649 prev=$arg
4650 fi
4651 ;;
4652 -g | -m | -o)
4653 prev=$arg
4654 ;;
4655 -s)
4656 stripme=" -s"
4657 continue
4658 ;;
4659 -*)
4660 ;;
4661 *)
4662 # If the previous option needed an argument, then skip it.
4663 if test -n "$prev"; then
4664 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4665 arg2=$install_override_mode
4666 no_mode=false
4667 fi
4668 prev=
4669 else
4670 dest=$arg
4671 continue
4672 fi
4673 ;;
4674 esac
4675
4676 # Aesthetically quote the argument.
4677 func_quote_for_eval "$arg"
4678 func_append install_prog " $func_quote_for_eval_result"
4679 if test -n "$arg2"; then
4680 func_quote_for_eval "$arg2"
4681 fi
4682 func_append install_shared_prog " $func_quote_for_eval_result"
4683 done
4684
4685 test -z "$install_prog" && \
4686 func_fatal_help "you must specify an install program"
4687
4688 test -n "$prev" && \
4689 func_fatal_help "the '$prev' option requires an argument"
4690
4691 if test -n "$install_override_mode" && $no_mode; then
4692 if $install_cp; then :; else
4693 func_quote_for_eval "$install_override_mode"
4694 func_append install_shared_prog " -m $func_quote_for_eval_result"
4695 fi
4696 fi
4697
4698 if test -z "$files"; then
4699 if test -z "$dest"; then
4700 func_fatal_help "no file or destination specified"
4701 else
4702 func_fatal_help "you must specify a destination"
4703 fi
4704 fi
4705
4706 # Strip any trailing slash from the destination.
4707 func_stripname '' '/' "$dest"
4708 dest=$func_stripname_result
4709
4710 # Check to see that the destination is a directory.
4711 test -d "$dest" && isdir=:
4712 if $isdir; then
4713 destdir=$dest
4714 destname=
4715 else
4716 func_dirname_and_basename "$dest" "" "."
4717 destdir=$func_dirname_result
4718 destname=$func_basename_result
4719
4720 # Not a directory, so check to see that there is only one file specified.
4721 set dummy $files; shift
4722 test "$#" -gt 1 && \
4723 func_fatal_help "'$dest' is not a directory"
4724 fi
4725 case $destdir in
4726 [\\/]* | [A-Za-z]:[\\/]*) ;;
4727 *)
4728 for file in $files; do
4729 case $file in
4730 *.lo) ;;
4731 *)
4732 func_fatal_help "'$destdir' must be an absolute directory name"
4733 ;;
4734 esac
4735 done
4736 ;;
4737 esac
4738
4739 # This variable tells wrapper scripts just to set variables rather
4740 # than running their programs.
4741 libtool_install_magic=$magic
4742
4743 staticlibs=
4744 future_libdirs=
4745 current_libdirs=
4746 for file in $files; do
4747
4748 # Do each installation.
4749 case $file in
4750 *.$libext)
4751 # Do the static libraries later.
4752 func_append staticlibs " $file"
4753 ;;
4754
4755 *.la)
4756 func_resolve_sysroot "$file"
4757 file=$func_resolve_sysroot_result
4758
4759 # Check to see that this really is a libtool archive.
4760 func_lalib_unsafe_p "$file" \
4761 || func_fatal_help "'$file' is not a valid libtool archive"
4762
4763 library_names=
4764 old_library=
4765 relink_command=
4766 func_source "$file"
4767
4768 # Add the libdir to current_libdirs if it is the destination.
4769 if test "X$destdir" = "X$libdir"; then
4770 case "$current_libdirs " in
4771 *" $libdir "*) ;;
4772 *) func_append current_libdirs " $libdir" ;;
4773 esac
4774 else
4775 # Note the libdir as a future libdir.
4776 case "$future_libdirs " in
4777 *" $libdir "*) ;;
4778 *) func_append future_libdirs " $libdir" ;;
4779 esac
4780 fi
4781
4782 func_dirname "$file" "/" ""
4783 dir=$func_dirname_result
4784 func_append dir "$objdir"
4785
4786 if test -n "$relink_command"; then
4787 # Determine the prefix the user has applied to our future dir.
4788 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4789
4790 # Don't allow the user to place us outside of our expected
4791 # location b/c this prevents finding dependent libraries that
4792 # are installed to the same prefix.
4793 # At present, this check doesn't affect windows .dll's that
4794 # are installed into $libdir/../bin (currently, that works fine)
4795 # but it's something to keep an eye on.
4796 test "$inst_prefix_dir" = "$destdir" && \
4797 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4798
4799 if test -n "$inst_prefix_dir"; then
4800 # Stick the inst_prefix_dir data into the link command.
4801 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4802 else
4803 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4804 fi
4805
4806 func_warning "relinking '$file'"
4807 func_show_eval "$relink_command" \
4808 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4809 fi
4810
4811 # See the names of the shared library.
4812 set dummy $library_names; shift
4813 if test -n "$1"; then
4814 realname=$1
4815 shift
4816
4817 srcname=$realname
4818 test -n "$relink_command" && srcname=${realname}T
4819
4820 # Install the shared library and build the symlinks.
4821 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4822 'exit $?'
4823 tstripme=$stripme
4824 case $host_os in
4825 cygwin* | mingw* | pw32* | cegcc*)
4826 case $realname in
4827 *.dll.a)
4828 tstripme=
4829 ;;
4830 esac
4831 ;;
4832 os2*)
4833 case $realname in
4834 *_dll.a)
4835 tstripme=
4836 ;;
4837 esac
4838 ;;
4839 esac
4840 if test -n "$tstripme" && test -n "$striplib"; then
4841 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4842 fi
4843
4844 if test "$#" -gt 0; then
4845 # Delete the old symlinks, and create new ones.
4846 # Try 'ln -sf' first, because the 'ln' binary might depend on
4847 # the symlink we replace! Solaris /bin/ln does not understand -f,
4848 # so we also need to try rm && ln -s.
4849 for linkname
4850 do
4851 test "$linkname" != "$realname" \
4852 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4853 done
4854 fi
4855
4856 # Do each command in the postinstall commands.
4857 lib=$destdir/$realname
4858 func_execute_cmds "$postinstall_cmds" 'exit $?'
4859 fi
4860
4861 # Install the pseudo-library for information purposes.
4862 func_basename "$file"
4863 name=$func_basename_result
4864 instname=$dir/${name}i
4865 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4866
4867 # Maybe install the static library, too.
4868 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4869 ;;
4870
4871 *.lo)
4872 # Install (i.e. copy) a libtool object.
4873
4874 # Figure out destination file name, if it wasn't already specified.
4875 if test -n "$destname"; then
4876 destfile=$destdir/$destname
4877 else
4878 func_basename "$file"
4879 destfile=$func_basename_result
4880 destfile=$destdir/$destfile
4881 fi
4882
4883 # Deduce the name of the destination old-style object file.
4884 case $destfile in
4885 *.lo)
4886 func_lo2o "$destfile"
4887 staticdest=$func_lo2o_result
4888 ;;
4889 *.$objext)
4890 staticdest=$destfile
4891 destfile=
4892 ;;
4893 *)
4894 func_fatal_help "cannot copy a libtool object to '$destfile'"
4895 ;;
4896 esac
4897
4898 # Install the libtool object if requested.
4899 test -n "$destfile" && \
4900 func_show_eval "$install_prog $file $destfile" 'exit $?'
4901
4902 # Install the old object if enabled.
4903 if test yes = "$build_old_libs"; then
4904 # Deduce the name of the old-style object file.
4905 func_lo2o "$file"
4906 staticobj=$func_lo2o_result
4907 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4908 fi
4909 exit $EXIT_SUCCESS
4910 ;;
4911
4912 *)
4913 # Figure out destination file name, if it wasn't already specified.
4914 if test -n "$destname"; then
4915 destfile=$destdir/$destname
4916 else
4917 func_basename "$file"
4918 destfile=$func_basename_result
4919 destfile=$destdir/$destfile
4920 fi
4921
4922 # If the file is missing, and there is a .exe on the end, strip it
4923 # because it is most likely a libtool script we actually want to
4924 # install
4925 stripped_ext=
4926 case $file in
4927 *.exe)
4928 if test ! -f "$file"; then
4929 func_stripname '' '.exe' "$file"
4930 file=$func_stripname_result
4931 stripped_ext=.exe
4932 fi
4933 ;;
4934 esac
4935
4936 # Do a test to see if this is really a libtool program.
4937 case $host in
4938 *cygwin* | *mingw*)
4939 if func_ltwrapper_executable_p "$file"; then
4940 func_ltwrapper_scriptname "$file"
4941 wrapper=$func_ltwrapper_scriptname_result
4942 else
4943 func_stripname '' '.exe' "$file"
4944 wrapper=$func_stripname_result
4945 fi
4946 ;;
4947 *)
4948 wrapper=$file
4949 ;;
4950 esac
4951 if func_ltwrapper_script_p "$wrapper"; then
4952 notinst_deplibs=
4953 relink_command=
4954
4955 func_source "$wrapper"
4956
4957 # Check the variables that should have been set.
4958 test -z "$generated_by_libtool_version" && \
4959 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4960
4961 finalize=:
4962 for lib in $notinst_deplibs; do
4963 # Check to see that each library is installed.
4964 libdir=
4965 if test -f "$lib"; then
4966 func_source "$lib"
4967 fi
4968 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4969 if test -n "$libdir" && test ! -f "$libfile"; then
4970 func_warning "'$lib' has not been installed in '$libdir'"
4971 finalize=false
4972 fi
4973 done
4974
4975 relink_command=
4976 func_source "$wrapper"
4977
4978 outputname=
4979 if test no = "$fast_install" && test -n "$relink_command"; then
4980 $opt_dry_run || {
4981 if $finalize; then
4982 tmpdir=`func_mktempdir`
4983 func_basename "$file$stripped_ext"
4984 file=$func_basename_result
4985 outputname=$tmpdir/$file
4986 # Replace the output file specification.
4987 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4988
4989 $opt_quiet || {
4990 func_quote_for_expand "$relink_command"
4991 eval "func_echo $func_quote_for_expand_result"
4992 }
4993 if eval "$relink_command"; then :
4994 else
4995 func_error "error: relink '$file' with the above command before installing it"
4996 $opt_dry_run || ${RM}r "$tmpdir"
4997 continue
4998 fi
4999 file=$outputname
5000 else
5001 func_warning "cannot relink '$file'"
5002 fi
5003 }
5004 else
5005 # Install the binary that we compiled earlier.
5006 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
5007 fi
5008 fi
5009
5010 # remove .exe since cygwin /usr/bin/install will append another
5011 # one anyway
5012 case $install_prog,$host in
5013 */usr/bin/install*,*cygwin*)
5014 case $file:$destfile in
5015 *.exe:*.exe)
5016 # this is ok
5017 ;;
5018 *.exe:*)
5019 destfile=$destfile.exe
5020 ;;
5021 *:*.exe)
5022 func_stripname '' '.exe' "$destfile"
5023 destfile=$func_stripname_result
5024 ;;
5025 esac
5026 ;;
5027 esac
5028 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5029 $opt_dry_run || if test -n "$outputname"; then
5030 ${RM}r "$tmpdir"
5031 fi
5032 ;;
5033 esac
5034 done
5035
5036 for file in $staticlibs; do
5037 func_basename "$file"
5038 name=$func_basename_result
5039
5040 # Set up the ranlib parameters.
5041 oldlib=$destdir/$name
5042 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5043 tool_oldlib=$func_to_tool_file_result
5044
5045 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5046
5047 if test -n "$stripme" && test -n "$old_striplib"; then
5048 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5049 fi
5050
5051 # Do each command in the postinstall commands.
5052 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5053 done
5054
5055 test -n "$future_libdirs" && \
5056 func_warning "remember to run '$progname --finish$future_libdirs'"
5057
5058 if test -n "$current_libdirs"; then
5059 # Maybe just do a dry run.
5060 $opt_dry_run && current_libdirs=" -n$current_libdirs"
5061 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5062 else
5063 exit $EXIT_SUCCESS
5064 fi
5065}
5066
5067test install = "$opt_mode" && func_mode_install ${1+"$@"}
5068
5069
5070# func_generate_dlsyms outputname originator pic_p
5071# Extract symbols from dlprefiles and create ${outputname}S.o with
5072# a dlpreopen symbol table.
5073func_generate_dlsyms ()
5074{
5075 $debug_cmd
5076
5077 my_outputname=$1
5078 my_originator=$2
5079 my_pic_p=${3-false}
5080 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5081 my_dlsyms=
5082
5083 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5084 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5085 my_dlsyms=${my_outputname}S.c
5086 else
5087 func_error "not configured to extract global symbols from dlpreopened files"
5088 fi
5089 fi
5090
5091 if test -n "$my_dlsyms"; then
5092 case $my_dlsyms in
5093 "") ;;
5094 *.c)
5095 # Discover the nlist of each of the dlfiles.
5096 nlist=$output_objdir/$my_outputname.nm
5097
5098 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5099
5100 # Parse the name list into a source file.
5101 func_verbose "creating $output_objdir/$my_dlsyms"
5102
5103 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5104/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5105/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5106
5107#ifdef __cplusplus
5108extern \"C\" {
5109#endif
5110
5111#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5112#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5113#endif
5114
5115/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5116#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5117/* DATA imports from DLLs on WIN32 can't be const, because runtime
5118 relocations are performed -- see ld's documentation on pseudo-relocs. */
5119# define LT_DLSYM_CONST
5120#elif defined __osf__
5121/* This system does not cope well with relocations in const data. */
5122# define LT_DLSYM_CONST
5123#else
5124# define LT_DLSYM_CONST const
5125#endif
5126
5127#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5128
5129/* External symbol declarations for the compiler. */\
5130"
5131
5132 if test yes = "$dlself"; then
5133 func_verbose "generating symbol list for '$output'"
5134
5135 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5136
5137 # Add our own program objects to the symbol list.
5138 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5139 for progfile in $progfiles; do
5140 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5141 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5142 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5143 done
5144
5145 if test -n "$exclude_expsyms"; then
5146 $opt_dry_run || {
5147 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5148 eval '$MV "$nlist"T "$nlist"'
5149 }
5150 fi
5151
5152 if test -n "$export_symbols_regex"; then
5153 $opt_dry_run || {
5154 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5155 eval '$MV "$nlist"T "$nlist"'
5156 }
5157 fi
5158
5159 # Prepare the list of exported symbols
5160 if test -z "$export_symbols"; then
5161 export_symbols=$output_objdir/$outputname.exp
5162 $opt_dry_run || {
5163 $RM $export_symbols
5164 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5165 case $host in
5166 *cygwin* | *mingw* | *cegcc* )
5167 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5168 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5169 ;;
5170 esac
5171 }
5172 else
5173 $opt_dry_run || {
5174 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5175 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5176 eval '$MV "$nlist"T "$nlist"'
5177 case $host in
5178 *cygwin* | *mingw* | *cegcc* )
5179 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5180 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5181 ;;
5182 esac
5183 }
5184 fi
5185 fi
5186
5187 for dlprefile in $dlprefiles; do
5188 func_verbose "extracting global C symbols from '$dlprefile'"
5189 func_basename "$dlprefile"
5190 name=$func_basename_result
5191 case $host in
5192 *cygwin* | *mingw* | *cegcc* )
5193 # if an import library, we need to obtain dlname
5194 if func_win32_import_lib_p "$dlprefile"; then
5195 func_tr_sh "$dlprefile"
5196 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5197 dlprefile_dlbasename=
5198 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5199 # Use subshell, to avoid clobbering current variable values
5200 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5201 if test -n "$dlprefile_dlname"; then
5202 func_basename "$dlprefile_dlname"
5203 dlprefile_dlbasename=$func_basename_result
5204 else
5205 # no lafile. user explicitly requested -dlpreopen <import library>.
5206 $sharedlib_from_linklib_cmd "$dlprefile"
5207 dlprefile_dlbasename=$sharedlib_from_linklib_result
5208 fi
5209 fi
5210 $opt_dry_run || {
5211 if test -n "$dlprefile_dlbasename"; then
5212 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5213 else
5214 func_warning "Could not compute DLL name from $name"
5215 eval '$ECHO ": $name " >> "$nlist"'
5216 fi
5217 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5218 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5219 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5220 }
5221 else # not an import lib
5222 $opt_dry_run || {
5223 eval '$ECHO ": $name " >> "$nlist"'
5224 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5225 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5226 }
5227 fi
5228 ;;
5229 *)
5230 $opt_dry_run || {
5231 eval '$ECHO ": $name " >> "$nlist"'
5232 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5233 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5234 }
5235 ;;
5236 esac
5237 done
5238
5239 $opt_dry_run || {
5240 # Make sure we have at least an empty file.
5241 test -f "$nlist" || : > "$nlist"
5242
5243 if test -n "$exclude_expsyms"; then
5244 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5245 $MV "$nlist"T "$nlist"
5246 fi
5247
5248 # Try sorting and uniquifying the output.
5249 if $GREP -v "^: " < "$nlist" |
5250 if sort -k 3 </dev/null >/dev/null 2>&1; then
5251 sort -k 3
5252 else
5253 sort +2
5254 fi |
5255 uniq > "$nlist"S; then
5256 :
5257 else
5258 $GREP -v "^: " < "$nlist" > "$nlist"S
5259 fi
5260
5261 if test -f "$nlist"S; then
5262 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5263 else
5264 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5265 fi
5266
5267 func_show_eval '$RM "${nlist}I"'
5268 if test -n "$global_symbol_to_import"; then
5269 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5270 fi
5271
5272 echo >> "$output_objdir/$my_dlsyms" "\
5273
5274/* The mapping between symbol names and symbols. */
5275typedef struct {
5276 const char *name;
5277 void *address;
5278} lt_dlsymlist;
5279extern LT_DLSYM_CONST lt_dlsymlist
5280lt_${my_prefix}_LTX_preloaded_symbols[];\
5281"
5282
5283 if test -s "$nlist"I; then
5284 echo >> "$output_objdir/$my_dlsyms" "\
5285static void lt_syminit(void)
5286{
5287 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5288 for (; symbol->name; ++symbol)
5289 {"
5290 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5291 echo >> "$output_objdir/$my_dlsyms" "\
5292 }
5293}"
5294 fi
5295 echo >> "$output_objdir/$my_dlsyms" "\
5296LT_DLSYM_CONST lt_dlsymlist
5297lt_${my_prefix}_LTX_preloaded_symbols[] =
5298{ {\"$my_originator\", (void *) 0},"
5299
5300 if test -s "$nlist"I; then
5301 echo >> "$output_objdir/$my_dlsyms" "\
5302 {\"@INIT@\", (void *) <_syminit},"
5303 fi
5304
5305 case $need_lib_prefix in
5306 no)
5307 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5308 ;;
5309 *)
5310 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5311 ;;
5312 esac
5313 echo >> "$output_objdir/$my_dlsyms" "\
5314 {0, (void *) 0}
5315};
5316
5317/* This works around a problem in FreeBSD linker */
5318#ifdef FREEBSD_WORKAROUND
5319static const void *lt_preloaded_setup() {
5320 return lt_${my_prefix}_LTX_preloaded_symbols;
5321}
5322#endif
5323
5324#ifdef __cplusplus
5325}
5326#endif\
5327"
5328 } # !$opt_dry_run
5329
5330 pic_flag_for_symtable=
5331 case "$compile_command " in
5332 *" -static "*) ;;
5333 *)
5334 case $host in
5335 # compiling the symbol table file with pic_flag works around
5336 # a FreeBSD bug that causes programs to crash when -lm is
5337 # linked before any other PIC object. But we must not use
5338 # pic_flag when linking with -static. The problem exists in
5339 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5340 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5341 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5342 *-*-hpux*)
5343 pic_flag_for_symtable=" $pic_flag" ;;
5344 *)
5345 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5346 ;;
5347 esac
5348 ;;
5349 esac
5350 symtab_cflags=
5351 for arg in $LTCFLAGS; do
5352 case $arg in
5353 -pie | -fpie | -fPIE) ;;
5354 *) func_append symtab_cflags " $arg" ;;
5355 esac
5356 done
5357
5358 # Now compile the dynamic symbol file.
5359 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5360
5361 # Clean up the generated files.
5362 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5363
5364 # Transform the symbol file into the correct name.
5365 symfileobj=$output_objdir/${my_outputname}S.$objext
5366 case $host in
5367 *cygwin* | *mingw* | *cegcc* )
5368 if test -f "$output_objdir/$my_outputname.def"; then
5369 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5370 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5371 else
5372 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5373 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5374 fi
5375 ;;
5376 *)
5377 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5378 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5379 ;;
5380 esac
5381 ;;
5382 *)
5383 func_fatal_error "unknown suffix for '$my_dlsyms'"
5384 ;;
5385 esac
5386 else
5387 # We keep going just in case the user didn't refer to
5388 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5389 # really was required.
5390
5391 # Nullify the symbol file.
5392 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5393 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5394 fi
5395}
5396
5397# func_cygming_gnu_implib_p ARG
5398# This predicate returns with zero status (TRUE) if
5399# ARG is a GNU/binutils-style import library. Returns
5400# with nonzero status (FALSE) otherwise.
5401func_cygming_gnu_implib_p ()
5402{
5403 $debug_cmd
5404
5405 func_to_tool_file "$1" func_convert_file_msys_to_w32
5406 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
5407 test -n "$func_cygming_gnu_implib_tmp"
5408}
5409
5410# func_cygming_ms_implib_p ARG
5411# This predicate returns with zero status (TRUE) if
5412# ARG is an MS-style import library. Returns
5413# with nonzero status (FALSE) otherwise.
5414func_cygming_ms_implib_p ()
5415{
5416 $debug_cmd
5417
5418 func_to_tool_file "$1" func_convert_file_msys_to_w32
5419 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5420 test -n "$func_cygming_ms_implib_tmp"
5421}
5422
5423# func_win32_libid arg
5424# return the library type of file 'arg'
5425#
5426# Need a lot of goo to handle *both* DLLs and import libs
5427# Has to be a shell function in order to 'eat' the argument
5428# that is supplied when $file_magic_command is called.
5429# Despite the name, also deal with 64 bit binaries.
5430func_win32_libid ()
5431{
5432 $debug_cmd
5433
5434 win32_libid_type=unknown
5435 win32_fileres=`file -L $1 2>/dev/null`
5436 case $win32_fileres in
5437 *ar\ archive\ import\ library*) # definitely import
5438 win32_libid_type="x86 archive import"
5439 ;;
5440 *ar\ archive*) # could be an import, or static
5441 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5442 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5443 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5444 case $nm_interface in
5445 "MS dumpbin")
5446 if func_cygming_ms_implib_p "$1" ||
5447 func_cygming_gnu_implib_p "$1"
5448 then
5449 win32_nmres=import
5450 else
5451 win32_nmres=
5452 fi
5453 ;;
5454 *)
5455 func_to_tool_file "$1" func_convert_file_msys_to_w32
5456 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5457 $SED -n -e '
5458 1,100{
5459 / I /{
5460 s|.*|import|
5461 p
5462 q
5463 }
5464 }'`
5465 ;;
5466 esac
5467 case $win32_nmres in
5468 import*) win32_libid_type="x86 archive import";;
5469 *) win32_libid_type="x86 archive static";;
5470 esac
5471 fi
5472 ;;
5473 *DLL*)
5474 win32_libid_type="x86 DLL"
5475 ;;
5476 *executable*) # but shell scripts are "executable" too...
5477 case $win32_fileres in
5478 *MS\ Windows\ PE\ Intel*)
5479 win32_libid_type="x86 DLL"
5480 ;;
5481 esac
5482 ;;
5483 esac
5484 $ECHO "$win32_libid_type"
5485}
5486
5487# func_cygming_dll_for_implib ARG
5488#
5489# Platform-specific function to extract the
5490# name of the DLL associated with the specified
5491# import library ARG.
5492# Invoked by eval'ing the libtool variable
5493# $sharedlib_from_linklib_cmd
5494# Result is available in the variable
5495# $sharedlib_from_linklib_result
5496func_cygming_dll_for_implib ()
5497{
5498 $debug_cmd
5499
5500 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5501}
5502
5503# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5504#
5505# The is the core of a fallback implementation of a
5506# platform-specific function to extract the name of the
5507# DLL associated with the specified import library LIBNAME.
5508#
5509# SECTION_NAME is either .idata$6 or .idata$7, depending
5510# on the platform and compiler that created the implib.
5511#
5512# Echos the name of the DLL associated with the
5513# specified import library.
5514func_cygming_dll_for_implib_fallback_core ()
5515{
5516 $debug_cmd
5517
5518 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5519 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5520 $SED '/^Contents of section '"$match_literal"':/{
5521 # Place marker at beginning of archive member dllname section
5522 s/.*/====MARK====/
5523 p
5524 d
5525 }
5526 # These lines can sometimes be longer than 43 characters, but
5527 # are always uninteresting
5528 /:[ ]*file format pe[i]\{,1\}-/d
5529 /^In archive [^:]*:/d
5530 # Ensure marker is printed
5531 /^====MARK====/p
5532 # Remove all lines with less than 43 characters
5533 /^.\{43\}/!d
5534 # From remaining lines, remove first 43 characters
5535 s/^.\{43\}//' |
5536 $SED -n '
5537 # Join marker and all lines until next marker into a single line
5538 /^====MARK====/ b para
5539 H
5540 $ b para
5541 b
5542 :para
5543 x
5544 s/\n//g
5545 # Remove the marker
5546 s/^====MARK====//
5547 # Remove trailing dots and whitespace
5548 s/[\. \t]*$//
5549 # Print
5550 /./p' |
5551 # we now have a list, one entry per line, of the stringified
5552 # contents of the appropriate section of all members of the
5553 # archive that possess that section. Heuristic: eliminate
5554 # all those that have a first or second character that is
5555 # a '.' (that is, objdump's representation of an unprintable
5556 # character.) This should work for all archives with less than
5557 # 0x302f exports -- but will fail for DLLs whose name actually
5558 # begins with a literal '.' or a single character followed by
5559 # a '.'.
5560 #
5561 # Of those that remain, print the first one.
5562 $SED -e '/^\./d;/^.\./d;q'
5563}
5564
5565# func_cygming_dll_for_implib_fallback ARG
5566# Platform-specific function to extract the
5567# name of the DLL associated with the specified
5568# import library ARG.
5569#
5570# This fallback implementation is for use when $DLLTOOL
5571# does not support the --identify-strict option.
5572# Invoked by eval'ing the libtool variable
5573# $sharedlib_from_linklib_cmd
5574# Result is available in the variable
5575# $sharedlib_from_linklib_result
5576func_cygming_dll_for_implib_fallback ()
5577{
5578 $debug_cmd
5579
5580 if func_cygming_gnu_implib_p "$1"; then
5581 # binutils import library
5582 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5583 elif func_cygming_ms_implib_p "$1"; then
5584 # ms-generated import library
5585 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5586 else
5587 # unknown
5588 sharedlib_from_linklib_result=
5589 fi
5590}
5591
5592
5593# func_extract_an_archive dir oldlib
5594func_extract_an_archive ()
5595{
5596 $debug_cmd
5597
5598 f_ex_an_ar_dir=$1; shift
5599 f_ex_an_ar_oldlib=$1
5600 if test yes = "$lock_old_archive_extraction"; then
5601 lockfile=$f_ex_an_ar_oldlib.lock
5602 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5603 func_echo "Waiting for $lockfile to be removed"
5604 sleep 2
5605 done
5606 fi
5607 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5608 'stat=$?; rm -f "$lockfile"; exit $stat'
5609 if test yes = "$lock_old_archive_extraction"; then
5610 $opt_dry_run || rm -f "$lockfile"
5611 fi
5612 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5613 :
5614 else
5615 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5616 fi
5617}
5618
5619
5620# func_extract_archives gentop oldlib ...
5621func_extract_archives ()
5622{
5623 $debug_cmd
5624
5625 my_gentop=$1; shift
5626 my_oldlibs=${1+"$@"}
5627 my_oldobjs=
5628 my_xlib=
5629 my_xabs=
5630 my_xdir=
5631
5632 for my_xlib in $my_oldlibs; do
5633 # Extract the objects.
5634 case $my_xlib in
5635 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5636 *) my_xabs=`pwd`"/$my_xlib" ;;
5637 esac
5638 func_basename "$my_xlib"
5639 my_xlib=$func_basename_result
5640 my_xlib_u=$my_xlib
5641 while :; do
5642 case " $extracted_archives " in
5643 *" $my_xlib_u "*)
5644 func_arith $extracted_serial + 1
5645 extracted_serial=$func_arith_result
5646 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5647 *) break ;;
5648 esac
5649 done
5650 extracted_archives="$extracted_archives $my_xlib_u"
5651 my_xdir=$my_gentop/$my_xlib_u
5652
5653 func_mkdir_p "$my_xdir"
5654
5655 case $host in
5656 *-darwin*)
5657 func_verbose "Extracting $my_xabs"
5658 # Do not bother doing anything if just a dry run
5659 $opt_dry_run || {
5660 darwin_orig_dir=`pwd`
5661 cd $my_xdir || exit $?
5662 darwin_archive=$my_xabs
5663 darwin_curdir=`pwd`
5664 func_basename "$darwin_archive"
5665 darwin_base_archive=$func_basename_result
5666 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5667 if test -n "$darwin_arches"; then
5668 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5669 darwin_arch=
5670 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5671 for darwin_arch in $darwin_arches; do
5672 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5673 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5674 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5675 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5676 cd "$darwin_curdir"
5677 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5678 done # $darwin_arches
5679 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5680 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5681 darwin_file=
5682 darwin_files=
5683 for darwin_file in $darwin_filelist; do
5684 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5685 $LIPO -create -output "$darwin_file" $darwin_files
5686 done # $darwin_filelist
5687 $RM -rf unfat-$$
5688 cd "$darwin_orig_dir"
5689 else
5690 cd $darwin_orig_dir
5691 func_extract_an_archive "$my_xdir" "$my_xabs"
5692 fi # $darwin_arches
5693 } # !$opt_dry_run
5694 ;;
5695 *)
5696 func_extract_an_archive "$my_xdir" "$my_xabs"
5697 ;;
5698 esac
5699 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5700 done
5701
5702 func_extract_archives_result=$my_oldobjs
5703}
5704
5705
5706# func_emit_wrapper [arg=no]
5707#
5708# Emit a libtool wrapper script on stdout.
5709# Don't directly open a file because we may want to
5710# incorporate the script contents within a cygwin/mingw
5711# wrapper executable. Must ONLY be called from within
5712# func_mode_link because it depends on a number of variables
5713# set therein.
5714#
5715# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5716# variable will take. If 'yes', then the emitted script
5717# will assume that the directory where it is stored is
5718# the $objdir directory. This is a cygwin/mingw-specific
5719# behavior.
5720func_emit_wrapper ()
5721{
5722 func_emit_wrapper_arg1=${1-no}
5723
5724 $ECHO "\
5725#! $SHELL
5726
5727# $output - temporary wrapper script for $objdir/$outputname
5728# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5729#
5730# The $output program cannot be directly executed until all the libtool
5731# libraries that it depends on are installed.
5732#
5733# This wrapper script should never be moved out of the build directory.
5734# If it is, it will not operate correctly.
5735
5736# Sed substitution that helps us do robust quoting. It backslashifies
5737# metacharacters that are still active within double-quoted strings.
5738sed_quote_subst='$sed_quote_subst'
5739
5740# Be Bourne compatible
5741if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5742 emulate sh
5743 NULLCMD=:
5744 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5745 # is contrary to our usage. Disable this feature.
5746 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5747 setopt NO_GLOB_SUBST
5748else
5749 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5750fi
5751BIN_SH=xpg4; export BIN_SH # for Tru64
5752DUALCASE=1; export DUALCASE # for MKS sh
5753
5754# The HP-UX ksh and POSIX shell print the target directory to stdout
5755# if CDPATH is set.
5756(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5757
5758relink_command=\"$relink_command\"
5759
5760# This environment variable determines our operation mode.
5761if test \"\$libtool_install_magic\" = \"$magic\"; then
5762 # install mode needs the following variables:
5763 generated_by_libtool_version='$macro_version'
5764 notinst_deplibs='$notinst_deplibs'
5765else
5766 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5767 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5768 file=\"\$0\""
5769
5770 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5771 $ECHO "\
5772
5773# A function that is used when there is no print builtin or printf.
5774func_fallback_echo ()
5775{
5776 eval 'cat <<_LTECHO_EOF
5777\$1
5778_LTECHO_EOF'
5779}
5780 ECHO=\"$qECHO\"
5781 fi
5782
5783# Very basic option parsing. These options are (a) specific to
5784# the libtool wrapper, (b) are identical between the wrapper
5785# /script/ and the wrapper /executable/ that is used only on
5786# windows platforms, and (c) all begin with the string "--lt-"
5787# (application programs are unlikely to have options that match
5788# this pattern).
5789#
5790# There are only two supported options: --lt-debug and
5791# --lt-dump-script. There is, deliberately, no --lt-help.
5792#
5793# The first argument to this parsing function should be the
5794# script's $0 value, followed by "$@".
5795lt_option_debug=
5796func_parse_lt_options ()
5797{
5798 lt_script_arg0=\$0
5799 shift
5800 for lt_opt
5801 do
5802 case \"\$lt_opt\" in
5803 --lt-debug) lt_option_debug=1 ;;
5804 --lt-dump-script)
5805 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5806 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5807 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5808 cat \"\$lt_dump_D/\$lt_dump_F\"
5809 exit 0
5810 ;;
5811 --lt-*)
5812 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5813 exit 1
5814 ;;
5815 esac
5816 done
5817
5818 # Print the debug banner immediately:
5819 if test -n \"\$lt_option_debug\"; then
5820 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5821 fi
5822}
5823
5824# Used when --lt-debug. Prints its arguments to stdout
5825# (redirection is the responsibility of the caller)
5826func_lt_dump_args ()
5827{
5828 lt_dump_args_N=1;
5829 for lt_arg
5830 do
5831 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5832 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5833 done
5834}
5835
5836# Core function for launching the target application
5837func_exec_program_core ()
5838{
5839"
5840 case $host in
5841 # Backslashes separate directories on plain windows
5842 *-*-mingw | *-*-os2* | *-cegcc*)
5843 $ECHO "\
5844 if test -n \"\$lt_option_debug\"; then
5845 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5846 func_lt_dump_args \${1+\"\$@\"} 1>&2
5847 fi
5848 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5849"
5850 ;;
5851
5852 *)
5853 $ECHO "\
5854 if test -n \"\$lt_option_debug\"; then
5855 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5856 func_lt_dump_args \${1+\"\$@\"} 1>&2
5857 fi
5858 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5859"
5860 ;;
5861 esac
5862 $ECHO "\
5863 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5864 exit 1
5865}
5866
5867# A function to encapsulate launching the target application
5868# Strips options in the --lt-* namespace from \$@ and
5869# launches target application with the remaining arguments.
5870func_exec_program ()
5871{
5872 case \" \$* \" in
5873 *\\ --lt-*)
5874 for lt_wr_arg
5875 do
5876 case \$lt_wr_arg in
5877 --lt-*) ;;
5878 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5879 esac
5880 shift
5881 done ;;
5882 esac
5883 func_exec_program_core \${1+\"\$@\"}
5884}
5885
5886 # Parse options
5887 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5888
5889 # Find the directory that this script lives in.
5890 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5891 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5892
5893 # Follow symbolic links until we get to the real thisdir.
5894 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5895 while test -n \"\$file\"; do
5896 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5897
5898 # If there was a directory component, then change thisdir.
5899 if test \"x\$destdir\" != \"x\$file\"; then
5900 case \"\$destdir\" in
5901 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5902 *) thisdir=\"\$thisdir/\$destdir\" ;;
5903 esac
5904 fi
5905
5906 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5907 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5908 done
5909
5910 # Usually 'no', except on cygwin/mingw when embedded into
5911 # the cwrapper.
5912 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5913 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5914 # special case for '.'
5915 if test \"\$thisdir\" = \".\"; then
5916 thisdir=\`pwd\`
5917 fi
5918 # remove .libs from thisdir
5919 case \"\$thisdir\" in
5920 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5921 $objdir ) thisdir=. ;;
5922 esac
5923 fi
5924
5925 # Try to get the absolute directory name.
5926 absdir=\`cd \"\$thisdir\" && pwd\`
5927 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5928"
5929
5930 if test yes = "$fast_install"; then
5931 $ECHO "\
5932 program=lt-'$outputname'$exeext
5933 progdir=\"\$thisdir/$objdir\"
5934
5935 if test ! -f \"\$progdir/\$program\" ||
5936 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5937 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5938
5939 file=\"\$\$-\$program\"
5940
5941 if test ! -d \"\$progdir\"; then
5942 $MKDIR \"\$progdir\"
5943 else
5944 $RM \"\$progdir/\$file\"
5945 fi"
5946
5947 $ECHO "\
5948
5949 # relink executable if necessary
5950 if test -n \"\$relink_command\"; then
5951 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5952 else
5953 \$ECHO \"\$relink_command_output\" >&2
5954 $RM \"\$progdir/\$file\"
5955 exit 1
5956 fi
5957 fi
5958
5959 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5960 { $RM \"\$progdir/\$program\";
5961 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5962 $RM \"\$progdir/\$file\"
5963 fi"
5964 else
5965 $ECHO "\
5966 program='$outputname'
5967 progdir=\"\$thisdir/$objdir\"
5968"
5969 fi
5970
5971 $ECHO "\
5972
5973 if test -f \"\$progdir/\$program\"; then"
5974
5975 # fixup the dll searchpath if we need to.
5976 #
5977 # Fix the DLL searchpath if we need to. Do this before prepending
5978 # to shlibpath, because on Windows, both are PATH and uninstalled
5979 # libraries must come first.
5980 if test -n "$dllsearchpath"; then
5981 $ECHO "\
5982 # Add the dll search path components to the executable PATH
5983 PATH=$dllsearchpath:\$PATH
5984"
5985 fi
5986
5987 # Export our shlibpath_var if we have one.
5988 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5989 $ECHO "\
5990 # Add our own library path to $shlibpath_var
5991 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5992
5993 # Some systems cannot cope with colon-terminated $shlibpath_var
5994 # The second colon is a workaround for a bug in BeOS R4 sed
5995 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5996
5997 export $shlibpath_var
5998"
5999 fi
6000
6001 $ECHO "\
6002 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6003 # Run the actual program with our arguments.
6004 func_exec_program \${1+\"\$@\"}
6005 fi
6006 else
6007 # The program doesn't exist.
6008 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
6009 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6010 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6011 exit 1
6012 fi
6013fi\
6014"
6015}
6016
6017
6018# func_emit_cwrapperexe_src
6019# emit the source code for a wrapper executable on stdout
6020# Must ONLY be called from within func_mode_link because
6021# it depends on a number of variable set therein.
6022func_emit_cwrapperexe_src ()
6023{
6024 cat <<EOF
6025
6026/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6027 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6028
6029 The $output program cannot be directly executed until all the libtool
6030 libraries that it depends on are installed.
6031
6032 This wrapper executable should never be moved out of the build directory.
6033 If it is, it will not operate correctly.
6034*/
6035EOF
6036 cat <<"EOF"
6037#ifdef _MSC_VER
6038# define _CRT_SECURE_NO_DEPRECATE 1
6039#endif
6040#include <stdio.h>
6041#include <stdlib.h>
6042#ifdef _MSC_VER
6043# include <direct.h>
6044# include <process.h>
6045# include <io.h>
6046#else
6047# include <unistd.h>
6048# include <stdint.h>
6049# ifdef __CYGWIN__
6050# include <io.h>
6051# endif
6052#endif
6053#include <malloc.h>
6054#include <stdarg.h>
6055#include <assert.h>
6056#include <string.h>
6057#include <ctype.h>
6058#include <errno.h>
6059#include <fcntl.h>
6060#include <sys/stat.h>
6061
6062#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6063
6064/* declarations of non-ANSI functions */
6065#if defined __MINGW32__
6066# ifdef __STRICT_ANSI__
6067int _putenv (const char *);
6068# endif
6069#elif defined __CYGWIN__
6070# ifdef __STRICT_ANSI__
6071char *realpath (const char *, char *);
6072int putenv (char *);
6073int setenv (const char *, const char *, int);
6074# endif
6075/* #elif defined other_platform || defined ... */
6076#endif
6077
6078/* portability defines, excluding path handling macros */
6079#if defined _MSC_VER
6080# define setmode _setmode
6081# define stat _stat
6082# define chmod _chmod
6083# define getcwd _getcwd
6084# define putenv _putenv
6085# define S_IXUSR _S_IEXEC
6086#elif defined __MINGW32__
6087# define setmode _setmode
6088# define stat _stat
6089# define chmod _chmod
6090# define getcwd _getcwd
6091# define putenv _putenv
6092#elif defined __CYGWIN__
6093# define HAVE_SETENV
6094# define FOPEN_WB "wb"
6095/* #elif defined other platforms ... */
6096#endif
6097
6098#if defined PATH_MAX
6099# define LT_PATHMAX PATH_MAX
6100#elif defined MAXPATHLEN
6101# define LT_PATHMAX MAXPATHLEN
6102#else
6103# define LT_PATHMAX 1024
6104#endif
6105
6106#ifndef S_IXOTH
6107# define S_IXOTH 0
6108#endif
6109#ifndef S_IXGRP
6110# define S_IXGRP 0
6111#endif
6112
6113/* path handling portability macros */
6114#ifndef DIR_SEPARATOR
6115# define DIR_SEPARATOR '/'
6116# define PATH_SEPARATOR ':'
6117#endif
6118
6119#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6120 defined __OS2__
6121# define HAVE_DOS_BASED_FILE_SYSTEM
6122# define FOPEN_WB "wb"
6123# ifndef DIR_SEPARATOR_2
6124# define DIR_SEPARATOR_2 '\\'
6125# endif
6126# ifndef PATH_SEPARATOR_2
6127# define PATH_SEPARATOR_2 ';'
6128# endif
6129#endif
6130
6131#ifndef DIR_SEPARATOR_2
6132# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6133#else /* DIR_SEPARATOR_2 */
6134# define IS_DIR_SEPARATOR(ch) \
6135 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6136#endif /* DIR_SEPARATOR_2 */
6137
6138#ifndef PATH_SEPARATOR_2
6139# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6140#else /* PATH_SEPARATOR_2 */
6141# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6142#endif /* PATH_SEPARATOR_2 */
6143
6144#ifndef FOPEN_WB
6145# define FOPEN_WB "w"
6146#endif
6147#ifndef _O_BINARY
6148# define _O_BINARY 0
6149#endif
6150
6151#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6152#define XFREE(stale) do { \
6153 if (stale) { free (stale); stale = 0; } \
6154} while (0)
6155
6156#if defined LT_DEBUGWRAPPER
6157static int lt_debug = 1;
6158#else
6159static int lt_debug = 0;
6160#endif
6161
6162const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6163
6164void *xmalloc (size_t num);
6165char *xstrdup (const char *string);
6166const char *base_name (const char *name);
6167char *find_executable (const char *wrapper);
6168char *chase_symlinks (const char *pathspec);
6169int make_executable (const char *path);
6170int check_executable (const char *path);
6171char *strendzap (char *str, const char *pat);
6172void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6173void lt_fatal (const char *file, int line, const char *message, ...);
6174static const char *nonnull (const char *s);
6175static const char *nonempty (const char *s);
6176void lt_setenv (const char *name, const char *value);
6177char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6178void lt_update_exe_path (const char *name, const char *value);
6179void lt_update_lib_path (const char *name, const char *value);
6180char **prepare_spawn (char **argv);
6181void lt_dump_script (FILE *f);
6182EOF
6183
6184 cat <<EOF
6185#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6186# define externally_visible volatile
6187#else
6188# define externally_visible __attribute__((externally_visible)) volatile
6189#endif
6190externally_visible const char * MAGIC_EXE = "$magic_exe";
6191const char * LIB_PATH_VARNAME = "$shlibpath_var";
6192EOF
6193
6194 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6195 func_to_host_path "$temp_rpath"
6196 cat <<EOF
6197const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6198EOF
6199 else
6200 cat <<"EOF"
6201const char * LIB_PATH_VALUE = "";
6202EOF
6203 fi
6204
6205 if test -n "$dllsearchpath"; then
6206 func_to_host_path "$dllsearchpath:"
6207 cat <<EOF
6208const char * EXE_PATH_VARNAME = "PATH";
6209const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6210EOF
6211 else
6212 cat <<"EOF"
6213const char * EXE_PATH_VARNAME = "";
6214const char * EXE_PATH_VALUE = "";
6215EOF
6216 fi
6217
6218 if test yes = "$fast_install"; then
6219 cat <<EOF
6220const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6221EOF
6222 else
6223 cat <<EOF
6224const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6225EOF
6226 fi
6227
6228
6229 cat <<"EOF"
6230
6231#define LTWRAPPER_OPTION_PREFIX "--lt-"
6232
6233static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6234static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6235static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6236
6237int
6238main (int argc, char *argv[])
6239{
6240 char **newargz;
6241 int newargc;
6242 char *tmp_pathspec;
6243 char *actual_cwrapper_path;
6244 char *actual_cwrapper_name;
6245 char *target_name;
6246 char *lt_argv_zero;
6247 int rval = 127;
6248
6249 int i;
6250
6251 program_name = (char *) xstrdup (base_name (argv[0]));
6252 newargz = XMALLOC (char *, (size_t) argc + 1);
6253
6254 /* very simple arg parsing; don't want to rely on getopt
6255 * also, copy all non cwrapper options to newargz, except
6256 * argz[0], which is handled differently
6257 */
6258 newargc=0;
6259 for (i = 1; i < argc; i++)
6260 {
6261 if (STREQ (argv[i], dumpscript_opt))
6262 {
6263EOF
6264 case $host in
6265 *mingw* | *cygwin* )
6266 # make stdout use "unix" line endings
6267 echo " setmode(1,_O_BINARY);"
6268 ;;
6269 esac
6270
6271 cat <<"EOF"
6272 lt_dump_script (stdout);
6273 return 0;
6274 }
6275 if (STREQ (argv[i], debug_opt))
6276 {
6277 lt_debug = 1;
6278 continue;
6279 }
6280 if (STREQ (argv[i], ltwrapper_option_prefix))
6281 {
6282 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6283 namespace, but it is not one of the ones we know about and
6284 have already dealt with, above (inluding dump-script), then
6285 report an error. Otherwise, targets might begin to believe
6286 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6287 namespace. The first time any user complains about this, we'll
6288 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6289 or a configure.ac-settable value.
6290 */
6291 lt_fatal (__FILE__, __LINE__,
6292 "unrecognized %s option: '%s'",
6293 ltwrapper_option_prefix, argv[i]);
6294 }
6295 /* otherwise ... */
6296 newargz[++newargc] = xstrdup (argv[i]);
6297 }
6298 newargz[++newargc] = NULL;
6299
6300EOF
6301 cat <<EOF
6302 /* The GNU banner must be the first non-error debug message */
6303 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6304EOF
6305 cat <<"EOF"
6306 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6307 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6308
6309 tmp_pathspec = find_executable (argv[0]);
6310 if (tmp_pathspec == NULL)
6311 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6312 lt_debugprintf (__FILE__, __LINE__,
6313 "(main) found exe (before symlink chase) at: %s\n",
6314 tmp_pathspec);
6315
6316 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6317 lt_debugprintf (__FILE__, __LINE__,
6318 "(main) found exe (after symlink chase) at: %s\n",
6319 actual_cwrapper_path);
6320 XFREE (tmp_pathspec);
6321
6322 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6323 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6324
6325 /* wrapper name transforms */
6326 strendzap (actual_cwrapper_name, ".exe");
6327 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6328 XFREE (actual_cwrapper_name);
6329 actual_cwrapper_name = tmp_pathspec;
6330 tmp_pathspec = 0;
6331
6332 /* target_name transforms -- use actual target program name; might have lt- prefix */
6333 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6334 strendzap (target_name, ".exe");
6335 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6336 XFREE (target_name);
6337 target_name = tmp_pathspec;
6338 tmp_pathspec = 0;
6339
6340 lt_debugprintf (__FILE__, __LINE__,
6341 "(main) libtool target name: %s\n",
6342 target_name);
6343EOF
6344
6345 cat <<EOF
6346 newargz[0] =
6347 XMALLOC (char, (strlen (actual_cwrapper_path) +
6348 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6349 strcpy (newargz[0], actual_cwrapper_path);
6350 strcat (newargz[0], "$objdir");
6351 strcat (newargz[0], "/");
6352EOF
6353
6354 cat <<"EOF"
6355 /* stop here, and copy so we don't have to do this twice */
6356 tmp_pathspec = xstrdup (newargz[0]);
6357
6358 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6359 strcat (newargz[0], actual_cwrapper_name);
6360
6361 /* DO want the lt- prefix here if it exists, so use target_name */
6362 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6363 XFREE (tmp_pathspec);
6364 tmp_pathspec = NULL;
6365EOF
6366
6367 case $host_os in
6368 mingw*)
6369 cat <<"EOF"
6370 {
6371 char* p;
6372 while ((p = strchr (newargz[0], '\\')) != NULL)
6373 {
6374 *p = '/';
6375 }
6376 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6377 {
6378 *p = '/';
6379 }
6380 }
6381EOF
6382 ;;
6383 esac
6384
6385 cat <<"EOF"
6386 XFREE (target_name);
6387 XFREE (actual_cwrapper_path);
6388 XFREE (actual_cwrapper_name);
6389
6390 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6391 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6392 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6393 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6394 because on Windows, both *_VARNAMEs are PATH but uninstalled
6395 libraries must come first. */
6396 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6397 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6398
6399 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6400 nonnull (lt_argv_zero));
6401 for (i = 0; i < newargc; i++)
6402 {
6403 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6404 i, nonnull (newargz[i]));
6405 }
6406
6407EOF
6408
6409 case $host_os in
6410 mingw*)
6411 cat <<"EOF"
6412 /* execv doesn't actually work on mingw as expected on unix */
6413 newargz = prepare_spawn (newargz);
6414 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6415 if (rval == -1)
6416 {
6417 /* failed to start process */
6418 lt_debugprintf (__FILE__, __LINE__,
6419 "(main) failed to launch target \"%s\": %s\n",
6420 lt_argv_zero, nonnull (strerror (errno)));
6421 return 127;
6422 }
6423 return rval;
6424EOF
6425 ;;
6426 *)
6427 cat <<"EOF"
6428 execv (lt_argv_zero, newargz);
6429 return rval; /* =127, but avoids unused variable warning */
6430EOF
6431 ;;
6432 esac
6433
6434 cat <<"EOF"
6435}
6436
6437void *
6438xmalloc (size_t num)
6439{
6440 void *p = (void *) malloc (num);
6441 if (!p)
6442 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6443
6444 return p;
6445}
6446
6447char *
6448xstrdup (const char *string)
6449{
6450 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6451 string) : NULL;
6452}
6453
6454const char *
6455base_name (const char *name)
6456{
6457 const char *base;
6458
6459#if defined HAVE_DOS_BASED_FILE_SYSTEM
6460 /* Skip over the disk name in MSDOS pathnames. */
6461 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6462 name += 2;
6463#endif
6464
6465 for (base = name; *name; name++)
6466 if (IS_DIR_SEPARATOR (*name))
6467 base = name + 1;
6468 return base;
6469}
6470
6471int
6472check_executable (const char *path)
6473{
6474 struct stat st;
6475
6476 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6477 nonempty (path));
6478 if ((!path) || (!*path))
6479 return 0;
6480
6481 if ((stat (path, &st) >= 0)
6482 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6483 return 1;
6484 else
6485 return 0;
6486}
6487
6488int
6489make_executable (const char *path)
6490{
6491 int rval = 0;
6492 struct stat st;
6493
6494 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6495 nonempty (path));
6496 if ((!path) || (!*path))
6497 return 0;
6498
6499 if (stat (path, &st) >= 0)
6500 {
6501 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6502 }
6503 return rval;
6504}
6505
6506/* Searches for the full path of the wrapper. Returns
6507 newly allocated full path name if found, NULL otherwise
6508 Does not chase symlinks, even on platforms that support them.
6509*/
6510char *
6511find_executable (const char *wrapper)
6512{
6513 int has_slash = 0;
6514 const char *p;
6515 const char *p_next;
6516 /* static buffer for getcwd */
6517 char tmp[LT_PATHMAX + 1];
6518 size_t tmp_len;
6519 char *concat_name;
6520
6521 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6522 nonempty (wrapper));
6523
6524 if ((wrapper == NULL) || (*wrapper == '\0'))
6525 return NULL;
6526
6527 /* Absolute path? */
6528#if defined HAVE_DOS_BASED_FILE_SYSTEM
6529 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6530 {
6531 concat_name = xstrdup (wrapper);
6532 if (check_executable (concat_name))
6533 return concat_name;
6534 XFREE (concat_name);
6535 }
6536 else
6537 {
6538#endif
6539 if (IS_DIR_SEPARATOR (wrapper[0]))
6540 {
6541 concat_name = xstrdup (wrapper);
6542 if (check_executable (concat_name))
6543 return concat_name;
6544 XFREE (concat_name);
6545 }
6546#if defined HAVE_DOS_BASED_FILE_SYSTEM
6547 }
6548#endif
6549
6550 for (p = wrapper; *p; p++)
6551 if (*p == '/')
6552 {
6553 has_slash = 1;
6554 break;
6555 }
6556 if (!has_slash)
6557 {
6558 /* no slashes; search PATH */
6559 const char *path = getenv ("PATH");
6560 if (path != NULL)
6561 {
6562 for (p = path; *p; p = p_next)
6563 {
6564 const char *q;
6565 size_t p_len;
6566 for (q = p; *q; q++)
6567 if (IS_PATH_SEPARATOR (*q))
6568 break;
6569 p_len = (size_t) (q - p);
6570 p_next = (*q == '\0' ? q : q + 1);
6571 if (p_len == 0)
6572 {
6573 /* empty path: current directory */
6574 if (getcwd (tmp, LT_PATHMAX) == NULL)
6575 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6576 nonnull (strerror (errno)));
6577 tmp_len = strlen (tmp);
6578 concat_name =
6579 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6580 memcpy (concat_name, tmp, tmp_len);
6581 concat_name[tmp_len] = '/';
6582 strcpy (concat_name + tmp_len + 1, wrapper);
6583 }
6584 else
6585 {
6586 concat_name =
6587 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6588 memcpy (concat_name, p, p_len);
6589 concat_name[p_len] = '/';
6590 strcpy (concat_name + p_len + 1, wrapper);
6591 }
6592 if (check_executable (concat_name))
6593 return concat_name;
6594 XFREE (concat_name);
6595 }
6596 }
6597 /* not found in PATH; assume curdir */
6598 }
6599 /* Relative path | not found in path: prepend cwd */
6600 if (getcwd (tmp, LT_PATHMAX) == NULL)
6601 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6602 nonnull (strerror (errno)));
6603 tmp_len = strlen (tmp);
6604 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6605 memcpy (concat_name, tmp, tmp_len);
6606 concat_name[tmp_len] = '/';
6607 strcpy (concat_name + tmp_len + 1, wrapper);
6608
6609 if (check_executable (concat_name))
6610 return concat_name;
6611 XFREE (concat_name);
6612 return NULL;
6613}
6614
6615char *
6616chase_symlinks (const char *pathspec)
6617{
6618#ifndef S_ISLNK
6619 return xstrdup (pathspec);
6620#else
6621 char buf[LT_PATHMAX];
6622 struct stat s;
6623 char *tmp_pathspec = xstrdup (pathspec);
6624 char *p;
6625 int has_symlinks = 0;
6626 while (strlen (tmp_pathspec) && !has_symlinks)
6627 {
6628 lt_debugprintf (__FILE__, __LINE__,
6629 "checking path component for symlinks: %s\n",
6630 tmp_pathspec);
6631 if (lstat (tmp_pathspec, &s) == 0)
6632 {
6633 if (S_ISLNK (s.st_mode) != 0)
6634 {
6635 has_symlinks = 1;
6636 break;
6637 }
6638
6639 /* search backwards for last DIR_SEPARATOR */
6640 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6641 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6642 p--;
6643 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6644 {
6645 /* no more DIR_SEPARATORS left */
6646 break;
6647 }
6648 *p = '\0';
6649 }
6650 else
6651 {
6652 lt_fatal (__FILE__, __LINE__,
6653 "error accessing file \"%s\": %s",
6654 tmp_pathspec, nonnull (strerror (errno)));
6655 }
6656 }
6657 XFREE (tmp_pathspec);
6658
6659 if (!has_symlinks)
6660 {
6661 return xstrdup (pathspec);
6662 }
6663
6664 tmp_pathspec = realpath (pathspec, buf);
6665 if (tmp_pathspec == 0)
6666 {
6667 lt_fatal (__FILE__, __LINE__,
6668 "could not follow symlinks for %s", pathspec);
6669 }
6670 return xstrdup (tmp_pathspec);
6671#endif
6672}
6673
6674char *
6675strendzap (char *str, const char *pat)
6676{
6677 size_t len, patlen;
6678
6679 assert (str != NULL);
6680 assert (pat != NULL);
6681
6682 len = strlen (str);
6683 patlen = strlen (pat);
6684
6685 if (patlen <= len)
6686 {
6687 str += len - patlen;
6688 if (STREQ (str, pat))
6689 *str = '\0';
6690 }
6691 return str;
6692}
6693
6694void
6695lt_debugprintf (const char *file, int line, const char *fmt, ...)
6696{
6697 va_list args;
6698 if (lt_debug)
6699 {
6700 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6701 va_start (args, fmt);
6702 (void) vfprintf (stderr, fmt, args);
6703 va_end (args);
6704 }
6705}
6706
6707static void
6708lt_error_core (int exit_status, const char *file,
6709 int line, const char *mode,
6710 const char *message, va_list ap)
6711{
6712 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6713 vfprintf (stderr, message, ap);
6714 fprintf (stderr, ".\n");
6715
6716 if (exit_status >= 0)
6717 exit (exit_status);
6718}
6719
6720void
6721lt_fatal (const char *file, int line, const char *message, ...)
6722{
6723 va_list ap;
6724 va_start (ap, message);
6725 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6726 va_end (ap);
6727}
6728
6729static const char *
6730nonnull (const char *s)
6731{
6732 return s ? s : "(null)";
6733}
6734
6735static const char *
6736nonempty (const char *s)
6737{
6738 return (s && !*s) ? "(empty)" : nonnull (s);
6739}
6740
6741void
6742lt_setenv (const char *name, const char *value)
6743{
6744 lt_debugprintf (__FILE__, __LINE__,
6745 "(lt_setenv) setting '%s' to '%s'\n",
6746 nonnull (name), nonnull (value));
6747 {
6748#ifdef HAVE_SETENV
6749 /* always make a copy, for consistency with !HAVE_SETENV */
6750 char *str = xstrdup (value);
6751 setenv (name, str, 1);
6752#else
6753 size_t len = strlen (name) + 1 + strlen (value) + 1;
6754 char *str = XMALLOC (char, len);
6755 sprintf (str, "%s=%s", name, value);
6756 if (putenv (str) != EXIT_SUCCESS)
6757 {
6758 XFREE (str);
6759 }
6760#endif
6761 }
6762}
6763
6764char *
6765lt_extend_str (const char *orig_value, const char *add, int to_end)
6766{
6767 char *new_value;
6768 if (orig_value && *orig_value)
6769 {
6770 size_t orig_value_len = strlen (orig_value);
6771 size_t add_len = strlen (add);
6772 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6773 if (to_end)
6774 {
6775 strcpy (new_value, orig_value);
6776 strcpy (new_value + orig_value_len, add);
6777 }
6778 else
6779 {
6780 strcpy (new_value, add);
6781 strcpy (new_value + add_len, orig_value);
6782 }
6783 }
6784 else
6785 {
6786 new_value = xstrdup (add);
6787 }
6788 return new_value;
6789}
6790
6791void
6792lt_update_exe_path (const char *name, const char *value)
6793{
6794 lt_debugprintf (__FILE__, __LINE__,
6795 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6796 nonnull (name), nonnull (value));
6797
6798 if (name && *name && value && *value)
6799 {
6800 char *new_value = lt_extend_str (getenv (name), value, 0);
6801 /* some systems can't cope with a ':'-terminated path #' */
6802 size_t len = strlen (new_value);
6803 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6804 {
6805 new_value[--len] = '\0';
6806 }
6807 lt_setenv (name, new_value);
6808 XFREE (new_value);
6809 }
6810}
6811
6812void
6813lt_update_lib_path (const char *name, const char *value)
6814{
6815 lt_debugprintf (__FILE__, __LINE__,
6816 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6817 nonnull (name), nonnull (value));
6818
6819 if (name && *name && value && *value)
6820 {
6821 char *new_value = lt_extend_str (getenv (name), value, 0);
6822 lt_setenv (name, new_value);
6823 XFREE (new_value);
6824 }
6825}
6826
6827EOF
6828 case $host_os in
6829 mingw*)
6830 cat <<"EOF"
6831
6832/* Prepares an argument vector before calling spawn().
6833 Note that spawn() does not by itself call the command interpreter
6834 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6835 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6836 GetVersionEx(&v);
6837 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6838 }) ? "cmd.exe" : "command.com").
6839 Instead it simply concatenates the arguments, separated by ' ', and calls
6840 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6841 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6842 special way:
6843 - Space and tab are interpreted as delimiters. They are not treated as
6844 delimiters if they are surrounded by double quotes: "...".
6845 - Unescaped double quotes are removed from the input. Their only effect is
6846 that within double quotes, space and tab are treated like normal
6847 characters.
6848 - Backslashes not followed by double quotes are not special.
6849 - But 2*n+1 backslashes followed by a double quote become
6850 n backslashes followed by a double quote (n >= 0):
6851 \" -> "
6852 \\\" -> \"
6853 \\\\\" -> \\"
6854 */
6855#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6856#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6857char **
6858prepare_spawn (char **argv)
6859{
6860 size_t argc;
6861 char **new_argv;
6862 size_t i;
6863
6864 /* Count number of arguments. */
6865 for (argc = 0; argv[argc] != NULL; argc++)
6866 ;
6867
6868 /* Allocate new argument vector. */
6869 new_argv = XMALLOC (char *, argc + 1);
6870
6871 /* Put quoted arguments into the new argument vector. */
6872 for (i = 0; i < argc; i++)
6873 {
6874 const char *string = argv[i];
6875
6876 if (string[0] == '\0')
6877 new_argv[i] = xstrdup ("\"\"");
6878 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6879 {
6880 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6881 size_t length;
6882 unsigned int backslashes;
6883 const char *s;
6884 char *quoted_string;
6885 char *p;
6886
6887 length = 0;
6888 backslashes = 0;
6889 if (quote_around)
6890 length++;
6891 for (s = string; *s != '\0'; s++)
6892 {
6893 char c = *s;
6894 if (c == '"')
6895 length += backslashes + 1;
6896 length++;
6897 if (c == '\\')
6898 backslashes++;
6899 else
6900 backslashes = 0;
6901 }
6902 if (quote_around)
6903 length += backslashes + 1;
6904
6905 quoted_string = XMALLOC (char, length + 1);
6906
6907 p = quoted_string;
6908 backslashes = 0;
6909 if (quote_around)
6910 *p++ = '"';
6911 for (s = string; *s != '\0'; s++)
6912 {
6913 char c = *s;
6914 if (c == '"')
6915 {
6916 unsigned int j;
6917 for (j = backslashes + 1; j > 0; j--)
6918 *p++ = '\\';
6919 }
6920 *p++ = c;
6921 if (c == '\\')
6922 backslashes++;
6923 else
6924 backslashes = 0;
6925 }
6926 if (quote_around)
6927 {
6928 unsigned int j;
6929 for (j = backslashes; j > 0; j--)
6930 *p++ = '\\';
6931 *p++ = '"';
6932 }
6933 *p = '\0';
6934
6935 new_argv[i] = quoted_string;
6936 }
6937 else
6938 new_argv[i] = (char *) string;
6939 }
6940 new_argv[argc] = NULL;
6941
6942 return new_argv;
6943}
6944EOF
6945 ;;
6946 esac
6947
6948 cat <<"EOF"
6949void lt_dump_script (FILE* f)
6950{
6951EOF
6952 func_emit_wrapper yes |
6953 $SED -n -e '
6954s/^\(.\{79\}\)\(..*\)/\1\
6955\2/
6956h
6957s/\([\\"]\)/\\\1/g
6958s/$/\\n/
6959s/\([^\n]*\).*/ fputs ("\1", f);/p
6960g
6961D'
6962 cat <<"EOF"
6963}
6964EOF
6965}
6966# end: func_emit_cwrapperexe_src
6967
6968# func_win32_import_lib_p ARG
6969# True if ARG is an import lib, as indicated by $file_magic_cmd
6970func_win32_import_lib_p ()
6971{
6972 $debug_cmd
6973
6974 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6975 *import*) : ;;
6976 *) false ;;
6977 esac
6978}
6979
6980# func_suncc_cstd_abi
6981# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6982# Several compiler flags select an ABI that is incompatible with the
6983# Cstd library. Avoid specifying it if any are in CXXFLAGS.
6984func_suncc_cstd_abi ()
6985{
6986 $debug_cmd
6987
6988 case " $compile_command " in
6989 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6990 suncc_use_cstd_abi=no
6991 ;;
6992 *)
6993 suncc_use_cstd_abi=yes
6994 ;;
6995 esac
6996}
6997
6998# func_mode_link arg...
6999func_mode_link ()
7000{
7001 $debug_cmd
7002
7003 case $host in
7004 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7005 # It is impossible to link a dll without this setting, and
7006 # we shouldn't force the makefile maintainer to figure out
7007 # what system we are compiling for in order to pass an extra
7008 # flag for every libtool invocation.
7009 # allow_undefined=no
7010
7011 # FIXME: Unfortunately, there are problems with the above when trying
7012 # to make a dll that has undefined symbols, in which case not
7013 # even a static library is built. For now, we need to specify
7014 # -no-undefined on the libtool link line when we can be certain
7015 # that all symbols are satisfied, otherwise we get a static library.
7016 allow_undefined=yes
7017 ;;
7018 *)
7019 allow_undefined=yes
7020 ;;
7021 esac
7022 libtool_args=$nonopt
7023 base_compile="$nonopt $@"
7024 compile_command=$nonopt
7025 finalize_command=$nonopt
7026
7027 compile_rpath=
7028 finalize_rpath=
7029 compile_shlibpath=
7030 finalize_shlibpath=
7031 convenience=
7032 old_convenience=
7033 deplibs=
7034 old_deplibs=
7035 compiler_flags=
7036 linker_flags=
7037 dllsearchpath=
7038 lib_search_path=`pwd`
7039 inst_prefix_dir=
7040 new_inherited_linker_flags=
7041
7042 avoid_version=no
7043 bindir=
7044 dlfiles=
7045 dlprefiles=
7046 dlself=no
7047 export_dynamic=no
7048 export_symbols=
7049 export_symbols_regex=
7050 generated=
7051 libobjs=
7052 ltlibs=
7053 module=no
7054 no_install=no
7055 objs=
7056 os2dllname=
7057 non_pic_objects=
7058 precious_files_regex=
7059 prefer_static_libs=no
7060 preload=false
7061 prev=
7062 prevarg=
7063 release=
7064 rpath=
7065 xrpath=
7066 perm_rpath=
7067 temp_rpath=
7068 thread_safe=no
7069 vinfo=
7070 vinfo_number=no
7071 weak_libs=
7072 single_module=$wl-single_module
7073 func_infer_tag $base_compile
7074
7075 # We need to know -static, to get the right output filenames.
7076 for arg
7077 do
7078 case $arg in
7079 -shared)
7080 test yes != "$build_libtool_libs" \
7081 && func_fatal_configuration "cannot build a shared library"
7082 build_old_libs=no
7083 break
7084 ;;
7085 -all-static | -static | -static-libtool-libs)
7086 case $arg in
7087 -all-static)
7088 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7089 func_warning "complete static linking is impossible in this configuration"
7090 fi
7091 if test -n "$link_static_flag"; then
7092 dlopen_self=$dlopen_self_static
7093 fi
7094 prefer_static_libs=yes
7095 ;;
7096 -static)
7097 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7098 dlopen_self=$dlopen_self_static
7099 fi
7100 prefer_static_libs=built
7101 ;;
7102 -static-libtool-libs)
7103 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7104 dlopen_self=$dlopen_self_static
7105 fi
7106 prefer_static_libs=yes
7107 ;;
7108 esac
7109 build_libtool_libs=no
7110 build_old_libs=yes
7111 break
7112 ;;
7113 esac
7114 done
7115
7116 # See if our shared archives depend on static archives.
7117 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7118
7119 # Go through the arguments, transforming them on the way.
7120 while test "$#" -gt 0; do
7121 arg=$1
7122 shift
7123 func_quote_for_eval "$arg"
7124 qarg=$func_quote_for_eval_unquoted_result
7125 func_append libtool_args " $func_quote_for_eval_result"
7126
7127 # If the previous option needs an argument, assign it.
7128 if test -n "$prev"; then
7129 case $prev in
7130 output)
7131 func_append compile_command " @OUTPUT@"
7132 func_append finalize_command " @OUTPUT@"
7133 ;;
7134 esac
7135
7136 case $prev in
7137 bindir)
7138 bindir=$arg
7139 prev=
7140 continue
7141 ;;
7142 dlfiles|dlprefiles)
7143 $preload || {
7144 # Add the symbol object into the linking commands.
7145 func_append compile_command " @SYMFILE@"
7146 func_append finalize_command " @SYMFILE@"
7147 preload=:
7148 }
7149 case $arg in
7150 *.la | *.lo) ;; # We handle these cases below.
7151 force)
7152 if test no = "$dlself"; then
7153 dlself=needless
7154 export_dynamic=yes
7155 fi
7156 prev=
7157 continue
7158 ;;
7159 self)
7160 if test dlprefiles = "$prev"; then
7161 dlself=yes
7162 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7163 dlself=yes
7164 else
7165 dlself=needless
7166 export_dynamic=yes
7167 fi
7168 prev=
7169 continue
7170 ;;
7171 *)
7172 if test dlfiles = "$prev"; then
7173 func_append dlfiles " $arg"
7174 else
7175 func_append dlprefiles " $arg"
7176 fi
7177 prev=
7178 continue
7179 ;;
7180 esac
7181 ;;
7182 expsyms)
7183 export_symbols=$arg
7184 test -f "$arg" \
7185 || func_fatal_error "symbol file '$arg' does not exist"
7186 prev=
7187 continue
7188 ;;
7189 expsyms_regex)
7190 export_symbols_regex=$arg
7191 prev=
7192 continue
7193 ;;
7194 framework)
7195 case $host in
7196 *-*-darwin*)
7197 case "$deplibs " in
7198 *" $qarg.ltframework "*) ;;
7199 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7200 ;;
7201 esac
7202 ;;
7203 esac
7204 prev=
7205 continue
7206 ;;
7207 inst_prefix)
7208 inst_prefix_dir=$arg
7209 prev=
7210 continue
7211 ;;
7212 mllvm)
7213 # Clang does not use LLVM to link, so we can simply discard any
7214 # '-mllvm $arg' options when doing the link step.
7215 prev=
7216 continue
7217 ;;
7218 objectlist)
7219 if test -f "$arg"; then
7220 save_arg=$arg
7221 moreargs=
7222 for fil in `cat "$save_arg"`
7223 do
7224# func_append moreargs " $fil"
7225 arg=$fil
7226 # A libtool-controlled object.
7227
7228 # Check to see that this really is a libtool object.
7229 if func_lalib_unsafe_p "$arg"; then
7230 pic_object=
7231 non_pic_object=
7232
7233 # Read the .lo file
7234 func_source "$arg"
7235
7236 if test -z "$pic_object" ||
7237 test -z "$non_pic_object" ||
7238 test none = "$pic_object" &&
7239 test none = "$non_pic_object"; then
7240 func_fatal_error "cannot find name of object for '$arg'"
7241 fi
7242
7243 # Extract subdirectory from the argument.
7244 func_dirname "$arg" "/" ""
7245 xdir=$func_dirname_result
7246
7247 if test none != "$pic_object"; then
7248 # Prepend the subdirectory the object is found in.
7249 pic_object=$xdir$pic_object
7250
7251 if test dlfiles = "$prev"; then
7252 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7253 func_append dlfiles " $pic_object"
7254 prev=
7255 continue
7256 else
7257 # If libtool objects are unsupported, then we need to preload.
7258 prev=dlprefiles
7259 fi
7260 fi
7261
7262 # CHECK ME: I think I busted this. -Ossama
7263 if test dlprefiles = "$prev"; then
7264 # Preload the old-style object.
7265 func_append dlprefiles " $pic_object"
7266 prev=
7267 fi
7268
7269 # A PIC object.
7270 func_append libobjs " $pic_object"
7271 arg=$pic_object
7272 fi
7273
7274 # Non-PIC object.
7275 if test none != "$non_pic_object"; then
7276 # Prepend the subdirectory the object is found in.
7277 non_pic_object=$xdir$non_pic_object
7278
7279 # A standard non-PIC object
7280 func_append non_pic_objects " $non_pic_object"
7281 if test -z "$pic_object" || test none = "$pic_object"; then
7282 arg=$non_pic_object
7283 fi
7284 else
7285 # If the PIC object exists, use it instead.
7286 # $xdir was prepended to $pic_object above.
7287 non_pic_object=$pic_object
7288 func_append non_pic_objects " $non_pic_object"
7289 fi
7290 else
7291 # Only an error if not doing a dry-run.
7292 if $opt_dry_run; then
7293 # Extract subdirectory from the argument.
7294 func_dirname "$arg" "/" ""
7295 xdir=$func_dirname_result
7296
7297 func_lo2o "$arg"
7298 pic_object=$xdir$objdir/$func_lo2o_result
7299 non_pic_object=$xdir$func_lo2o_result
7300 func_append libobjs " $pic_object"
7301 func_append non_pic_objects " $non_pic_object"
7302 else
7303 func_fatal_error "'$arg' is not a valid libtool object"
7304 fi
7305 fi
7306 done
7307 else
7308 func_fatal_error "link input file '$arg' does not exist"
7309 fi
7310 arg=$save_arg
7311 prev=
7312 continue
7313 ;;
7314 os2dllname)
7315 os2dllname=$arg
7316 prev=
7317 continue
7318 ;;
7319 precious_regex)
7320 precious_files_regex=$arg
7321 prev=
7322 continue
7323 ;;
7324 release)
7325 release=-$arg
7326 prev=
7327 continue
7328 ;;
7329 rpath | xrpath)
7330 # We need an absolute path.
7331 case $arg in
7332 [\\/]* | [A-Za-z]:[\\/]*) ;;
7333 *)
7334 func_fatal_error "only absolute run-paths are allowed"
7335 ;;
7336 esac
7337 if test rpath = "$prev"; then
7338 case "$rpath " in
7339 *" $arg "*) ;;
7340 *) func_append rpath " $arg" ;;
7341 esac
7342 else
7343 case "$xrpath " in
7344 *" $arg "*) ;;
7345 *) func_append xrpath " $arg" ;;
7346 esac
7347 fi
7348 prev=
7349 continue
7350 ;;
7351 shrext)
7352 shrext_cmds=$arg
7353 prev=
7354 continue
7355 ;;
7356 weak)
7357 func_append weak_libs " $arg"
7358 prev=
7359 continue
7360 ;;
7361 xcclinker)
7362 func_append linker_flags " $qarg"
7363 func_append compiler_flags " $qarg"
7364 prev=
7365 func_append compile_command " $qarg"
7366 func_append finalize_command " $qarg"
7367 continue
7368 ;;
7369 xcompiler)
7370 func_append compiler_flags " $qarg"
7371 prev=
7372 func_append compile_command " $qarg"
7373 func_append finalize_command " $qarg"
7374 continue
7375 ;;
7376 xlinker)
7377 func_append linker_flags " $qarg"
7378 func_append compiler_flags " $wl$qarg"
7379 prev=
7380 func_append compile_command " $wl$qarg"
7381 func_append finalize_command " $wl$qarg"
7382 continue
7383 ;;
7384 *)
7385 eval "$prev=\"\$arg\""
7386 prev=
7387 continue
7388 ;;
7389 esac
7390 fi # test -n "$prev"
7391
7392 prevarg=$arg
7393
7394 case $arg in
7395 -all-static)
7396 if test -n "$link_static_flag"; then
7397 # See comment for -static flag below, for more details.
7398 func_append compile_command " $link_static_flag"
7399 func_append finalize_command " $link_static_flag"
7400 fi
7401 continue
7402 ;;
7403
7404 -allow-undefined)
7405 # FIXME: remove this flag sometime in the future.
7406 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7407 ;;
7408
7409 -avoid-version)
7410 avoid_version=yes
7411 continue
7412 ;;
7413
7414 -bindir)
7415 prev=bindir
7416 continue
7417 ;;
7418
7419 -dlopen)
7420 prev=dlfiles
7421 continue
7422 ;;
7423
7424 -dlpreopen)
7425 prev=dlprefiles
7426 continue
7427 ;;
7428
7429 -export-dynamic)
7430 export_dynamic=yes
7431 continue
7432 ;;
7433
7434 -export-symbols | -export-symbols-regex)
7435 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7436 func_fatal_error "more than one -exported-symbols argument is not allowed"
7437 fi
7438 if test X-export-symbols = "X$arg"; then
7439 prev=expsyms
7440 else
7441 prev=expsyms_regex
7442 fi
7443 continue
7444 ;;
7445
7446 -framework)
7447 prev=framework
7448 continue
7449 ;;
7450
7451 -inst-prefix-dir)
7452 prev=inst_prefix
7453 continue
7454 ;;
7455
7456 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7457 # so, if we see these flags be careful not to treat them like -L
7458 -L[A-Z][A-Z]*:*)
7459 case $with_gcc/$host in
7460 no/*-*-irix* | /*-*-irix*)
7461 func_append compile_command " $arg"
7462 func_append finalize_command " $arg"
7463 ;;
7464 esac
7465 continue
7466 ;;
7467
7468 -L*)
7469 func_stripname "-L" '' "$arg"
7470 if test -z "$func_stripname_result"; then
7471 if test "$#" -gt 0; then
7472 func_fatal_error "require no space between '-L' and '$1'"
7473 else
7474 func_fatal_error "need path for '-L' option"
7475 fi
7476 fi
7477 func_resolve_sysroot "$func_stripname_result"
7478 dir=$func_resolve_sysroot_result
7479 # We need an absolute path.
7480 case $dir in
7481 [\\/]* | [A-Za-z]:[\\/]*) ;;
7482 *)
7483 absdir=`cd "$dir" && pwd`
7484 test -z "$absdir" && \
7485 func_fatal_error "cannot determine absolute directory name of '$dir'"
7486 dir=$absdir
7487 ;;
7488 esac
7489 case "$deplibs " in
7490 *" -L$dir "* | *" $arg "*)
7491 # Will only happen for absolute or sysroot arguments
7492 ;;
7493 *)
7494 # Preserve sysroot, but never include relative directories
7495 case $dir in
7496 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7497 *) func_append deplibs " -L$dir" ;;
7498 esac
7499 func_append lib_search_path " $dir"
7500 ;;
7501 esac
7502 case $host in
7503 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7504 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7505 case :$dllsearchpath: in
7506 *":$dir:"*) ;;
7507 ::) dllsearchpath=$dir;;
7508 *) func_append dllsearchpath ":$dir";;
7509 esac
7510 case :$dllsearchpath: in
7511 *":$testbindir:"*) ;;
7512 ::) dllsearchpath=$testbindir;;
7513 *) func_append dllsearchpath ":$testbindir";;
7514 esac
7515 ;;
7516 esac
7517 continue
7518 ;;
7519
7520 -l*)
7521 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7522 case $host in
7523 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7524 # These systems don't actually have a C or math library (as such)
7525 continue
7526 ;;
7527 *-*-os2*)
7528 # These systems don't actually have a C library (as such)
7529 test X-lc = "X$arg" && continue
7530 ;;
7531 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7532 # Do not include libc due to us having libc/libc_r.
7533 test X-lc = "X$arg" && continue
7534 ;;
7535 *-*-rhapsody* | *-*-darwin1.[012])
7536 # Rhapsody C and math libraries are in the System framework
7537 func_append deplibs " System.ltframework"
7538 continue
7539 ;;
7540 *-*-sco3.2v5* | *-*-sco5v6*)
7541 # Causes problems with __ctype
7542 test X-lc = "X$arg" && continue
7543 ;;
7544 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7545 # Compiler inserts libc in the correct place for threads to work
7546 test X-lc = "X$arg" && continue
7547 ;;
7548 esac
7549 elif test X-lc_r = "X$arg"; then
7550 case $host in
7551 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7552 # Do not include libc_r directly, use -pthread flag.
7553 continue
7554 ;;
7555 esac
7556 fi
7557 func_append deplibs " $arg"
7558 continue
7559 ;;
7560
7561 -mllvm)
7562 prev=mllvm
7563 continue
7564 ;;
7565
7566 -module)
7567 module=yes
7568 continue
7569 ;;
7570
7571 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7572 # classes, name mangling, and exception handling.
7573 # Darwin uses the -arch flag to determine output architecture.
7574 -model|-arch|-isysroot|--sysroot)
7575 func_append compiler_flags " $arg"
7576 func_append compile_command " $arg"
7577 func_append finalize_command " $arg"
7578 prev=xcompiler
7579 continue
7580 ;;
7581
7582 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7583 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7584 func_append compiler_flags " $arg"
7585 func_append compile_command " $arg"
7586 func_append finalize_command " $arg"
7587 case "$new_inherited_linker_flags " in
7588 *" $arg "*) ;;
7589 * ) func_append new_inherited_linker_flags " $arg" ;;
7590 esac
7591 continue
7592 ;;
7593
7594 -multi_module)
7595 single_module=$wl-multi_module
7596 continue
7597 ;;
7598
7599 -no-fast-install)
7600 fast_install=no
7601 continue
7602 ;;
7603
7604 -no-install)
7605 case $host in
7606 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7607 # The PATH hackery in wrapper scripts is required on Windows
7608 # and Darwin in order for the loader to find any dlls it needs.
7609 func_warning "'-no-install' is ignored for $host"
7610 func_warning "assuming '-no-fast-install' instead"
7611 fast_install=no
7612 ;;
7613 *) no_install=yes ;;
7614 esac
7615 continue
7616 ;;
7617
7618 -no-undefined)
7619 allow_undefined=no
7620 continue
7621 ;;
7622
7623 -objectlist)
7624 prev=objectlist
7625 continue
7626 ;;
7627
7628 -os2dllname)
7629 prev=os2dllname
7630 continue
7631 ;;
7632
7633 -o) prev=output ;;
7634
7635 -precious-files-regex)
7636 prev=precious_regex
7637 continue
7638 ;;
7639
7640 -release)
7641 prev=release
7642 continue
7643 ;;
7644
7645 -rpath)
7646 prev=rpath
7647 continue
7648 ;;
7649
7650 -R)
7651 prev=xrpath
7652 continue
7653 ;;
7654
7655 -R*)
7656 func_stripname '-R' '' "$arg"
7657 dir=$func_stripname_result
7658 # We need an absolute path.
7659 case $dir in
7660 [\\/]* | [A-Za-z]:[\\/]*) ;;
7661 =*)
7662 func_stripname '=' '' "$dir"
7663 dir=$lt_sysroot$func_stripname_result
7664 ;;
7665 *)
7666 func_fatal_error "only absolute run-paths are allowed"
7667 ;;
7668 esac
7669 case "$xrpath " in
7670 *" $dir "*) ;;
7671 *) func_append xrpath " $dir" ;;
7672 esac
7673 continue
7674 ;;
7675
7676 -shared)
7677 # The effects of -shared are defined in a previous loop.
7678 continue
7679 ;;
7680
7681 -shrext)
7682 prev=shrext
7683 continue
7684 ;;
7685
7686 -static | -static-libtool-libs)
7687 # The effects of -static are defined in a previous loop.
7688 # We used to do the same as -all-static on platforms that
7689 # didn't have a PIC flag, but the assumption that the effects
7690 # would be equivalent was wrong. It would break on at least
7691 # Digital Unix and AIX.
7692 continue
7693 ;;
7694
7695 -thread-safe)
7696 thread_safe=yes
7697 continue
7698 ;;
7699
7700 -version-info)
7701 prev=vinfo
7702 continue
7703 ;;
7704
7705 -version-number)
7706 prev=vinfo
7707 vinfo_number=yes
7708 continue
7709 ;;
7710
7711 -weak)
7712 prev=weak
7713 continue
7714 ;;
7715
7716 -Wc,*)
7717 func_stripname '-Wc,' '' "$arg"
7718 args=$func_stripname_result
7719 arg=
7720 save_ifs=$IFS; IFS=,
7721 for flag in $args; do
7722 IFS=$save_ifs
7723 func_quote_for_eval "$flag"
7724 func_append arg " $func_quote_for_eval_result"
7725 func_append compiler_flags " $func_quote_for_eval_result"
7726 done
7727 IFS=$save_ifs
7728 func_stripname ' ' '' "$arg"
7729 arg=$func_stripname_result
7730 ;;
7731
7732 -Wl,*)
7733 func_stripname '-Wl,' '' "$arg"
7734 args=$func_stripname_result
7735 arg=
7736 save_ifs=$IFS; IFS=,
7737 for flag in $args; do
7738 IFS=$save_ifs
7739 func_quote_for_eval "$flag"
7740 func_append arg " $wl$func_quote_for_eval_result"
7741 func_append compiler_flags " $wl$func_quote_for_eval_result"
7742 func_append linker_flags " $func_quote_for_eval_result"
7743 done
7744 IFS=$save_ifs
7745 func_stripname ' ' '' "$arg"
7746 arg=$func_stripname_result
7747 ;;
7748
7749 -Xcompiler)
7750 prev=xcompiler
7751 continue
7752 ;;
7753
7754 -Xlinker)
7755 prev=xlinker
7756 continue
7757 ;;
7758
7759 -XCClinker)
7760 prev=xcclinker
7761 continue
7762 ;;
7763
7764 # -msg_* for osf cc
7765 -msg_*)
7766 func_quote_for_eval "$arg"
7767 arg=$func_quote_for_eval_result
7768 ;;
7769
7770 # Flags to be passed through unchanged, with rationale:
7771 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7772 # -r[0-9][0-9]* specify processor for the SGI compiler
7773 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7774 # +DA*, +DD* enable 64-bit mode for the HP compiler
7775 # -q* compiler args for the IBM compiler
7776 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7777 # -F/path path to uninstalled frameworks, gcc on darwin
7778 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7779 # -fstack-protector* stack protector flags for GCC
7780 # @file GCC response files
7781 # -tp=* Portland pgcc target processor selection
7782 # --sysroot=* for sysroot support
7783 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7784 # -stdlib=* select c++ std lib with clang
7785 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7786 -t[45]*|-txscale*|-B*|-fstack-protector*|-fuse-ld=*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7787 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
7788 func_quote_for_eval "$arg"
7789 arg=$func_quote_for_eval_result
7790 func_append compile_command " $arg"
7791 func_append finalize_command " $arg"
7792 func_append compiler_flags " $arg"
7793 continue
7794 ;;
7795
7796 -Z*)
7797 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7798 # OS/2 uses -Zxxx to specify OS/2-specific options
7799 compiler_flags="$compiler_flags $arg"
7800 func_append compile_command " $arg"
7801 func_append finalize_command " $arg"
7802 case $arg in
7803 -Zlinker | -Zstack)
7804 prev=xcompiler
7805 ;;
7806 esac
7807 continue
7808 else
7809 # Otherwise treat like 'Some other compiler flag' below
7810 func_quote_for_eval "$arg"
7811 arg=$func_quote_for_eval_result
7812 fi
7813 ;;
7814
7815 # Some other compiler flag.
7816 -* | +*)
7817 func_quote_for_eval "$arg"
7818 arg=$func_quote_for_eval_result
7819 ;;
7820
7821 *.$objext)
7822 # A standard object.
7823 func_append objs " $arg"
7824 ;;
7825
7826 *.lo)
7827 # A libtool-controlled object.
7828
7829 # Check to see that this really is a libtool object.
7830 if func_lalib_unsafe_p "$arg"; then
7831 pic_object=
7832 non_pic_object=
7833
7834 # Read the .lo file
7835 func_source "$arg"
7836
7837 if test -z "$pic_object" ||
7838 test -z "$non_pic_object" ||
7839 test none = "$pic_object" &&
7840 test none = "$non_pic_object"; then
7841 func_fatal_error "cannot find name of object for '$arg'"
7842 fi
7843
7844 # Extract subdirectory from the argument.
7845 func_dirname "$arg" "/" ""
7846 xdir=$func_dirname_result
7847
7848 test none = "$pic_object" || {
7849 # Prepend the subdirectory the object is found in.
7850 pic_object=$xdir$pic_object
7851
7852 if test dlfiles = "$prev"; then
7853 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7854 func_append dlfiles " $pic_object"
7855 prev=
7856 continue
7857 else
7858 # If libtool objects are unsupported, then we need to preload.
7859 prev=dlprefiles
7860 fi
7861 fi
7862
7863 # CHECK ME: I think I busted this. -Ossama
7864 if test dlprefiles = "$prev"; then
7865 # Preload the old-style object.
7866 func_append dlprefiles " $pic_object"
7867 prev=
7868 fi
7869
7870 # A PIC object.
7871 func_append libobjs " $pic_object"
7872 arg=$pic_object
7873 }
7874
7875 # Non-PIC object.
7876 if test none != "$non_pic_object"; then
7877 # Prepend the subdirectory the object is found in.
7878 non_pic_object=$xdir$non_pic_object
7879
7880 # A standard non-PIC object
7881 func_append non_pic_objects " $non_pic_object"
7882 if test -z "$pic_object" || test none = "$pic_object"; then
7883 arg=$non_pic_object
7884 fi
7885 else
7886 # If the PIC object exists, use it instead.
7887 # $xdir was prepended to $pic_object above.
7888 non_pic_object=$pic_object
7889 func_append non_pic_objects " $non_pic_object"
7890 fi
7891 else
7892 # Only an error if not doing a dry-run.
7893 if $opt_dry_run; then
7894 # Extract subdirectory from the argument.
7895 func_dirname "$arg" "/" ""
7896 xdir=$func_dirname_result
7897
7898 func_lo2o "$arg"
7899 pic_object=$xdir$objdir/$func_lo2o_result
7900 non_pic_object=$xdir$func_lo2o_result
7901 func_append libobjs " $pic_object"
7902 func_append non_pic_objects " $non_pic_object"
7903 else
7904 func_fatal_error "'$arg' is not a valid libtool object"
7905 fi
7906 fi
7907 ;;
7908
7909 *.$libext)
7910 # An archive.
7911 func_append deplibs " $arg"
7912 func_append old_deplibs " $arg"
7913 continue
7914 ;;
7915
7916 *.la)
7917 # A libtool-controlled library.
7918
7919 func_resolve_sysroot "$arg"
7920 if test dlfiles = "$prev"; then
7921 # This library was specified with -dlopen.
7922 func_append dlfiles " $func_resolve_sysroot_result"
7923 prev=
7924 elif test dlprefiles = "$prev"; then
7925 # The library was specified with -dlpreopen.
7926 func_append dlprefiles " $func_resolve_sysroot_result"
7927 prev=
7928 else
7929 func_append deplibs " $func_resolve_sysroot_result"
7930 fi
7931 continue
7932 ;;
7933
7934 # Some other compiler argument.
7935 *)
7936 # Unknown arguments in both finalize_command and compile_command need
7937 # to be aesthetically quoted because they are evaled later.
7938 func_quote_for_eval "$arg"
7939 arg=$func_quote_for_eval_result
7940 ;;
7941 esac # arg
7942
7943 # Now actually substitute the argument into the commands.
7944 if test -n "$arg"; then
7945 func_append compile_command " $arg"
7946 func_append finalize_command " $arg"
7947 fi
7948 done # argument parsing loop
7949
7950 test -n "$prev" && \
7951 func_fatal_help "the '$prevarg' option requires an argument"
7952
7953 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7954 eval arg=\"$export_dynamic_flag_spec\"
7955 func_append compile_command " $arg"
7956 func_append finalize_command " $arg"
7957 fi
7958
7959 oldlibs=
7960 # calculate the name of the file, without its directory
7961 func_basename "$output"
7962 outputname=$func_basename_result
7963 libobjs_save=$libobjs
7964
7965 if test -n "$shlibpath_var"; then
7966 # get the directories listed in $shlibpath_var
7967 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7968 else
7969 shlib_search_path=
7970 fi
7971 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7972 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7973
7974 # Definition is injected by LT_CONFIG during libtool generation.
7975 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7976
7977 func_dirname "$output" "/" ""
7978 output_objdir=$func_dirname_result$objdir
7979 func_to_tool_file "$output_objdir/"
7980 tool_output_objdir=$func_to_tool_file_result
7981 # Create the object directory.
7982 func_mkdir_p "$output_objdir"
7983
7984 # Determine the type of output
7985 case $output in
7986 "")
7987 func_fatal_help "you must specify an output file"
7988 ;;
7989 *.$libext) linkmode=oldlib ;;
7990 *.lo | *.$objext) linkmode=obj ;;
7991 *.la) linkmode=lib ;;
7992 *) linkmode=prog ;; # Anything else should be a program.
7993 esac
7994
7995 specialdeplibs=
7996
7997 libs=
7998 # Find all interdependent deplibs by searching for libraries
7999 # that are linked more than once (e.g. -la -lb -la)
8000 for deplib in $deplibs; do
8001 if $opt_preserve_dup_deps; then
8002 case "$libs " in
8003 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8004 esac
8005 fi
8006 func_append libs " $deplib"
8007 done
8008
8009 if test lib = "$linkmode"; then
8010 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8011
8012 # Compute libraries that are listed more than once in $predeps
8013 # $postdeps and mark them as special (i.e., whose duplicates are
8014 # not to be eliminated).
8015 pre_post_deps=
8016 if $opt_duplicate_compiler_generated_deps; then
8017 for pre_post_dep in $predeps $postdeps; do
8018 case "$pre_post_deps " in
8019 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8020 esac
8021 func_append pre_post_deps " $pre_post_dep"
8022 done
8023 fi
8024 pre_post_deps=
8025 fi
8026
8027 deplibs=
8028 newdependency_libs=
8029 newlib_search_path=
8030 need_relink=no # whether we're linking any uninstalled libtool libraries
8031 notinst_deplibs= # not-installed libtool libraries
8032 notinst_path= # paths that contain not-installed libtool libraries
8033
8034 case $linkmode in
8035 lib)
8036 passes="conv dlpreopen link"
8037 for file in $dlfiles $dlprefiles; do
8038 case $file in
8039 *.la) ;;
8040 *)
8041 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8042 ;;
8043 esac
8044 done
8045 ;;
8046 prog)
8047 compile_deplibs=
8048 finalize_deplibs=
8049 alldeplibs=false
8050 newdlfiles=
8051 newdlprefiles=
8052 passes="conv scan dlopen dlpreopen link"
8053 ;;
8054 *) passes="conv"
8055 ;;
8056 esac
8057
8058 for pass in $passes; do
8059 # The preopen pass in lib mode reverses $deplibs; put it back here
8060 # so that -L comes before libs that need it for instance...
8061 if test lib,link = "$linkmode,$pass"; then
8062 ## FIXME: Find the place where the list is rebuilt in the wrong
8063 ## order, and fix it there properly
8064 tmp_deplibs=
8065 for deplib in $deplibs; do
8066 tmp_deplibs="$deplib $tmp_deplibs"
8067 done
8068 deplibs=$tmp_deplibs
8069 fi
8070
8071 if test lib,link = "$linkmode,$pass" ||
8072 test prog,scan = "$linkmode,$pass"; then
8073 libs=$deplibs
8074 deplibs=
8075 fi
8076 if test prog = "$linkmode"; then
8077 case $pass in
8078 dlopen) libs=$dlfiles ;;
8079 dlpreopen) libs=$dlprefiles ;;
8080 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
8081 esac
8082 fi
8083 if test lib,dlpreopen = "$linkmode,$pass"; then
8084 # Collect and forward deplibs of preopened libtool libs
8085 for lib in $dlprefiles; do
8086 # Ignore non-libtool-libs
8087 dependency_libs=
8088 func_resolve_sysroot "$lib"
8089 case $lib in
8090 *.la) func_source "$func_resolve_sysroot_result" ;;
8091 esac
8092
8093 # Collect preopened libtool deplibs, except any this library
8094 # has declared as weak libs
8095 for deplib in $dependency_libs; do
8096 func_basename "$deplib"
8097 deplib_base=$func_basename_result
8098 case " $weak_libs " in
8099 *" $deplib_base "*) ;;
8100 *) func_append deplibs " $deplib" ;;
8101 esac
8102 done
8103 done
8104 libs=$dlprefiles
8105 fi
8106 if test dlopen = "$pass"; then
8107 # Collect dlpreopened libraries
8108 save_deplibs=$deplibs
8109 deplibs=
8110 fi
8111
8112 for deplib in $libs; do
8113 lib=
8114 found=false
8115 case $deplib in
8116 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8117 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8118 if test prog,link = "$linkmode,$pass"; then
8119 compile_deplibs="$deplib $compile_deplibs"
8120 finalize_deplibs="$deplib $finalize_deplibs"
8121 else
8122 func_append compiler_flags " $deplib"
8123 if test lib = "$linkmode"; then
8124 case "$new_inherited_linker_flags " in
8125 *" $deplib "*) ;;
8126 * ) func_append new_inherited_linker_flags " $deplib" ;;
8127 esac
8128 fi
8129 fi
8130 continue
8131 ;;
8132 -l*)
8133 if test lib != "$linkmode" && test prog != "$linkmode"; then
8134 func_warning "'-l' is ignored for archives/objects"
8135 continue
8136 fi
8137 func_stripname '-l' '' "$deplib"
8138 name=$func_stripname_result
8139 if test lib = "$linkmode"; then
8140 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8141 else
8142 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8143 fi
8144 for searchdir in $searchdirs; do
8145 for search_ext in .la $std_shrext .so .a; do
8146 # Search the libtool library
8147 lib=$searchdir/lib$name$search_ext
8148 if test -f "$lib"; then
8149 if test .la = "$search_ext"; then
8150 found=:
8151 else
8152 found=false
8153 fi
8154 break 2
8155 fi
8156 done
8157 done
8158 if $found; then
8159 # deplib is a libtool library
8160 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8161 # We need to do some special things here, and not later.
8162 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8163 case " $predeps $postdeps " in
8164 *" $deplib "*)
8165 if func_lalib_p "$lib"; then
8166 library_names=
8167 old_library=
8168 func_source "$lib"
8169 for l in $old_library $library_names; do
8170 ll=$l
8171 done
8172 if test "X$ll" = "X$old_library"; then # only static version available
8173 found=false
8174 func_dirname "$lib" "" "."
8175 ladir=$func_dirname_result
8176 lib=$ladir/$old_library
8177 if test prog,link = "$linkmode,$pass"; then
8178 compile_deplibs="$deplib $compile_deplibs"
8179 finalize_deplibs="$deplib $finalize_deplibs"
8180 else
8181 deplibs="$deplib $deplibs"
8182 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8183 fi
8184 continue
8185 fi
8186 fi
8187 ;;
8188 *) ;;
8189 esac
8190 fi
8191 else
8192 # deplib doesn't seem to be a libtool library
8193 if test prog,link = "$linkmode,$pass"; then
8194 compile_deplibs="$deplib $compile_deplibs"
8195 finalize_deplibs="$deplib $finalize_deplibs"
8196 else
8197 deplibs="$deplib $deplibs"
8198 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8199 fi
8200 continue
8201 fi
8202 ;; # -l
8203 *.ltframework)
8204 if test prog,link = "$linkmode,$pass"; then
8205 compile_deplibs="$deplib $compile_deplibs"
8206 finalize_deplibs="$deplib $finalize_deplibs"
8207 else
8208 deplibs="$deplib $deplibs"
8209 if test lib = "$linkmode"; then
8210 case "$new_inherited_linker_flags " in
8211 *" $deplib "*) ;;
8212 * ) func_append new_inherited_linker_flags " $deplib" ;;
8213 esac
8214 fi
8215 fi
8216 continue
8217 ;;
8218 -L*)
8219 case $linkmode in
8220 lib)
8221 deplibs="$deplib $deplibs"
8222 test conv = "$pass" && continue
8223 newdependency_libs="$deplib $newdependency_libs"
8224 func_stripname '-L' '' "$deplib"
8225 func_resolve_sysroot "$func_stripname_result"
8226 func_append newlib_search_path " $func_resolve_sysroot_result"
8227 ;;
8228 prog)
8229 if test conv = "$pass"; then
8230 deplibs="$deplib $deplibs"
8231 continue
8232 fi
8233 if test scan = "$pass"; then
8234 deplibs="$deplib $deplibs"
8235 else
8236 compile_deplibs="$deplib $compile_deplibs"
8237 finalize_deplibs="$deplib $finalize_deplibs"
8238 fi
8239 func_stripname '-L' '' "$deplib"
8240 func_resolve_sysroot "$func_stripname_result"
8241 func_append newlib_search_path " $func_resolve_sysroot_result"
8242 ;;
8243 *)
8244 func_warning "'-L' is ignored for archives/objects"
8245 ;;
8246 esac # linkmode
8247 continue
8248 ;; # -L
8249 -R*)
8250 if test link = "$pass"; then
8251 func_stripname '-R' '' "$deplib"
8252 func_resolve_sysroot "$func_stripname_result"
8253 dir=$func_resolve_sysroot_result
8254 # Make sure the xrpath contains only unique directories.
8255 case "$xrpath " in
8256 *" $dir "*) ;;
8257 *) func_append xrpath " $dir" ;;
8258 esac
8259 fi
8260 deplibs="$deplib $deplibs"
8261 continue
8262 ;;
8263 *.la)
8264 func_resolve_sysroot "$deplib"
8265 lib=$func_resolve_sysroot_result
8266 ;;
8267 *.$libext)
8268 if test conv = "$pass"; then
8269 deplibs="$deplib $deplibs"
8270 continue
8271 fi
8272 case $linkmode in
8273 lib)
8274 # Linking convenience modules into shared libraries is allowed,
8275 # but linking other static libraries is non-portable.
8276 case " $dlpreconveniencelibs " in
8277 *" $deplib "*) ;;
8278 *)
8279 valid_a_lib=false
8280 case $deplibs_check_method in
8281 match_pattern*)
8282 set dummy $deplibs_check_method; shift
8283 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8284 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8285 | $EGREP "$match_pattern_regex" > /dev/null; then
8286 valid_a_lib=:
8287 fi
8288 ;;
8289 pass_all)
8290 valid_a_lib=:
8291 ;;
8292 esac
8293 if $valid_a_lib; then
8294 echo
8295 $ECHO "*** Warning: Linking the shared library $output against the"
8296 $ECHO "*** static library $deplib is not portable!"
8297 deplibs="$deplib $deplibs"
8298 else
8299 echo
8300 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8301 echo "*** I have the capability to make that library automatically link in when"
8302 echo "*** you link to this library. But I can only do this if you have a"
8303 echo "*** shared version of the library, which you do not appear to have"
8304 echo "*** because the file extensions .$libext of this argument makes me believe"
8305 echo "*** that it is just a static archive that I should not use here."
8306 fi
8307 ;;
8308 esac
8309 continue
8310 ;;
8311 prog)
8312 if test link != "$pass"; then
8313 deplibs="$deplib $deplibs"
8314 else
8315 compile_deplibs="$deplib $compile_deplibs"
8316 finalize_deplibs="$deplib $finalize_deplibs"
8317 fi
8318 continue
8319 ;;
8320 esac # linkmode
8321 ;; # *.$libext
8322 *.lo | *.$objext)
8323 if test conv = "$pass"; then
8324 deplibs="$deplib $deplibs"
8325 elif test prog = "$linkmode"; then
8326 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8327 # If there is no dlopen support or we're linking statically,
8328 # we need to preload.
8329 func_append newdlprefiles " $deplib"
8330 compile_deplibs="$deplib $compile_deplibs"
8331 finalize_deplibs="$deplib $finalize_deplibs"
8332 else
8333 func_append newdlfiles " $deplib"
8334 fi
8335 fi
8336 continue
8337 ;;
8338 %DEPLIBS%)
8339 alldeplibs=:
8340 continue
8341 ;;
8342 esac # case $deplib
8343
8344 $found || test -f "$lib" \
8345 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8346
8347 # Check to see that this really is a libtool archive.
8348 func_lalib_unsafe_p "$lib" \
8349 || func_fatal_error "'$lib' is not a valid libtool archive"
8350
8351 func_dirname "$lib" "" "."
8352 ladir=$func_dirname_result
8353
8354 dlname=
8355 dlopen=
8356 dlpreopen=
8357 libdir=
8358 library_names=
8359 old_library=
8360 inherited_linker_flags=
8361 # If the library was installed with an old release of libtool,
8362 # it will not redefine variables installed, or shouldnotlink
8363 installed=yes
8364 shouldnotlink=no
8365 avoidtemprpath=
8366
8367
8368 # Read the .la file
8369 func_source "$lib"
8370
8371 # Convert "-framework foo" to "foo.ltframework"
8372 if test -n "$inherited_linker_flags"; then
8373 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8374 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8375 case " $new_inherited_linker_flags " in
8376 *" $tmp_inherited_linker_flag "*) ;;
8377 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8378 esac
8379 done
8380 fi
8381 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8382 if test lib,link = "$linkmode,$pass" ||
8383 test prog,scan = "$linkmode,$pass" ||
8384 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8385 test -n "$dlopen" && func_append dlfiles " $dlopen"
8386 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8387 fi
8388
8389 if test conv = "$pass"; then
8390 # Only check for convenience libraries
8391 deplibs="$lib $deplibs"
8392 if test -z "$libdir"; then
8393 if test -z "$old_library"; then
8394 func_fatal_error "cannot find name of link library for '$lib'"
8395 fi
8396 # It is a libtool convenience library, so add in its objects.
8397 func_append convenience " $ladir/$objdir/$old_library"
8398 func_append old_convenience " $ladir/$objdir/$old_library"
8399 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8400 func_fatal_error "'$lib' is not a convenience library"
8401 fi
8402 tmp_libs=
8403 for deplib in $dependency_libs; do
8404 deplibs="$deplib $deplibs"
8405 if $opt_preserve_dup_deps; then
8406 case "$tmp_libs " in
8407 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8408 esac
8409 fi
8410 func_append tmp_libs " $deplib"
8411 done
8412 continue
8413 fi # $pass = conv
8414
8415
8416 # Get the name of the library we link against.
8417 linklib=
8418 if test -n "$old_library" &&
8419 { test yes = "$prefer_static_libs" ||
8420 test built,no = "$prefer_static_libs,$installed"; }; then
8421 linklib=$old_library
8422 else
8423 for l in $old_library $library_names; do
8424 linklib=$l
8425 done
8426 fi
8427 if test -z "$linklib"; then
8428 func_fatal_error "cannot find name of link library for '$lib'"
8429 fi
8430
8431 # This library was specified with -dlopen.
8432 if test dlopen = "$pass"; then
8433 test -z "$libdir" \
8434 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8435 if test -z "$dlname" ||
8436 test yes != "$dlopen_support" ||
8437 test no = "$build_libtool_libs"
8438 then
8439 # If there is no dlname, no dlopen support or we're linking
8440 # statically, we need to preload. We also need to preload any
8441 # dependent libraries so libltdl's deplib preloader doesn't
8442 # bomb out in the load deplibs phase.
8443 func_append dlprefiles " $lib $dependency_libs"
8444 else
8445 func_append newdlfiles " $lib"
8446 fi
8447 continue
8448 fi # $pass = dlopen
8449
8450 # We need an absolute path.
8451 case $ladir in
8452 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8453 *)
8454 abs_ladir=`cd "$ladir" && pwd`
8455 if test -z "$abs_ladir"; then
8456 func_warning "cannot determine absolute directory name of '$ladir'"
8457 func_warning "passing it literally to the linker, although it might fail"
8458 abs_ladir=$ladir
8459 fi
8460 ;;
8461 esac
8462 func_basename "$lib"
8463 laname=$func_basename_result
8464
8465 # Find the relevant object directory and library name.
8466 if test yes = "$installed"; then
8467 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8468 func_warning "library '$lib' was moved."
8469 dir=$ladir
8470 absdir=$abs_ladir
8471 libdir=$abs_ladir
8472 else
8473 dir=$lt_sysroot$libdir
8474 absdir=$lt_sysroot$libdir
8475 fi
8476 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8477 else
8478 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8479 dir=$ladir
8480 absdir=$abs_ladir
8481 # Remove this search path later
8482 func_append notinst_path " $abs_ladir"
8483 else
8484 dir=$ladir/$objdir
8485 absdir=$abs_ladir/$objdir
8486 # Remove this search path later
8487 func_append notinst_path " $abs_ladir"
8488 fi
8489 fi # $installed = yes
8490 func_stripname 'lib' '.la' "$laname"
8491 name=$func_stripname_result
8492
8493 # This library was specified with -dlpreopen.
8494 if test dlpreopen = "$pass"; then
8495 if test -z "$libdir" && test prog = "$linkmode"; then
8496 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8497 fi
8498 case $host in
8499 # special handling for platforms with PE-DLLs.
8500 *cygwin* | *mingw* | *cegcc* )
8501 # Linker will automatically link against shared library if both
8502 # static and shared are present. Therefore, ensure we extract
8503 # symbols from the import library if a shared library is present
8504 # (otherwise, the dlopen module name will be incorrect). We do
8505 # this by putting the import library name into $newdlprefiles.
8506 # We recover the dlopen module name by 'saving' the la file
8507 # name in a special purpose variable, and (later) extracting the
8508 # dlname from the la file.
8509 if test -n "$dlname"; then
8510 func_tr_sh "$dir/$linklib"
8511 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8512 func_append newdlprefiles " $dir/$linklib"
8513 else
8514 func_append newdlprefiles " $dir/$old_library"
8515 # Keep a list of preopened convenience libraries to check
8516 # that they are being used correctly in the link pass.
8517 test -z "$libdir" && \
8518 func_append dlpreconveniencelibs " $dir/$old_library"
8519 fi
8520 ;;
8521 * )
8522 # Prefer using a static library (so that no silly _DYNAMIC symbols
8523 # are required to link).
8524 if test -n "$old_library"; then
8525 func_append newdlprefiles " $dir/$old_library"
8526 # Keep a list of preopened convenience libraries to check
8527 # that they are being used correctly in the link pass.
8528 test -z "$libdir" && \
8529 func_append dlpreconveniencelibs " $dir/$old_library"
8530 # Otherwise, use the dlname, so that lt_dlopen finds it.
8531 elif test -n "$dlname"; then
8532 func_append newdlprefiles " $dir/$dlname"
8533 else
8534 func_append newdlprefiles " $dir/$linklib"
8535 fi
8536 ;;
8537 esac
8538 fi # $pass = dlpreopen
8539
8540 if test -z "$libdir"; then
8541 # Link the convenience library
8542 if test lib = "$linkmode"; then
8543 deplibs="$dir/$old_library $deplibs"
8544 elif test prog,link = "$linkmode,$pass"; then
8545 compile_deplibs="$dir/$old_library $compile_deplibs"
8546 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8547 else
8548 deplibs="$lib $deplibs" # used for prog,scan pass
8549 fi
8550 continue
8551 fi
8552
8553
8554 if test prog = "$linkmode" && test link != "$pass"; then
8555 func_append newlib_search_path " $ladir"
8556 deplibs="$lib $deplibs"
8557
8558 linkalldeplibs=false
8559 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8560 test no = "$build_libtool_libs"; then
8561 linkalldeplibs=:
8562 fi
8563
8564 tmp_libs=
8565 for deplib in $dependency_libs; do
8566 case $deplib in
8567 -L*) func_stripname '-L' '' "$deplib"
8568 func_resolve_sysroot "$func_stripname_result"
8569 func_append newlib_search_path " $func_resolve_sysroot_result"
8570 ;;
8571 esac
8572 # Need to link against all dependency_libs?
8573 if $linkalldeplibs; then
8574 deplibs="$deplib $deplibs"
8575 else
8576 # Need to hardcode shared library paths
8577 # or/and link against static libraries
8578 newdependency_libs="$deplib $newdependency_libs"
8579 fi
8580 if $opt_preserve_dup_deps; then
8581 case "$tmp_libs " in
8582 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8583 esac
8584 fi
8585 func_append tmp_libs " $deplib"
8586 done # for deplib
8587 continue
8588 fi # $linkmode = prog...
8589
8590 if test prog,link = "$linkmode,$pass"; then
8591 if test -n "$library_names" &&
8592 { { test no = "$prefer_static_libs" ||
8593 test built,yes = "$prefer_static_libs,$installed"; } ||
8594 test -z "$old_library"; }; then
8595 # We need to hardcode the library path
8596 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8597 # Make sure the rpath contains only unique directories.
8598 case $temp_rpath: in
8599 *"$absdir:"*) ;;
8600 *) func_append temp_rpath "$absdir:" ;;
8601 esac
8602 fi
8603
8604 # Hardcode the library path.
8605 # Skip directories that are in the system default run-time
8606 # search path.
8607 case " $sys_lib_dlsearch_path " in
8608 *" $absdir "*) ;;
8609 *)
8610 case "$compile_rpath " in
8611 *" $absdir "*) ;;
8612 *) func_append compile_rpath " $absdir" ;;
8613 esac
8614 ;;
8615 esac
8616 case " $sys_lib_dlsearch_path " in
8617 *" $libdir "*) ;;
8618 *)
8619 case "$finalize_rpath " in
8620 *" $libdir "*) ;;
8621 *) func_append finalize_rpath " $libdir" ;;
8622 esac
8623 ;;
8624 esac
8625 fi # $linkmode,$pass = prog,link...
8626
8627 if $alldeplibs &&
8628 { test pass_all = "$deplibs_check_method" ||
8629 { test yes = "$build_libtool_libs" &&
8630 test -n "$library_names"; }; }; then
8631 # We only need to search for static libraries
8632 continue
8633 fi
8634 fi
8635
8636 link_static=no # Whether the deplib will be linked statically
8637 use_static_libs=$prefer_static_libs
8638 if test built = "$use_static_libs" && test yes = "$installed"; then
8639 use_static_libs=no
8640 fi
8641 if test -n "$library_names" &&
8642 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8643 case $host in
8644 *cygwin* | *mingw* | *cegcc* | *os2*)
8645 # No point in relinking DLLs because paths are not encoded
8646 func_append notinst_deplibs " $lib"
8647 need_relink=no
8648 ;;
8649 *)
8650 if test no = "$installed"; then
8651 func_append notinst_deplibs " $lib"
8652 need_relink=yes
8653 fi
8654 ;;
8655 esac
8656 # This is a shared library
8657
8658 # Warn about portability, can't link against -module's on some
8659 # systems (darwin). Don't bleat about dlopened modules though!
8660 dlopenmodule=
8661 for dlpremoduletest in $dlprefiles; do
8662 if test "X$dlpremoduletest" = "X$lib"; then
8663 dlopenmodule=$dlpremoduletest
8664 break
8665 fi
8666 done
8667 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8668 echo
8669 if test prog = "$linkmode"; then
8670 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8671 else
8672 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8673 fi
8674 $ECHO "*** $linklib is not portable!"
8675 fi
8676 if test lib = "$linkmode" &&
8677 test yes = "$hardcode_into_libs"; then
8678 # Hardcode the library path.
8679 # Skip directories that are in the system default run-time
8680 # search path.
8681 case " $sys_lib_dlsearch_path " in
8682 *" $absdir "*) ;;
8683 *)
8684 case "$compile_rpath " in
8685 *" $absdir "*) ;;
8686 *) func_append compile_rpath " $absdir" ;;
8687 esac
8688 ;;
8689 esac
8690 case " $sys_lib_dlsearch_path " in
8691 *" $libdir "*) ;;
8692 *)
8693 case "$finalize_rpath " in
8694 *" $libdir "*) ;;
8695 *) func_append finalize_rpath " $libdir" ;;
8696 esac
8697 ;;
8698 esac
8699 fi
8700
8701 if test -n "$old_archive_from_expsyms_cmds"; then
8702 # figure out the soname
8703 set dummy $library_names
8704 shift
8705 realname=$1
8706 shift
8707 libname=`eval "\\$ECHO \"$libname_spec\""`
8708 # use dlname if we got it. it's perfectly good, no?
8709 if test -n "$dlname"; then
8710 soname=$dlname
8711 elif test -n "$soname_spec"; then
8712 # bleh windows
8713 case $host in
8714 *cygwin* | mingw* | *cegcc* | *os2*)
8715 func_arith $current - $age
8716 major=$func_arith_result
8717 versuffix=-$major
8718 ;;
8719 esac
8720 eval soname=\"$soname_spec\"
8721 else
8722 soname=$realname
8723 fi
8724
8725 # Make a new name for the extract_expsyms_cmds to use
8726 soroot=$soname
8727 func_basename "$soroot"
8728 soname=$func_basename_result
8729 func_stripname 'lib' '.dll' "$soname"
8730 newlib=libimp-$func_stripname_result.a
8731
8732 # If the library has no export list, then create one now
8733 if test -f "$output_objdir/$soname-def"; then :
8734 else
8735 func_verbose "extracting exported symbol list from '$soname'"
8736 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8737 fi
8738
8739 # Create $newlib
8740 if test -f "$output_objdir/$newlib"; then :; else
8741 func_verbose "generating import library for '$soname'"
8742 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8743 fi
8744 # make sure the library variables are pointing to the new library
8745 dir=$output_objdir
8746 linklib=$newlib
8747 fi # test -n "$old_archive_from_expsyms_cmds"
8748
8749 if :; then
8750 add_shlibpath=
8751 add_dir=
8752 add=
8753 lib_linked=yes
8754 case $hardcode_action in
8755 immediate | unsupported)
8756 if test no = "$hardcode_direct"; then
8757 add=$dir/$linklib
8758 case $host in
8759 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8760 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8761 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8762 *-*-unixware7*) add_dir=-L$dir ;;
8763 *-*-darwin* )
8764 # if the lib is a (non-dlopened) module then we cannot
8765 # link against it, someone is ignoring the earlier warnings
8766 if /usr/bin/file -L $add 2> /dev/null |
8767 $GREP ": [^:]* bundle" >/dev/null; then
8768 if test "X$dlopenmodule" != "X$lib"; then
8769 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8770 if test -z "$old_library"; then
8771 echo
8772 echo "*** And there doesn't seem to be a static archive available"
8773 echo "*** The link will probably fail, sorry"
8774 else
8775 add=$dir/$old_library
8776 fi
8777 elif test -n "$old_library"; then
8778 add=$dir/$old_library
8779 fi
8780 fi
8781 esac
8782 elif test no = "$hardcode_minus_L"; then
8783 case $host in
8784 *-*-sunos*) add_shlibpath=$dir ;;
8785 esac
8786 add_dir=-L$dir
8787 add=-l$name
8788 elif test no = "$hardcode_shlibpath_var"; then
8789 add_shlibpath=$dir
8790 add=-l$name
8791 else
8792 lib_linked=no
8793 fi
8794 ;;
8795 relink)
8796 if test yes = "$hardcode_direct" &&
8797 test no = "$hardcode_direct_absolute"; then
8798 add=$dir/$linklib
8799 elif test yes = "$hardcode_minus_L"; then
8800 add_dir=-L$absdir
8801 # Try looking first in the location we're being installed to.
8802 if test -n "$inst_prefix_dir"; then
8803 case $libdir in
8804 [\\/]*)
8805 func_append add_dir " -L$inst_prefix_dir$libdir"
8806 ;;
8807 esac
8808 fi
8809 add=-l$name
8810 elif test yes = "$hardcode_shlibpath_var"; then
8811 add_shlibpath=$dir
8812 add=-l$name
8813 else
8814 lib_linked=no
8815 fi
8816 ;;
8817 *) lib_linked=no ;;
8818 esac
8819
8820 if test yes != "$lib_linked"; then
8821 func_fatal_configuration "unsupported hardcode properties"
8822 fi
8823
8824 if test -n "$add_shlibpath"; then
8825 case :$compile_shlibpath: in
8826 *":$add_shlibpath:"*) ;;
8827 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8828 esac
8829 fi
8830 if test prog = "$linkmode"; then
8831 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8832 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8833 else
8834 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8835 test -n "$add" && deplibs="$add $deplibs"
8836 if test yes != "$hardcode_direct" &&
8837 test yes != "$hardcode_minus_L" &&
8838 test yes = "$hardcode_shlibpath_var"; then
8839 case :$finalize_shlibpath: in
8840 *":$libdir:"*) ;;
8841 *) func_append finalize_shlibpath "$libdir:" ;;
8842 esac
8843 fi
8844 fi
8845 fi
8846
8847 if test prog = "$linkmode" ; then
8848 add_shlibpath=
8849 add_dir=
8850 add=
8851 # Finalize command for both is simple: just hardcode it.
8852 if test yes = "$hardcode_direct" &&
8853 test no = "$hardcode_direct_absolute"; then
8854 add=$libdir/$linklib
8855 elif test yes = "$hardcode_minus_L"; then
8856 add_dir=-L$libdir
8857 add=-l$name
8858 elif test yes = "$hardcode_shlibpath_var"; then
8859 case :$finalize_shlibpath: in
8860 *":$libdir:"*) ;;
8861 *) func_append finalize_shlibpath "$libdir:" ;;
8862 esac
8863 add=-l$name
8864 elif test yes = "$hardcode_automatic"; then
8865 if test -n "$inst_prefix_dir" &&
8866 test -f "$inst_prefix_dir$libdir/$linklib"; then
8867 add=$inst_prefix_dir$libdir/$linklib
8868 else
8869 add=$libdir/$linklib
8870 fi
8871 else
8872 # We cannot seem to hardcode it, guess we'll fake it.
8873 add_dir=-L$libdir
8874 # Try looking first in the location we're being installed to.
8875 if test -n "$inst_prefix_dir"; then
8876 case $libdir in
8877 [\\/]*)
8878 func_append add_dir " -L$inst_prefix_dir$libdir"
8879 ;;
8880 esac
8881 fi
8882 add=-l$name
8883 fi
8884
8885 if test prog = "$linkmode"; then
8886 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8887 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8888 else
8889 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8890 test -n "$add" && deplibs="$add $deplibs"
8891 fi
8892 fi
8893 elif test prog = "$linkmode"; then
8894 # Here we assume that one of hardcode_direct or hardcode_minus_L
8895 # is not unsupported. This is valid on all known static and
8896 # shared platforms.
8897 if test unsupported != "$hardcode_direct"; then
8898 test -n "$old_library" && linklib=$old_library
8899 compile_deplibs="$dir/$linklib $compile_deplibs"
8900 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8901 else
8902 compile_deplibs="-l$name -L$dir $compile_deplibs"
8903 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8904 fi
8905 elif test yes = "$build_libtool_libs"; then
8906 # Not a shared library
8907 if test pass_all != "$deplibs_check_method"; then
8908 # We're trying link a shared library against a static one
8909 # but the system doesn't support it.
8910
8911 # Just print a warning and add the library to dependency_libs so
8912 # that the program can be linked against the static library.
8913 echo
8914 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8915 echo "*** I have the capability to make that library automatically link in when"
8916 echo "*** you link to this library. But I can only do this if you have a"
8917 echo "*** shared version of the library, which you do not appear to have."
8918 if test yes = "$module"; then
8919 echo "*** But as you try to build a module library, libtool will still create "
8920 echo "*** a static module, that should work as long as the dlopening application"
8921 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8922 if test -z "$global_symbol_pipe"; then
8923 echo
8924 echo "*** However, this would only work if libtool was able to extract symbol"
8925 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8926 echo "*** not find such a program. So, this module is probably useless."
8927 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8928 fi
8929 if test no = "$build_old_libs"; then
8930 build_libtool_libs=module
8931 build_old_libs=yes
8932 else
8933 build_libtool_libs=no
8934 fi
8935 fi
8936 else
8937 deplibs="$dir/$old_library $deplibs"
8938 link_static=yes
8939 fi
8940 fi # link shared/static library?
8941
8942 if test lib = "$linkmode"; then
8943 if test -n "$dependency_libs" &&
8944 { test yes != "$hardcode_into_libs" ||
8945 test yes = "$build_old_libs" ||
8946 test yes = "$link_static"; }; then
8947 # Extract -R from dependency_libs
8948 temp_deplibs=
8949 for libdir in $dependency_libs; do
8950 case $libdir in
8951 -R*) func_stripname '-R' '' "$libdir"
8952 temp_xrpath=$func_stripname_result
8953 case " $xrpath " in
8954 *" $temp_xrpath "*) ;;
8955 *) func_append xrpath " $temp_xrpath";;
8956 esac;;
8957 *) func_append temp_deplibs " $libdir";;
8958 esac
8959 done
8960 dependency_libs=$temp_deplibs
8961 fi
8962
8963 func_append newlib_search_path " $absdir"
8964 # Link against this library
8965 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8966 # ... and its dependency_libs
8967 tmp_libs=
8968 for deplib in $dependency_libs; do
8969 newdependency_libs="$deplib $newdependency_libs"
8970 case $deplib in
8971 -L*) func_stripname '-L' '' "$deplib"
8972 func_resolve_sysroot "$func_stripname_result";;
8973 *) func_resolve_sysroot "$deplib" ;;
8974 esac
8975 if $opt_preserve_dup_deps; then
8976 case "$tmp_libs " in
8977 *" $func_resolve_sysroot_result "*)
8978 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8979 esac
8980 fi
8981 func_append tmp_libs " $func_resolve_sysroot_result"
8982 done
8983
8984 if test no != "$link_all_deplibs"; then
8985 # Add the search paths of all dependency libraries
8986 for deplib in $dependency_libs; do
8987 path=
8988 case $deplib in
8989 -L*) path=$deplib ;;
8990 *.la)
8991 func_resolve_sysroot "$deplib"
8992 deplib=$func_resolve_sysroot_result
8993 func_dirname "$deplib" "" "."
8994 dir=$func_dirname_result
8995 # We need an absolute path.
8996 case $dir in
8997 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8998 *)
8999 absdir=`cd "$dir" && pwd`
9000 if test -z "$absdir"; then
9001 func_warning "cannot determine absolute directory name of '$dir'"
9002 absdir=$dir
9003 fi
9004 ;;
9005 esac
9006 if $GREP "^installed=no" $deplib > /dev/null; then
9007 case $host in
9008 *-*-darwin*)
9009 depdepl=
9010 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9011 if test -n "$deplibrary_names"; then
9012 for tmp in $deplibrary_names; do
9013 depdepl=$tmp
9014 done
9015 if test -f "$absdir/$objdir/$depdepl"; then
9016 depdepl=$absdir/$objdir/$depdepl
9017 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9018 if test -z "$darwin_install_name"; then
9019 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9020 fi
9021 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9022 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9023 path=
9024 fi
9025 fi
9026 ;;
9027 *)
9028 path=-L$absdir/$objdir
9029 ;;
9030 esac
9031 else
9032 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9033 test -z "$libdir" && \
9034 func_fatal_error "'$deplib' is not a valid libtool archive"
9035 test "$absdir" != "$libdir" && \
9036 func_warning "'$deplib' seems to be moved"
9037
9038 path=-L$absdir
9039 fi
9040 ;;
9041 esac
9042 case " $deplibs " in
9043 *" $path "*) ;;
9044 *) deplibs="$path $deplibs" ;;
9045 esac
9046 done
9047 fi # link_all_deplibs != no
9048 fi # linkmode = lib
9049 done # for deplib in $libs
9050 if test link = "$pass"; then
9051 if test prog = "$linkmode"; then
9052 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9053 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9054 else
9055 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9056 fi
9057 fi
9058 dependency_libs=$newdependency_libs
9059 if test dlpreopen = "$pass"; then
9060 # Link the dlpreopened libraries before other libraries
9061 for deplib in $save_deplibs; do
9062 deplibs="$deplib $deplibs"
9063 done
9064 fi
9065 if test dlopen != "$pass"; then
9066 test conv = "$pass" || {
9067 # Make sure lib_search_path contains only unique directories.
9068 lib_search_path=
9069 for dir in $newlib_search_path; do
9070 case "$lib_search_path " in
9071 *" $dir "*) ;;
9072 *) func_append lib_search_path " $dir" ;;
9073 esac
9074 done
9075 newlib_search_path=
9076 }
9077
9078 if test prog,link = "$linkmode,$pass"; then
9079 vars="compile_deplibs finalize_deplibs"
9080 else
9081 vars=deplibs
9082 fi
9083 for var in $vars dependency_libs; do
9084 # Add libraries to $var in reverse order
9085 eval tmp_libs=\"\$$var\"
9086 new_libs=
9087 for deplib in $tmp_libs; do
9088 # FIXME: Pedantically, this is the right thing to do, so
9089 # that some nasty dependency loop isn't accidentally
9090 # broken:
9091 #new_libs="$deplib $new_libs"
9092 # Pragmatically, this seems to cause very few problems in
9093 # practice:
9094 case $deplib in
9095 -L*) new_libs="$deplib $new_libs" ;;
9096 -R*) ;;
9097 *)
9098 # And here is the reason: when a library appears more
9099 # than once as an explicit dependence of a library, or
9100 # is implicitly linked in more than once by the
9101 # compiler, it is considered special, and multiple
9102 # occurrences thereof are not removed. Compare this
9103 # with having the same library being listed as a
9104 # dependency of multiple other libraries: in this case,
9105 # we know (pedantically, we assume) the library does not
9106 # need to be listed more than once, so we keep only the
9107 # last copy. This is not always right, but it is rare
9108 # enough that we require users that really mean to play
9109 # such unportable linking tricks to link the library
9110 # using -Wl,-lname, so that libtool does not consider it
9111 # for duplicate removal.
9112 case " $specialdeplibs " in
9113 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9114 *)
9115 case " $new_libs " in
9116 *" $deplib "*) ;;
9117 *) new_libs="$deplib $new_libs" ;;
9118 esac
9119 ;;
9120 esac
9121 ;;
9122 esac
9123 done
9124 tmp_libs=
9125 for deplib in $new_libs; do
9126 case $deplib in
9127 -L*)
9128 case " $tmp_libs " in
9129 *" $deplib "*) ;;
9130 *) func_append tmp_libs " $deplib" ;;
9131 esac
9132 ;;
9133 *) func_append tmp_libs " $deplib" ;;
9134 esac
9135 done
9136 eval $var=\"$tmp_libs\"
9137 done # for var
9138 fi
9139
9140 # Add Sun CC postdeps if required:
9141 test CXX = "$tagname" && {
9142 case $host_os in
9143 linux*)
9144 case `$CC -V 2>&1 | sed 5q` in
9145 *Sun\ C*) # Sun C++ 5.9
9146 func_suncc_cstd_abi
9147
9148 if test no != "$suncc_use_cstd_abi"; then
9149 func_append postdeps ' -library=Cstd -library=Crun'
9150 fi
9151 ;;
9152 esac
9153 ;;
9154
9155 solaris*)
9156 func_cc_basename "$CC"
9157 case $func_cc_basename_result in
9158 CC* | sunCC*)
9159 func_suncc_cstd_abi
9160
9161 if test no != "$suncc_use_cstd_abi"; then
9162 func_append postdeps ' -library=Cstd -library=Crun'
9163 fi
9164 ;;
9165 esac
9166 ;;
9167 esac
9168 }
9169
9170 # Last step: remove runtime libs from dependency_libs
9171 # (they stay in deplibs)
9172 tmp_libs=
9173 for i in $dependency_libs; do
9174 case " $predeps $postdeps $compiler_lib_search_path " in
9175 *" $i "*)
9176 i=
9177 ;;
9178 esac
9179 if test -n "$i"; then
9180 func_append tmp_libs " $i"
9181 fi
9182 done
9183 dependency_libs=$tmp_libs
9184 done # for pass
9185 if test prog = "$linkmode"; then
9186 dlfiles=$newdlfiles
9187 fi
9188 if test prog = "$linkmode" || test lib = "$linkmode"; then
9189 dlprefiles=$newdlprefiles
9190 fi
9191
9192 case $linkmode in
9193 oldlib)
9194 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9195 func_warning "'-dlopen' is ignored for archives"
9196 fi
9197
9198 case " $deplibs" in
9199 *\ -l* | *\ -L*)
9200 func_warning "'-l' and '-L' are ignored for archives" ;;
9201 esac
9202
9203 test -n "$rpath" && \
9204 func_warning "'-rpath' is ignored for archives"
9205
9206 test -n "$xrpath" && \
9207 func_warning "'-R' is ignored for archives"
9208
9209 test -n "$vinfo" && \
9210 func_warning "'-version-info/-version-number' is ignored for archives"
9211
9212 test -n "$release" && \
9213 func_warning "'-release' is ignored for archives"
9214
9215 test -n "$export_symbols$export_symbols_regex" && \
9216 func_warning "'-export-symbols' is ignored for archives"
9217
9218 # Now set the variables for building old libraries.
9219 build_libtool_libs=no
9220 oldlibs=$output
9221 func_append objs "$old_deplibs"
9222 ;;
9223
9224 lib)
9225 # Make sure we only generate libraries of the form 'libNAME.la'.
9226 case $outputname in
9227 lib*)
9228 func_stripname 'lib' '.la' "$outputname"
9229 name=$func_stripname_result
9230 eval shared_ext=\"$shrext_cmds\"
9231 eval libname=\"$libname_spec\"
9232 ;;
9233 *)
9234 test no = "$module" \
9235 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9236
9237 if test no != "$need_lib_prefix"; then
9238 # Add the "lib" prefix for modules if required
9239 func_stripname '' '.la' "$outputname"
9240 name=$func_stripname_result
9241 eval shared_ext=\"$shrext_cmds\"
9242 eval libname=\"$libname_spec\"
9243 else
9244 func_stripname '' '.la' "$outputname"
9245 libname=$func_stripname_result
9246 fi
9247 ;;
9248 esac
9249
9250 if test -n "$objs"; then
9251 if test pass_all != "$deplibs_check_method"; then
9252 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9253 else
9254 echo
9255 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9256 $ECHO "*** objects $objs is not portable!"
9257 func_append libobjs " $objs"
9258 fi
9259 fi
9260
9261 test no = "$dlself" \
9262 || func_warning "'-dlopen self' is ignored for libtool libraries"
9263
9264 set dummy $rpath
9265 shift
9266 test 1 -lt "$#" \
9267 && func_warning "ignoring multiple '-rpath's for a libtool library"
9268
9269 install_libdir=$1
9270
9271 oldlibs=
9272 if test -z "$rpath"; then
9273 if test yes = "$build_libtool_libs"; then
9274 # Building a libtool convenience library.
9275 # Some compilers have problems with a '.al' extension so
9276 # convenience libraries should have the same extension an
9277 # archive normally would.
9278 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9279 build_libtool_libs=convenience
9280 build_old_libs=yes
9281 fi
9282
9283 test -n "$vinfo" && \
9284 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9285
9286 test -n "$release" && \
9287 func_warning "'-release' is ignored for convenience libraries"
9288 else
9289
9290 # Parse the version information argument.
9291 save_ifs=$IFS; IFS=:
9292 set dummy $vinfo 0 0 0
9293 shift
9294 IFS=$save_ifs
9295
9296 test -n "$7" && \
9297 func_fatal_help "too many parameters to '-version-info'"
9298
9299 # convert absolute version numbers to libtool ages
9300 # this retains compatibility with .la files and attempts
9301 # to make the code below a bit more comprehensible
9302
9303 case $vinfo_number in
9304 yes)
9305 number_major=$1
9306 number_minor=$2
9307 number_revision=$3
9308 #
9309 # There are really only two kinds -- those that
9310 # use the current revision as the major version
9311 # and those that subtract age and use age as
9312 # a minor version. But, then there is irix
9313 # that has an extra 1 added just for fun
9314 #
9315 case $version_type in
9316 # correct linux to gnu/linux during the next big refactor
9317 darwin|freebsd-elf|linux|osf|windows|none)
9318 func_arith $number_major + $number_minor
9319 current=$func_arith_result
9320 age=$number_minor
9321 revision=$number_revision
9322 ;;
9323 freebsd-aout|qnx|sunos)
9324 current=$number_major
9325 revision=$number_minor
9326 age=0
9327 ;;
9328 irix|nonstopux)
9329 func_arith $number_major + $number_minor
9330 current=$func_arith_result
9331 age=$number_minor
9332 revision=$number_minor
9333 lt_irix_increment=no
9334 ;;
9335 esac
9336 ;;
9337 no)
9338 current=$1
9339 revision=$2
9340 age=$3
9341 ;;
9342 esac
9343
9344 # Check that each of the things are valid numbers.
9345 case $current in
9346 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9347 *)
9348 func_error "CURRENT '$current' must be a nonnegative integer"
9349 func_fatal_error "'$vinfo' is not valid version information"
9350 ;;
9351 esac
9352
9353 case $revision in
9354 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9355 *)
9356 func_error "REVISION '$revision' must be a nonnegative integer"
9357 func_fatal_error "'$vinfo' is not valid version information"
9358 ;;
9359 esac
9360
9361 case $age in
9362 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9363 *)
9364 func_error "AGE '$age' must be a nonnegative integer"
9365 func_fatal_error "'$vinfo' is not valid version information"
9366 ;;
9367 esac
9368
9369 if test "$age" -gt "$current"; then
9370 func_error "AGE '$age' is greater than the current interface number '$current'"
9371 func_fatal_error "'$vinfo' is not valid version information"
9372 fi
9373
9374 # Calculate the version variables.
9375 major=
9376 versuffix=
9377 verstring=
9378 case $version_type in
9379 none) ;;
9380
9381 darwin)
9382 # Like Linux, but with the current version available in
9383 # verstring for coding it into the library header
9384 func_arith $current - $age
9385 major=.$func_arith_result
9386 versuffix=$major.$age.$revision
9387 # Darwin ld doesn't like 0 for these options...
9388 func_arith $current + 1
9389 minor_current=$func_arith_result
9390 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9391 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9392 # On Darwin other compilers
9393 case $CC in
9394 nagfor*)
9395 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9396 ;;
9397 *)
9398 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9399 ;;
9400 esac
9401 ;;
9402
9403 freebsd-aout)
9404 major=.$current
9405 versuffix=.$current.$revision
9406 ;;
9407
9408 freebsd-elf)
9409 func_arith $current - $age
9410 major=.$(($current - $age))
9411 versuffix=$major.$age.$revision
9412 ;;
9413
9414 irix | nonstopux)
9415 if test no = "$lt_irix_increment"; then
9416 func_arith $current - $age
9417 else
9418 func_arith $current - $age + 1
9419 fi
9420 major=$func_arith_result
9421
9422 case $version_type in
9423 nonstopux) verstring_prefix=nonstopux ;;
9424 *) verstring_prefix=sgi ;;
9425 esac
9426 verstring=$verstring_prefix$major.$revision
9427
9428 # Add in all the interfaces that we are compatible with.
9429 loop=$revision
9430 while test 0 -ne "$loop"; do
9431 func_arith $revision - $loop
9432 iface=$func_arith_result
9433 func_arith $loop - 1
9434 loop=$func_arith_result
9435 verstring=$verstring_prefix$major.$iface:$verstring
9436 done
9437
9438 # Before this point, $major must not contain '.'.
9439 major=.$major
9440 versuffix=$major.$revision
9441 ;;
9442
9443 linux) # correct to gnu/linux during the next big refactor
9444 func_arith $current - $age
9445 major=.$func_arith_result
9446 versuffix=$major.$age.$revision
9447 ;;
9448
9449 osf)
9450 func_arith $current - $age
9451 major=.$func_arith_result
9452 versuffix=.$current.$age.$revision
9453 verstring=$current.$age.$revision
9454
9455 # Add in all the interfaces that we are compatible with.
9456 loop=$age
9457 while test 0 -ne "$loop"; do
9458 func_arith $current - $loop
9459 iface=$func_arith_result
9460 func_arith $loop - 1
9461 loop=$func_arith_result
9462 verstring=$verstring:$iface.0
9463 done
9464
9465 # Make executables depend on our current version.
9466 func_append verstring ":$current.0"
9467 ;;
9468
9469 qnx)
9470 major=.$current
9471 versuffix=.$current
9472 ;;
9473
9474 sco)
9475 major=.$current
9476 versuffix=.$current
9477 ;;
9478
9479 sunos)
9480 major=.$current
9481 versuffix=.$current.$revision
9482 ;;
9483
9484 windows)
9485 # Use '-' rather than '.', since we only want one
9486 # extension on DOS 8.3 file systems.
9487 func_arith $current - $age
9488 major=$func_arith_result
9489 versuffix=-$major
9490 ;;
9491
9492 *)
9493 func_fatal_configuration "unknown library version type '$version_type'"
9494 ;;
9495 esac
9496
9497 # Clear the version info if we defaulted, and they specified a release.
9498 if test -z "$vinfo" && test -n "$release"; then
9499 major=
9500 case $version_type in
9501 darwin)
9502 # we can't check for "0.0" in archive_cmds due to quoting
9503 # problems, so we reset it completely
9504 verstring=
9505 ;;
9506 *)
9507 verstring=0.0
9508 ;;
9509 esac
9510 if test no = "$need_version"; then
9511 versuffix=
9512 else
9513 versuffix=.0.0
9514 fi
9515 fi
9516
9517 # Remove version info from name if versioning should be avoided
9518 if test yes,no = "$avoid_version,$need_version"; then
9519 major=
9520 versuffix=
9521 verstring=
9522 fi
9523
9524 # Check to see if the archive will have undefined symbols.
9525 if test yes = "$allow_undefined"; then
9526 if test unsupported = "$allow_undefined_flag"; then
9527 if test yes = "$build_old_libs"; then
9528 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9529 build_libtool_libs=no
9530 else
9531 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9532 fi
9533 fi
9534 else
9535 # Don't allow undefined symbols.
9536 allow_undefined_flag=$no_undefined_flag
9537 fi
9538
9539 fi
9540
9541 func_generate_dlsyms "$libname" "$libname" :
9542 func_append libobjs " $symfileobj"
9543 test " " = "$libobjs" && libobjs=
9544
9545 if test relink != "$opt_mode"; then
9546 # Remove our outputs, but don't remove object files since they
9547 # may have been created when compiling PIC objects.
9548 removelist=
9549 tempremovelist=`$ECHO "$output_objdir/*"`
9550 for p in $tempremovelist; do
9551 case $p in
9552 *.$objext | *.gcno)
9553 ;;
9554 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9555 if test -n "$precious_files_regex"; then
9556 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9557 then
9558 continue
9559 fi
9560 fi
9561 func_append removelist " $p"
9562 ;;
9563 *) ;;
9564 esac
9565 done
9566 test -n "$removelist" && \
9567 func_show_eval "${RM}r \$removelist"
9568 fi
9569
9570 # Now set the variables for building old libraries.
9571 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9572 func_append oldlibs " $output_objdir/$libname.$libext"
9573
9574 # Transform .lo files to .o files.
9575 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9576 fi
9577
9578 # Eliminate all temporary directories.
9579 #for path in $notinst_path; do
9580 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9581 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9582 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9583 #done
9584
9585 if test -n "$xrpath"; then
9586 # If the user specified any rpath flags, then add them.
9587 temp_xrpath=
9588 for libdir in $xrpath; do
9589 func_replace_sysroot "$libdir"
9590 func_append temp_xrpath " -R$func_replace_sysroot_result"
9591 case "$finalize_rpath " in
9592 *" $libdir "*) ;;
9593 *) func_append finalize_rpath " $libdir" ;;
9594 esac
9595 done
9596 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9597 dependency_libs="$temp_xrpath $dependency_libs"
9598 fi
9599 fi
9600
9601 # Make sure dlfiles contains only unique files that won't be dlpreopened
9602 old_dlfiles=$dlfiles
9603 dlfiles=
9604 for lib in $old_dlfiles; do
9605 case " $dlprefiles $dlfiles " in
9606 *" $lib "*) ;;
9607 *) func_append dlfiles " $lib" ;;
9608 esac
9609 done
9610
9611 # Make sure dlprefiles contains only unique files
9612 old_dlprefiles=$dlprefiles
9613 dlprefiles=
9614 for lib in $old_dlprefiles; do
9615 case "$dlprefiles " in
9616 *" $lib "*) ;;
9617 *) func_append dlprefiles " $lib" ;;
9618 esac
9619 done
9620
9621 if test yes = "$build_libtool_libs"; then
9622 if test -n "$rpath"; then
9623 case $host in
9624 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9625 # these systems don't actually have a c library (as such)!
9626 ;;
9627 *-*-rhapsody* | *-*-darwin1.[012])
9628 # Rhapsody C library is in the System framework
9629 func_append deplibs " System.ltframework"
9630 ;;
9631 *-*-netbsd*)
9632 # Don't link with libc until the a.out ld.so is fixed.
9633 ;;
9634 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9635 # Do not include libc due to us having libc/libc_r.
9636 ;;
9637 *-*-sco3.2v5* | *-*-sco5v6*)
9638 # Causes problems with __ctype
9639 ;;
9640 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9641 # Compiler inserts libc in the correct place for threads to work
9642 ;;
9643 *)
9644 # Add libc to deplibs on all other systems if necessary.
9645 if test yes = "$build_libtool_need_lc"; then
9646 func_append deplibs " -lc"
9647 fi
9648 ;;
9649 esac
9650 fi
9651
9652 # Transform deplibs into only deplibs that can be linked in shared.
9653 name_save=$name
9654 libname_save=$libname
9655 release_save=$release
9656 versuffix_save=$versuffix
9657 major_save=$major
9658 # I'm not sure if I'm treating the release correctly. I think
9659 # release should show up in the -l (ie -lgmp5) so we don't want to
9660 # add it in twice. Is that correct?
9661 release=
9662 versuffix=
9663 major=
9664 newdeplibs=
9665 droppeddeps=no
9666 case $deplibs_check_method in
9667 pass_all)
9668 # Don't check for shared/static. Everything works.
9669 # This might be a little naive. We might want to check
9670 # whether the library exists or not. But this is on
9671 # osf3 & osf4 and I'm not really sure... Just
9672 # implementing what was already the behavior.
9673 newdeplibs=$deplibs
9674 ;;
9675 test_compile)
9676 # This code stresses the "libraries are programs" paradigm to its
9677 # limits. Maybe even breaks it. We compile a program, linking it
9678 # against the deplibs as a proxy for the library. Then we can check
9679 # whether they linked in statically or dynamically with ldd.
9680 $opt_dry_run || $RM conftest.c
9681 cat > conftest.c <<EOF
9682 int main() { return 0; }
9683EOF
9684 $opt_dry_run || $RM conftest
9685 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9686 ldd_output=`ldd conftest`
9687 for i in $deplibs; do
9688 case $i in
9689 -l*)
9690 func_stripname -l '' "$i"
9691 name=$func_stripname_result
9692 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9693 case " $predeps $postdeps " in
9694 *" $i "*)
9695 func_append newdeplibs " $i"
9696 i=
9697 ;;
9698 esac
9699 fi
9700 if test -n "$i"; then
9701 libname=`eval "\\$ECHO \"$libname_spec\""`
9702 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9703 set dummy $deplib_matches; shift
9704 deplib_match=$1
9705 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9706 func_append newdeplibs " $i"
9707 else
9708 droppeddeps=yes
9709 echo
9710 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9711 echo "*** I have the capability to make that library automatically link in when"
9712 echo "*** you link to this library. But I can only do this if you have a"
9713 echo "*** shared version of the library, which I believe you do not have"
9714 echo "*** because a test_compile did reveal that the linker did not use it for"
9715 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9716 fi
9717 fi
9718 ;;
9719 *)
9720 func_append newdeplibs " $i"
9721 ;;
9722 esac
9723 done
9724 else
9725 # Error occurred in the first compile. Let's try to salvage
9726 # the situation: Compile a separate program for each library.
9727 for i in $deplibs; do
9728 case $i in
9729 -l*)
9730 func_stripname -l '' "$i"
9731 name=$func_stripname_result
9732 $opt_dry_run || $RM conftest
9733 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9734 ldd_output=`ldd conftest`
9735 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9736 case " $predeps $postdeps " in
9737 *" $i "*)
9738 func_append newdeplibs " $i"
9739 i=
9740 ;;
9741 esac
9742 fi
9743 if test -n "$i"; then
9744 libname=`eval "\\$ECHO \"$libname_spec\""`
9745 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9746 set dummy $deplib_matches; shift
9747 deplib_match=$1
9748 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9749 func_append newdeplibs " $i"
9750 else
9751 droppeddeps=yes
9752 echo
9753 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9754 echo "*** I have the capability to make that library automatically link in when"
9755 echo "*** you link to this library. But I can only do this if you have a"
9756 echo "*** shared version of the library, which you do not appear to have"
9757 echo "*** because a test_compile did reveal that the linker did not use this one"
9758 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9759 fi
9760 fi
9761 else
9762 droppeddeps=yes
9763 echo
9764 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9765 echo "*** make it link in! You will probably need to install it or some"
9766 echo "*** library that it depends on before this library will be fully"
9767 echo "*** functional. Installing it before continuing would be even better."
9768 fi
9769 ;;
9770 *)
9771 func_append newdeplibs " $i"
9772 ;;
9773 esac
9774 done
9775 fi
9776 ;;
9777 file_magic*)
9778 set dummy $deplibs_check_method; shift
9779 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9780 for a_deplib in $deplibs; do
9781 case $a_deplib in
9782 -l*)
9783 func_stripname -l '' "$a_deplib"
9784 name=$func_stripname_result
9785 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9786 case " $predeps $postdeps " in
9787 *" $a_deplib "*)
9788 func_append newdeplibs " $a_deplib"
9789 a_deplib=
9790 ;;
9791 esac
9792 fi
9793 if test -n "$a_deplib"; then
9794 libname=`eval "\\$ECHO \"$libname_spec\""`
9795 if test -n "$file_magic_glob"; then
9796 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9797 else
9798 libnameglob=$libname
9799 fi
9800 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9801 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9802 if test yes = "$want_nocaseglob"; then
9803 shopt -s nocaseglob
9804 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9805 $nocaseglob
9806 else
9807 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9808 fi
9809 for potent_lib in $potential_libs; do
9810 # Follow soft links.
9811 if ls -lLd "$potent_lib" 2>/dev/null |
9812 $GREP " -> " >/dev/null; then
9813 continue
9814 fi
9815 # The statement above tries to avoid entering an
9816 # endless loop below, in case of cyclic links.
9817 # We might still enter an endless loop, since a link
9818 # loop can be closed while we follow links,
9819 # but so what?
9820 potlib=$potent_lib
9821 while test -h "$potlib" 2>/dev/null; do
9822 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9823 case $potliblink in
9824 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9825 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9826 esac
9827 done
9828 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9829 $SED -e 10q |
9830 $EGREP "$file_magic_regex" > /dev/null; then
9831 func_append newdeplibs " $a_deplib"
9832 a_deplib=
9833 break 2
9834 fi
9835 done
9836 done
9837 fi
9838 if test -n "$a_deplib"; then
9839 droppeddeps=yes
9840 echo
9841 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9842 echo "*** I have the capability to make that library automatically link in when"
9843 echo "*** you link to this library. But I can only do this if you have a"
9844 echo "*** shared version of the library, which you do not appear to have"
9845 echo "*** because I did check the linker path looking for a file starting"
9846 if test -z "$potlib"; then
9847 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9848 else
9849 $ECHO "*** with $libname and none of the candidates passed a file format test"
9850 $ECHO "*** using a file magic. Last file checked: $potlib"
9851 fi
9852 fi
9853 ;;
9854 *)
9855 # Add a -L argument.
9856 func_append newdeplibs " $a_deplib"
9857 ;;
9858 esac
9859 done # Gone through all deplibs.
9860 ;;
9861 match_pattern*)
9862 set dummy $deplibs_check_method; shift
9863 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9864 for a_deplib in $deplibs; do
9865 case $a_deplib in
9866 -l*)
9867 func_stripname -l '' "$a_deplib"
9868 name=$func_stripname_result
9869 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9870 case " $predeps $postdeps " in
9871 *" $a_deplib "*)
9872 func_append newdeplibs " $a_deplib"
9873 a_deplib=
9874 ;;
9875 esac
9876 fi
9877 if test -n "$a_deplib"; then
9878 libname=`eval "\\$ECHO \"$libname_spec\""`
9879 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9880 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9881 for potent_lib in $potential_libs; do
9882 potlib=$potent_lib # see symlink-check above in file_magic test
9883 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9884 $EGREP "$match_pattern_regex" > /dev/null; then
9885 func_append newdeplibs " $a_deplib"
9886 a_deplib=
9887 break 2
9888 fi
9889 done
9890 done
9891 fi
9892 if test -n "$a_deplib"; then
9893 droppeddeps=yes
9894 echo
9895 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9896 echo "*** I have the capability to make that library automatically link in when"
9897 echo "*** you link to this library. But I can only do this if you have a"
9898 echo "*** shared version of the library, which you do not appear to have"
9899 echo "*** because I did check the linker path looking for a file starting"
9900 if test -z "$potlib"; then
9901 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9902 else
9903 $ECHO "*** with $libname and none of the candidates passed a file format test"
9904 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9905 fi
9906 fi
9907 ;;
9908 *)
9909 # Add a -L argument.
9910 func_append newdeplibs " $a_deplib"
9911 ;;
9912 esac
9913 done # Gone through all deplibs.
9914 ;;
9915 none | unknown | *)
9916 newdeplibs=
9917 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9918 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9919 for i in $predeps $postdeps; do
9920 # can't use Xsed below, because $i might contain '/'
9921 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9922 done
9923 fi
9924 case $tmp_deplibs in
9925 *[!\ \ ]*)
9926 echo
9927 if test none = "$deplibs_check_method"; then
9928 echo "*** Warning: inter-library dependencies are not supported in this platform."
9929 else
9930 echo "*** Warning: inter-library dependencies are not known to be supported."
9931 fi
9932 echo "*** All declared inter-library dependencies are being dropped."
9933 droppeddeps=yes
9934 ;;
9935 esac
9936 ;;
9937 esac
9938 versuffix=$versuffix_save
9939 major=$major_save
9940 release=$release_save
9941 libname=$libname_save
9942 name=$name_save
9943
9944 case $host in
9945 *-*-rhapsody* | *-*-darwin1.[012])
9946 # On Rhapsody replace the C library with the System framework
9947 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9948 ;;
9949 esac
9950
9951 if test yes = "$droppeddeps"; then
9952 if test yes = "$module"; then
9953 echo
9954 echo "*** Warning: libtool could not satisfy all declared inter-library"
9955 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9956 echo "*** a static module, that should work as long as the dlopening"
9957 echo "*** application is linked with the -dlopen flag."
9958 if test -z "$global_symbol_pipe"; then
9959 echo
9960 echo "*** However, this would only work if libtool was able to extract symbol"
9961 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9962 echo "*** not find such a program. So, this module is probably useless."
9963 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9964 fi
9965 if test no = "$build_old_libs"; then
9966 oldlibs=$output_objdir/$libname.$libext
9967 build_libtool_libs=module
9968 build_old_libs=yes
9969 else
9970 build_libtool_libs=no
9971 fi
9972 else
9973 echo "*** The inter-library dependencies that have been dropped here will be"
9974 echo "*** automatically added whenever a program is linked with this library"
9975 echo "*** or is declared to -dlopen it."
9976
9977 if test no = "$allow_undefined"; then
9978 echo
9979 echo "*** Since this library must not contain undefined symbols,"
9980 echo "*** because either the platform does not support them or"
9981 echo "*** it was explicitly requested with -no-undefined,"
9982 echo "*** libtool will only create a static version of it."
9983 if test no = "$build_old_libs"; then
9984 oldlibs=$output_objdir/$libname.$libext
9985 build_libtool_libs=module
9986 build_old_libs=yes
9987 else
9988 build_libtool_libs=no
9989 fi
9990 fi
9991 fi
9992 fi
9993 # Done checking deplibs!
9994 deplibs=$newdeplibs
9995 fi
9996 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9997 case $host in
9998 *-*-darwin*)
9999 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10000 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10001 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10002 ;;
10003 esac
10004
10005 # move library search paths that coincide with paths to not yet
10006 # installed libraries to the beginning of the library search list
10007 new_libs=
10008 for path in $notinst_path; do
10009 case " $new_libs " in
10010 *" -L$path/$objdir "*) ;;
10011 *)
10012 case " $deplibs " in
10013 *" -L$path/$objdir "*)
10014 func_append new_libs " -L$path/$objdir" ;;
10015 esac
10016 ;;
10017 esac
10018 done
10019 for deplib in $deplibs; do
10020 case $deplib in
10021 -L*)
10022 case " $new_libs " in
10023 *" $deplib "*) ;;
10024 *) func_append new_libs " $deplib" ;;
10025 esac
10026 ;;
10027 *) func_append new_libs " $deplib" ;;
10028 esac
10029 done
10030 deplibs=$new_libs
10031
10032 # All the library-specific variables (install_libdir is set above).
10033 library_names=
10034 old_library=
10035 dlname=
10036
10037 # Test again, we may have decided not to build it any more
10038 if test yes = "$build_libtool_libs"; then
10039 # Remove $wl instances when linking with ld.
10040 # FIXME: should test the right _cmds variable.
10041 case $archive_cmds in
10042 *\$LD\ *) wl= ;;
10043 esac
10044 if test yes = "$hardcode_into_libs"; then
10045 # Hardcode the library paths
10046 hardcode_libdirs=
10047 dep_rpath=
10048 rpath=$finalize_rpath
10049 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10050 for libdir in $rpath; do
10051 if test -n "$hardcode_libdir_flag_spec"; then
10052 if test -n "$hardcode_libdir_separator"; then
10053 func_replace_sysroot "$libdir"
10054 libdir=$func_replace_sysroot_result
10055 if test -z "$hardcode_libdirs"; then
10056 hardcode_libdirs=$libdir
10057 else
10058 # Just accumulate the unique libdirs.
10059 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10060 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10061 ;;
10062 *)
10063 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10064 ;;
10065 esac
10066 fi
10067 else
10068 eval flag=\"$hardcode_libdir_flag_spec\"
10069 func_append dep_rpath " $flag"
10070 fi
10071 elif test -n "$runpath_var"; then
10072 case "$perm_rpath " in
10073 *" $libdir "*) ;;
10074 *) func_append perm_rpath " $libdir" ;;
10075 esac
10076 fi
10077 done
10078 # Substitute the hardcoded libdirs into the rpath.
10079 if test -n "$hardcode_libdir_separator" &&
10080 test -n "$hardcode_libdirs"; then
10081 libdir=$hardcode_libdirs
10082 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10083 fi
10084 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10085 # We should set the runpath_var.
10086 rpath=
10087 for dir in $perm_rpath; do
10088 func_append rpath "$dir:"
10089 done
10090 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10091 fi
10092 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10093 fi
10094
10095 shlibpath=$finalize_shlibpath
10096 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10097 if test -n "$shlibpath"; then
10098 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10099 fi
10100
10101 # Get the real and link names of the library.
10102 eval shared_ext=\"$shrext_cmds\"
10103 eval library_names=\"$library_names_spec\"
10104 set dummy $library_names
10105 shift
10106 realname=$1
10107 shift
10108
10109 if test -n "$soname_spec"; then
10110 eval soname=\"$soname_spec\"
10111 else
10112 soname=$realname
10113 fi
10114 if test -z "$dlname"; then
10115 dlname=$soname
10116 fi
10117
10118 lib=$output_objdir/$realname
10119 linknames=
10120 for link
10121 do
10122 func_append linknames " $link"
10123 done
10124
10125 # Use standard objects if they are pic
10126 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10127 test "X$libobjs" = "X " && libobjs=
10128
10129 delfiles=
10130 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10131 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10132 export_symbols=$output_objdir/$libname.uexp
10133 func_append delfiles " $export_symbols"
10134 fi
10135
10136 orig_export_symbols=
10137 case $host_os in
10138 cygwin* | mingw* | cegcc*)
10139 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10140 # exporting using user supplied symfile
10141 func_dll_def_p "$export_symbols" || {
10142 # and it's NOT already a .def file. Must figure out
10143 # which of the given symbols are data symbols and tag
10144 # them as such. So, trigger use of export_symbols_cmds.
10145 # export_symbols gets reassigned inside the "prepare
10146 # the list of exported symbols" if statement, so the
10147 # include_expsyms logic still works.
10148 orig_export_symbols=$export_symbols
10149 export_symbols=
10150 always_export_symbols=yes
10151 }
10152 fi
10153 ;;
10154 esac
10155
10156 # Prepare the list of exported symbols
10157 if test -z "$export_symbols"; then
10158 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10159 func_verbose "generating symbol list for '$libname.la'"
10160 export_symbols=$output_objdir/$libname.exp
10161 $opt_dry_run || $RM $export_symbols
10162 cmds=$export_symbols_cmds
10163 save_ifs=$IFS; IFS='~'
10164 for cmd1 in $cmds; do
10165 IFS=$save_ifs
10166 # Take the normal branch if the nm_file_list_spec branch
10167 # doesn't work or if tool conversion is not needed.
10168 case $nm_file_list_spec~$to_tool_file_cmd in
10169 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10170 try_normal_branch=yes
10171 eval cmd=\"$cmd1\"
10172 func_len " $cmd"
10173 len=$func_len_result
10174 ;;
10175 *)
10176 try_normal_branch=no
10177 ;;
10178 esac
10179 if test yes = "$try_normal_branch" \
10180 && { test "$len" -lt "$max_cmd_len" \
10181 || test "$max_cmd_len" -le -1; }
10182 then
10183 func_show_eval "$cmd" 'exit $?'
10184 skipped_export=false
10185 elif test -n "$nm_file_list_spec"; then
10186 func_basename "$output"
10187 output_la=$func_basename_result
10188 save_libobjs=$libobjs
10189 save_output=$output
10190 output=$output_objdir/$output_la.nm
10191 func_to_tool_file "$output"
10192 libobjs=$nm_file_list_spec$func_to_tool_file_result
10193 func_append delfiles " $output"
10194 func_verbose "creating $NM input file list: $output"
10195 for obj in $save_libobjs; do
10196 func_to_tool_file "$obj"
10197 $ECHO "$func_to_tool_file_result"
10198 done > "$output"
10199 eval cmd=\"$cmd1\"
10200 func_show_eval "$cmd" 'exit $?'
10201 output=$save_output
10202 libobjs=$save_libobjs
10203 skipped_export=false
10204 else
10205 # The command line is too long to execute in one step.
10206 func_verbose "using reloadable object file for export list..."
10207 skipped_export=:
10208 # Break out early, otherwise skipped_export may be
10209 # set to false by a later but shorter cmd.
10210 break
10211 fi
10212 done
10213 IFS=$save_ifs
10214 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10215 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10216 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10217 fi
10218 fi
10219 fi
10220
10221 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10222 tmp_export_symbols=$export_symbols
10223 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10224 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10225 fi
10226
10227 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10228 # The given exports_symbols file has to be filtered, so filter it.
10229 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10230 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10231 # 's' commands, which not all seds can handle. GNU sed should be fine
10232 # though. Also, the filter scales superlinearly with the number of
10233 # global variables. join(1) would be nice here, but unfortunately
10234 # isn't a blessed tool.
10235 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10236 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10237 export_symbols=$output_objdir/$libname.def
10238 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10239 fi
10240
10241 tmp_deplibs=
10242 for test_deplib in $deplibs; do
10243 case " $convenience " in
10244 *" $test_deplib "*) ;;
10245 *)
10246 func_append tmp_deplibs " $test_deplib"
10247 ;;
10248 esac
10249 done
10250 deplibs=$tmp_deplibs
10251
10252 if test -n "$convenience"; then
10253 if test -n "$whole_archive_flag_spec" &&
10254 test yes = "$compiler_needs_object" &&
10255 test -z "$libobjs"; then
10256 # extract the archives, so we have objects to list.
10257 # TODO: could optimize this to just extract one archive.
10258 whole_archive_flag_spec=
10259 fi
10260 if test -n "$whole_archive_flag_spec"; then
10261 save_libobjs=$libobjs
10262 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10263 test "X$libobjs" = "X " && libobjs=
10264 else
10265 gentop=$output_objdir/${outputname}x
10266 func_append generated " $gentop"
10267
10268 func_extract_archives $gentop $convenience
10269 func_append libobjs " $func_extract_archives_result"
10270 test "X$libobjs" = "X " && libobjs=
10271 fi
10272 fi
10273
10274 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10275 eval flag=\"$thread_safe_flag_spec\"
10276 func_append linker_flags " $flag"
10277 fi
10278
10279 # Make a backup of the uninstalled library when relinking
10280 if test relink = "$opt_mode"; then
10281 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10282 fi
10283
10284 # Do each of the archive commands.
10285 if test yes = "$module" && test -n "$module_cmds"; then
10286 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10287 eval test_cmds=\"$module_expsym_cmds\"
10288 cmds=$module_expsym_cmds
10289 else
10290 eval test_cmds=\"$module_cmds\"
10291 cmds=$module_cmds
10292 fi
10293 else
10294 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10295 eval test_cmds=\"$archive_expsym_cmds\"
10296 cmds=$archive_expsym_cmds
10297 else
10298 eval test_cmds=\"$archive_cmds\"
10299 cmds=$archive_cmds
10300 fi
10301 fi
10302
10303 if test : != "$skipped_export" &&
10304 func_len " $test_cmds" &&
10305 len=$func_len_result &&
10306 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10307 :
10308 else
10309 # The command line is too long to link in one step, link piecewise
10310 # or, if using GNU ld and skipped_export is not :, use a linker
10311 # script.
10312
10313 # Save the value of $output and $libobjs because we want to
10314 # use them later. If we have whole_archive_flag_spec, we
10315 # want to use save_libobjs as it was before
10316 # whole_archive_flag_spec was expanded, because we can't
10317 # assume the linker understands whole_archive_flag_spec.
10318 # This may have to be revisited, in case too many
10319 # convenience libraries get linked in and end up exceeding
10320 # the spec.
10321 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10322 save_libobjs=$libobjs
10323 fi
10324 save_output=$output
10325 func_basename "$output"
10326 output_la=$func_basename_result
10327
10328 # Clear the reloadable object creation command queue and
10329 # initialize k to one.
10330 test_cmds=
10331 concat_cmds=
10332 objlist=
10333 last_robj=
10334 k=1
10335
10336 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10337 output=$output_objdir/$output_la.lnkscript
10338 func_verbose "creating GNU ld script: $output"
10339 echo 'INPUT (' > $output
10340 for obj in $save_libobjs
10341 do
10342 func_to_tool_file "$obj"
10343 $ECHO "$func_to_tool_file_result" >> $output
10344 done
10345 echo ')' >> $output
10346 func_append delfiles " $output"
10347 func_to_tool_file "$output"
10348 output=$func_to_tool_file_result
10349 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10350 output=$output_objdir/$output_la.lnk
10351 func_verbose "creating linker input file list: $output"
10352 : > $output
10353 set x $save_libobjs
10354 shift
10355 firstobj=
10356 if test yes = "$compiler_needs_object"; then
10357 firstobj="$1 "
10358 shift
10359 fi
10360 for obj
10361 do
10362 func_to_tool_file "$obj"
10363 $ECHO "$func_to_tool_file_result" >> $output
10364 done
10365 func_append delfiles " $output"
10366 func_to_tool_file "$output"
10367 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10368 else
10369 if test -n "$save_libobjs"; then
10370 func_verbose "creating reloadable object files..."
10371 output=$output_objdir/$output_la-$k.$objext
10372 eval test_cmds=\"$reload_cmds\"
10373 func_len " $test_cmds"
10374 len0=$func_len_result
10375 len=$len0
10376
10377 # Loop over the list of objects to be linked.
10378 for obj in $save_libobjs
10379 do
10380 func_len " $obj"
10381 func_arith $len + $func_len_result
10382 len=$func_arith_result
10383 if test -z "$objlist" ||
10384 test "$len" -lt "$max_cmd_len"; then
10385 func_append objlist " $obj"
10386 else
10387 # The command $test_cmds is almost too long, add a
10388 # command to the queue.
10389 if test 1 -eq "$k"; then
10390 # The first file doesn't have a previous command to add.
10391 reload_objs=$objlist
10392 eval concat_cmds=\"$reload_cmds\"
10393 else
10394 # All subsequent reloadable object files will link in
10395 # the last one created.
10396 reload_objs="$objlist $last_robj"
10397 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10398 fi
10399 last_robj=$output_objdir/$output_la-$k.$objext
10400 func_arith $k + 1
10401 k=$func_arith_result
10402 output=$output_objdir/$output_la-$k.$objext
10403 objlist=" $obj"
10404 func_len " $last_robj"
10405 func_arith $len0 + $func_len_result
10406 len=$func_arith_result
10407 fi
10408 done
10409 # Handle the remaining objects by creating one last
10410 # reloadable object file. All subsequent reloadable object
10411 # files will link in the last one created.
10412 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10413 reload_objs="$objlist $last_robj"
10414 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10415 if test -n "$last_robj"; then
10416 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10417 fi
10418 func_append delfiles " $output"
10419
10420 else
10421 output=
10422 fi
10423
10424 ${skipped_export-false} && {
10425 func_verbose "generating symbol list for '$libname.la'"
10426 export_symbols=$output_objdir/$libname.exp
10427 $opt_dry_run || $RM $export_symbols
10428 libobjs=$output
10429 # Append the command to create the export file.
10430 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10431 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10432 if test -n "$last_robj"; then
10433 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10434 fi
10435 }
10436
10437 test -n "$save_libobjs" &&
10438 func_verbose "creating a temporary reloadable object file: $output"
10439
10440 # Loop through the commands generated above and execute them.
10441 save_ifs=$IFS; IFS='~'
10442 for cmd in $concat_cmds; do
10443 IFS=$save_ifs
10444 $opt_quiet || {
10445 func_quote_for_expand "$cmd"
10446 eval "func_echo $func_quote_for_expand_result"
10447 }
10448 $opt_dry_run || eval "$cmd" || {
10449 lt_exit=$?
10450
10451 # Restore the uninstalled library and exit
10452 if test relink = "$opt_mode"; then
10453 ( cd "$output_objdir" && \
10454 $RM "${realname}T" && \
10455 $MV "${realname}U" "$realname" )
10456 fi
10457
10458 exit $lt_exit
10459 }
10460 done
10461 IFS=$save_ifs
10462
10463 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10464 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10465 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10466 fi
10467 fi
10468
10469 ${skipped_export-false} && {
10470 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10471 tmp_export_symbols=$export_symbols
10472 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10473 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10474 fi
10475
10476 if test -n "$orig_export_symbols"; then
10477 # The given exports_symbols file has to be filtered, so filter it.
10478 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10479 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10480 # 's' commands, which not all seds can handle. GNU sed should be fine
10481 # though. Also, the filter scales superlinearly with the number of
10482 # global variables. join(1) would be nice here, but unfortunately
10483 # isn't a blessed tool.
10484 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10485 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10486 export_symbols=$output_objdir/$libname.def
10487 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10488 fi
10489 }
10490
10491 libobjs=$output
10492 # Restore the value of output.
10493 output=$save_output
10494
10495 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10496 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10497 test "X$libobjs" = "X " && libobjs=
10498 fi
10499 # Expand the library linking commands again to reset the
10500 # value of $libobjs for piecewise linking.
10501
10502 # Do each of the archive commands.
10503 if test yes = "$module" && test -n "$module_cmds"; then
10504 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10505 cmds=$module_expsym_cmds
10506 else
10507 cmds=$module_cmds
10508 fi
10509 else
10510 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10511 cmds=$archive_expsym_cmds
10512 else
10513 cmds=$archive_cmds
10514 fi
10515 fi
10516 fi
10517
10518 if test -n "$delfiles"; then
10519 # Append the command to remove temporary files to $cmds.
10520 eval cmds=\"\$cmds~\$RM $delfiles\"
10521 fi
10522
10523 # Add any objects from preloaded convenience libraries
10524 if test -n "$dlprefiles"; then
10525 gentop=$output_objdir/${outputname}x
10526 func_append generated " $gentop"
10527
10528 func_extract_archives $gentop $dlprefiles
10529 func_append libobjs " $func_extract_archives_result"
10530 test "X$libobjs" = "X " && libobjs=
10531 fi
10532
10533 save_ifs=$IFS; IFS='~'
10534 for cmd in $cmds; do
10535 IFS=$sp$nl
10536 eval cmd=\"$cmd\"
10537 IFS=$save_ifs
10538 $opt_quiet || {
10539 func_quote_for_expand "$cmd"
10540 eval "func_echo $func_quote_for_expand_result"
10541 }
10542 $opt_dry_run || eval "$cmd" || {
10543 lt_exit=$?
10544
10545 # Restore the uninstalled library and exit
10546 if test relink = "$opt_mode"; then
10547 ( cd "$output_objdir" && \
10548 $RM "${realname}T" && \
10549 $MV "${realname}U" "$realname" )
10550 fi
10551
10552 exit $lt_exit
10553 }
10554 done
10555 IFS=$save_ifs
10556
10557 # Restore the uninstalled library and exit
10558 if test relink = "$opt_mode"; then
10559 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10560
10561 if test -n "$convenience"; then
10562 if test -z "$whole_archive_flag_spec"; then
10563 func_show_eval '${RM}r "$gentop"'
10564 fi
10565 fi
10566
10567 exit $EXIT_SUCCESS
10568 fi
10569
10570 # Create links to the real library.
10571 for linkname in $linknames; do
10572 if test "$realname" != "$linkname"; then
10573 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10574 fi
10575 done
10576
10577 # If -module or -export-dynamic was specified, set the dlname.
10578 if test yes = "$module" || test yes = "$export_dynamic"; then
10579 # On all known operating systems, these are identical.
10580 dlname=$soname
10581 fi
10582 fi
10583 ;;
10584
10585 obj)
10586 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10587 func_warning "'-dlopen' is ignored for objects"
10588 fi
10589
10590 case " $deplibs" in
10591 *\ -l* | *\ -L*)
10592 func_warning "'-l' and '-L' are ignored for objects" ;;
10593 esac
10594
10595 test -n "$rpath" && \
10596 func_warning "'-rpath' is ignored for objects"
10597
10598 test -n "$xrpath" && \
10599 func_warning "'-R' is ignored for objects"
10600
10601 test -n "$vinfo" && \
10602 func_warning "'-version-info' is ignored for objects"
10603
10604 test -n "$release" && \
10605 func_warning "'-release' is ignored for objects"
10606
10607 case $output in
10608 *.lo)
10609 test -n "$objs$old_deplibs" && \
10610 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10611
10612 libobj=$output
10613 func_lo2o "$libobj"
10614 obj=$func_lo2o_result
10615 ;;
10616 *)
10617 libobj=
10618 obj=$output
10619 ;;
10620 esac
10621
10622 # Delete the old objects.
10623 $opt_dry_run || $RM $obj $libobj
10624
10625 # Objects from convenience libraries. This assumes
10626 # single-version convenience libraries. Whenever we create
10627 # different ones for PIC/non-PIC, this we'll have to duplicate
10628 # the extraction.
10629 reload_conv_objs=
10630 gentop=
10631 # if reload_cmds runs $LD directly, get rid of -Wl from
10632 # whole_archive_flag_spec and hope we can get by with turning comma
10633 # into space.
10634 case $reload_cmds in
10635 *\$LD[\ \$]*) wl= ;;
10636 esac
10637 if test -n "$convenience"; then
10638 if test -n "$whole_archive_flag_spec"; then
10639 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10640 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10641 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10642 else
10643 gentop=$output_objdir/${obj}x
10644 func_append generated " $gentop"
10645
10646 func_extract_archives $gentop $convenience
10647 reload_conv_objs="$reload_objs $func_extract_archives_result"
10648 fi
10649 fi
10650
10651 # If we're not building shared, we need to use non_pic_objs
10652 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10653
10654 # Create the old-style object.
10655 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10656
10657 output=$obj
10658 func_execute_cmds "$reload_cmds" 'exit $?'
10659
10660 # Exit if we aren't doing a library object file.
10661 if test -z "$libobj"; then
10662 if test -n "$gentop"; then
10663 func_show_eval '${RM}r "$gentop"'
10664 fi
10665
10666 exit $EXIT_SUCCESS
10667 fi
10668
10669 test yes = "$build_libtool_libs" || {
10670 if test -n "$gentop"; then
10671 func_show_eval '${RM}r "$gentop"'
10672 fi
10673
10674 # Create an invalid libtool object if no PIC, so that we don't
10675 # accidentally link it into a program.
10676 # $show "echo timestamp > $libobj"
10677 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10678 exit $EXIT_SUCCESS
10679 }
10680
10681 if test -n "$pic_flag" || test default != "$pic_mode"; then
10682 # Only do commands if we really have different PIC objects.
10683 reload_objs="$libobjs $reload_conv_objs"
10684 output=$libobj
10685 func_execute_cmds "$reload_cmds" 'exit $?'
10686 fi
10687
10688 if test -n "$gentop"; then
10689 func_show_eval '${RM}r "$gentop"'
10690 fi
10691
10692 exit $EXIT_SUCCESS
10693 ;;
10694
10695 prog)
10696 case $host in
10697 *cygwin*) func_stripname '' '.exe' "$output"
10698 output=$func_stripname_result.exe;;
10699 esac
10700 test -n "$vinfo" && \
10701 func_warning "'-version-info' is ignored for programs"
10702
10703 test -n "$release" && \
10704 func_warning "'-release' is ignored for programs"
10705
10706 $preload \
10707 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10708 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10709
10710 case $host in
10711 *-*-rhapsody* | *-*-darwin1.[012])
10712 # On Rhapsody replace the C library is the System framework
10713 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10714 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10715 ;;
10716 esac
10717
10718 case $host in
10719 *-*-darwin*)
10720 # Don't allow lazy linking, it breaks C++ global constructors
10721 # But is supposedly fixed on 10.4 or later (yay!).
10722 if test CXX = "$tagname"; then
10723 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10724 10.[0123])
10725 func_append compile_command " $wl-bind_at_load"
10726 func_append finalize_command " $wl-bind_at_load"
10727 ;;
10728 esac
10729 fi
10730 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10731 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10732 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10733 ;;
10734 esac
10735
10736
10737 # move library search paths that coincide with paths to not yet
10738 # installed libraries to the beginning of the library search list
10739 new_libs=
10740 for path in $notinst_path; do
10741 case " $new_libs " in
10742 *" -L$path/$objdir "*) ;;
10743 *)
10744 case " $compile_deplibs " in
10745 *" -L$path/$objdir "*)
10746 func_append new_libs " -L$path/$objdir" ;;
10747 esac
10748 ;;
10749 esac
10750 done
10751 for deplib in $compile_deplibs; do
10752 case $deplib in
10753 -L*)
10754 case " $new_libs " in
10755 *" $deplib "*) ;;
10756 *) func_append new_libs " $deplib" ;;
10757 esac
10758 ;;
10759 *) func_append new_libs " $deplib" ;;
10760 esac
10761 done
10762 compile_deplibs=$new_libs
10763
10764
10765 func_append compile_command " $compile_deplibs"
10766 func_append finalize_command " $finalize_deplibs"
10767
10768 if test -n "$rpath$xrpath"; then
10769 # If the user specified any rpath flags, then add them.
10770 for libdir in $rpath $xrpath; do
10771 # This is the magic to use -rpath.
10772 case "$finalize_rpath " in
10773 *" $libdir "*) ;;
10774 *) func_append finalize_rpath " $libdir" ;;
10775 esac
10776 done
10777 fi
10778
10779 # Now hardcode the library paths
10780 rpath=
10781 hardcode_libdirs=
10782 for libdir in $compile_rpath $finalize_rpath; do
10783 if test -n "$hardcode_libdir_flag_spec"; then
10784 if test -n "$hardcode_libdir_separator"; then
10785 if test -z "$hardcode_libdirs"; then
10786 hardcode_libdirs=$libdir
10787 else
10788 # Just accumulate the unique libdirs.
10789 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10790 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10791 ;;
10792 *)
10793 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10794 ;;
10795 esac
10796 fi
10797 else
10798 eval flag=\"$hardcode_libdir_flag_spec\"
10799 func_append rpath " $flag"
10800 fi
10801 elif test -n "$runpath_var"; then
10802 case "$perm_rpath " in
10803 *" $libdir "*) ;;
10804 *) func_append perm_rpath " $libdir" ;;
10805 esac
10806 fi
10807 case $host in
10808 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10809 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10810 case :$dllsearchpath: in
10811 *":$libdir:"*) ;;
10812 ::) dllsearchpath=$libdir;;
10813 *) func_append dllsearchpath ":$libdir";;
10814 esac
10815 case :$dllsearchpath: in
10816 *":$testbindir:"*) ;;
10817 ::) dllsearchpath=$testbindir;;
10818 *) func_append dllsearchpath ":$testbindir";;
10819 esac
10820 ;;
10821 esac
10822 done
10823 # Substitute the hardcoded libdirs into the rpath.
10824 if test -n "$hardcode_libdir_separator" &&
10825 test -n "$hardcode_libdirs"; then
10826 libdir=$hardcode_libdirs
10827 eval rpath=\" $hardcode_libdir_flag_spec\"
10828 fi
10829 compile_rpath=$rpath
10830
10831 rpath=
10832 hardcode_libdirs=
10833 for libdir in $finalize_rpath; do
10834 if test -n "$hardcode_libdir_flag_spec"; then
10835 if test -n "$hardcode_libdir_separator"; then
10836 if test -z "$hardcode_libdirs"; then
10837 hardcode_libdirs=$libdir
10838 else
10839 # Just accumulate the unique libdirs.
10840 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10841 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10842 ;;
10843 *)
10844 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10845 ;;
10846 esac
10847 fi
10848 else
10849 eval flag=\"$hardcode_libdir_flag_spec\"
10850 func_append rpath " $flag"
10851 fi
10852 elif test -n "$runpath_var"; then
10853 case "$finalize_perm_rpath " in
10854 *" $libdir "*) ;;
10855 *) func_append finalize_perm_rpath " $libdir" ;;
10856 esac
10857 fi
10858 done
10859 # Substitute the hardcoded libdirs into the rpath.
10860 if test -n "$hardcode_libdir_separator" &&
10861 test -n "$hardcode_libdirs"; then
10862 libdir=$hardcode_libdirs
10863 eval rpath=\" $hardcode_libdir_flag_spec\"
10864 fi
10865 finalize_rpath=$rpath
10866
10867 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10868 # Transform all the library objects into standard objects.
10869 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10870 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10871 fi
10872
10873 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10874
10875 # template prelinking step
10876 if test -n "$prelink_cmds"; then
10877 func_execute_cmds "$prelink_cmds" 'exit $?'
10878 fi
10879
10880 wrappers_required=:
10881 case $host in
10882 *cegcc* | *mingw32ce*)
10883 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10884 wrappers_required=false
10885 ;;
10886 *cygwin* | *mingw* )
10887 test yes = "$build_libtool_libs" || wrappers_required=false
10888 ;;
10889 *)
10890 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10891 wrappers_required=false
10892 fi
10893 ;;
10894 esac
10895 $wrappers_required || {
10896 # Replace the output file specification.
10897 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10898 link_command=$compile_command$compile_rpath
10899
10900 # We have no uninstalled library dependencies, so finalize right now.
10901 exit_status=0
10902 func_show_eval "$link_command" 'exit_status=$?'
10903
10904 if test -n "$postlink_cmds"; then
10905 func_to_tool_file "$output"
10906 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10907 func_execute_cmds "$postlink_cmds" 'exit $?'
10908 fi
10909
10910 # Delete the generated files.
10911 if test -f "$output_objdir/${outputname}S.$objext"; then
10912 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10913 fi
10914
10915 exit $exit_status
10916 }
10917
10918 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10919 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10920 fi
10921 if test -n "$finalize_shlibpath"; then
10922 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10923 fi
10924
10925 compile_var=
10926 finalize_var=
10927 if test -n "$runpath_var"; then
10928 if test -n "$perm_rpath"; then
10929 # We should set the runpath_var.
10930 rpath=
10931 for dir in $perm_rpath; do
10932 func_append rpath "$dir:"
10933 done
10934 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10935 fi
10936 if test -n "$finalize_perm_rpath"; then
10937 # We should set the runpath_var.
10938 rpath=
10939 for dir in $finalize_perm_rpath; do
10940 func_append rpath "$dir:"
10941 done
10942 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10943 fi
10944 fi
10945
10946 if test yes = "$no_install"; then
10947 # We don't need to create a wrapper script.
10948 link_command=$compile_var$compile_command$compile_rpath
10949 # Replace the output file specification.
10950 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10951 # Delete the old output file.
10952 $opt_dry_run || $RM $output
10953 # Link the executable and exit
10954 func_show_eval "$link_command" 'exit $?'
10955
10956 if test -n "$postlink_cmds"; then
10957 func_to_tool_file "$output"
10958 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10959 func_execute_cmds "$postlink_cmds" 'exit $?'
10960 fi
10961
10962 exit $EXIT_SUCCESS
10963 fi
10964
10965 case $hardcode_action,$fast_install in
10966 relink,*)
10967 # Fast installation is not supported
10968 link_command=$compile_var$compile_command$compile_rpath
10969 relink_command=$finalize_var$finalize_command$finalize_rpath
10970
10971 func_warning "this platform does not like uninstalled shared libraries"
10972 func_warning "'$output' will be relinked during installation"
10973 ;;
10974 *,yes)
10975 link_command=$finalize_var$compile_command$finalize_rpath
10976 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10977 ;;
10978 *,no)
10979 link_command=$compile_var$compile_command$compile_rpath
10980 relink_command=$finalize_var$finalize_command$finalize_rpath
10981 ;;
10982 *,needless)
10983 link_command=$finalize_var$compile_command$finalize_rpath
10984 relink_command=
10985 ;;
10986 esac
10987
10988 # Replace the output file specification.
10989 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10990
10991 # Delete the old output files.
10992 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10993
10994 func_show_eval "$link_command" 'exit $?'
10995
10996 if test -n "$postlink_cmds"; then
10997 func_to_tool_file "$output_objdir/$outputname"
10998 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10999 func_execute_cmds "$postlink_cmds" 'exit $?'
11000 fi
11001
11002 # Now create the wrapper script.
11003 func_verbose "creating $output"
11004
11005 # Quote the relink command for shipping.
11006 if test -n "$relink_command"; then
11007 # Preserve any variables that may affect compiler behavior
11008 for var in $variables_saved_for_relink; do
11009 if eval test -z \"\${$var+set}\"; then
11010 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11011 elif eval var_value=\$$var; test -z "$var_value"; then
11012 relink_command="$var=; export $var; $relink_command"
11013 else
11014 func_quote_for_eval "$var_value"
11015 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11016 fi
11017 done
11018 relink_command="(cd `pwd`; $relink_command)"
11019 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11020 fi
11021
11022 # Only actually do things if not in dry run mode.
11023 $opt_dry_run || {
11024 # win32 will think the script is a binary if it has
11025 # a .exe suffix, so we strip it off here.
11026 case $output in
11027 *.exe) func_stripname '' '.exe' "$output"
11028 output=$func_stripname_result ;;
11029 esac
11030 # test for cygwin because mv fails w/o .exe extensions
11031 case $host in
11032 *cygwin*)
11033 exeext=.exe
11034 func_stripname '' '.exe' "$outputname"
11035 outputname=$func_stripname_result ;;
11036 *) exeext= ;;
11037 esac
11038 case $host in
11039 *cygwin* | *mingw* )
11040 func_dirname_and_basename "$output" "" "."
11041 output_name=$func_basename_result
11042 output_path=$func_dirname_result
11043 cwrappersource=$output_path/$objdir/lt-$output_name.c
11044 cwrapper=$output_path/$output_name.exe
11045 $RM $cwrappersource $cwrapper
11046 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11047
11048 func_emit_cwrapperexe_src > $cwrappersource
11049
11050 # The wrapper executable is built using the $host compiler,
11051 # because it contains $host paths and files. If cross-
11052 # compiling, it, like the target executable, must be
11053 # executed on the $host or under an emulation environment.
11054 $opt_dry_run || {
11055 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11056 $STRIP $cwrapper
11057 }
11058
11059 # Now, create the wrapper script for func_source use:
11060 func_ltwrapper_scriptname $cwrapper
11061 $RM $func_ltwrapper_scriptname_result
11062 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11063 $opt_dry_run || {
11064 # note: this script will not be executed, so do not chmod.
11065 if test "x$build" = "x$host"; then
11066 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11067 else
11068 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11069 fi
11070 }
11071 ;;
11072 * )
11073 $RM $output
11074 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11075
11076 func_emit_wrapper no > $output
11077 chmod +x $output
11078 ;;
11079 esac
11080 }
11081 exit $EXIT_SUCCESS
11082 ;;
11083 esac
11084
11085 # See if we need to build an old-fashioned archive.
11086 for oldlib in $oldlibs; do
11087
11088 case $build_libtool_libs in
11089 convenience)
11090 oldobjs="$libobjs_save $symfileobj"
11091 addlibs=$convenience
11092 build_libtool_libs=no
11093 ;;
11094 module)
11095 oldobjs=$libobjs_save
11096 addlibs=$old_convenience
11097 build_libtool_libs=no
11098 ;;
11099 *)
11100 oldobjs="$old_deplibs $non_pic_objects"
11101 $preload && test -f "$symfileobj" \
11102 && func_append oldobjs " $symfileobj"
11103 addlibs=$old_convenience
11104 ;;
11105 esac
11106
11107 if test -n "$addlibs"; then
11108 gentop=$output_objdir/${outputname}x
11109 func_append generated " $gentop"
11110
11111 func_extract_archives $gentop $addlibs
11112 func_append oldobjs " $func_extract_archives_result"
11113 fi
11114
11115 # Do each command in the archive commands.
11116 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11117 cmds=$old_archive_from_new_cmds
11118 else
11119
11120 # Add any objects from preloaded convenience libraries
11121 if test -n "$dlprefiles"; then
11122 gentop=$output_objdir/${outputname}x
11123 func_append generated " $gentop"
11124
11125 func_extract_archives $gentop $dlprefiles
11126 func_append oldobjs " $func_extract_archives_result"
11127 fi
11128
11129 # POSIX demands no paths to be encoded in archives. We have
11130 # to avoid creating archives with duplicate basenames if we
11131 # might have to extract them afterwards, e.g., when creating a
11132 # static archive out of a convenience library, or when linking
11133 # the entirety of a libtool archive into another (currently
11134 # not supported by libtool).
11135 if (for obj in $oldobjs
11136 do
11137 func_basename "$obj"
11138 $ECHO "$func_basename_result"
11139 done | sort | sort -uc >/dev/null 2>&1); then
11140 :
11141 else
11142 echo "copying selected object files to avoid basename conflicts..."
11143 gentop=$output_objdir/${outputname}x
11144 func_append generated " $gentop"
11145 func_mkdir_p "$gentop"
11146 save_oldobjs=$oldobjs
11147 oldobjs=
11148 counter=1
11149 for obj in $save_oldobjs
11150 do
11151 func_basename "$obj"
11152 objbase=$func_basename_result
11153 case " $oldobjs " in
11154 " ") oldobjs=$obj ;;
11155 *[\ /]"$objbase "*)
11156 while :; do
11157 # Make sure we don't pick an alternate name that also
11158 # overlaps.
11159 newobj=lt$counter-$objbase
11160 func_arith $counter + 1
11161 counter=$func_arith_result
11162 case " $oldobjs " in
11163 *[\ /]"$newobj "*) ;;
11164 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11165 esac
11166 done
11167 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11168 func_append oldobjs " $gentop/$newobj"
11169 ;;
11170 *) func_append oldobjs " $obj" ;;
11171 esac
11172 done
11173 fi
11174 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11175 tool_oldlib=$func_to_tool_file_result
11176 eval cmds=\"$old_archive_cmds\"
11177
11178 func_len " $cmds"
11179 len=$func_len_result
11180 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11181 cmds=$old_archive_cmds
11182 elif test -n "$archiver_list_spec"; then
11183 func_verbose "using command file archive linking..."
11184 for obj in $oldobjs
11185 do
11186 func_to_tool_file "$obj"
11187 $ECHO "$func_to_tool_file_result"
11188 done > $output_objdir/$libname.libcmd
11189 func_to_tool_file "$output_objdir/$libname.libcmd"
11190 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11191 cmds=$old_archive_cmds
11192 else
11193 # the command line is too long to link in one step, link in parts
11194 func_verbose "using piecewise archive linking..."
11195 save_RANLIB=$RANLIB
11196 RANLIB=:
11197 objlist=
11198 concat_cmds=
11199 save_oldobjs=$oldobjs
11200 oldobjs=
11201 # Is there a better way of finding the last object in the list?
11202 for obj in $save_oldobjs
11203 do
11204 last_oldobj=$obj
11205 done
11206 eval test_cmds=\"$old_archive_cmds\"
11207 func_len " $test_cmds"
11208 len0=$func_len_result
11209 len=$len0
11210 for obj in $save_oldobjs
11211 do
11212 func_len " $obj"
11213 func_arith $len + $func_len_result
11214 len=$func_arith_result
11215 func_append objlist " $obj"
11216 if test "$len" -lt "$max_cmd_len"; then
11217 :
11218 else
11219 # the above command should be used before it gets too long
11220 oldobjs=$objlist
11221 if test "$obj" = "$last_oldobj"; then
11222 RANLIB=$save_RANLIB
11223 fi
11224 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11225 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11226 objlist=
11227 len=$len0
11228 fi
11229 done
11230 RANLIB=$save_RANLIB
11231 oldobjs=$objlist
11232 if test -z "$oldobjs"; then
11233 eval cmds=\"\$concat_cmds\"
11234 else
11235 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11236 fi
11237 fi
11238 fi
11239 func_execute_cmds "$cmds" 'exit $?'
11240 done
11241
11242 test -n "$generated" && \
11243 func_show_eval "${RM}r$generated"
11244
11245 # Now create the libtool archive.
11246 case $output in
11247 *.la)
11248 old_library=
11249 test yes = "$build_old_libs" && old_library=$libname.$libext
11250 func_verbose "creating $output"
11251
11252 # Preserve any variables that may affect compiler behavior
11253 for var in $variables_saved_for_relink; do
11254 if eval test -z \"\${$var+set}\"; then
11255 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11256 elif eval var_value=\$$var; test -z "$var_value"; then
11257 relink_command="$var=; export $var; $relink_command"
11258 else
11259 func_quote_for_eval "$var_value"
11260 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11261 fi
11262 done
11263 # Quote the link command for shipping.
11264 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11265 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11266 if test yes = "$hardcode_automatic"; then
11267 relink_command=
11268 fi
11269
11270 # Only create the output if not a dry run.
11271 $opt_dry_run || {
11272 for installed in no yes; do
11273 if test yes = "$installed"; then
11274 if test -z "$install_libdir"; then
11275 break
11276 fi
11277 output=$output_objdir/${outputname}i
11278 # Replace all uninstalled libtool libraries with the installed ones
11279 newdependency_libs=
11280 for deplib in $dependency_libs; do
11281 case $deplib in
11282 *.la)
11283 func_basename "$deplib"
11284 name=$func_basename_result
11285 func_resolve_sysroot "$deplib"
11286 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11287 test -z "$libdir" && \
11288 func_fatal_error "'$deplib' is not a valid libtool archive"
11289 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11290 ;;
11291 -L*)
11292 func_stripname -L '' "$deplib"
11293 func_replace_sysroot "$func_stripname_result"
11294 func_append newdependency_libs " -L$func_replace_sysroot_result"
11295 ;;
11296 -R*)
11297 func_stripname -R '' "$deplib"
11298 func_replace_sysroot "$func_stripname_result"
11299 func_append newdependency_libs " -R$func_replace_sysroot_result"
11300 ;;
11301 *) func_append newdependency_libs " $deplib" ;;
11302 esac
11303 done
11304 dependency_libs=$newdependency_libs
11305 newdlfiles=
11306
11307 for lib in $dlfiles; do
11308 case $lib in
11309 *.la)
11310 func_basename "$lib"
11311 name=$func_basename_result
11312 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11313 test -z "$libdir" && \
11314 func_fatal_error "'$lib' is not a valid libtool archive"
11315 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11316 ;;
11317 *) func_append newdlfiles " $lib" ;;
11318 esac
11319 done
11320 dlfiles=$newdlfiles
11321 newdlprefiles=
11322 for lib in $dlprefiles; do
11323 case $lib in
11324 *.la)
11325 # Only pass preopened files to the pseudo-archive (for
11326 # eventual linking with the app. that links it) if we
11327 # didn't already link the preopened objects directly into
11328 # the library:
11329 func_basename "$lib"
11330 name=$func_basename_result
11331 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11332 test -z "$libdir" && \
11333 func_fatal_error "'$lib' is not a valid libtool archive"
11334 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11335 ;;
11336 esac
11337 done
11338 dlprefiles=$newdlprefiles
11339 else
11340 newdlfiles=
11341 for lib in $dlfiles; do
11342 case $lib in
11343 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11344 *) abs=`pwd`"/$lib" ;;
11345 esac
11346 func_append newdlfiles " $abs"
11347 done
11348 dlfiles=$newdlfiles
11349 newdlprefiles=
11350 for lib in $dlprefiles; do
11351 case $lib in
11352 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11353 *) abs=`pwd`"/$lib" ;;
11354 esac
11355 func_append newdlprefiles " $abs"
11356 done
11357 dlprefiles=$newdlprefiles
11358 fi
11359 $RM $output
11360 # place dlname in correct position for cygwin
11361 # In fact, it would be nice if we could use this code for all target
11362 # systems that can't hard-code library paths into their executables
11363 # and that have no shared library path variable independent of PATH,
11364 # but it turns out we can't easily determine that from inspecting
11365 # libtool variables, so we have to hard-code the OSs to which it
11366 # applies here; at the moment, that means platforms that use the PE
11367 # object format with DLL files. See the long comment at the top of
11368 # tests/bindir.at for full details.
11369 tdlname=$dlname
11370 case $host,$output,$installed,$module,$dlname in
11371 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11372 # If a -bindir argument was supplied, place the dll there.
11373 if test -n "$bindir"; then
11374 func_relative_path "$install_libdir" "$bindir"
11375 tdlname=$func_relative_path_result/$dlname
11376 else
11377 # Otherwise fall back on heuristic.
11378 tdlname=../bin/$dlname
11379 fi
11380 ;;
11381 esac
11382 $ECHO > $output "\
11383# $outputname - a libtool library file
11384# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11385#
11386# Please DO NOT delete this file!
11387# It is necessary for linking the library.
11388
11389# The name that we can dlopen(3).
11390dlname='$tdlname'
11391
11392# Names of this library.
11393library_names='$library_names'
11394
11395# The name of the static archive.
11396old_library='$old_library'
11397
11398# Linker flags that cannot go in dependency_libs.
11399inherited_linker_flags='$new_inherited_linker_flags'
11400
11401# Libraries that this one depends upon.
11402dependency_libs='$dependency_libs'
11403
11404# Names of additional weak libraries provided by this library
11405weak_library_names='$weak_libs'
11406
11407# Version information for $libname.
11408current=$current
11409age=$age
11410revision=$revision
11411
11412# Is this an already installed library?
11413installed=$installed
11414
11415# Should we warn about portability when linking against -modules?
11416shouldnotlink=$module
11417
11418# Files to dlopen/dlpreopen
11419dlopen='$dlfiles'
11420dlpreopen='$dlprefiles'
11421
11422# Directory that this library needs to be installed in:
11423libdir='$install_libdir'"
11424 if test no,yes = "$installed,$need_relink"; then
11425 $ECHO >> $output "\
11426relink_command=\"$relink_command\""
11427 fi
11428 done
11429 }
11430
11431 # Do a symbolic link so that the libtool archive can be found in
11432 # LD_LIBRARY_PATH before the program is installed.
11433 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11434 ;;
11435 esac
11436 exit $EXIT_SUCCESS
11437}
11438
11439if test link = "$opt_mode" || test relink = "$opt_mode"; then
11440 func_mode_link ${1+"$@"}
11441fi
11442
11443
11444# func_mode_uninstall arg...
11445func_mode_uninstall ()
11446{
11447 $debug_cmd
11448
11449 RM=$nonopt
11450 files=
11451 rmforce=false
11452 exit_status=0
11453
11454 # This variable tells wrapper scripts just to set variables rather
11455 # than running their programs.
11456 libtool_install_magic=$magic
11457
11458 for arg
11459 do
11460 case $arg in
11461 -f) func_append RM " $arg"; rmforce=: ;;
11462 -*) func_append RM " $arg" ;;
11463 *) func_append files " $arg" ;;
11464 esac
11465 done
11466
11467 test -z "$RM" && \
11468 func_fatal_help "you must specify an RM program"
11469
11470 rmdirs=
11471
11472 for file in $files; do
11473 func_dirname "$file" "" "."
11474 dir=$func_dirname_result
11475 if test . = "$dir"; then
11476 odir=$objdir
11477 else
11478 odir=$dir/$objdir
11479 fi
11480 func_basename "$file"
11481 name=$func_basename_result
11482 test uninstall = "$opt_mode" && odir=$dir
11483
11484 # Remember odir for removal later, being careful to avoid duplicates
11485 if test clean = "$opt_mode"; then
11486 case " $rmdirs " in
11487 *" $odir "*) ;;
11488 *) func_append rmdirs " $odir" ;;
11489 esac
11490 fi
11491
11492 # Don't error if the file doesn't exist and rm -f was used.
11493 if { test -L "$file"; } >/dev/null 2>&1 ||
11494 { test -h "$file"; } >/dev/null 2>&1 ||
11495 test -f "$file"; then
11496 :
11497 elif test -d "$file"; then
11498 exit_status=1
11499 continue
11500 elif $rmforce; then
11501 continue
11502 fi
11503
11504 rmfiles=$file
11505
11506 case $name in
11507 *.la)
11508 # Possibly a libtool archive, so verify it.
11509 if func_lalib_p "$file"; then
11510 func_source $dir/$name
11511
11512 # Delete the libtool libraries and symlinks.
11513 for n in $library_names; do
11514 func_append rmfiles " $odir/$n"
11515 done
11516 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11517
11518 case $opt_mode in
11519 clean)
11520 case " $library_names " in
11521 *" $dlname "*) ;;
11522 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11523 esac
11524 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11525 ;;
11526 uninstall)
11527 if test -n "$library_names"; then
11528 # Do each command in the postuninstall commands.
11529 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11530 fi
11531
11532 if test -n "$old_library"; then
11533 # Do each command in the old_postuninstall commands.
11534 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11535 fi
11536 # FIXME: should reinstall the best remaining shared library.
11537 ;;
11538 esac
11539 fi
11540 ;;
11541
11542 *.lo)
11543 # Possibly a libtool object, so verify it.
11544 if func_lalib_p "$file"; then
11545
11546 # Read the .lo file
11547 func_source $dir/$name
11548
11549 # Add PIC object to the list of files to remove.
11550 if test -n "$pic_object" && test none != "$pic_object"; then
11551 func_append rmfiles " $dir/$pic_object"
11552 fi
11553
11554 # Add non-PIC object to the list of files to remove.
11555 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11556 func_append rmfiles " $dir/$non_pic_object"
11557 fi
11558 fi
11559 ;;
11560
11561 *)
11562 if test clean = "$opt_mode"; then
11563 noexename=$name
11564 case $file in
11565 *.exe)
11566 func_stripname '' '.exe' "$file"
11567 file=$func_stripname_result
11568 func_stripname '' '.exe' "$name"
11569 noexename=$func_stripname_result
11570 # $file with .exe has already been added to rmfiles,
11571 # add $file without .exe
11572 func_append rmfiles " $file"
11573 ;;
11574 esac
11575 # Do a test to see if this is a libtool program.
11576 if func_ltwrapper_p "$file"; then
11577 if func_ltwrapper_executable_p "$file"; then
11578 func_ltwrapper_scriptname "$file"
11579 relink_command=
11580 func_source $func_ltwrapper_scriptname_result
11581 func_append rmfiles " $func_ltwrapper_scriptname_result"
11582 else
11583 relink_command=
11584 func_source $dir/$noexename
11585 fi
11586
11587 # note $name still contains .exe if it was in $file originally
11588 # as does the version of $file that was added into $rmfiles
11589 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11590 if test yes = "$fast_install" && test -n "$relink_command"; then
11591 func_append rmfiles " $odir/lt-$name"
11592 fi
11593 if test "X$noexename" != "X$name"; then
11594 func_append rmfiles " $odir/lt-$noexename.c"
11595 fi
11596 fi
11597 fi
11598 ;;
11599 esac
11600 func_show_eval "$RM $rmfiles" 'exit_status=1'
11601 done
11602
11603 # Try to remove the $objdir's in the directories where we deleted files
11604 for dir in $rmdirs; do
11605 if test -d "$dir"; then
11606 func_show_eval "rmdir $dir >/dev/null 2>&1"
11607 fi
11608 done
11609
11610 exit $exit_status
11611}
11612
11613if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11614 func_mode_uninstall ${1+"$@"}
11615fi
11616
11617test -z "$opt_mode" && {
11618 help=$generic_help
11619 func_fatal_help "you must specify a MODE"
11620}
11621
11622test -z "$exec_cmd" && \
11623 func_fatal_help "invalid operation mode '$opt_mode'"
11624
11625if test -n "$exec_cmd"; then
11626 eval exec "$exec_cmd"
11627 exit $EXIT_FAILURE
11628fi
11629
11630exit $exit_status
11631
11632
11633# The TAGs below are defined such that we never get into a situation
11634# where we disable both kinds of libraries. Given conflicting
11635# choices, we go for a static library, that is the most portable,
11636# since we can't tell whether shared libraries were disabled because
11637# the user asked for that or because the platform doesn't support
11638# them. This is particularly important on AIX, because we don't
11639# support having both static and shared libraries enabled at the same
11640# time on that platform, so we default to a shared-only configuration.
11641# If a disable-shared tag is given, we'll fallback to a static-only
11642# configuration. But we'll never go from static-only to shared-only.
11643
11644# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11645build_libtool_libs=no
11646build_old_libs=yes
11647# ### END LIBTOOL TAG CONFIG: disable-shared
11648
11649# ### BEGIN LIBTOOL TAG CONFIG: disable-static
11650build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11651# ### END LIBTOOL TAG CONFIG: disable-static
11652
11653# Local Variables:
11654# mode:shell-script
11655# sh-indentation:2
11656# End:
11657
11658# ### BEGIN LIBTOOL TAG CONFIG: CXX
11659
11660# The linker used to build libraries.
11661LD="/usr/bin/ld"
11662
11663# How to create reloadable object files.
11664reload_flag=" -r"
11665reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
11666
11667# Commands used to build an old-style archive.
11668old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
11669
11670# A language specific compiler.
11671CC="clang++"
11672
11673# Is the compiler the GNU compiler?
11674with_gcc=yes
11675
11676# Compiler flag to turn off builtin functions.
11677no_builtin_flag=" -fno-builtin"
11678
11679# Additional compiler flags for building library objects.
11680pic_flag=" -fPIC -DPIC"
11681
11682# How to pass a linker flag through the compiler.
11683wl="-Wl,"
11684
11685# Compiler flag to prevent dynamic linking.
11686link_static_flag="-static"
11687
11688# Does compiler simultaneously support -c and -o options?
11689compiler_c_o="yes"
11690
11691# Whether or not to add -lc for building shared libraries.
11692build_libtool_need_lc=no
11693
11694# Whether or not to disallow shared libs when runtime libs are static.
11695allow_libtool_libs_with_static_runtimes=no
11696
11697# Compiler flag to allow reflexive dlopens.
11698export_dynamic_flag_spec="\$wl--export-dynamic"
11699
11700# Compiler flag to generate shared objects directly from archives.
11701whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
11702
11703# Whether the compiler copes with passing no objects directly.
11704compiler_needs_object="no"
11705
11706# Create an old-style archive from a shared archive.
11707old_archive_from_new_cmds=""
11708
11709# Create a temporary old-style archive to link instead of a shared archive.
11710old_archive_from_expsyms_cmds=""
11711
11712# Commands used to build a shared archive.
11713archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
11714archive_expsym_cmds="echo \\\"{ global:\\\" > \$lib-ver~ sed -e \\\"s|\$|;|\\\" < \$export_symbols >> \$lib-ver~ echo \\\"local: *; };\\\" >> \$lib-ver~\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$lib-ver -o \$lib"
11715
11716# Commands used to build a loadable module if different from building
11717# a shared archive.
11718module_cmds=""
11719module_expsym_cmds=""
11720
11721# Whether we are building with GNU ld or not.
11722with_gnu_ld="yes"
11723
11724# Flag that allows shared libraries with undefined symbols to be built.
11725allow_undefined_flag=""
11726
11727# Flag that enforces no undefined symbols.
11728no_undefined_flag=""
11729
11730# Flag to hardcode $libdir into a binary during linking.
11731# This must work even if $libdir does not exist
11732hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
11733
11734# Whether we need a single "-rpath" flag with a separated argument.
11735hardcode_libdir_separator=""
11736
11737# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11738# DIR into the resulting binary.
11739hardcode_direct=no
11740
11741# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11742# DIR into the resulting binary and the resulting library dependency is
11743# "absolute",i.e impossible to change by setting $shlibpath_var if the
11744# library is relocated.
11745hardcode_direct_absolute=no
11746
11747# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
11748# into the resulting binary.
11749hardcode_minus_L=no
11750
11751# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
11752# into the resulting binary.
11753hardcode_shlibpath_var=unsupported
11754
11755# Set to "yes" if building a shared library automatically hardcodes DIR
11756# into the library and all subsequent libraries and executables linked
11757# against it.
11758hardcode_automatic=no
11759
11760# Set to yes if linker adds runtime paths of dependent libraries
11761# to runtime path list.
11762inherit_rpath=no
11763
11764# Whether libtool must link a program against all its dependency libraries.
11765link_all_deplibs=no
11766
11767# Set to "yes" if exported symbols are required.
11768always_export_symbols=no
11769
11770# The commands to list exported symbols.
11771export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
11772
11773# Symbols that should not be listed in the preloaded symbols.
11774exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
11775
11776# Symbols that must always be exported.
11777include_expsyms=""
11778
11779# Commands necessary for linking programs (against libraries) with templates.
11780prelink_cmds=""
11781
11782# Commands necessary for finishing linking programs.
11783postlink_cmds=""
11784
11785# Specify filename containing input files.
11786file_list_spec=""
11787
11788# How to hardcode a shared library path into an executable.
11789hardcode_action=immediate
11790
11791# The directories searched by this compiler when creating a shared library.
11792compiler_lib_search_dirs="/usr/lib"
11793
11794# Dependencies to place before and after the objects being linked to
11795# create a shared library.
11796predep_objects="/usr/lib/crti.o /usr/lib/crtbeginS.o"
11797postdep_objects="/usr/lib/crtendS.o /usr/lib/crtn.o"
11798predeps=""
11799postdeps="-lc++ -lm -lgcc -lgcc_s -lc -lgcc -lgcc_s"
11800
11801# The library search path used internally by the compiler when linking
11802# a shared library.
11803compiler_lib_search_path="-L/usr/lib"
11804
11805# ### END LIBTOOL TAG CONFIG: CXX
11806
11807# ### BEGIN LIBTOOL TAG CONFIG: FC
11808
11809# The linker used to build libraries.
11810LD="/usr/bin/ld"
11811
11812# How to create reloadable object files.
11813reload_flag=" -r"
11814reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
11815
11816# Commands used to build an old-style archive.
11817old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
11818
11819# A language specific compiler.
11820CC="flang"
11821
11822# Is the compiler the GNU compiler?
11823with_gcc=no
11824
11825# Compiler flag to turn off builtin functions.
11826no_builtin_flag=""
11827
11828# Additional compiler flags for building library objects.
11829pic_flag=""
11830
11831# How to pass a linker flag through the compiler.
11832wl=""
11833
11834# Compiler flag to prevent dynamic linking.
11835link_static_flag=""
11836
11837# Does compiler simultaneously support -c and -o options?
11838compiler_c_o="yes"
11839
11840# Whether or not to add -lc for building shared libraries.
11841build_libtool_need_lc=no
11842
11843# Whether or not to disallow shared libs when runtime libs are static.
11844allow_libtool_libs_with_static_runtimes=no
11845
11846# Compiler flag to allow reflexive dlopens.
11847export_dynamic_flag_spec="\$wl--export-dynamic"
11848
11849# Compiler flag to generate shared objects directly from archives.
11850whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
11851
11852# Whether the compiler copes with passing no objects directly.
11853compiler_needs_object="no"
11854
11855# Create an old-style archive from a shared archive.
11856old_archive_from_new_cmds=""
11857
11858# Create a temporary old-style archive to link instead of a shared archive.
11859old_archive_from_expsyms_cmds=""
11860
11861# Commands used to build a shared archive.
11862archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
11863archive_expsym_cmds="echo \\\"{ global:\\\" > \$lib-ver~ sed -e \\\"s|\$|;|\\\" < \$export_symbols >> \$lib-ver~ echo \\\"local: *; };\\\" >> \$lib-ver~\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$lib-ver -o \$lib"
11864
11865# Commands used to build a loadable module if different from building
11866# a shared archive.
11867module_cmds=""
11868module_expsym_cmds=""
11869
11870# Whether we are building with GNU ld or not.
11871with_gnu_ld="yes"
11872
11873# Flag that allows shared libraries with undefined symbols to be built.
11874allow_undefined_flag=""
11875
11876# Flag that enforces no undefined symbols.
11877no_undefined_flag=""
11878
11879# Flag to hardcode $libdir into a binary during linking.
11880# This must work even if $libdir does not exist
11881hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
11882
11883# Whether we need a single "-rpath" flag with a separated argument.
11884hardcode_libdir_separator=""
11885
11886# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11887# DIR into the resulting binary.
11888hardcode_direct=no
11889
11890# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11891# DIR into the resulting binary and the resulting library dependency is
11892# "absolute",i.e impossible to change by setting $shlibpath_var if the
11893# library is relocated.
11894hardcode_direct_absolute=no
11895
11896# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
11897# into the resulting binary.
11898hardcode_minus_L=no
11899
11900# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
11901# into the resulting binary.
11902hardcode_shlibpath_var=unsupported
11903
11904# Set to "yes" if building a shared library automatically hardcodes DIR
11905# into the library and all subsequent libraries and executables linked
11906# against it.
11907hardcode_automatic=no
11908
11909# Set to yes if linker adds runtime paths of dependent libraries
11910# to runtime path list.
11911inherit_rpath=no
11912
11913# Whether libtool must link a program against all its dependency libraries.
11914link_all_deplibs=no
11915
11916# Set to "yes" if exported symbols are required.
11917always_export_symbols=no
11918
11919# The commands to list exported symbols.
11920export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
11921
11922# Symbols that should not be listed in the preloaded symbols.
11923exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
11924
11925# Symbols that must always be exported.
11926include_expsyms=""
11927
11928# Commands necessary for linking programs (against libraries) with templates.
11929prelink_cmds=""
11930
11931# Commands necessary for finishing linking programs.
11932postlink_cmds=""
11933
11934# Specify filename containing input files.
11935file_list_spec=""
11936
11937# How to hardcode a shared library path into an executable.
11938hardcode_action=immediate
11939
11940# The directories searched by this compiler when creating a shared library.
11941compiler_lib_search_dirs="/usr/local/flang/lib /usr/lib"
11942
11943# Dependencies to place before and after the objects being linked to
11944# create a shared library.
11945predep_objects="/usr/lib/crti.o /usr/lib/crtbeginS.o"
11946postdep_objects="/usr/lib/crtendS.o /usr/lib/crtn.o"
11947predeps=""
11948postdeps="-lgcc -lgcc_s -lc -lgcc -lgcc_s"
11949
11950# The library search path used internally by the compiler when linking
11951# a shared library.
11952compiler_lib_search_path="-L/usr/local/flang/lib -L/usr/lib"
11953
11954# ### END LIBTOOL TAG CONFIG: FC
11955
11956# ### BEGIN LIBTOOL TAG CONFIG: F77
11957
11958# The linker used to build libraries.
11959LD="/usr/bin/ld"
11960
11961# How to create reloadable object files.
11962reload_flag=" -r"
11963reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
11964
11965# Commands used to build an old-style archive.
11966old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
11967
11968# A language specific compiler.
11969CC="flang"
11970
11971# Is the compiler the GNU compiler?
11972with_gcc=
11973
11974# Compiler flag to turn off builtin functions.
11975no_builtin_flag=""
11976
11977# Additional compiler flags for building library objects.
11978pic_flag=""
11979
11980# How to pass a linker flag through the compiler.
11981wl=""
11982
11983# Compiler flag to prevent dynamic linking.
11984link_static_flag=""
11985
11986# Does compiler simultaneously support -c and -o options?
11987compiler_c_o="yes"
11988
11989# Whether or not to add -lc for building shared libraries.
11990build_libtool_need_lc=no
11991
11992# Whether or not to disallow shared libs when runtime libs are static.
11993allow_libtool_libs_with_static_runtimes=no
11994
11995# Compiler flag to allow reflexive dlopens.
11996export_dynamic_flag_spec="\$wl--export-dynamic"
11997
11998# Compiler flag to generate shared objects directly from archives.
11999whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
12000
12001# Whether the compiler copes with passing no objects directly.
12002compiler_needs_object="no"
12003
12004# Create an old-style archive from a shared archive.
12005old_archive_from_new_cmds=""
12006
12007# Create a temporary old-style archive to link instead of a shared archive.
12008old_archive_from_expsyms_cmds=""
12009
12010# Commands used to build a shared archive.
12011archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
12012archive_expsym_cmds="echo \\\"{ global:\\\" > \$lib-ver~ sed -e \\\"s|\$|;|\\\" < \$export_symbols >> \$lib-ver~ echo \\\"local: *; };\\\" >> \$lib-ver~\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$lib-ver -o \$lib"
12013
12014# Commands used to build a loadable module if different from building
12015# a shared archive.
12016module_cmds=""
12017module_expsym_cmds=""
12018
12019# Whether we are building with GNU ld or not.
12020with_gnu_ld="yes"
12021
12022# Flag that allows shared libraries with undefined symbols to be built.
12023allow_undefined_flag=""
12024
12025# Flag that enforces no undefined symbols.
12026no_undefined_flag=""
12027
12028# Flag to hardcode $libdir into a binary during linking.
12029# This must work even if $libdir does not exist
12030hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
12031
12032# Whether we need a single "-rpath" flag with a separated argument.
12033hardcode_libdir_separator=""
12034
12035# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
12036# DIR into the resulting binary.
12037hardcode_direct=no
12038
12039# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
12040# DIR into the resulting binary and the resulting library dependency is
12041# "absolute",i.e impossible to change by setting $shlibpath_var if the
12042# library is relocated.
12043hardcode_direct_absolute=no
12044
12045# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
12046# into the resulting binary.
12047hardcode_minus_L=no
12048
12049# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
12050# into the resulting binary.
12051hardcode_shlibpath_var=unsupported
12052
12053# Set to "yes" if building a shared library automatically hardcodes DIR
12054# into the library and all subsequent libraries and executables linked
12055# against it.
12056hardcode_automatic=no
12057
12058# Set to yes if linker adds runtime paths of dependent libraries
12059# to runtime path list.
12060inherit_rpath=no
12061
12062# Whether libtool must link a program against all its dependency libraries.
12063link_all_deplibs=no
12064
12065# Set to "yes" if exported symbols are required.
12066always_export_symbols=no
12067
12068# The commands to list exported symbols.
12069export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
12070
12071# Symbols that should not be listed in the preloaded symbols.
12072exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
12073
12074# Symbols that must always be exported.
12075include_expsyms=""
12076
12077# Commands necessary for linking programs (against libraries) with templates.
12078prelink_cmds=""
12079
12080# Commands necessary for finishing linking programs.
12081postlink_cmds=""
12082
12083# Specify filename containing input files.
12084file_list_spec=""
12085
12086# How to hardcode a shared library path into an executable.
12087hardcode_action=immediate
12088
12089# The directories searched by this compiler when creating a shared library.
12090compiler_lib_search_dirs=""
12091
12092# Dependencies to place before and after the objects being linked to
12093# create a shared library.
12094predep_objects=""
12095postdep_objects=""
12096predeps=""
12097postdeps=""
12098
12099# The library search path used internally by the compiler when linking
12100# a shared library.
12101compiler_lib_search_path=""
12102
12103# ### END LIBTOOL TAG CONFIG: F77