annotate GEMBASSY-1.0.3/ltmain.sh @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1 #! /bin/sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3 ## by inline-source v2014-01-03.01
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5 # libtool (GNU libtool) 2.4.5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6 # Provide generalized library-building support services.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10 # This is free software; see the source for copying conditions. There is NO
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
12
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
13 # GNU Libtool is free software; you can redistribute it and/or modify
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
14 # it under the terms of the GNU General Public License as published by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
15 # the Free Software Foundation; either version 2 of the License, or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
16 # (at your option) any later version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
17 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
18 # As a special exception to the GNU General Public License,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
19 # if you distribute this file as part of a program or library that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
20 # is built using GNU Libtool, you may include this file under the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
21 # same distribution terms that you use for the rest of that program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
22 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
23 # GNU Libtool is distributed in the hope that it will be useful, but
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
26 # General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
27 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
28 # You should have received a copy of the GNU General Public License
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
30
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
31
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
32 PROGRAM=libtool
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
33 PACKAGE=libtool
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
34 VERSION=2.4.5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
35 package_revision=2.4.5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
36
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
37
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
38 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
39 ## Usage. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
40 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
41
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
42 # Run './libtool --help' for help with using this script from the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
43 # command line.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
44
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
45
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
46 ## ------------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
47 ## User overridable command paths. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
48 ## ------------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
49
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
50 # After configure completes, it has a better idea of some of the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
51 # shell tools we need than the defaults used by the functions shared
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
52 # with bootstrap, so set those here where they can still be over-
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
53 # ridden by the user, but otherwise take precedence.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
54
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
55 : ${AUTOCONF="autoconf"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
56 : ${AUTOMAKE="automake"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
57
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
58
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
59 ## -------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
60 ## Source external libraries. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
61 ## -------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
62
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
63 # Much of our low-level functionality needs to be sourced from external
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
64 # libraries, which are installed to $pkgauxdir.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
65
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
66 # Set a version string for this script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
67 scriptversion=2014-01-03.01; # UTC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
68
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
69 # General shell script boiler plate, and helper functions.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
70 # Written by Gary V. Vaughan, 2004
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
71
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
72 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
73 # This is free software; see the source for copying conditions. There is NO
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
75
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
76 # This program is free software; you can redistribute it and/or modify
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
77 # it under the terms of the GNU General Public License as published by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
78 # the Free Software Foundation; either version 3 of the License, or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
79 # (at your option) any later version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
80
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
81 # As a special exception to the GNU General Public License, if you distribute
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
82 # this file as part of a program or library that is built using GNU Libtool,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
83 # you may include this file under the same distribution terms that you use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
84 # for the rest of that program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
85
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
86 # This program is distributed in the hope that it will be useful,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
89 # General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
90
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
91 # You should have received a copy of the GNU General Public License
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
93
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
94 # Please report bugs or propose patches to gary@gnu.org.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
95
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
96
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
97 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
98 ## Usage. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
99 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
100
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
101 # Evaluate this file near the top of your script to gain access to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
102 # the functions and variables defined here:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
103 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
105 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
106 # If you need to override any of the default environment variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
107 # settings, do that before evaluating this file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
109
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
110 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
111 ## Shell normalisation. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
112 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
113
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
114 # Some shells need a little help to be as Bourne compatible as possible.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
115 # Before doing anything else, make sure all that help has been provided!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
116
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
117 DUALCASE=1; export DUALCASE # for MKS sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
119 emulate sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
120 NULLCMD=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
122 # is contrary to our usage. Disable this feature.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
123 alias -g '${1+"$@"}'='"$@"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
124 setopt NO_GLOB_SUBST
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
125 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
127 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
128
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
129 # NLS nuisances: We save the old values in case they are required later.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
130 _G_user_locale=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
131 _G_safe_locale=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
133 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
134 eval "if test set = \"\${$_G_var+set}\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
135 save_$_G_var=\$$_G_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
136 $_G_var=C
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
137 export $_G_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
140 fi"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
141 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
142
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
143 # CDPATH.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
145
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
146 # Make sure IFS has a sensible default
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
147 sp=' '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
148 nl='
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
149 '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
150 IFS="$sp $nl"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
151
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
152 # There are apparently some retarded systems that use ';' as a PATH separator!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
153 if test "${PATH_SEPARATOR+set}" != set; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
154 PATH_SEPARATOR=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
157 PATH_SEPARATOR=';'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
158 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
159 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
160
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
161
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
162
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
163 ## ------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
164 ## Locate command utilities. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
165 ## ------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
166
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
167
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
168 # func_executable_p FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
169 # ----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
170 # Check that FILE is an executable regular file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
171 func_executable_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
172 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
173 test -f "$1" && test -x "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
174 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
175
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
176
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
178 # --------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
179 # Search for either a program that responds to --version with output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
181 # trying all the directories in PATH with each of the elements of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
182 # PROGS_LIST.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
183 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
184 # CHECK_FUNC should accept the path to a candidate program, and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
185 # set $func_check_prog_result if it truncates its output less than
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
186 # $_G_path_prog_max characters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
187 func_path_progs ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
188 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
189 _G_progs_list=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
190 _G_check_func=$2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
191 _G_PATH=${3-"$PATH"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
192
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
193 _G_path_prog_max=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
194 _G_path_prog_found=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
195 _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
196 for _G_dir in $_G_PATH; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
197 IFS=$_G_save_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
198 test -z "$_G_dir" && _G_dir=.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
199 for _G_prog_name in $_G_progs_list; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
200 for _exeext in '' .EXE; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
202 func_executable_p "$_G_path_prog" || continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
203 case `"$_G_path_prog" --version 2>&1` in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
205 *) $_G_check_func $_G_path_prog
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
206 func_path_progs_result=$func_check_prog_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
207 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
208 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
209 $_G_path_prog_found && break 3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
210 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
211 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
212 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
213 IFS=$_G_save_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
214 test -z "$func_path_progs_result" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
215 echo "no acceptable sed could be found in \$PATH" >&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
216 exit 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
217 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
218 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
219
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
220
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
221 # We want to be able to use the functions in this file before configure
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
222 # has figured out where the best binaries are kept, which means we have
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
223 # to search for them ourselves - except when the results are already set
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
224 # where we skip the searches.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
225
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
226 # Unless the user overrides by setting SED, search the path for either GNU
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
227 # sed, or the sed that truncates its output the least.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
228 test -z "$SED" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
230 for _G_i in 1 2 3 4 5 6 7; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
232 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
234 _G_sed_script=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
235
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
236 func_check_prog_sed ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
237 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
238 _G_path_prog=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
239
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
240 _G_count=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
241 printf 0123456789 >conftest.in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
242 while :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
243 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
244 cat conftest.in conftest.in >conftest.tmp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
245 mv conftest.tmp conftest.in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
246 cp conftest.in conftest.nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
247 echo '' >> conftest.nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
250 _G_count=`expr $_G_count + 1`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
252 # Best one so far, save it but keep looking for a better one
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
253 func_check_prog_result=$_G_path_prog
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
254 _G_path_prog_max=$_G_count
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
255 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
256 # 10*(2^10) chars as input seems more than enough
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
257 test 10 -lt "$_G_count" && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
258 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
260 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
261
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
263 rm -f conftest.sed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
264 SED=$func_path_progs_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
265 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
266
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
267
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
268 # Unless the user overrides by setting GREP, search the path for either GNU
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
269 # grep, or the grep that truncates its output the least.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
270 test -z "$GREP" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
271 func_check_prog_grep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
272 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
273 _G_path_prog=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
274
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
275 _G_count=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
276 _G_path_prog_max=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
277 printf 0123456789 >conftest.in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
278 while :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
279 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
280 cat conftest.in conftest.in >conftest.tmp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
281 mv conftest.tmp conftest.in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
282 cp conftest.in conftest.nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
283 echo 'GREP' >> conftest.nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
286 _G_count=`expr $_G_count + 1`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
288 # Best one so far, save it but keep looking for a better one
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
289 func_check_prog_result=$_G_path_prog
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
290 _G_path_prog_max=$_G_count
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
291 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
292 # 10*(2^10) chars as input seems more than enough
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
293 test 10 -lt "$_G_count" && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
294 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
296 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
297
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
299 GREP=$func_path_progs_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
300 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
301
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
302
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
303 ## ------------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
304 ## User overridable command paths. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
305 ## ------------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
306
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
307 # All uppercase variable names are used for environment variables. These
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
308 # variables can be overridden by the user before calling a script that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
309 # uses them if a suitable command of that name is not already available
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
310 # in the command search PATH.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
311
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
312 : ${CP="cp -f"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
313 : ${ECHO="printf %s\n"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
314 : ${EGREP="$GREP -E"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
315 : ${FGREP="$GREP -F"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
316 : ${LN_S="ln -s"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
317 : ${MAKE="make"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
318 : ${MKDIR="mkdir"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
319 : ${MV="mv -f"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
320 : ${RM="rm -f"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
321 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
322
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
323
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
324 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
325 ## Useful sed snippets. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
326 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
327
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
328 sed_dirname='s|/[^/]*$||'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
329 sed_basename='s|^.*/||'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
330
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
331 # Sed substitution that helps us do robust quoting. It backslashifies
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
332 # metacharacters that are still active within double-quoted strings.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
333 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
334
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
335 # Same as above, but do not quote variable references.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
336 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
337
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
338 # Sed substitution that turns a string into a regex matching for the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
339 # string literally.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
340 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
341
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
342 # Sed substitution that converts a w32 file name or path
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
343 # that contains forward slashes, into one that contains
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
344 # (escaped) backslashes. A very naive implementation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
345 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
346
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
347 # Re-'\' parameter expansions in output of sed_double_quote_subst that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
348 # were '\'-ed in input to the same. If an odd number of '\' preceded a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
349 # '$' in input to sed_double_quote_subst, that '$' was protected from
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
350 # expansion. Since each input '\' is now two '\'s, look for any number
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
351 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
352 _G_bs='\\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
353 _G_bs2='\\\\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
354 _G_bs4='\\\\\\\\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
355 _G_dollar='\$'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
356 sed_double_backslash="\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
357 s/$_G_bs4/&\\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
358 /g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
359 s/^$_G_bs2$_G_dollar/$_G_bs&/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
360 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
361 s/\n//g"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
362
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
363
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
364 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
365 ## Global variables. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
366 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
367
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
368 # Except for the global variables explicitly listed below, the following
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
369 # functions in the '^func_' namespace, and the '^require_' namespace
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
370 # variables initialised in the 'Resource management' section, sourcing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
371 # this file will not pollute your global namespace with anything
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
372 # else. There's no portable way to scope variables in Bourne shell
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
373 # though, so actually running these functions will sometimes place
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
374 # results into a variable named after the function, and often use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
375 # temporary variables in the '^_G_' namespace. If you are careful to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
376 # avoid using those namespaces casually in your sourcing script, things
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
377 # should continue to work as you expect. And, of course, you can freely
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
378 # overwrite any of the functions or variables defined here before
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
379 # calling anything to customize them.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
380
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
381 EXIT_SUCCESS=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
382 EXIT_FAILURE=1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
383 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
384 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
385
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
386 # Allow overriding, eg assuming that you follow the convention of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
387 # putting '$debug_cmd' at the start of all your functions, you can get
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
388 # bash to show function call trace with:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
389 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
390 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
391 debug_cmd=${debug_cmd-":"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
392 exit_cmd=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
393
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
394 # By convention, finish your script with:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
395 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
396 # exit $exit_status
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
397 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
398 # so that you can set exit_status to non-zero if you want to indicate
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
399 # something went wrong during execution without actually bailing out at
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
400 # the point of failure.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
401 exit_status=$EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
402
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
403 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
404 # is ksh but when the shell is invoked as "sh" and the current value of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
405 # the _XPG environment variable is not equal to 1 (one), the special
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
406 # positional parameter $0, within a function call, is the name of the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
407 # function.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
408 progpath=$0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
409
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
410 # The name of this program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
411 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
412
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
413 # Make sure we have an absolute progpath for reexecution:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
414 case $progpath in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
415 [\\/]*|[A-Za-z]:\\*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
416 *[\\/]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
417 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
418 progdir=`cd "$progdir" && pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
419 progpath=$progdir/$progname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
420 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
421 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
422 _G_IFS=$IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
423 IFS=${PATH_SEPARATOR-:}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
424 for progdir in $PATH; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
425 IFS=$_G_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
426 test -x "$progdir/$progname" && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
427 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
428 IFS=$_G_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
429 test -n "$progdir" || progdir=`pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
430 progpath=$progdir/$progname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
431 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
432 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
433
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
434
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
435 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
436 ## Standard options. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
437 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
438
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
439 # The following options affect the operation of the functions defined
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
440 # below, and should be set appropriately depending on run-time para-
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
441 # meters passed on the command line.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
442
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
443 opt_dry_run=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
444 opt_quiet=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
445 opt_verbose=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
446
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
447 # Categories 'all' and 'none' are always available. Append any others
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
448 # you will pass as the first argument to func_warning from your own
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
449 # code.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
450 warning_categories=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
451
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
452 # By default, display warnings according to 'opt_warning_types'. Set
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
453 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
454 # treat the next displayed warning as a fatal error.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
455 warning_func=func_warn_and_continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
456
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
457 # Set to 'all' to display all warnings, 'none' to suppress all
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
458 # warnings, or a space delimited list of some subset of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
459 # 'warning_categories' to display only the listed warnings.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
460 opt_warning_types=all
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
461
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
462
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
463 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
464 ## Resource management. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
465 ## -------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
466
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
467 # This section contains definitions for functions that each ensure a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
468 # particular resource (a file, or a non-empty configuration variable for
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
469 # example) is available, and if appropriate to extract default values
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
470 # from pertinent package files. Call them using their associated
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
471 # 'require_*' variable to ensure that they are executed, at most, once.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
472 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
473 # It's entirely deliberate that calling these functions can set
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
474 # variables that don't obey the namespace limitations obeyed by the rest
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
475 # of this file, in order that that they be as useful as possible to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
476 # callers.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
477
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
478
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
479 # require_term_colors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
480 # -------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
481 # Allow display of bold text on terminals that support it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
482 require_term_colors=func_require_term_colors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
483 func_require_term_colors ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
484 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
485 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
486
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
487 test -t 1 && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
488 # COLORTERM and USE_ANSI_COLORS environment variables take
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
489 # precedence, because most terminfo databases neglect to describe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
490 # whether color sequences are supported.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
491 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
492
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
493 if test 1 = "$USE_ANSI_COLORS"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
494 # Standard ANSI escape sequences
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
495 tc_reset=''
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
496 tc_bold=''; tc_standout=''
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
497 tc_red=''; tc_green=''
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
498 tc_blue=''; tc_cyan=''
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
499 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
500 # Otherwise trust the terminfo database after all.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
501 test -n "`tput sgr0 2>/dev/null`" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
502 tc_reset=`tput sgr0`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
503 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
504 tc_standout=$tc_bold
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
505 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
506 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
507 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
508 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
509 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
510 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
511 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
512 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
513
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
514 require_term_colors=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
515 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
516
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
517
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
518 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
519 ## Function library. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
520 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
521
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
522 # This section contains a variety of useful functions to call in your
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
523 # scripts. Take note of the portable wrappers for features provided by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
524 # some modern shells, which will fall back to slower equivalents on
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
525 # less featureful shells.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
526
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
527
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
528 # func_append VAR VALUE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
529 # ---------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
530 # Append VALUE onto the existing contents of VAR.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
531
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
532 # We should try to minimise forks, especially on Windows where they are
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
533 # unreasonably slow, so skip the feature probes when bash or zsh are
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
534 # being used:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
535 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
536 : ${_G_HAVE_ARITH_OP="yes"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
537 : ${_G_HAVE_XSI_OPS="yes"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
538 # The += operator was introduced in bash 3.1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
539 case $BASH_VERSION in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
540 [12].* | 3.0 | 3.0*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
541 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
542 : ${_G_HAVE_PLUSEQ_OP="yes"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
543 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
544 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
545 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
546
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
547 # _G_HAVE_PLUSEQ_OP
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
548 # Can be empty, in which case the shell is probed, "yes" if += is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
549 # useable or anything else if it does not work.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
550 test -z "$_G_HAVE_PLUSEQ_OP" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
551 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
552 && _G_HAVE_PLUSEQ_OP=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
553
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
554 if test yes = "$_G_HAVE_PLUSEQ_OP"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
555 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
556 # This is an XSI compatible shell, allowing a faster implementation...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
557 eval 'func_append ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
558 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
559 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
560
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
561 eval "$1+=\$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
562 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
563 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
564 # ...otherwise fall back to using expr, which is often a shell builtin.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
565 func_append ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
566 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
567 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
568
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
569 eval "$1=\$$1\$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
570 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
571 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
572
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
573
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
574 # func_append_quoted VAR VALUE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
575 # ----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
576 # Quote VALUE and append to the end of shell variable VAR, separated
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
577 # by a space.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
578 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
579 eval 'func_append_quoted ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
580 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
581 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
582
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
583 func_quote_for_eval "$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
584 eval "$1+=\\ \$func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
585 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
586 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
587 func_append_quoted ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
588 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
589 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
590
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
591 func_quote_for_eval "$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
592 eval "$1=\$$1\\ \$func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
593 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
594 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
595
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
596
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
597 # func_append_uniq VAR VALUE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
598 # --------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
599 # Append unique VALUE onto the existing contents of VAR, assuming
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
600 # entries are delimited by the first character of VALUE. For example:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
601 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
602 # func_append_uniq options " --another-option option-argument"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
603 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
604 # will only append to $options if " --another-option option-argument "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
605 # is not already present somewhere in $options already (note spaces at
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
606 # each end implied by leading space in second argument).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
607 func_append_uniq ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
608 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
609 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
610
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
611 eval _G_current_value='`$ECHO $'$1'`'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
612 _G_delim=`expr "$2" : '\(.\)'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
613
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
614 case $_G_delim$_G_current_value$_G_delim in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
615 *"$2$_G_delim"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
616 *) func_append "$@" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
617 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
618 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
619
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
620
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
621 # func_arith TERM...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
622 # ------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
623 # Set func_arith_result to the result of evaluating TERMs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
624 test -z "$_G_HAVE_ARITH_OP" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
625 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
626 && _G_HAVE_ARITH_OP=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
627
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
628 if test yes = "$_G_HAVE_ARITH_OP"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
629 eval 'func_arith ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
630 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
631 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
632
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
633 func_arith_result=$(( $* ))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
634 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
635 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
636 func_arith ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
637 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
638 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
639
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
640 func_arith_result=`expr "$@"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
641 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
642 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
643
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
644
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
645 # func_basename FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
646 # ------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
647 # Set func_basename_result to FILE with everything up to and including
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
648 # the last / stripped.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
649 if test yes = "$_G_HAVE_XSI_OPS"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
650 # If this shell supports suffix pattern removal, then use it to avoid
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
651 # forking. Hide the definitions single quotes in case the shell chokes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
652 # on unsupported syntax...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
653 _b='func_basename_result=${1##*/}'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
654 _d='case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
655 */*) func_dirname_result=${1%/*}$2 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
656 * ) func_dirname_result=$3 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
657 esac'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
658
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
659 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
660 # ...otherwise fall back to using sed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
661 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
662 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
663 if test "X$func_dirname_result" = "X$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
664 func_dirname_result=$3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
665 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
666 func_append func_dirname_result "$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
667 fi'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
668 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
669
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
670 eval 'func_basename ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
671 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
672 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
673
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
674 '"$_b"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
675 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
676
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
677
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
678 # func_dirname FILE APPEND NONDIR_REPLACEMENT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
679 # -------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
680 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
681 # otherwise set result to NONDIR_REPLACEMENT.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
682 eval 'func_dirname ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
683 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
684 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
685
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
686 '"$_d"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
687 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
688
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
689
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
690 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
691 # --------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
692 # Perform func_basename and func_dirname in a single function
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
693 # call:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
694 # dirname: Compute the dirname of FILE. If nonempty,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
695 # add APPEND to the result, otherwise set result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
696 # to NONDIR_REPLACEMENT.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
697 # value returned in "$func_dirname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
698 # basename: Compute filename of FILE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
699 # value retuned in "$func_basename_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
700 # For efficiency, we do not delegate to the functions above but instead
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
701 # duplicate the functionality here.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
702 eval 'func_dirname_and_basename ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
703 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
704 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
705
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
706 '"$_b"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
707 '"$_d"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
708 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
709
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
710
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
711 # func_echo ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
712 # ----------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
713 # Echo program name prefixed message.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
714 func_echo ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
715 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
716 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
717
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
718 _G_message=$*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
719
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
720 func_echo_IFS=$IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
721 IFS=$nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
722 for _G_line in $_G_message; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
723 IFS=$func_echo_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
724 $ECHO "$progname: $_G_line"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
725 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
726 IFS=$func_echo_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
727 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
728
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
729
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
730 # func_echo_all ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
731 # --------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
732 # Invoke $ECHO with all args, space-separated.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
733 func_echo_all ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
734 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
735 $ECHO "$*"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
736 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
737
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
738
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
739 # func_echo_infix_1 INFIX ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
740 # ------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
741 # Echo program name, followed by INFIX on the first line, with any
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
742 # additional lines not showing INFIX.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
743 func_echo_infix_1 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
744 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
745 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
746
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
747 $require_term_colors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
748
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
749 _G_infix=$1; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
750 _G_indent=$_G_infix
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
751 _G_prefix="$progname: $_G_infix: "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
752 _G_message=$*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
753
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
754 # Strip color escape sequences before counting printable length
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
755 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
756 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
757 test -n "$_G_tc" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
758 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
759 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
760 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
761 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
762 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
763
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
764 func_echo_infix_1_IFS=$IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
765 IFS=$nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
766 for _G_line in $_G_message; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
767 IFS=$func_echo_infix_1_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
768 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
769 _G_prefix=$_G_indent
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
770 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
771 IFS=$func_echo_infix_1_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
772 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
773
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
774
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
775 # func_error ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
776 # -----------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
777 # Echo program name prefixed message to standard error.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
778 func_error ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
779 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
780 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
781
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
782 $require_term_colors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
783
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
784 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
785 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
786
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
787
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
788 # func_fatal_error ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
789 # -----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
790 # Echo program name prefixed message to standard error, and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
791 func_fatal_error ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
792 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
793 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
794
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
795 func_error "$*"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
796 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
797 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
798
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
799
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
800 # func_grep EXPRESSION FILENAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
801 # -----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
802 # Check whether EXPRESSION matches any line of FILENAME, without output.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
803 func_grep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
804 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
805 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
806
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
807 $GREP "$1" "$2" >/dev/null 2>&1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
808 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
809
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
810
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
811 # func_len STRING
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
812 # ---------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
813 # Set func_len_result to the length of STRING. STRING may not
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
814 # start with a hyphen.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
815 test -z "$_G_HAVE_XSI_OPS" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
816 && (eval 'x=a/b/c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
817 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
818 && _G_HAVE_XSI_OPS=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
819
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
820 if test yes = "$_G_HAVE_XSI_OPS"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
821 eval 'func_len ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
822 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
823 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
824
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
825 func_len_result=${#1}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
826 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
827 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
828 func_len ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
829 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
830 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
831
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
832 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
833 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
834 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
835
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
836
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
837 # func_mkdir_p DIRECTORY-PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
838 # ---------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
839 # Make sure the entire path to DIRECTORY-PATH is available.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
840 func_mkdir_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
841 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
842 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
843
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
844 _G_directory_path=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
845 _G_dir_list=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
846
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
847 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
848
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
849 # Protect directory names starting with '-'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
850 case $_G_directory_path in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
851 -*) _G_directory_path=./$_G_directory_path ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
852 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
853
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
854 # While some portion of DIR does not yet exist...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
855 while test ! -d "$_G_directory_path"; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
856 # ...make a list in topmost first order. Use a colon delimited
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
857 # list incase some portion of path contains whitespace.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
858 _G_dir_list=$_G_directory_path:$_G_dir_list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
859
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
860 # If the last portion added has no slash in it, the list is done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
861 case $_G_directory_path in */*) ;; *) break ;; esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
862
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
863 # ...otherwise throw away the child directory and loop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
864 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
865 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
866 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
867
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
868 func_mkdir_p_IFS=$IFS; IFS=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
869 for _G_dir in $_G_dir_list; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
870 IFS=$func_mkdir_p_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
871 # mkdir can fail with a 'File exist' error if two processes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
872 # try to create one of the directories concurrently. Don't
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
873 # stop in that case!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
874 $MKDIR "$_G_dir" 2>/dev/null || :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
875 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
876 IFS=$func_mkdir_p_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
877
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
878 # Bail out if we (or some other process) failed to create a directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
879 test -d "$_G_directory_path" || \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
880 func_fatal_error "Failed to create '$1'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
881 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
882 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
883
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
884
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
885 # func_mktempdir [BASENAME]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
886 # -------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
887 # Make a temporary directory that won't clash with other running
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
888 # libtool processes, and avoids race conditions if possible. If
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
889 # given, BASENAME is the basename for that directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
890 func_mktempdir ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
891 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
892 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
893
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
894 _G_template=${TMPDIR-/tmp}/${1-$progname}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
895
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
896 if test : = "$opt_dry_run"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
897 # Return a directory name, but don't create it in dry-run mode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
898 _G_tmpdir=$_G_template-$$
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
899 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
900
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
901 # If mktemp works, use that first and foremost
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
902 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
903
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
904 if test ! -d "$_G_tmpdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
905 # Failing that, at least try and use $RANDOM to avoid a race
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
906 _G_tmpdir=$_G_template-${RANDOM-0}$$
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
907
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
908 func_mktempdir_umask=`umask`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
909 umask 0077
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
910 $MKDIR "$_G_tmpdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
911 umask $func_mktempdir_umask
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
912 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
913
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
914 # If we're not in dry-run mode, bomb out on failure
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
915 test -d "$_G_tmpdir" || \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
916 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
917 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
918
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
919 $ECHO "$_G_tmpdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
920 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
921
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
922
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
923 # func_normal_abspath PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
924 # ------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
925 # Remove doubled-up and trailing slashes, "." path components,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
926 # and cancel out any ".." path components in PATH after making
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
927 # it an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
928 func_normal_abspath ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
929 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
930 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
931
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
932 # These SED scripts presuppose an absolute path with a trailing slash.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
933 _G_pathcar='s|^/\([^/]*\).*$|\1|'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
934 _G_pathcdr='s|^/[^/]*||'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
935 _G_removedotparts=':dotsl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
936 s|/\./|/|g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
937 t dotsl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
938 s|/\.$|/|'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
939 _G_collapseslashes='s|/\{1,\}|/|g'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
940 _G_finalslash='s|/*$|/|'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
941
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
942 # Start from root dir and reassemble the path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
943 func_normal_abspath_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
944 func_normal_abspath_tpath=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
945 func_normal_abspath_altnamespace=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
946 case $func_normal_abspath_tpath in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
947 "")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
948 # Empty path, that just means $cwd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
949 func_stripname '' '/' "`pwd`"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
950 func_normal_abspath_result=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
951 return
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
952 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
953 # The next three entries are used to spot a run of precisely
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
954 # two leading slashes without using negated character classes;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
955 # we take advantage of case's first-match behaviour.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
956 ///*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
957 # Unusual form of absolute path, do nothing.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
958 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
959 //*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
960 # Not necessarily an ordinary path; POSIX reserves leading '//'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
961 # and for example Cygwin uses it to access remote file shares
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
962 # over CIFS/SMB, so we conserve a leading double slash if found.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
963 func_normal_abspath_altnamespace=/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
964 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
965 /*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
966 # Absolute path, do nothing.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
967 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
968 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
969 # Relative path, prepend $cwd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
970 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
971 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
972 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
973
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
974 # Cancel out all the simple stuff to save iterations. We also want
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
975 # the path to end with a slash for ease of parsing, so make sure
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
976 # there is one (and only one) here.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
977 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
978 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
979 while :; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
980 # Processed it all yet?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
981 if test / = "$func_normal_abspath_tpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
982 # If we ascended to the root using ".." the result may be empty now.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
983 if test -z "$func_normal_abspath_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
984 func_normal_abspath_result=/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
985 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
986 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
987 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
988 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
989 -e "$_G_pathcar"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
990 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
991 -e "$_G_pathcdr"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
992 # Figure out what to do with it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
993 case $func_normal_abspath_tcomponent in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
994 "")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
995 # Trailing empty path component, ignore it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
996 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
997 ..)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
998 # Parent dir; strip last assembled component from result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
999 func_dirname "$func_normal_abspath_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1000 func_normal_abspath_result=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1001 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1002 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1003 # Actual path component, append it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1004 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1005 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1006 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1007 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1008 # Restore leading double-slash if one was found on entry.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1009 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1010 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1011
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1012
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1013 # func_notquiet ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1014 # --------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1015 # Echo program name prefixed message only when not in quiet mode.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1016 func_notquiet ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1017 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1018 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1019
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1020 $opt_quiet || func_echo ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1021
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1022 # A bug in bash halts the script if the last line of a function
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1023 # fails when set -e is in force, so we need another command to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1024 # work around that:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1025 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1026 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1027
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1028
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1029 # func_relative_path SRCDIR DSTDIR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1030 # --------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1031 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1032 func_relative_path ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1033 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1034 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1035
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1036 func_relative_path_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1037 func_normal_abspath "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1038 func_relative_path_tlibdir=$func_normal_abspath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1039 func_normal_abspath "$2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1040 func_relative_path_tbindir=$func_normal_abspath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1041
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1042 # Ascend the tree starting from libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1043 while :; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1044 # check if we have found a prefix of bindir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1045 case $func_relative_path_tbindir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1046 $func_relative_path_tlibdir)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1047 # found an exact match
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1048 func_relative_path_tcancelled=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1049 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1050 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1051 $func_relative_path_tlibdir*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1052 # found a matching prefix
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1053 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1054 func_relative_path_tcancelled=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1055 if test -z "$func_relative_path_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1056 func_relative_path_result=.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1057 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1058 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1059 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1060 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1061 func_dirname $func_relative_path_tlibdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1062 func_relative_path_tlibdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1063 if test -z "$func_relative_path_tlibdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1064 # Have to descend all the way to the root!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1065 func_relative_path_result=../$func_relative_path_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1066 func_relative_path_tcancelled=$func_relative_path_tbindir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1067 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1068 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1069 func_relative_path_result=../$func_relative_path_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1070 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1071 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1072 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1073
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1074 # Now calculate path; take care to avoid doubling-up slashes.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1075 func_stripname '' '/' "$func_relative_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1076 func_relative_path_result=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1077 func_stripname '/' '/' "$func_relative_path_tcancelled"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1078 if test -n "$func_stripname_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1079 func_append func_relative_path_result "/$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1080 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1081
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1082 # Normalisation. If bindir is libdir, return '.' else relative path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1083 if test -n "$func_relative_path_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1084 func_stripname './' '' "$func_relative_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1085 func_relative_path_result=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1086 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1087
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1088 test -n "$func_relative_path_result" || func_relative_path_result=.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1089
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1090 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1091 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1092
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1093
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1094 # func_quote_for_eval ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1095 # --------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1096 # Aesthetically quote ARGs to be evaled later.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1097 # This function returns two values:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1098 # i) func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1099 # double-quoted, suitable for a subsequent eval
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1100 # ii) func_quote_for_eval_unquoted_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1101 # has all characters that are still active within double
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1102 # quotes backslashified.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1103 func_quote_for_eval ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1104 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1105 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1106
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1107 func_quote_for_eval_unquoted_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1108 func_quote_for_eval_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1109 while test 0 -lt $#; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1110 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1111 *[\\\`\"\$]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1112 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1113 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1114 _G_unquoted_arg=$1 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1115 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1116 if test -n "$func_quote_for_eval_unquoted_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1117 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1118 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1119 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1120 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1121
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1122 case $_G_unquoted_arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1123 # Double-quote args containing shell metacharacters to delay
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1124 # word splitting, command substitution and variable expansion
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1125 # for a subsequent eval.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1126 # Many Bourne shells cannot handle close brackets correctly
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1127 # in scan sets, so we specify it separately.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1128 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1129 _G_quoted_arg=\"$_G_unquoted_arg\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1130 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1131 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1132 _G_quoted_arg=$_G_unquoted_arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1133 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1134 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1135
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1136 if test -n "$func_quote_for_eval_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1137 func_append func_quote_for_eval_result " $_G_quoted_arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1138 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1139 func_append func_quote_for_eval_result "$_G_quoted_arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1140 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1141 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1142 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1143 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1144
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1145
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1146 # func_quote_for_expand ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1147 # -------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1148 # Aesthetically quote ARG to be evaled later; same as above,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1149 # but do not quote variable references.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1150 func_quote_for_expand ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1151 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1152 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1153
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1154 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1155 *[\\\`\"]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1156 _G_arg=`$ECHO "$1" | $SED \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1157 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1158 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1159 _G_arg=$1 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1160 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1161
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1162 case $_G_arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1163 # Double-quote args containing shell metacharacters to delay
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1164 # word splitting and command substitution for a subsequent eval.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1165 # Many Bourne shells cannot handle close brackets correctly
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1166 # in scan sets, so we specify it separately.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1167 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1168 _G_arg=\"$_G_arg\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1169 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1170 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1171
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1172 func_quote_for_expand_result=$_G_arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1173 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1174
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1175
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1176 # func_stripname PREFIX SUFFIX NAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1177 # ---------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1178 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1179 # PREFIX and SUFFIX must not contain globbing or regex special
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1180 # characters, hashes, percent signs, but SUFFIX may contain a leading
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1181 # dot (in which case that matches only a dot).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1182 if test yes = "$_G_HAVE_XSI_OPS"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1183 eval 'func_stripname ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1184 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1185 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1186
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1187 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1188 # positional parameters, so assign one to ordinary variable first.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1189 func_stripname_result=$3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1190 func_stripname_result=${func_stripname_result#"$1"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1191 func_stripname_result=${func_stripname_result%"$2"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1192 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1193 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1194 func_stripname ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1195 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1196 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1197
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1198 case $2 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1199 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1200 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1201 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1202 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1203 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1204
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1205
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1206 # func_show_eval CMD [FAIL_EXP]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1207 # -----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1208 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1209 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1210 # is given, then evaluate it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1211 func_show_eval ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1212 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1213 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1214
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1215 _G_cmd=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1216 _G_fail_exp=${2-':'}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1217
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1218 func_quote_for_expand "$_G_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1219 eval "func_notquiet $func_quote_for_expand_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1220
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1221 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1222 eval "$_G_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1223 _G_status=$?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1224 if test 0 -ne "$_G_status"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1225 eval "(exit $_G_status); $_G_fail_exp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1226 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1227 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1228 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1229
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1230
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1231 # func_show_eval_locale CMD [FAIL_EXP]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1232 # ------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1233 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1234 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1235 # is given, then evaluate it. Use the saved locale for evaluation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1236 func_show_eval_locale ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1237 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1238 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1239
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1240 _G_cmd=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1241 _G_fail_exp=${2-':'}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1242
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1243 $opt_quiet || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1244 func_quote_for_expand "$_G_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1245 eval "func_echo $func_quote_for_expand_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1246 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1247
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1248 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1249 eval "$_G_user_locale
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1250 $_G_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1251 _G_status=$?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1252 eval "$_G_safe_locale"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1253 if test 0 -ne "$_G_status"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1254 eval "(exit $_G_status); $_G_fail_exp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1255 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1256 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1257 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1258
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1259
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1260 # func_tr_sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1261 # ----------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1262 # Turn $1 into a string suitable for a shell variable name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1263 # Result is stored in $func_tr_sh_result. All characters
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1264 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1265 # if $1 begins with a digit, a '_' is prepended as well.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1266 func_tr_sh ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1267 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1268 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1269
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1270 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1271 [0-9]* | *[!a-zA-Z0-9_]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1272 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1273 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1274 * )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1275 func_tr_sh_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1276 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1277 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1278 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1279
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1280
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1281 # func_verbose ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1282 # -------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1283 # Echo program name prefixed message in verbose mode only.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1284 func_verbose ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1285 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1286 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1287
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1288 $opt_verbose && func_echo "$*"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1289
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1290 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1291 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1292
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1293
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1294 # func_warn_and_continue ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1295 # -----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1296 # Echo program name prefixed warning message to standard error.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1297 func_warn_and_continue ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1298 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1299 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1300
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1301 $require_term_colors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1302
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1303 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1304 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1305
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1306
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1307 # func_warning CATEGORY ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1308 # ----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1309 # Echo program name prefixed warning message to standard error. Warning
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1310 # messages can be filtered according to CATEGORY, where this function
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1311 # elides messages where CATEGORY is not listed in the global variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1312 # 'opt_warning_types'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1313 func_warning ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1314 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1315 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1316
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1317 # CATEGORY must be in the warning_categories list!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1318 case " $warning_categories " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1319 *" $1 "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1320 *) func_internal_error "invalid warning category '$1'" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1321 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1322
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1323 _G_category=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1324 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1325
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1326 case " $opt_warning_types " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1327 *" $_G_category "*) $warning_func ${1+"$@"} ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1328 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1329 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1330
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1331
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1332 # func_sort_ver VER1 VER2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1333 # -----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1334 # 'sort -V' is not generally available.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1335 # Note this deviates from the version comparison in automake
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1336 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1337 # but this should suffice as we won't be specifying old
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1338 # version formats or redundant trailing .0 in bootstrap.conf.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1339 # If we did want full compatibility then we should probably
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1340 # use m4_version_compare from autoconf.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1341 func_sort_ver ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1342 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1343 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1344
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1345 printf '%s\n%s\n' "$1" "$2" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1346 | 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
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1347 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1348
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1349 # func_lt_ver PREV CURR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1350 # ---------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1351 # Return true if PREV and CURR are in the correct order according to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1352 # func_sort_ver, otherwise false. Use it like this:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1353 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1354 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1355 func_lt_ver ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1356 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1357 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1358
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1359 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1360 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1361
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1362
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1363 # Local variables:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1364 # mode: shell-script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1365 # sh-indentation: 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1366 # eval: (add-hook 'before-save-hook 'time-stamp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1367 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1368 # time-stamp-time-zone: "UTC"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1369 # End:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1370 #! /bin/sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1371
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1372 # Set a version string for this script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1373 scriptversion=2014-01-07.03; # UTC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1374
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1375 # A portable, pluggable option parser for Bourne shell.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1376 # Written by Gary V. Vaughan, 2010
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1377
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1378 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1379 # This is free software; see the source for copying conditions. There is NO
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1380 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1381
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1382 # This program is free software: you can redistribute it and/or modify
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1383 # it under the terms of the GNU General Public License as published by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1384 # the Free Software Foundation, either version 3 of the License, or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1385 # (at your option) any later version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1386
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1387 # This program is distributed in the hope that it will be useful,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1388 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1389 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1390 # GNU General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1391
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1392 # You should have received a copy of the GNU General Public License
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1393 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1394
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1395 # Please report bugs or propose patches to gary@gnu.org.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1396
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1397
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1398 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1399 ## Usage. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1400 ## ------ ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1401
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1402 # This file is a library for parsing options in your shell scripts along
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1403 # with assorted other useful supporting features that you can make use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1404 # of too.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1405 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1406 # For the simplest scripts you might need only:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1407 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1408 # #!/bin/sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1409 # . relative/path/to/funclib.sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1410 # . relative/path/to/options-parser
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1411 # scriptversion=1.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1412 # func_options ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1413 # eval set dummy "$func_options_result"; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1414 # ...rest of your script...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1415 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1416 # In order for the '--version' option to work, you will need to have a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1417 # suitably formatted comment like the one at the top of this file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1418 # starting with '# Written by ' and ending with '# warranty; '.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1419 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1420 # For '-h' and '--help' to work, you will also need a one line
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1421 # description of your script's purpose in a comment directly above the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1422 # '# Written by ' line, like the one at the top of this file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1423 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1424 # The default options also support '--debug', which will turn on shell
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1425 # execution tracing (see the comment above debug_cmd below for another
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1426 # use), and '--verbose' and the func_verbose function to allow your script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1427 # to display verbose messages only when your user has specified
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1428 # '--verbose'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1429 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1430 # After sourcing this file, you can plug processing for additional
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1431 # options by amending the variables from the 'Configuration' section
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1432 # below, and following the instructions in the 'Option parsing'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1433 # section further down.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1434
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1435 ## -------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1436 ## Configuration. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1437 ## -------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1438
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1439 # You should override these variables in your script after sourcing this
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1440 # file so that they reflect the customisations you have added to the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1441 # option parser.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1442
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1443 # The usage line for option parsing errors and the start of '-h' and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1444 # '--help' output messages. You can embed shell variables for delayed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1445 # expansion at the time the message is displayed, but you will need to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1446 # quote other shell meta-characters carefully to prevent them being
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1447 # expanded when the contents are evaled.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1448 usage='$progpath [OPTION]...'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1449
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1450 # Short help message in response to '-h' and '--help'. Add to this or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1451 # override it after sourcing this library to reflect the full set of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1452 # options your script accepts.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1453 usage_message="\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1454 --debug enable verbose shell tracing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1455 -W, --warnings=CATEGORY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1456 report the warnings falling in CATEGORY [all]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1457 -v, --verbose verbosely report processing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1458 --version print version information and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1459 -h, --help print short or long help message and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1460 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1461
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1462 # Additional text appended to 'usage_message' in response to '--help'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1463 long_help_message="
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1464 Warning categories include:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1465 'all' show all warnings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1466 'none' turn off all the warnings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1467 'error' warnings are treated as fatal errors"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1468
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1469 # Help message printed before fatal option parsing errors.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1470 fatal_help="Try '\$progname --help' for more information."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1471
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1472
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1473
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1474 ## ------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1475 ## Hook function management. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1476 ## ------------------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1477
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1478 # This section contains functions for adding, removing, and running hooks
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1479 # to the main code. A hook is just a named list of of function, that can
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1480 # be run in order later on.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1481
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1482 # func_hookable FUNC_NAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1483 # -----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1484 # Declare that FUNC_NAME will run hooks added with
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1485 # 'func_add_hook FUNC_NAME ...'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1486 func_hookable ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1487 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1488 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1489
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1490 func_append hookable_fns " $1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1491 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1492
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1493
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1494 # func_add_hook FUNC_NAME HOOK_FUNC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1495 # ---------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1496 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1497 # first have been declared "hookable" by a call to 'func_hookable'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1498 func_add_hook ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1499 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1500 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1501
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1502 case " $hookable_fns " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1503 *" $1 "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1504 *) func_fatal_error "'$1' does not accept hook functions." ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1505 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1506
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1507 eval func_append ${1}_hooks '" $2"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1508 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1509
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1510
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1511 # func_remove_hook FUNC_NAME HOOK_FUNC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1512 # ------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1513 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1514 func_remove_hook ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1515 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1516 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1517
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1518 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1519 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1520
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1521
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1522 # func_run_hooks FUNC_NAME [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1523 # ---------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1524 # Run all hook functions registered to FUNC_NAME.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1525 # It is assumed that the list of hook functions contains nothing more
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1526 # than a whitespace-delimited list of legal shell function names, and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1527 # no effort is wasted trying to catch shell meta-characters or preserve
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1528 # whitespace.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1529 func_run_hooks ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1530 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1531 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1532
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1533 case " $hookable_fns " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1534 *" $1 "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1535 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1536 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1537
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1538 eval _G_hook_fns=\$$1_hooks; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1539
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1540 for _G_hook in $_G_hook_fns; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1541 eval $_G_hook '"$@"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1542
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1543 # store returned options list back into positional
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1544 # parameters for next 'cmd' execution.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1545 eval _G_hook_result=\$${_G_hook}_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1546 eval set dummy "$_G_hook_result"; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1547 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1548
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1549 func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1550 func_run_hooks_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1551 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1552
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1553
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1554
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1555 ## --------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1556 ## Option parsing. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1557 ## --------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1558
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1559 # In order to add your own option parsing hooks, you must accept the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1560 # full positional parameter list in your hook function, remove any
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1561 # options that you action, and then pass back the remaining unprocessed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1562 # options in '<hooked_function_name>_result', escaped suitably for
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1563 # 'eval'. Like this:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1564 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1565 # my_options_prep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1566 # {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1567 # $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1568 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1569 # # Extend the existing usage message.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1570 # usage_message=$usage_message'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1571 # -s, --silent don'\''t print informational messages
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1572 # '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1573 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1574 # func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1575 # my_options_prep_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1576 # }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1577 # func_add_hook func_options_prep my_options_prep
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1578 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1579 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1580 # my_silent_option ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1581 # {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1582 # $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1583 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1584 # # Note that for efficiency, we parse as many options as we can
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1585 # # recognise in a loop before passing the remainder back to the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1586 # # caller on the first unrecognised argument we encounter.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1587 # while test $# -gt 0; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1588 # opt=$1; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1589 # case $opt in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1590 # --silent|-s) opt_silent=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1591 # # Separate non-argument short options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1592 # -s*) func_split_short_opt "$_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1593 # set dummy "$func_split_short_opt_name" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1594 # "-$func_split_short_opt_arg" ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1595 # shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1596 # ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1597 # *) set dummy "$_G_opt" "$*"; shift; break ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1598 # esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1599 # done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1600 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1601 # func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1602 # my_silent_option_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1603 # }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1604 # func_add_hook func_parse_options my_silent_option
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1605 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1606 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1607 # my_option_validation ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1608 # {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1609 # $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1610 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1611 # $opt_silent && $opt_verbose && func_fatal_help "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1612 # '--silent' and '--verbose' options are mutually exclusive."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1613 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1614 # func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1615 # my_option_validation_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1616 # }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1617 # func_add_hook func_validate_options my_option_validation
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1618 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1619 # You'll alse need to manually amend $usage_message to reflect the extra
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1620 # options you parse. It's preferable to append if you can, so that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1621 # multiple option parsing hooks can be added safely.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1622
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1623
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1624 # func_options [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1625 # ---------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1626 # All the functions called inside func_options are hookable. See the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1627 # individual implementations for details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1628 func_hookable func_options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1629 func_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1630 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1631 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1632
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1633 func_options_prep ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1634 eval func_parse_options \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1635 ${func_options_prep_result+"$func_options_prep_result"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1636 eval func_validate_options \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1637 ${func_parse_options_result+"$func_parse_options_result"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1638
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1639 eval func_run_hooks func_options \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1640 ${func_validate_options_result+"$func_validate_options_result"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1641
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1642 # save modified positional parameters for caller
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1643 func_options_result=$func_run_hooks_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1644 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1645
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1646
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1647 # func_options_prep [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1648 # --------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1649 # All initialisations required before starting the option parse loop.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1650 # Note that when calling hook functions, we pass through the list of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1651 # positional parameters. If a hook function modifies that list, and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1652 # needs to propogate that back to rest of this script, then the complete
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1653 # modified list must be put in 'func_run_hooks_result' before
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1654 # returning.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1655 func_hookable func_options_prep
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1656 func_options_prep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1657 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1658 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1659
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1660 # Option defaults:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1661 opt_verbose=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1662 opt_warning_types=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1663
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1664 func_run_hooks func_options_prep ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1665
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1666 # save modified positional parameters for caller
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1667 func_options_prep_result=$func_run_hooks_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1668 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1669
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1670
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1671 # func_parse_options [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1672 # ---------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1673 # The main option parsing loop.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1674 func_hookable func_parse_options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1675 func_parse_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1676 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1677 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1678
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1679 func_parse_options_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1680
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1681 # this just eases exit handling
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1682 while test $# -gt 0; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1683 # Defer to hook functions for initial option parsing, so they
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1684 # get priority in the event of reusing an option name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1685 func_run_hooks func_parse_options ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1686
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1687 # Adjust func_parse_options positional parameters to match
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1688 eval set dummy "$func_run_hooks_result"; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1689
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1690 # Break out of the loop if we already parsed every option.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1691 test $# -gt 0 || break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1692
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1693 _G_opt=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1694 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1695 case $_G_opt in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1696 --debug|-x) debug_cmd='set -x'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1697 func_echo "enabling shell trace mode"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1698 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1699 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1700
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1701 --no-warnings|--no-warning|--no-warn)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1702 set dummy --warnings none ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1703 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1704 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1705
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1706 --warnings|--warning|-W)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1707 test $# = 0 && func_missing_arg $_G_opt && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1708 case " $warning_categories $1" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1709 *" $1 "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1710 # trailing space prevents matching last $1 above
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1711 func_append_uniq opt_warning_types " $1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1712 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1713 *all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1714 opt_warning_types=$warning_categories
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1715 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1716 *none)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1717 opt_warning_types=none
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1718 warning_func=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1719 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1720 *error)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1721 opt_warning_types=$warning_categories
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1722 warning_func=func_fatal_error
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1723 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1724 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1725 func_fatal_error \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1726 "unsupported warning category: '$1'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1727 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1728 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1729 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1730 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1731
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1732 --verbose|-v) opt_verbose=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1733 --version) func_version ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1734 -\?|-h) func_usage ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1735 --help) func_help ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1736
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1737 # Separate optargs to long options (plugins may need this):
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1738 --*=*) func_split_equals "$_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1739 set dummy "$func_split_equals_lhs" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1740 "$func_split_equals_rhs" ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1741 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1742 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1743
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1744 # Separate optargs to short options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1745 -W*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1746 func_split_short_opt "$_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1747 set dummy "$func_split_short_opt_name" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1748 "$func_split_short_opt_arg" ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1749 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1750 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1751
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1752 # Separate non-argument short options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1753 -\?*|-h*|-v*|-x*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1754 func_split_short_opt "$_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1755 set dummy "$func_split_short_opt_name" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1756 "-$func_split_short_opt_arg" ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1757 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1758 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1759
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1760 --) break ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1761 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1762 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1763 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1764 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1765
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1766 # save modified positional parameters for caller
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1767 func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1768 func_parse_options_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1769 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1770
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1771
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1772 # func_validate_options [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1773 # ------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1774 # Perform any sanity checks on option settings and/or unconsumed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1775 # arguments.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1776 func_hookable func_validate_options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1777 func_validate_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1778 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1779 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1780
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1781 # Display all warnings if -W was not given.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1782 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1783
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1784 func_run_hooks func_validate_options ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1785
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1786 # Bail if the options were screwed!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1787 $exit_cmd $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1788
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1789 # save modified positional parameters for caller
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1790 func_validate_options_result=$func_run_hooks_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1791 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1792
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1793
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1794
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1795 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1796 ## Helper functions. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1797 ## ----------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1798
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1799 # This section contains the helper functions used by the rest of the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1800 # hookable option parser framework in ascii-betical order.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1801
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1802
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1803 # func_fatal_help ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1804 # ----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1805 # Echo program name prefixed message to standard error, followed by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1806 # a help hint, and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1807 func_fatal_help ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1808 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1809 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1810
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1811 eval \$ECHO \""Usage: $usage"\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1812 eval \$ECHO \""$fatal_help"\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1813 func_error ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1814 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1815 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1816
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1817
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1818 # func_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1819 # ---------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1820 # Echo long help message to standard output and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1821 func_help ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1822 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1823 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1824
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1825 func_usage_message
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1826 $ECHO "$long_help_message"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1827 exit 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1828 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1829
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1830
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1831 # func_missing_arg ARGNAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1832 # ------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1833 # Echo program name prefixed message to standard error and set global
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1834 # exit_cmd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1835 func_missing_arg ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1836 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1837 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1838
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1839 func_error "Missing argument for '$1'."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1840 exit_cmd=exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1841 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1842
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1843
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1844 # func_split_equals STRING
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1845 # ------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1846 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1847 # splitting STRING at the '=' sign.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1848 test -z "$_G_HAVE_XSI_OPS" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1849 && (eval 'x=a/b/c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1850 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1851 && _G_HAVE_XSI_OPS=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1852
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1853 if test yes = "$_G_HAVE_XSI_OPS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1854 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1855 # This is an XSI compatible shell, allowing a faster implementation...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1856 eval 'func_split_equals ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1857 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1858 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1859
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1860 func_split_equals_lhs=${1%%=*}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1861 func_split_equals_rhs=${1#*=}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1862 test "x$func_split_equals_lhs" = "x$1" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1863 && func_split_equals_rhs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1864 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1865 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1866 # ...otherwise fall back to using expr, which is often a shell builtin.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1867 func_split_equals ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1868 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1869 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1870
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1871 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1872 func_split_equals_rhs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1873 test "x$func_split_equals_lhs" = "x$1" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1874 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1875 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1876 fi #func_split_equals
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1877
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1878
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1879 # func_split_short_opt SHORTOPT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1880 # -----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1881 # Set func_split_short_opt_name and func_split_short_opt_arg shell
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1882 # variables after splitting SHORTOPT after the 2nd character.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1883 if test yes = "$_G_HAVE_XSI_OPS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1884 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1885 # This is an XSI compatible shell, allowing a faster implementation...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1886 eval 'func_split_short_opt ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1887 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1888 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1889
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1890 func_split_short_opt_arg=${1#??}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1891 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1892 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1893 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1894 # ...otherwise fall back to using expr, which is often a shell builtin.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1895 func_split_short_opt ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1896 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1897 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1898
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1899 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1900 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1901 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1902 fi #func_split_short_opt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1903
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1904
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1905 # func_usage
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1906 # ----------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1907 # Echo short help message to standard output and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1908 func_usage ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1909 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1910 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1911
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1912 func_usage_message
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1913 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1914 exit 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1915 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1916
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1917
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1918 # func_usage_message
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1919 # ------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1920 # Echo short help message to standard output.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1921 func_usage_message ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1922 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1923 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1924
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1925 eval \$ECHO \""Usage: $usage"\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1926 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1927 $SED -n 's|^# ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1928 /^Written by/{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1929 x;p;x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1930 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1931 h
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1932 /^Written by/q' < "$progpath"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1933 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1934 eval \$ECHO \""$usage_message"\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1935 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1936
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1937
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1938 # func_version
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1939 # ------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1940 # Echo version message to standard output and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1941 func_version ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1942 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1943 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1944
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1945 printf '%s\n' "$progname $scriptversion"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1946 $SED -n '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1947 /(C)/!b go
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1948 :more
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1949 /\./!{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1950 N
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1951 s|\n# | |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1952 b more
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1953 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1954 :go
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1955 /^# Written by /,/# warranty; / {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1956 s|^# ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1957 s|^# *$||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1958 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1959 p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1960 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1961 /^# Written by / {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1962 s|^# ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1963 p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1964 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1965 /^warranty; /q' < "$progpath"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1966
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1967 exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1968 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1969
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1970
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1971 # Local variables:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1972 # mode: shell-script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1973 # sh-indentation: 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1974 # eval: (add-hook 'before-save-hook 'time-stamp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1975 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1976 # time-stamp-time-zone: "UTC"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1977 # End:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1978
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1979 # Set a version string.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1980 scriptversion='(GNU libtool) 2.4.5'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1981
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1982
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1983 # func_echo ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1984 # ----------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1985 # Libtool also displays the current mode in messages, so override
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1986 # funclib.sh func_echo with this custom definition.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1987 func_echo ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1988 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1989 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1990
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1991 _G_message=$*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1992
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1993 func_echo_IFS=$IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1994 IFS=$nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1995 for _G_line in $_G_message; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1996 IFS=$func_echo_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1997 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1998 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1999 IFS=$func_echo_IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2000 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2001
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2002
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2003 # func_warning ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2004 # -------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2005 # Libtool warnings are not categorized, so override funclib.sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2006 # func_warning with this simpler definition.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2007 func_warning ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2008 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2009 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2010
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2011 $warning_func ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2012 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2013
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2014
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2015 ## ---------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2016 ## Options parsing. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2017 ## ---------------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2018
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2019 # Hook in the functions to make sure our own options are parsed during
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2020 # the option parsing loop.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2021
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2022 usage='$progpath [OPTION]... [MODE-ARG]...'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2023
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2024 # Short help message in response to '-h'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2025 usage_message="Options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2026 --config show all configuration variables
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2027 --debug enable verbose shell tracing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2028 -n, --dry-run display commands without modifying any files
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2029 --features display basic configuration information and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2030 --mode=MODE use operation mode MODE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2031 --no-warnings equivalent to '-Wnone'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2032 --preserve-dup-deps don't remove duplicate dependency libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2033 --quiet, --silent don't print informational messages
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2034 --tag=TAG use configuration variables from tag TAG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2035 -v, --verbose print more informational messages than default
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2036 --version print version information
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2037 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2038 -h, --help, --help-all print short, long, or detailed help message
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2039 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2040
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2041 # Additional text appended to 'usage_message' in response to '--help'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2042 long_help_message=$long_help_message"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2043
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2044 MODE must be one of the following:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2045
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2046 clean remove files from the build directory
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2047 compile compile a source file into a libtool object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2048 execute automatically set library path, then run a program
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2049 finish complete the installation of libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2050 install install libraries or executables
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2051 link create a library or an executable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2052 uninstall remove libraries from an installed directory
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2053
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2054 MODE-ARGS vary depending on the MODE. When passed as first option,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2055 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2056 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2057
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2058 When reporting a bug, please describe a test case to reproduce it and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2059 include the following information:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2060
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2061 host-triplet: $host
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2062 shell: $SHELL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2063 compiler: $LTCC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2064 compiler flags: $LTCFLAGS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2065 linker: $LD (gnu? $with_gnu_ld)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2066 version: $progname (GNU libtool) 2.4.5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2067 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2068 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2069
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2070 Report bugs to <bug-libtool@gnu.org>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2071 GNU libtool home page: <http://www.gnu.org/software/libtool/>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2072 General help using GNU software: <http://www.gnu.org/gethelp/>."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2073
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2074
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2075 # func_lo2o OBJECT-NAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2076 # ---------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2077 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2078 # object suffix.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2079
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2080 lo2o=s/\\.lo\$/.$objext/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2081 o2lo=s/\\.$objext\$/.lo/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2082
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2083 if test yes = "$_G_HAVE_XSI_OPS"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2084 eval 'func_lo2o ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2085 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2086 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2087 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2088 * ) func_lo2o_result=$1 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2089 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2090 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2091
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2092 # func_xform LIBOBJ-OR-SOURCE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2093 # ---------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2094 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2095 # suffix to a '.lo' libtool-object suffix.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2096 eval 'func_xform ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2097 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2098 func_xform_result=${1%.*}.lo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2099 }'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2100 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2101 # ...otherwise fall back to using sed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2102 func_lo2o ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2103 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2104 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2105 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2106
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2107 func_xform ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2108 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2109 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2110 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2111 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2112
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2113
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2114 # func_fatal_configuration ARG...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2115 # -------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2116 # Echo program name prefixed message to standard error, followed by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2117 # a configuration failure hint, and exit.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2118 func_fatal_configuration ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2119 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2120 func__fatal_error ${1+"$@"} \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2121 "See the $PACKAGE documentation for more information." \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2122 "Fatal configuration error."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2123 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2124
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2125
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2126 # func_config
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2127 # -----------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2128 # Display the configuration for all the tags in this script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2129 func_config ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2130 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2131 re_begincf='^# ### BEGIN LIBTOOL'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2132 re_endcf='^# ### END LIBTOOL'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2133
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2134 # Default configuration.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2135 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2136
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2137 # Now print the configurations for the tags.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2138 for tagname in $taglist; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2139 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2140 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2141
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2142 exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2143 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2144
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2145
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2146 # func_features
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2147 # -------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2148 # Display the features supported by this script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2149 func_features ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2150 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2151 echo "host: $host"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2152 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2153 echo "enable shared libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2154 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2155 echo "disable shared libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2156 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2157 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2158 echo "enable static libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2159 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2160 echo "disable static libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2161 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2162
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2163 exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2164 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2165
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2166
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2167 # func_enable_tag TAGNAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2168 # -----------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2169 # Verify that TAGNAME is valid, and either flag an error and exit, or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2170 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2171 # variable here.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2172 func_enable_tag ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2173 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2174 # Global variable:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2175 tagname=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2176
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2177 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2178 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2179 sed_extractcf=/$re_begincf/,/$re_endcf/p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2180
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2181 # Validate tagname.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2182 case $tagname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2183 *[!-_A-Za-z0-9,/]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2184 func_fatal_error "invalid tag name: $tagname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2185 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2186 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2187
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2188 # Don't test for the "default" C tag, as we know it's
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2189 # there but not specially marked.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2190 case $tagname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2191 CC) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2192 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2193 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2194 taglist="$taglist $tagname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2195
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2196 # Evaluate the configuration. Be careful to quote the path
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2197 # and the sed script, to avoid splitting on whitespace, but
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2198 # also don't use non-portable quotes within backquotes within
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2199 # quotes we have to do it in 2 steps:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2200 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2201 eval "$extractedcf"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2202 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2203 func_error "ignoring unknown tag $tagname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2204 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2205 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2206 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2207 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2208
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2209
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2210 # func_check_version_match
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2211 # ------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2212 # Ensure that we are using m4 macros, and libtool script from the same
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2213 # release of libtool.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2214 func_check_version_match ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2215 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2216 if test "$package_revision" != "$macro_revision"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2217 if test "$VERSION" != "$macro_version"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2218 if test -z "$macro_version"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2219 cat >&2 <<_LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2220 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2221 $progname: definition of this LT_INIT comes from an older release.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2222 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2223 $progname: and run autoconf again.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2224 _LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2225 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2226 cat >&2 <<_LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2227 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2228 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2229 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2230 $progname: and run autoconf again.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2231 _LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2232 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2233 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2234 cat >&2 <<_LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2235 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2236 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2237 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2238 $progname: of $PACKAGE $VERSION and run autoconf again.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2239 _LT_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2240 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2241
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2242 exit $EXIT_MISMATCH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2243 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2244 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2245
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2246
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2247 # libtool_options_prep [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2248 # -----------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2249 # Preparation for options parsed by libtool.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2250 libtool_options_prep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2251 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2252 $debug_mode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2253
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2254 # Option defaults:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2255 opt_config=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2256 opt_dlopen=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2257 opt_dry_run=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2258 opt_help=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2259 opt_mode=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2260 opt_preserve_dup_deps=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2261 opt_quiet=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2262
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2263 nonopt=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2264 preserve_args=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2265
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2266 # Shorthand for --mode=foo, only valid as the first argument
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2267 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2268 clean|clea|cle|cl)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2269 shift; set dummy --mode clean ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2270 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2271 compile|compil|compi|comp|com|co|c)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2272 shift; set dummy --mode compile ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2273 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2274 execute|execut|execu|exec|exe|ex|e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2275 shift; set dummy --mode execute ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2276 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2277 finish|finis|fini|fin|fi|f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2278 shift; set dummy --mode finish ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2279 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2280 install|instal|insta|inst|ins|in|i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2281 shift; set dummy --mode install ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2282 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2283 link|lin|li|l)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2284 shift; set dummy --mode link ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2285 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2286 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2287 shift; set dummy --mode uninstall ${1+"$@"}; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2288 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2289 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2290
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2291 # Pass back the list of options.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2292 func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2293 libtool_options_prep_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2294 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2295 func_add_hook func_options_prep libtool_options_prep
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2296
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2297
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2298 # libtool_parse_options [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2299 # ---------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2300 # Provide handling for libtool specific options.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2301 libtool_parse_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2302 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2303 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2304
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2305 # Perform our own loop to consume as many options as possible in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2306 # each iteration.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2307 while test $# -gt 0; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2308 _G_opt=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2309 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2310 case $_G_opt in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2311 --dry-run|--dryrun|-n)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2312 opt_dry_run=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2313 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2314
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2315 --config) func_config ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2316
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2317 --dlopen|-dlopen)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2318 opt_dlopen="${opt_dlopen+$opt_dlopen
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2319 }$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2320 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2321 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2322
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2323 --preserve-dup-deps)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2324 opt_preserve_dup_deps=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2325
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2326 --features) func_features ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2327
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2328 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2329
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2330 --help) opt_help=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2331
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2332 --help-all) opt_help=': help-all' ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2333
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2334 --mode) test $# = 0 && func_missing_arg $_G_opt && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2335 opt_mode=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2336 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2337 # Valid mode arguments:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2338 clean|compile|execute|finish|install|link|relink|uninstall) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2339
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2340 # Catch anything else as an error
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2341 *) func_error "invalid argument for $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2342 exit_cmd=exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2343 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2344 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2345 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2346 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2347 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2348
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2349 --no-silent|--no-quiet)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2350 opt_quiet=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2351 func_append preserve_args " $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2352 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2353
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2354 --no-warnings|--no-warning|--no-warn)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2355 opt_warning=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2356 func_append preserve_args " $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2357 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2358
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2359 --no-verbose)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2360 opt_verbose=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2361 func_append preserve_args " $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2362 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2363
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2364 --silent|--quiet)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2365 opt_quiet=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2366 opt_verbose=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2367 func_append preserve_args " $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2368 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2369
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2370 --tag) test $# = 0 && func_missing_arg $_G_opt && break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2371 opt_tag=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2372 func_append preserve_args " $_G_opt $1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2373 func_enable_tag "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2374 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2375 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2376
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2377 --verbose|-v) opt_quiet=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2378 opt_verbose=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2379 func_append preserve_args " $_G_opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2380 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2381
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2382 # An option not handled by this hook function:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2383 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2384 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2385 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2386
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2387
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2388 # save modified positional parameters for caller
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2389 func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2390 libtool_parse_options_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2391 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2392 func_add_hook func_parse_options libtool_parse_options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2393
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2394
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2395
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2396 # libtool_validate_options [ARG]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2397 # ---------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2398 # Perform any sanity checks on option settings and/or unconsumed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2399 # arguments.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2400 libtool_validate_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2401 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2402 # save first non-option argument
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2403 if test 0 -lt $#; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2404 nonopt=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2405 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2406 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2407
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2408 # preserve --debug
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2409 test : = "$debug_cmd" || func_append preserve_args " --debug"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2410
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2411 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2412 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2413 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2414 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2415 # don't eliminate duplications in $postdeps and $predeps
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2416 opt_duplicate_compiler_generated_deps=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2417 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2418 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2419 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2420 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2421 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2422
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2423 $opt_help || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2424 # Sanity checks first:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2425 func_check_version_match
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2426
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2427 test yes != "$build_libtool_libs" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2428 && test yes != "$build_old_libs" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2429 && func_fatal_configuration "not configured to build any kind of library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2430
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2431 # Darwin sucks
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2432 eval std_shrext=\"$shrext_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2433
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2434 # Only execute mode is allowed to have -dlopen flags.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2435 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2436 func_error "unrecognized option '-dlopen'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2437 $ECHO "$help" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2438 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2439 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2440
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2441 # Change the help message to a mode-specific one.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2442 generic_help=$help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2443 help="Try '$progname --help --mode=$opt_mode' for more information."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2444 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2445
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2446 # Pass back the unparsed argument list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2447 func_quote_for_eval ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2448 libtool_validate_options_result=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2449 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2450 func_add_hook func_validate_options libtool_validate_options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2451
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2452
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2453 # Process options as early as possible so that --help and --version
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2454 # can return quickly.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2455 func_options ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2456 eval set dummy "$func_options_result"; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2457
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2458
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2459
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2460 ## ----------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2461 ## Main. ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2462 ## ----------- ##
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2463
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2464 magic='%%%MAGIC variable%%%'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2465 magic_exe='%%%MAGIC EXE variable%%%'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2466
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2467 # Global variables.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2468 extracted_archives=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2469 extracted_serial=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2470
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2471 # If this variable is set in any of the actions, the command in it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2472 # will be execed at the end. This prevents here-documents from being
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2473 # left over by shells.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2474 exec_cmd=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2475
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2476
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2477 # A function that is used when there is no print builtin or printf.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2478 func_fallback_echo ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2479 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2480 eval 'cat <<_LTECHO_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2481 $1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2482 _LTECHO_EOF'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2483 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2484
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2485 # func_generated_by_libtool
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2486 # True iff stdin has been generated by Libtool. This function is only
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2487 # a basic sanity check; it will hardly flush out determined imposters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2488 func_generated_by_libtool_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2489 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2490 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2491 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2492
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2493 # func_lalib_p file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2494 # True iff FILE is a libtool '.la' library or '.lo' object file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2495 # This function is only a basic sanity check; it will hardly flush out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2496 # determined imposters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2497 func_lalib_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2498 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2499 test -f "$1" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2500 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2501 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2502
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2503 # func_lalib_unsafe_p file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2504 # True iff FILE is a libtool '.la' library or '.lo' object file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2505 # This function implements the same check as func_lalib_p without
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2506 # resorting to external programs. To this end, it redirects stdin and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2507 # closes it afterwards, without saving the original file descriptor.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2508 # As a safety measure, use it only where a negative result would be
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2509 # fatal anyway. Works if 'file' does not exist.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2510 func_lalib_unsafe_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2511 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2512 lalib_p=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2513 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2514 for lalib_p_l in 1 2 3 4
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2515 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2516 read lalib_p_line
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2517 case $lalib_p_line in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2518 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2519 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2520 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2521 exec 0<&5 5<&-
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2522 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2523 test yes = "$lalib_p"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2524 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2525
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2526 # func_ltwrapper_script_p file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2527 # True iff FILE is a libtool wrapper script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2528 # This function is only a basic sanity check; it will hardly flush out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2529 # determined imposters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2530 func_ltwrapper_script_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2531 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2532 test -f "$1" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2533 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2534 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2535
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2536 # func_ltwrapper_executable_p file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2537 # True iff FILE is a libtool wrapper executable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2538 # This function is only a basic sanity check; it will hardly flush out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2539 # determined imposters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2540 func_ltwrapper_executable_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2541 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2542 func_ltwrapper_exec_suffix=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2543 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2544 *.exe) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2545 *) func_ltwrapper_exec_suffix=.exe ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2546 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2547 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2548 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2549
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2550 # func_ltwrapper_scriptname file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2551 # Assumes file is an ltwrapper_executable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2552 # uses $file to determine the appropriate filename for a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2553 # temporary ltwrapper_script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2554 func_ltwrapper_scriptname ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2555 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2556 func_dirname_and_basename "$1" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2557 func_stripname '' '.exe' "$func_basename_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2558 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2559 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2560
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2561 # func_ltwrapper_p file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2562 # True iff FILE is a libtool wrapper script or wrapper executable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2563 # This function is only a basic sanity check; it will hardly flush out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2564 # determined imposters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2565 func_ltwrapper_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2566 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2567 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2568 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2569
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2570
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2571 # func_execute_cmds commands fail_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2572 # Execute tilde-delimited COMMANDS.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2573 # If FAIL_CMD is given, eval that upon failure.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2574 # FAIL_CMD may read-access the current command in variable CMD!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2575 func_execute_cmds ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2576 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2577 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2578
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2579 save_ifs=$IFS; IFS='~'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2580 for cmd in $1; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2581 IFS=$sp$nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2582 eval cmd=\"$cmd\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2583 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2584 func_show_eval "$cmd" "${2-:}"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2585 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2586 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2587 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2588
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2589
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2590 # func_source file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2591 # Source FILE, adding directory component if necessary.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2592 # Note that it is not necessary on cygwin/mingw to append a dot to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2593 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2594 # behavior happens only for exec(3), not for open(2)! Also, sourcing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2595 # 'FILE.' does not work on cygwin managed mounts.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2596 func_source ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2597 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2598 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2599
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2600 case $1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2601 */* | *\\*) . "$1" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2602 *) . "./$1" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2603 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2604 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2605
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2606
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2607 # func_resolve_sysroot PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2608 # Replace a leading = in PATH with a sysroot. Store the result into
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2609 # func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2610 func_resolve_sysroot ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2611 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2612 func_resolve_sysroot_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2613 case $func_resolve_sysroot_result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2614 =*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2615 func_stripname '=' '' "$func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2616 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2617 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2618 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2619 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2620
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2621 # func_replace_sysroot PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2622 # If PATH begins with the sysroot, replace it with = and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2623 # store the result into func_replace_sysroot_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2624 func_replace_sysroot ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2625 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2626 case $lt_sysroot:$1 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2627 ?*:"$lt_sysroot"*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2628 func_stripname "$lt_sysroot" '' "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2629 func_replace_sysroot_result='='$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2630 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2631 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2632 # Including no sysroot.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2633 func_replace_sysroot_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2634 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2635 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2636 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2637
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2638 # func_infer_tag arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2639 # Infer tagged configuration to use if any are available and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2640 # if one wasn't chosen via the "--tag" command line option.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2641 # Only attempt this if the compiler in the base compile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2642 # command doesn't match the default compiler.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2643 # arg is usually of the form 'gcc ...'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2644 func_infer_tag ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2645 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2646 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2647
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2648 if test -n "$available_tags" && test -z "$tagname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2649 CC_quoted=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2650 for arg in $CC; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2651 func_append_quoted CC_quoted "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2652 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2653 CC_expanded=`func_echo_all $CC`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2654 CC_quoted_expanded=`func_echo_all $CC_quoted`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2655 case $@ in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2656 # Blanks in the command may have been stripped by the calling shell,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2657 # but not from the CC environment variable when configure was run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2658 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2659 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2660 # Blanks at the start of $base_compile will cause this to fail
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2661 # if we don't check for them as well.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2662 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2663 for z in $available_tags; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2664 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2665 # Evaluate the configuration.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2666 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2667 CC_quoted=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2668 for arg in $CC; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2669 # Double-quote args containing other shell metacharacters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2670 func_append_quoted CC_quoted "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2671 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2672 CC_expanded=`func_echo_all $CC`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2673 CC_quoted_expanded=`func_echo_all $CC_quoted`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2674 case "$@ " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2675 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2676 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2677 # The compiler in the base compile command matches
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2678 # the one in the tagged configuration.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2679 # Assume this is the tagged configuration we want.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2680 tagname=$z
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2681 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2682 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2683 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2684 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2685 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2686 # If $tagname still isn't set, then no tagged configuration
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2687 # was found and let the user know that the "--tag" command
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2688 # line option must be used.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2689 if test -z "$tagname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2690 func_echo "unable to infer tagged configuration"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2691 func_fatal_error "specify a tag with '--tag'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2692 # else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2693 # func_verbose "using $tagname tagged configuration"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2694 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2695 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2696 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2697 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2698 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2699
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2700
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2701
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2702 # func_write_libtool_object output_name pic_name nonpic_name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2703 # Create a libtool object file (analogous to a ".la" file),
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2704 # but don't create it if we're doing a dry run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2705 func_write_libtool_object ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2706 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2707 write_libobj=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2708 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2709 write_lobj=\'$2\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2710 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2711 write_lobj=none
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2712 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2713
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2714 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2715 write_oldobj=\'$3\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2716 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2717 write_oldobj=none
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2718 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2719
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2720 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2721 cat >${write_libobj}T <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2722 # $write_libobj - a libtool object file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2723 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2724 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2725 # Please DO NOT delete this file!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2726 # It is necessary for linking the library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2727
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2728 # Name of the PIC object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2729 pic_object=$write_lobj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2730
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2731 # Name of the non-PIC object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2732 non_pic_object=$write_oldobj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2733
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2734 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2735 $MV "${write_libobj}T" "$write_libobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2736 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2737 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2738
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2739
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2740 ##################################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2741 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2742 ##################################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2743
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2744 # func_convert_core_file_wine_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2745 # Helper function used by file name conversion functions when $build is *nix,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2746 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2747 # correctly configured wine environment available, with the winepath program
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2748 # in $build's $PATH.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2749 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2750 # ARG is the $build file name to be converted to w32 format.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2751 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2752 # be empty on error (or when ARG is empty)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2753 func_convert_core_file_wine_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2754 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2755 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2756
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2757 func_convert_core_file_wine_to_w32_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2758 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2759 # Unfortunately, winepath does not exit with a non-zero error code, so we
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2760 # are forced to check the contents of stdout. On the other hand, if the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2761 # command is not found, the shell will set an exit code of 127 and print
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2762 # *an error message* to stdout. So we must check for both error code of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2763 # zero AND non-empty stdout, which explains the odd construction:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2764 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2765 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2766 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2767 $SED -e "$sed_naive_backslashify"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2768 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2769 func_convert_core_file_wine_to_w32_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2770 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2771 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2772 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2773 # end: func_convert_core_file_wine_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2774
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2775
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2776 # func_convert_core_path_wine_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2777 # Helper function used by path conversion functions when $build is *nix, and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2778 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2779 # configured wine environment available, with the winepath program in $build's
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2780 # $PATH. Assumes ARG has no leading or trailing path separator characters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2781 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2782 # ARG is path to be converted from $build format to win32.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2783 # Result is available in $func_convert_core_path_wine_to_w32_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2784 # Unconvertible file (directory) names in ARG are skipped; if no directory names
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2785 # are convertible, then the result may be empty.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2786 func_convert_core_path_wine_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2787 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2788 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2789
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2790 # unfortunately, winepath doesn't convert paths, only file names
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2791 func_convert_core_path_wine_to_w32_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2792 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2793 oldIFS=$IFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2794 IFS=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2795 for func_convert_core_path_wine_to_w32_f in $1; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2796 IFS=$oldIFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2797 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2798 if test -n "$func_convert_core_file_wine_to_w32_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2799 if test -z "$func_convert_core_path_wine_to_w32_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2800 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2801 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2802 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2803 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2804 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2805 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2806 IFS=$oldIFS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2807 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2808 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2809 # end: func_convert_core_path_wine_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2810
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2811
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2812 # func_cygpath ARGS...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2813 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2814 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2815 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2816 # (2), returns the Cygwin file name or path in func_cygpath_result (input
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2817 # file name or path is assumed to be in w32 format, as previously converted
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2818 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2819 # or path in func_cygpath_result (input file name or path is assumed to be in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2820 # Cygwin format). Returns an empty string on error.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2821 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2822 # ARGS are passed to cygpath, with the last one being the file name or path to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2823 # be converted.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2824 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2825 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2826 # environment variable; do not put it in $PATH.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2827 func_cygpath ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2828 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2829 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2830
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2831 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2832 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2833 if test "$?" -ne 0; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2834 # on failure, ensure result is empty
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2835 func_cygpath_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2836 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2837 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2838 func_cygpath_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2839 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2840 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2841 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2842 #end: func_cygpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2843
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2844
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2845 # func_convert_core_msys_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2846 # Convert file name or path ARG from MSYS format to w32 format. Return
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2847 # result in func_convert_core_msys_to_w32_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2848 func_convert_core_msys_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2849 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2850 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2851
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2852 # awkward: cmd appends spaces to result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2853 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2854 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2855 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2856 #end: func_convert_core_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2857
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2858
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2859 # func_convert_file_check ARG1 ARG2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2860 # Verify that ARG1 (a file name in $build format) was converted to $host
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2861 # format in ARG2. Otherwise, emit an error message, but continue (resetting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2862 # func_to_host_file_result to ARG1).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2863 func_convert_file_check ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2864 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2865 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2866
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2867 if test -z "$2" && test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2868 func_error "Could not determine host file name corresponding to"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2869 func_error " '$1'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2870 func_error "Continuing, but uninstalled executables may not work."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2871 # Fallback:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2872 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2873 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2874 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2875 # end func_convert_file_check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2876
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2877
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2878 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2879 # Verify that FROM_PATH (a path in $build format) was converted to $host
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2880 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2881 # func_to_host_file_result to a simplistic fallback value (see below).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2882 func_convert_path_check ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2883 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2884 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2885
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2886 if test -z "$4" && test -n "$3"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2887 func_error "Could not determine the host path corresponding to"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2888 func_error " '$3'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2889 func_error "Continuing, but uninstalled executables may not work."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2890 # Fallback. This is a deliberately simplistic "conversion" and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2891 # should not be "improved". See libtool.info.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2892 if test "x$1" != "x$2"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2893 lt_replace_pathsep_chars="s|$1|$2|g"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2894 func_to_host_path_result=`echo "$3" |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2895 $SED -e "$lt_replace_pathsep_chars"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2896 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2897 func_to_host_path_result=$3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2898 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2899 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2900 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2901 # end func_convert_path_check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2902
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2903
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2904 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2905 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2906 # and appending REPL if ORIG matches BACKPAT.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2907 func_convert_path_front_back_pathsep ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2908 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2909 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2910
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2911 case $4 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2912 $1 ) func_to_host_path_result=$3$func_to_host_path_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2913 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2914 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2915 case $4 in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2916 $2 ) func_append func_to_host_path_result "$3"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2917 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2918 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2919 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2920 # end func_convert_path_front_back_pathsep
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2921
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2922
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2923 ##################################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2924 # $build to $host FILE NAME CONVERSION FUNCTIONS #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2925 ##################################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2926 # invoked via '$to_host_file_cmd ARG'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2927 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2928 # In each case, ARG is the path to be converted from $build to $host format.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2929 # Result will be available in $func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2930
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2931
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2932 # func_to_host_file ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2933 # Converts the file name ARG from $build format to $host format. Return result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2934 # in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2935 func_to_host_file ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2936 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2937 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2938
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2939 $to_host_file_cmd "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2940 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2941 # end func_to_host_file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2942
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2943
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2944 # func_to_tool_file ARG LAZY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2945 # converts the file name ARG from $build format to toolchain format. Return
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2946 # result in func_to_tool_file_result. If the conversion in use is listed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2947 # in (the comma separated) LAZY, no conversion takes place.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2948 func_to_tool_file ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2949 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2950 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2951
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2952 case ,$2, in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2953 *,"$to_tool_file_cmd",*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2954 func_to_tool_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2955 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2956 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2957 $to_tool_file_cmd "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2958 func_to_tool_file_result=$func_to_host_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2959 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2960 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2961 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2962 # end func_to_tool_file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2963
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2964
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2965 # func_convert_file_noop ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2966 # Copy ARG to func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2967 func_convert_file_noop ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2968 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2969 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2970 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2971 # end func_convert_file_noop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2972
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2973
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2974 # func_convert_file_msys_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2975 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2976 # conversion to w32 is not available inside the cwrapper. Returns result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2977 # func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2978 func_convert_file_msys_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2979 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2980 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2981
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2982 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2983 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2984 func_convert_core_msys_to_w32 "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2985 func_to_host_file_result=$func_convert_core_msys_to_w32_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2986 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2987 func_convert_file_check "$1" "$func_to_host_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2988 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2989 # end func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2990
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2991
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2992 # func_convert_file_cygwin_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2993 # Convert file name ARG from Cygwin to w32 format. Returns result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2994 # func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2995 func_convert_file_cygwin_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2996 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2997 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2998
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2999 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3000 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3001 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3002 # LT_CYGPATH in this case.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3003 func_to_host_file_result=`cygpath -m "$1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3004 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3005 func_convert_file_check "$1" "$func_to_host_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3006 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3007 # end func_convert_file_cygwin_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3008
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3009
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3010 # func_convert_file_nix_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3011 # Convert file name ARG from *nix to w32 format. Requires a wine environment
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3012 # and a working winepath. Returns result in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3013 func_convert_file_nix_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3014 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3015 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3016
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3017 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3018 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3019 func_convert_core_file_wine_to_w32 "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3020 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3021 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3022 func_convert_file_check "$1" "$func_to_host_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3023 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3024 # end func_convert_file_nix_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3025
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3026
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3027 # func_convert_file_msys_to_cygwin ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3028 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3029 # Returns result in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3030 func_convert_file_msys_to_cygwin ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3031 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3032 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3033
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3034 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3035 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3036 func_convert_core_msys_to_w32 "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3037 func_cygpath -u "$func_convert_core_msys_to_w32_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3038 func_to_host_file_result=$func_cygpath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3039 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3040 func_convert_file_check "$1" "$func_to_host_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3041 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3042 # end func_convert_file_msys_to_cygwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3043
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3044
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3045 # func_convert_file_nix_to_cygwin ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3046 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3047 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3048 # in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3049 func_convert_file_nix_to_cygwin ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3050 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3051 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3052
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3053 func_to_host_file_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3054 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3055 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3056 func_convert_core_file_wine_to_w32 "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3057 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3058 func_to_host_file_result=$func_cygpath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3059 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3060 func_convert_file_check "$1" "$func_to_host_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3061 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3062 # end func_convert_file_nix_to_cygwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3063
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3064
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3065 #############################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3066 # $build to $host PATH CONVERSION FUNCTIONS #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3067 #############################################
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3068 # invoked via '$to_host_path_cmd ARG'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3069 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3070 # In each case, ARG is the path to be converted from $build to $host format.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3071 # The result will be available in $func_to_host_path_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3072 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3073 # Path separators are also converted from $build format to $host format. If
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3074 # ARG begins or ends with a path separator character, it is preserved (but
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3075 # converted to $host format) on output.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3076 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3077 # All path conversion functions are named using the following convention:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3078 # file name conversion function : func_convert_file_X_to_Y ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3079 # path conversion function : func_convert_path_X_to_Y ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3080 # where, for any given $build/$host combination the 'X_to_Y' value is the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3081 # same. If conversion functions are added for new $build/$host combinations,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3082 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3083 # will break.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3084
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3085
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3086 # func_init_to_host_path_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3087 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3088 # appropriate value, based on the value of $to_host_file_cmd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3089 to_host_path_cmd=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3090 func_init_to_host_path_cmd ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3091 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3092 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3093
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3094 if test -z "$to_host_path_cmd"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3095 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3096 to_host_path_cmd=func_convert_path_$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3097 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3098 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3099
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3100
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3101 # func_to_host_path ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3102 # Converts the path ARG from $build format to $host format. Return result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3103 # in func_to_host_path_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3104 func_to_host_path ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3105 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3106 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3107
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3108 func_init_to_host_path_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3109 $to_host_path_cmd "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3110 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3111 # end func_to_host_path
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3112
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3113
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3114 # func_convert_path_noop ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3115 # Copy ARG to func_to_host_path_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3116 func_convert_path_noop ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3117 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3118 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3119 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3120 # end func_convert_path_noop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3121
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3122
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3123 # func_convert_path_msys_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3124 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3125 # conversion to w32 is not available inside the cwrapper. Returns result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3126 # func_to_host_path_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3127 func_convert_path_msys_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3128 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3129 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3130
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3131 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3132 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3133 # Remove leading and trailing path separator characters from ARG. MSYS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3134 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3135 # and winepath ignores them completely.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3136 func_stripname : : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3137 func_to_host_path_tmp1=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3138 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3139 func_to_host_path_result=$func_convert_core_msys_to_w32_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3140 func_convert_path_check : ";" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3141 "$func_to_host_path_tmp1" "$func_to_host_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3142 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3143 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3144 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3145 # end func_convert_path_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3146
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3147
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3148 # func_convert_path_cygwin_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3149 # Convert path ARG from Cygwin to w32 format. Returns result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3150 # func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3151 func_convert_path_cygwin_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3152 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3153 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3154
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3155 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3156 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3157 # See func_convert_path_msys_to_w32:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3158 func_stripname : : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3159 func_to_host_path_tmp1=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3160 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3161 func_convert_path_check : ";" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3162 "$func_to_host_path_tmp1" "$func_to_host_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3163 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3164 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3165 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3166 # end func_convert_path_cygwin_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3167
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3168
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3169 # func_convert_path_nix_to_w32 ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3170 # Convert path ARG from *nix to w32 format. Requires a wine environment and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3171 # a working winepath. Returns result in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3172 func_convert_path_nix_to_w32 ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3173 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3174 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3175
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3176 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3177 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3178 # See func_convert_path_msys_to_w32:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3179 func_stripname : : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3180 func_to_host_path_tmp1=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3181 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3182 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3183 func_convert_path_check : ";" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3184 "$func_to_host_path_tmp1" "$func_to_host_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3185 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3186 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3187 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3188 # end func_convert_path_nix_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3189
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3190
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3191 # func_convert_path_msys_to_cygwin ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3192 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3193 # Returns result in func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3194 func_convert_path_msys_to_cygwin ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3195 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3196 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3197
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3198 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3199 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3200 # See func_convert_path_msys_to_w32:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3201 func_stripname : : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3202 func_to_host_path_tmp1=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3203 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3204 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3205 func_to_host_path_result=$func_cygpath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3206 func_convert_path_check : : \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3207 "$func_to_host_path_tmp1" "$func_to_host_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3208 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3209 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3210 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3211 # end func_convert_path_msys_to_cygwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3212
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3213
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3214 # func_convert_path_nix_to_cygwin ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3215 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3216 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3217 # func_to_host_file_result.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3218 func_convert_path_nix_to_cygwin ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3219 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3220 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3221
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3222 func_to_host_path_result=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3223 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3224 # Remove leading and trailing path separator characters from
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3225 # ARG. msys behavior is inconsistent here, cygpath turns them
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3226 # into '.;' and ';.', and winepath ignores them completely.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3227 func_stripname : : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3228 func_to_host_path_tmp1=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3229 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3230 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3231 func_to_host_path_result=$func_cygpath_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3232 func_convert_path_check : : \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3233 "$func_to_host_path_tmp1" "$func_to_host_path_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3234 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3235 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3236 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3237 # end func_convert_path_nix_to_cygwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3238
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3239
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3240 # func_dll_def_p FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3241 # True iff FILE is a Windows DLL '.def' file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3242 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3243 func_dll_def_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3244 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3245 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3246
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3247 func_dll_def_p_tmp=`$SED -n \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3248 -e 's/^[ ]*//' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3249 -e '/^\(;.*\)*$/d' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3250 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3251 -e q \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3252 "$1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3253 test DEF = "$func_dll_def_p_tmp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3254 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3255
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3256
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3257 # func_mode_compile arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3258 func_mode_compile ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3259 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3260 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3261
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3262 # Get the compilation command and the source file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3263 base_compile=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3264 srcfile=$nonopt # always keep a non-empty value in "srcfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3265 suppress_opt=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3266 suppress_output=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3267 arg_mode=normal
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3268 libobj=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3269 later=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3270 pie_flag=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3271
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3272 for arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3273 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3274 case $arg_mode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3275 arg )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3276 # do not "continue". Instead, add this to base_compile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3277 lastarg=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3278 arg_mode=normal
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3279 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3280
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3281 target )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3282 libobj=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3283 arg_mode=normal
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3284 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3285 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3286
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3287 normal )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3288 # Accept any command-line options.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3289 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3290 -o)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3291 test -n "$libobj" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3292 func_fatal_error "you cannot specify '-o' more than once"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3293 arg_mode=target
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3294 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3295 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3296
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3297 -pie | -fpie | -fPIE)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3298 func_append pie_flag " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3299 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3300 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3301
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3302 -shared | -static | -prefer-pic | -prefer-non-pic)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3303 func_append later " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3304 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3305 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3306
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3307 -no-suppress)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3308 suppress_opt=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3309 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3310 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3311
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3312 -Xcompiler)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3313 arg_mode=arg # the next one goes into the "base_compile" arg list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3314 continue # The current "srcfile" will either be retained or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3315 ;; # replaced later. I would guess that would be a bug.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3316
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3317 -Wc,*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3318 func_stripname '-Wc,' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3319 args=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3320 lastarg=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3321 save_ifs=$IFS; IFS=,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3322 for arg in $args; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3323 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3324 func_append_quoted lastarg "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3325 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3326 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3327 func_stripname ' ' '' "$lastarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3328 lastarg=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3329
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3330 # Add the arguments to base_compile.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3331 func_append base_compile " $lastarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3332 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3333 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3334
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3335 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3336 # Accept the current argument as the source file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3337 # The previous "srcfile" becomes the current argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3338 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3339 lastarg=$srcfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3340 srcfile=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3341 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3342 esac # case $arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3343 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3344 esac # case $arg_mode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3345
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3346 # Aesthetically quote the previous argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3347 func_append_quoted base_compile "$lastarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3348 done # for arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3349
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3350 case $arg_mode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3351 arg)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3352 func_fatal_error "you must specify an argument for -Xcompile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3353 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3354 target)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3355 func_fatal_error "you must specify a target with '-o'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3356 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3357 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3358 # Get the name of the library object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3359 test -z "$libobj" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3360 func_basename "$srcfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3361 libobj=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3362 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3363 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3364 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3365
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3366 # Recognize several different file suffixes.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3367 # If the user specifies -o file.o, it is replaced with file.lo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3368 case $libobj in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3369 *.[cCFSifmso] | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3370 *.ada | *.adb | *.ads | *.asm | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3371 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3372 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3373 func_xform "$libobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3374 libobj=$func_xform_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3375 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3376 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3377
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3378 case $libobj in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3379 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3380 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3381 func_fatal_error "cannot determine name of library object from '$libobj'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3382 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3383 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3384
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3385 func_infer_tag $base_compile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3386
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3387 for arg in $later; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3388 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3389 -shared)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3390 test yes = "$build_libtool_libs" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3391 || func_fatal_configuration "cannot build a shared library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3392 build_old_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3393 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3394 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3395
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3396 -static)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3397 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3398 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3399 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3400 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3401
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3402 -prefer-pic)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3403 pic_mode=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3404 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3405 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3406
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3407 -prefer-non-pic)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3408 pic_mode=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3409 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3410 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3411 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3412 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3413
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3414 func_quote_for_eval "$libobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3415 test "X$libobj" != "X$func_quote_for_eval_result" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3416 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3417 && func_warning "libobj name '$libobj' may not contain shell special characters."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3418 func_dirname_and_basename "$obj" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3419 objname=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3420 xdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3421 lobj=$xdir$objdir/$objname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3422
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3423 test -z "$base_compile" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3424 func_fatal_help "you must specify a compilation command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3425
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3426 # Delete any leftover library objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3427 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3428 removelist="$obj $lobj $libobj ${libobj}T"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3429 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3430 removelist="$lobj $libobj ${libobj}T"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3431 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3432
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3433 # On Cygwin there's no "real" PIC flag so we must build both object types
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3434 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3435 cygwin* | mingw* | pw32* | os2* | cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3436 pic_mode=default
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3437 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3438 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3439 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3440 # non-PIC code in shared libraries is not supported
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3441 pic_mode=default
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3442 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3443
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3444 # Calculate the filename of the output object if compiler does
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3445 # not support -o with -c
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3446 if test no = "$compiler_c_o"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3447 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3448 lockfile=$output_obj.lock
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3449 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3450 output_obj=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3451 need_locks=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3452 lockfile=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3453 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3454
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3455 # Lock this critical section if it is needed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3456 # We use this script file to make the link, it avoids creating a new file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3457 if test yes = "$need_locks"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3458 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3459 func_echo "Waiting for $lockfile to be removed"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3460 sleep 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3461 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3462 elif test warn = "$need_locks"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3463 if test -f "$lockfile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3464 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3465 *** ERROR, $lockfile exists and contains:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3466 `cat $lockfile 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3467
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3468 This indicates that another process is trying to use the same
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3469 temporary object file, and libtool could not work around it because
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3470 your compiler does not support '-c' and '-o' together. If you
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3471 repeat this compilation, it may succeed, by chance, but you had better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3472 avoid parallel builds (make -j) in this platform, or get a better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3473 compiler."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3474
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3475 $opt_dry_run || $RM $removelist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3476 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3477 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3478 func_append removelist " $output_obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3479 $ECHO "$srcfile" > "$lockfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3480 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3481
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3482 $opt_dry_run || $RM $removelist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3483 func_append removelist " $lockfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3484 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3485
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3486 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3487 srcfile=$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3488 func_quote_for_eval "$srcfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3489 qsrcfile=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3490
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3491 # Only build a PIC object if we are building libtool libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3492 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3493 # Without this assignment, base_compile gets emptied.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3494 fbsd_hideous_sh_bug=$base_compile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3495
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3496 if test no != "$pic_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3497 command="$base_compile $qsrcfile $pic_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3498 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3499 # Don't build PIC code
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3500 command="$base_compile $qsrcfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3501 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3502
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3503 func_mkdir_p "$xdir$objdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3504
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3505 if test -z "$output_obj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3506 # Place PIC objects in $objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3507 func_append command " -o $lobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3508 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3509
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3510 func_show_eval_locale "$command" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3511 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3512
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3513 if test warn = "$need_locks" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3514 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3515 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3516 *** ERROR, $lockfile contains:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3517 `cat $lockfile 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3518
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3519 but it should contain:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3520 $srcfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3521
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3522 This indicates that another process is trying to use the same
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3523 temporary object file, and libtool could not work around it because
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3524 your compiler does not support '-c' and '-o' together. If you
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3525 repeat this compilation, it may succeed, by chance, but you had better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3526 avoid parallel builds (make -j) in this platform, or get a better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3527 compiler."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3528
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3529 $opt_dry_run || $RM $removelist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3530 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3531 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3532
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3533 # Just move the object if needed, then go on to compile the next one
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3534 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3535 func_show_eval '$MV "$output_obj" "$lobj"' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3536 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3537 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3538
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3539 # Allow error messages only from the first compilation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3540 if test yes = "$suppress_opt"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3541 suppress_output=' >/dev/null 2>&1'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3542 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3543 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3544
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3545 # Only build a position-dependent object if we build old libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3546 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3547 if test yes != "$pic_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3548 # Don't build PIC code
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3549 command="$base_compile $qsrcfile$pie_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3550 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3551 command="$base_compile $qsrcfile $pic_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3552 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3553 if test yes = "$compiler_c_o"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3554 func_append command " -o $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3555 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3556
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3557 # Suppress compiler output if we already did a PIC compilation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3558 func_append command "$suppress_output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3559 func_show_eval_locale "$command" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3560 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3561
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3562 if test warn = "$need_locks" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3563 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3564 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3565 *** ERROR, $lockfile contains:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3566 `cat $lockfile 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3567
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3568 but it should contain:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3569 $srcfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3570
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3571 This indicates that another process is trying to use the same
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3572 temporary object file, and libtool could not work around it because
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3573 your compiler does not support '-c' and '-o' together. If you
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3574 repeat this compilation, it may succeed, by chance, but you had better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3575 avoid parallel builds (make -j) in this platform, or get a better
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3576 compiler."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3577
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3578 $opt_dry_run || $RM $removelist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3579 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3580 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3581
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3582 # Just move the object if needed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3583 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3584 func_show_eval '$MV "$output_obj" "$obj"' \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3585 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3586 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3587 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3588
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3589 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3590 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3591
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3592 # Unlock the critical section if it was locked
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3593 if test no != "$need_locks"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3594 removelist=$lockfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3595 $RM "$lockfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3596 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3597 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3598
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3599 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3600 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3601
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3602 $opt_help || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3603 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3604 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3605
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3606 func_mode_help ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3607 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3608 # We need to display help for each of the modes.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3609 case $opt_mode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3610 "")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3611 # Generic help is extracted from the usage comments
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3612 # at the start of this file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3613 func_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3614 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3615
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3616 clean)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3617 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3618 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3619
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3620 Remove files from the build directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3621
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3622 RM is the name of the program to use to delete files associated with each FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3623 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3624 to RM.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3625
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3626 If FILE is a libtool library, object or program, all the files associated
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3627 with it are deleted. Otherwise, only FILE itself is deleted using RM."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3628 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3629
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3630 compile)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3631 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3632 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3633
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3634 Compile a source file into a libtool library object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3635
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3636 This mode accepts the following additional options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3637
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3638 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3639 -no-suppress do not suppress compiler output for multiple passes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3640 -prefer-pic try to build PIC objects only
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3641 -prefer-non-pic try to build non-PIC objects only
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3642 -shared do not build a '.o' file suitable for static linking
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3643 -static only build a '.o' file suitable for static linking
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3644 -Wc,FLAG pass FLAG directly to the compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3645
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3646 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3647 from the given SOURCEFILE.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3648
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3649 The output file name is determined by removing the directory component from
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3650 SOURCEFILE, then substituting the C source code suffix '.c' with the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3651 library object suffix, '.lo'."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3652 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3653
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3654 execute)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3655 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3656 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3657
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3658 Automatically set library path, then run a program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3659
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3660 This mode accepts the following additional options:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3661
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3662 -dlopen FILE add the directory containing FILE to the library path
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3663
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3664 This mode sets the library path environment variable according to '-dlopen'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3665 flags.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3666
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3667 If any of the ARGS are libtool executable wrappers, then they are translated
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3668 into their corresponding uninstalled binary, and any of their required library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3669 directories are added to the library path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3670
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3671 Then, COMMAND is executed, with ARGS as arguments."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3672 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3673
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3674 finish)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3675 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3676 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3677
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3678 Complete the installation of libtool libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3679
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3680 Each LIBDIR is a directory that contains libtool libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3681
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3682 The commands that this mode executes may require superuser privileges. Use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3683 the '--dry-run' option if you just want to see what would be executed."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3684 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3685
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3686 install)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3687 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3688 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3689
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3690 Install executables or libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3691
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3692 INSTALL-COMMAND is the installation command. The first component should be
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3693 either the 'install' or 'cp' program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3694
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3695 The following components of INSTALL-COMMAND are treated specially:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3696
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3697 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3698
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3699 The rest of the components are interpreted as arguments to that command (only
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3700 BSD-compatible install options are recognized)."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3701 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3702
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3703 link)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3704 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3705 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3706
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3707 Link object files or libraries together to form another library, or to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3708 create an executable program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3709
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3710 LINK-COMMAND is a command using the C compiler that you would use to create
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3711 a program from several object files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3712
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3713 The following components of LINK-COMMAND are treated specially:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3714
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3715 -all-static do not do any dynamic linking at all
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3716 -avoid-version do not add a version suffix if possible
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3717 -bindir BINDIR specify path to binaries directory (for systems where
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3718 libraries must be found in the PATH setting at runtime)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3719 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3720 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3721 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3722 -export-symbols SYMFILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3723 try to export only the symbols listed in SYMFILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3724 -export-symbols-regex REGEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3725 try to export only the symbols matching REGEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3726 -LLIBDIR search LIBDIR for required installed libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3727 -lNAME OUTPUT-FILE requires the installed library libNAME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3728 -module build a library that can dlopened
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3729 -no-fast-install disable the fast-install mode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3730 -no-install link a not-installable executable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3731 -no-undefined declare that a library does not refer to external symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3732 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3733 -objectlist FILE use a list of object files found in FILE to specify objects
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3734 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3735 -precious-files-regex REGEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3736 don't remove output files matching REGEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3737 -release RELEASE specify package release information
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3738 -rpath LIBDIR the created library will eventually be installed in LIBDIR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3739 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3740 -shared only do dynamic linking of libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3741 -shrext SUFFIX override the standard shared library file extension
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3742 -static do not do any dynamic linking of uninstalled libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3743 -static-libtool-libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3744 do not do any dynamic linking of libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3745 -version-info CURRENT[:REVISION[:AGE]]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3746 specify library version info [each variable defaults to 0]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3747 -weak LIBNAME declare that the target provides the LIBNAME interface
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3748 -Wc,FLAG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3749 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3750 -Wl,FLAG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3751 -Xlinker FLAG pass linker-specific FLAG directly to the linker
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3752 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3753
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3754 All other options (arguments beginning with '-') are ignored.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3755
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3756 Every other argument is treated as a filename. Files ending in '.la' are
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3757 treated as uninstalled libtool libraries, other files are standard or library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3758 object files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3759
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3760 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3761 only library objects ('.lo' files) may be specified, and '-rpath' is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3762 required, except when creating a convenience library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3763
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3764 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3765 using 'ar' and 'ranlib', or on Windows using 'lib'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3766
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3767 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3768 is created, otherwise an executable program is created."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3769 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3770
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3771 uninstall)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3772 $ECHO \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3773 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3774
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3775 Remove libraries from an installation directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3776
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3777 RM is the name of the program to use to delete files associated with each FILE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3778 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3779 to RM.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3780
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3781 If FILE is a libtool library, all the files associated with it are deleted.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3782 Otherwise, only FILE itself is deleted using RM."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3783 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3784
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3785 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3786 func_fatal_help "invalid operation mode '$opt_mode'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3787 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3788 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3789
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3790 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3791 $ECHO "Try '$progname --help' for more information about other modes."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3792 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3793
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3794 # Now that we've collected a possible --mode arg, show help if necessary
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3795 if $opt_help; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3796 if test : = "$opt_help"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3797 func_mode_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3798 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3799 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3800 func_help noexit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3801 for opt_mode in compile link execute install finish uninstall clean; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3802 func_mode_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3803 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3804 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3805 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3806 func_help noexit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3807 for opt_mode in compile link execute install finish uninstall clean; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3808 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3809 func_mode_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3810 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3811 } |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3812 $SED '1d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3813 /^When reporting/,/^Report/{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3814 H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3815 d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3816 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3817 $x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3818 /information about other modes/d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3819 /more detailed .*MODE/d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3820 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3821 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3822 exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3823 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3824
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3825
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3826 # func_mode_execute arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3827 func_mode_execute ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3828 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3829 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3830
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3831 # The first argument is the command name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3832 cmd=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3833 test -z "$cmd" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3834 func_fatal_help "you must specify a COMMAND"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3835
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3836 # Handle -dlopen flags immediately.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3837 for file in $opt_dlopen; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3838 test -f "$file" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3839 || func_fatal_help "'$file' is not a file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3840
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3841 dir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3842 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3843 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3844 func_resolve_sysroot "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3845 file=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3846
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3847 # Check to see that this really is a libtool archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3848 func_lalib_unsafe_p "$file" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3849 || func_fatal_help "'$lib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3850
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3851 # Read the libtool library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3852 dlname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3853 library_names=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3854 func_source "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3855
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3856 # Skip this library if it cannot be dlopened.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3857 if test -z "$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3858 # Warn if it was a shared library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3859 test -n "$library_names" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3860 func_warning "'$file' was not linked with '-export-dynamic'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3861 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3862 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3863
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3864 func_dirname "$file" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3865 dir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3866
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3867 if test -f "$dir/$objdir/$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3868 func_append dir "/$objdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3869 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3870 if test ! -f "$dir/$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3871 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3872 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3873 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3874 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3875
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3876 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3877 # Just add the directory containing the .lo file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3878 func_dirname "$file" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3879 dir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3880 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3881
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3882 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3883 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3884 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3885 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3886 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3887
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3888 # Get the absolute pathname.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3889 absdir=`cd "$dir" && pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3890 test -n "$absdir" && dir=$absdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3891
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3892 # Now add the directory to shlibpath_var.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3893 if eval "test -z \"\$$shlibpath_var\""; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3894 eval "$shlibpath_var=\"\$dir\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3895 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3896 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3897 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3898 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3899
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3900 # This variable tells wrapper scripts just to set shlibpath_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3901 # rather than running their programs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3902 libtool_execute_magic=$magic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3903
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3904 # Check if any of the arguments is a wrapper script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3905 args=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3906 for file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3907 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3908 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3909 -* | *.la | *.lo ) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3910 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3911 # Do a test to see if this is really a libtool program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3912 if func_ltwrapper_script_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3913 func_source "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3914 # Transform arg to wrapped name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3915 file=$progdir/$program
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3916 elif func_ltwrapper_executable_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3917 func_ltwrapper_scriptname "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3918 func_source "$func_ltwrapper_scriptname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3919 # Transform arg to wrapped name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3920 file=$progdir/$program
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3921 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3922 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3923 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3924 # Quote arguments (to preserve shell metacharacters).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3925 func_append_quoted args "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3926 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3927
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3928 if $opt_dry_run; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3929 # Display what would be done.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3930 if test -n "$shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3931 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3932 echo "export $shlibpath_var"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3933 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3934 $ECHO "$cmd$args"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3935 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3936 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3937 if test -n "$shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3938 # Export the shlibpath_var.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3939 eval "export $shlibpath_var"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3940 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3941
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3942 # Restore saved environment variables
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3943 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3944 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3945 eval "if test \"\${save_$lt_var+set}\" = set; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3946 $lt_var=\$save_$lt_var; export $lt_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3947 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3948 $lt_unset $lt_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3949 fi"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3950 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3951
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3952 # Now prepare to actually exec the command.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3953 exec_cmd=\$cmd$args
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3954 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3955 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3956
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3957 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3958
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3959
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3960 # func_mode_finish arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3961 func_mode_finish ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3962 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3963 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3964
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3965 libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3966 libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3967 admincmds=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3968
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3969 for opt in "$nonopt" ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3970 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3971 if test -d "$opt"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3972 func_append libdirs " $opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3973
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3974 elif test -f "$opt"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3975 if func_lalib_unsafe_p "$opt"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3976 func_append libs " $opt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3977 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3978 func_warning "'$opt' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3979 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3980
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3981 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3982 func_fatal_error "invalid argument '$opt'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3983 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3984 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3985
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3986 if test -n "$libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3987 if test -n "$lt_sysroot"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3988 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3989 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3990 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3991 sysroot_cmd=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3992 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3993
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3994 # Remove sysroot references
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3995 if $opt_dry_run; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3996 for lib in $libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3997 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3998 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3999 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4000 tmpdir=`func_mktempdir`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4001 for lib in $libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4002 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4003 > $tmpdir/tmp-la
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4004 mv -f $tmpdir/tmp-la $lib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4005 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4006 ${RM}r "$tmpdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4007 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4008 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4009
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4010 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4011 for libdir in $libdirs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4012 if test -n "$finish_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4013 # Do each command in the finish commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4014 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4015 '"$cmd"'"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4016 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4017 if test -n "$finish_eval"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4018 # Do the single finish_eval.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4019 eval cmds=\"$finish_eval\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4020 $opt_dry_run || eval "$cmds" || func_append admincmds "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4021 $cmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4022 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4023 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4024 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4025
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4026 # Exit here if they wanted silent mode.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4027 $opt_quiet && exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4028
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4029 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4030 echo "----------------------------------------------------------------------"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4031 echo "Libraries have been installed in:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4032 for libdir in $libdirs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4033 $ECHO " $libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4034 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4035 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4036 echo "If you ever happen to want to link against installed libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4037 echo "in a given directory, LIBDIR, you must either use libtool, and"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4038 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4039 echo "flag during linking and do at least one of the following:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4040 if test -n "$shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4041 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4042 echo " during execution"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4043 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4044 if test -n "$runpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4045 echo " - add LIBDIR to the '$runpath_var' environment variable"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4046 echo " during linking"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4047 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4048 if test -n "$hardcode_libdir_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4049 libdir=LIBDIR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4050 eval flag=\"$hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4051
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4052 $ECHO " - use the '$flag' linker flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4053 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4054 if test -n "$admincmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4055 $ECHO " - have your system administrator run these commands:$admincmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4056 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4057 if test -f /etc/ld.so.conf; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4058 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4059 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4060 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4061
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4062 echo "See any operating system documentation about shared libraries for"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4063 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4064 solaris2.[6789]|solaris2.1[0-9])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4065 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4066 echo "pages."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4067 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4068 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4069 echo "more information, such as the ld(1) and ld.so(8) manual pages."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4070 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4071 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4072 echo "----------------------------------------------------------------------"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4073 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4074 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4075 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4076
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4077 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4078
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4079
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4080 # func_mode_install arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4081 func_mode_install ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4082 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4083 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4084
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4085 # There may be an optional sh(1) argument at the beginning of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4086 # install_prog (especially on Windows NT).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4087 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4088 # Allow the use of GNU shtool's install command.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4089 case $nonopt in *shtool*) :;; *) false;; esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4090 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4091 # Aesthetically quote it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4092 func_quote_for_eval "$nonopt"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4093 install_prog="$func_quote_for_eval_result "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4094 arg=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4095 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4096 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4097 install_prog=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4098 arg=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4099 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4100
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4101 # The real first argument should be the name of the installation program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4102 # Aesthetically quote it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4103 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4104 func_append install_prog "$func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4105 install_shared_prog=$install_prog
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4106 case " $install_prog " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4107 *[\\\ /]cp\ *) install_cp=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4108 *) install_cp=false ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4109 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4110
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4111 # We need to accept at least all the BSD install flags.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4112 dest=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4113 files=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4114 opts=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4115 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4116 install_type=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4117 isdir=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4118 stripme=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4119 no_mode=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4120 for arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4121 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4122 arg2=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4123 if test -n "$dest"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4124 func_append files " $dest"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4125 dest=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4126 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4127 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4128
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4129 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4130 -d) isdir=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4131 -f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4132 if $install_cp; then :; else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4133 prev=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4134 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4135 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4136 -g | -m | -o)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4137 prev=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4138 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4139 -s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4140 stripme=" -s"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4141 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4142 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4143 -*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4144 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4145 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4146 # If the previous option needed an argument, then skip it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4147 if test -n "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4148 if test X-m = "X$prev" && test -n "$install_override_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4149 arg2=$install_override_mode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4150 no_mode=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4151 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4152 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4153 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4154 dest=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4155 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4156 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4157 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4158 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4159
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4160 # Aesthetically quote the argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4161 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4162 func_append install_prog " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4163 if test -n "$arg2"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4164 func_quote_for_eval "$arg2"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4165 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4166 func_append install_shared_prog " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4167 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4168
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4169 test -z "$install_prog" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4170 func_fatal_help "you must specify an install program"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4171
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4172 test -n "$prev" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4173 func_fatal_help "the '$prev' option requires an argument"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4174
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4175 if test -n "$install_override_mode" && $no_mode; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4176 if $install_cp; then :; else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4177 func_quote_for_eval "$install_override_mode"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4178 func_append install_shared_prog " -m $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4179 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4180 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4181
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4182 if test -z "$files"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4183 if test -z "$dest"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4184 func_fatal_help "no file or destination specified"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4185 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4186 func_fatal_help "you must specify a destination"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4187 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4188 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4189
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4190 # Strip any trailing slash from the destination.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4191 func_stripname '' '/' "$dest"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4192 dest=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4193
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4194 # Check to see that the destination is a directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4195 test -d "$dest" && isdir=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4196 if $isdir; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4197 destdir=$dest
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4198 destname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4199 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4200 func_dirname_and_basename "$dest" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4201 destdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4202 destname=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4203
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4204 # Not a directory, so check to see that there is only one file specified.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4205 set dummy $files; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4206 test "$#" -gt 1 && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4207 func_fatal_help "'$dest' is not a directory"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4208 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4209 case $destdir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4210 [\\/]* | [A-Za-z]:[\\/]*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4211 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4212 for file in $files; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4213 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4214 *.lo) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4215 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4216 func_fatal_help "'$destdir' must be an absolute directory name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4217 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4218 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4219 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4220 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4221 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4222
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4223 # This variable tells wrapper scripts just to set variables rather
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4224 # than running their programs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4225 libtool_install_magic=$magic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4226
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4227 staticlibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4228 future_libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4229 current_libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4230 for file in $files; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4231
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4232 # Do each installation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4233 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4234 *.$libext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4235 # Do the static libraries later.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4236 func_append staticlibs " $file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4237 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4238
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4239 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4240 func_resolve_sysroot "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4241 file=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4242
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4243 # Check to see that this really is a libtool archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4244 func_lalib_unsafe_p "$file" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4245 || func_fatal_help "'$file' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4246
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4247 library_names=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4248 old_library=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4249 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4250 func_source "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4251
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4252 # Add the libdir to current_libdirs if it is the destination.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4253 if test "X$destdir" = "X$libdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4254 case "$current_libdirs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4255 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4256 *) func_append current_libdirs " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4257 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4258 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4259 # Note the libdir as a future libdir.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4260 case "$future_libdirs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4261 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4262 *) func_append future_libdirs " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4263 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4264 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4265
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4266 func_dirname "$file" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4267 dir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4268 func_append dir "$objdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4269
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4270 if test -n "$relink_command"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4271 # Determine the prefix the user has applied to our future dir.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4272 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4273
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4274 # Don't allow the user to place us outside of our expected
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4275 # location b/c this prevents finding dependent libraries that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4276 # are installed to the same prefix.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4277 # At present, this check doesn't affect windows .dll's that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4278 # are installed into $libdir/../bin (currently, that works fine)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4279 # but it's something to keep an eye on.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4280 test "$inst_prefix_dir" = "$destdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4281 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4282
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4283 if test -n "$inst_prefix_dir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4284 # Stick the inst_prefix_dir data into the link command.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4285 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4286 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4287 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4288 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4289
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4290 func_warning "relinking '$file'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4291 func_show_eval "$relink_command" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4292 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4293 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4294
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4295 # See the names of the shared library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4296 set dummy $library_names; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4297 if test -n "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4298 realname=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4299 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4300
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4301 srcname=$realname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4302 test -n "$relink_command" && srcname=${realname}T
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4303
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4304 # Install the shared library and build the symlinks.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4305 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4306 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4307 tstripme=$stripme
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4308 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4309 cygwin* | mingw* | pw32* | cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4310 case $realname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4311 *.dll.a)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4312 tstripme=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4313 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4314 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4315 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4316 os2*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4317 case $realname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4318 *_dll.a)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4319 tstripme=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4320 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4321 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4322 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4323 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4324 if test -n "$tstripme" && test -n "$striplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4325 func_show_eval "$striplib $destdir/$realname" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4326 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4327
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4328 if test "$#" -gt 0; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4329 # Delete the old symlinks, and create new ones.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4330 # Try 'ln -sf' first, because the 'ln' binary might depend on
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4331 # the symlink we replace! Solaris /bin/ln does not understand -f,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4332 # so we also need to try rm && ln -s.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4333 for linkname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4334 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4335 test "$linkname" != "$realname" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4336 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4337 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4338 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4339
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4340 # Do each command in the postinstall commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4341 lib=$destdir/$realname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4342 func_execute_cmds "$postinstall_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4343 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4344
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4345 # Install the pseudo-library for information purposes.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4346 func_basename "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4347 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4348 instname=$dir/${name}i
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4349 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4350
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4351 # Maybe install the static library, too.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4352 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4353 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4354
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4355 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4356 # Install (i.e. copy) a libtool object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4357
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4358 # Figure out destination file name, if it wasn't already specified.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4359 if test -n "$destname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4360 destfile=$destdir/$destname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4361 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4362 func_basename "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4363 destfile=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4364 destfile=$destdir/$destfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4365 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4366
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4367 # Deduce the name of the destination old-style object file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4368 case $destfile in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4369 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4370 func_lo2o "$destfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4371 staticdest=$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4372 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4373 *.$objext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4374 staticdest=$destfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4375 destfile=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4376 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4377 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4378 func_fatal_help "cannot copy a libtool object to '$destfile'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4379 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4380 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4381
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4382 # Install the libtool object if requested.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4383 test -n "$destfile" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4384 func_show_eval "$install_prog $file $destfile" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4385
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4386 # Install the old object if enabled.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4387 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4388 # Deduce the name of the old-style object file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4389 func_lo2o "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4390 staticobj=$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4391 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4392 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4393 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4394 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4395
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4396 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4397 # Figure out destination file name, if it wasn't already specified.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4398 if test -n "$destname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4399 destfile=$destdir/$destname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4400 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4401 func_basename "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4402 destfile=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4403 destfile=$destdir/$destfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4404 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4405
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4406 # If the file is missing, and there is a .exe on the end, strip it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4407 # because it is most likely a libtool script we actually want to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4408 # install
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4409 stripped_ext=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4410 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4411 *.exe)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4412 if test ! -f "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4413 func_stripname '' '.exe' "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4414 file=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4415 stripped_ext=.exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4416 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4417 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4418 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4419
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4420 # Do a test to see if this is really a libtool program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4421 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4422 *cygwin* | *mingw*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4423 if func_ltwrapper_executable_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4424 func_ltwrapper_scriptname "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4425 wrapper=$func_ltwrapper_scriptname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4426 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4427 func_stripname '' '.exe' "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4428 wrapper=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4429 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4430 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4431 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4432 wrapper=$file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4433 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4434 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4435 if func_ltwrapper_script_p "$wrapper"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4436 notinst_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4437 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4438
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4439 func_source "$wrapper"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4440
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4441 # Check the variables that should have been set.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4442 test -z "$generated_by_libtool_version" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4443 func_fatal_error "invalid libtool wrapper script '$wrapper'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4444
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4445 finalize=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4446 for lib in $notinst_deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4447 # Check to see that each library is installed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4448 libdir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4449 if test -f "$lib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4450 func_source "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4451 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4452 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4453 if test -n "$libdir" && test ! -f "$libfile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4454 func_warning "'$lib' has not been installed in '$libdir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4455 finalize=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4456 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4457 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4458
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4459 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4460 func_source "$wrapper"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4461
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4462 outputname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4463 if test no = "$fast_install" && test -n "$relink_command"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4464 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4465 if $finalize; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4466 tmpdir=`func_mktempdir`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4467 func_basename "$file$stripped_ext"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4468 file=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4469 outputname=$tmpdir/$file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4470 # Replace the output file specification.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4471 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4472
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4473 $opt_quiet || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4474 func_quote_for_expand "$relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4475 eval "func_echo $func_quote_for_expand_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4476 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4477 if eval "$relink_command"; then :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4478 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4479 func_error "error: relink '$file' with the above command before installing it"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4480 $opt_dry_run || ${RM}r "$tmpdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4481 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4482 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4483 file=$outputname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4484 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4485 func_warning "cannot relink '$file'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4486 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4487 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4488 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4489 # Install the binary that we compiled earlier.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4490 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4491 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4492 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4493
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4494 # remove .exe since cygwin /usr/bin/install will append another
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4495 # one anyway
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4496 case $install_prog,$host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4497 */usr/bin/install*,*cygwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4498 case $file:$destfile in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4499 *.exe:*.exe)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4500 # this is ok
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4501 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4502 *.exe:*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4503 destfile=$destfile.exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4504 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4505 *:*.exe)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4506 func_stripname '' '.exe' "$destfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4507 destfile=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4508 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4509 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4510 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4511 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4512 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4513 $opt_dry_run || if test -n "$outputname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4514 ${RM}r "$tmpdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4515 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4516 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4517 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4518 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4519
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4520 for file in $staticlibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4521 func_basename "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4522 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4523
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4524 # Set up the ranlib parameters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4525 oldlib=$destdir/$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4526 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4527 tool_oldlib=$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4528
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4529 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4530
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4531 if test -n "$stripme" && test -n "$old_striplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4532 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4533 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4534
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4535 # Do each command in the postinstall commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4536 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4537 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4538
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4539 test -n "$future_libdirs" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4540 func_warning "remember to run '$progname --finish$future_libdirs'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4541
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4542 if test -n "$current_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4543 # Maybe just do a dry run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4544 $opt_dry_run && current_libdirs=" -n$current_libdirs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4545 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4546 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4547 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4548 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4549 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4550
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4551 test install = "$opt_mode" && func_mode_install ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4552
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4553
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4554 # func_generate_dlsyms outputname originator pic_p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4555 # Extract symbols from dlprefiles and create ${outputname}S.o with
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4556 # a dlpreopen symbol table.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4557 func_generate_dlsyms ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4558 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4559 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4560
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4561 my_outputname=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4562 my_originator=$2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4563 my_pic_p=${3-false}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4564 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4565 my_dlsyms=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4566
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4567 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4568 if test -n "$NM" && test -n "$global_symbol_pipe"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4569 my_dlsyms=${my_outputname}S.c
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4570 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4571 func_error "not configured to extract global symbols from dlpreopened files"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4572 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4573 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4574
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4575 if test -n "$my_dlsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4576 case $my_dlsyms in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4577 "") ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4578 *.c)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4579 # Discover the nlist of each of the dlfiles.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4580 nlist=$output_objdir/$my_outputname.nm
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4581
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4582 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4583
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4584 # Parse the name list into a source file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4585 func_verbose "creating $output_objdir/$my_dlsyms"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4586
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4587 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4588 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4589 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4590
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4591 #ifdef __cplusplus
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4592 extern \"C\" {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4593 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4594
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4595 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4596 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4597 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4598
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4599 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4600 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4601 /* DATA imports from DLLs on WIN32 can't be const, because runtime
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4602 relocations are performed -- see ld's documentation on pseudo-relocs. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4603 # define LT_DLSYM_CONST
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4604 #elif defined __osf__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4605 /* This system does not cope well with relocations in const data. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4606 # define LT_DLSYM_CONST
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4607 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4608 # define LT_DLSYM_CONST const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4609 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4610
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4611 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4612
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4613 /* External symbol declarations for the compiler. */\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4614 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4615
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4616 if test yes = "$dlself"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4617 func_verbose "generating symbol list for '$output'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4618
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4619 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4620
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4621 # Add our own program objects to the symbol list.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4622 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4623 for progfile in $progfiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4624 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4625 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4626 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4627 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4628
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4629 if test -n "$exclude_expsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4630 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4631 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4632 eval '$MV "$nlist"T "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4633 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4634 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4635
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4636 if test -n "$export_symbols_regex"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4637 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4638 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4639 eval '$MV "$nlist"T "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4640 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4641 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4642
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4643 # Prepare the list of exported symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4644 if test -z "$export_symbols"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4645 export_symbols=$output_objdir/$outputname.exp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4646 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4647 $RM $export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4648 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4649 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4650 *cygwin* | *mingw* | *cegcc* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4651 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4652 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4653 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4654 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4655 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4656 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4657 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4658 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4659 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4660 eval '$MV "$nlist"T "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4661 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4662 *cygwin* | *mingw* | *cegcc* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4663 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4664 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4665 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4666 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4667 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4668 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4669 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4670
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4671 for dlprefile in $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4672 func_verbose "extracting global C symbols from '$dlprefile'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4673 func_basename "$dlprefile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4674 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4675 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4676 *cygwin* | *mingw* | *cegcc* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4677 # if an import library, we need to obtain dlname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4678 if func_win32_import_lib_p "$dlprefile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4679 func_tr_sh "$dlprefile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4680 eval "curr_lafile=\$libfile_$func_tr_sh_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4681 dlprefile_dlbasename=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4682 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4683 # Use subshell, to avoid clobbering current variable values
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4684 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4685 if test -n "$dlprefile_dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4686 func_basename "$dlprefile_dlname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4687 dlprefile_dlbasename=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4688 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4689 # no lafile. user explicitly requested -dlpreopen <import library>.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4690 $sharedlib_from_linklib_cmd "$dlprefile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4691 dlprefile_dlbasename=$sharedlib_from_linklib_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4692 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4693 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4694 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4695 if test -n "$dlprefile_dlbasename"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4696 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4697 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4698 func_warning "Could not compute DLL name from $name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4699 eval '$ECHO ": $name " >> "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4700 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4701 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4702 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4703 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4704 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4705 else # not an import lib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4706 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4707 eval '$ECHO ": $name " >> "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4708 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4709 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4710 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4711 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4712 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4713 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4714 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4715 eval '$ECHO ": $name " >> "$nlist"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4716 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4717 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4718 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4719 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4720 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4721 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4722
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4723 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4724 # Make sure we have at least an empty file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4725 test -f "$nlist" || : > "$nlist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4726
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4727 if test -n "$exclude_expsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4728 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4729 $MV "$nlist"T "$nlist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4730 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4731
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4732 # Try sorting and uniquifying the output.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4733 if $GREP -v "^: " < "$nlist" |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4734 if sort -k 3 </dev/null >/dev/null 2>&1; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4735 sort -k 3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4736 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4737 sort +2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4738 fi |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4739 uniq > "$nlist"S; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4740 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4741 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4742 $GREP -v "^: " < "$nlist" > "$nlist"S
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4743 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4744
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4745 if test -f "$nlist"S; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4746 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4747 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4748 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4749 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4750
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4751 func_show_eval '$RM "${nlist}I"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4752 if test -n "$global_symbol_to_import"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4753 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4754 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4755
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4756 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4757
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4758 /* The mapping between symbol names and symbols. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4759 typedef struct {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4760 const char *name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4761 void *address;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4762 } lt_dlsymlist;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4763 extern LT_DLSYM_CONST lt_dlsymlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4764 lt_${my_prefix}_LTX_preloaded_symbols[];\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4765 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4766
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4767 if test -s "$nlist"I; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4768 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4769 static void lt_syminit(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4770 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4771 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4772 for (; symbol->name; ++symbol)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4773 {"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4774 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4775 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4776 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4777 }"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4778 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4779 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4780 LT_DLSYM_CONST lt_dlsymlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4781 lt_${my_prefix}_LTX_preloaded_symbols[] =
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4782 { {\"$my_originator\", (void *) 0},"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4783
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4784 if test -s "$nlist"I; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4785 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4786 {\"@INIT@\", (void *) &lt_syminit},"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4787 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4788
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4789 case $need_lib_prefix in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4790 no)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4791 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4792 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4793 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4794 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4795 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4796 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4797 echo >> "$output_objdir/$my_dlsyms" "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4798 {0, (void *) 0}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4799 };
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4800
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4801 /* This works around a problem in FreeBSD linker */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4802 #ifdef FREEBSD_WORKAROUND
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4803 static const void *lt_preloaded_setup() {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4804 return lt_${my_prefix}_LTX_preloaded_symbols;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4805 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4806 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4807
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4808 #ifdef __cplusplus
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4809 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4810 #endif\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4811 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4812 } # !$opt_dry_run
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4813
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4814 pic_flag_for_symtable=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4815 case "$compile_command " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4816 *" -static "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4817 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4818 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4819 # compiling the symbol table file with pic_flag works around
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4820 # a FreeBSD bug that causes programs to crash when -lm is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4821 # linked before any other PIC object. But we must not use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4822 # pic_flag when linking with -static. The problem exists in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4823 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4824 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4825 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4826 *-*-hpux*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4827 pic_flag_for_symtable=" $pic_flag" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4828 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4829 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4830 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4831 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4832 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4833 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4834 symtab_cflags=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4835 for arg in $LTCFLAGS; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4836 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4837 -pie | -fpie | -fPIE) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4838 *) func_append symtab_cflags " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4839 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4840 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4841
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4842 # Now compile the dynamic symbol file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4843 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4844
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4845 # Clean up the generated files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4846 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4847
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4848 # Transform the symbol file into the correct name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4849 symfileobj=$output_objdir/${my_outputname}S.$objext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4850 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4851 *cygwin* | *mingw* | *cegcc* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4852 if test -f "$output_objdir/$my_outputname.def"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4853 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4854 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4855 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4856 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4857 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4858 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4859 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4860 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4861 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4862 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4863 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4864 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4865 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4866 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4867 func_fatal_error "unknown suffix for '$my_dlsyms'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4868 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4869 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4870 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4871 # We keep going just in case the user didn't refer to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4872 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4873 # really was required.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4874
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4875 # Nullify the symbol file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4876 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4877 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4878 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4879 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4880
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4881 # func_cygming_gnu_implib_p ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4882 # This predicate returns with zero status (TRUE) if
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4883 # ARG is a GNU/binutils-style import library. Returns
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4884 # with nonzero status (FALSE) otherwise.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4885 func_cygming_gnu_implib_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4886 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4887 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4888
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4889 func_to_tool_file "$1" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4890 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)$'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4891 test -n "$func_cygming_gnu_implib_tmp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4892 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4893
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4894 # func_cygming_ms_implib_p ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4895 # This predicate returns with zero status (TRUE) if
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4896 # ARG is an MS-style import library. Returns
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4897 # with nonzero status (FALSE) otherwise.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4898 func_cygming_ms_implib_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4899 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4900 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4901
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4902 func_to_tool_file "$1" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4903 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4904 test -n "$func_cygming_ms_implib_tmp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4905 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4906
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4907 # func_win32_libid arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4908 # return the library type of file 'arg'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4909 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4910 # Need a lot of goo to handle *both* DLLs and import libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4911 # Has to be a shell function in order to 'eat' the argument
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4912 # that is supplied when $file_magic_command is called.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4913 # Despite the name, also deal with 64 bit binaries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4914 func_win32_libid ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4915 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4916 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4917
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4918 win32_libid_type=unknown
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4919 win32_fileres=`file -L $1 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4920 case $win32_fileres in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4921 *ar\ archive\ import\ library*) # definitely import
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4922 win32_libid_type="x86 archive import"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4923 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4924 *ar\ archive*) # could be an import, or static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4925 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4926 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4927 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4928 case $nm_interface in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4929 "MS dumpbin")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4930 if func_cygming_ms_implib_p "$1" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4931 func_cygming_gnu_implib_p "$1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4932 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4933 win32_nmres=import
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4934 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4935 win32_nmres=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4936 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4937 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4938 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4939 func_to_tool_file "$1" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4940 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4941 $SED -n -e '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4942 1,100{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4943 / I /{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4944 s|.*|import|
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4945 p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4946 q
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4947 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4948 }'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4949 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4950 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4951 case $win32_nmres in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4952 import*) win32_libid_type="x86 archive import";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4953 *) win32_libid_type="x86 archive static";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4954 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4955 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4956 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4957 *DLL*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4958 win32_libid_type="x86 DLL"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4959 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4960 *executable*) # but shell scripts are "executable" too...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4961 case $win32_fileres in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4962 *MS\ Windows\ PE\ Intel*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4963 win32_libid_type="x86 DLL"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4964 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4965 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4966 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4967 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4968 $ECHO "$win32_libid_type"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4969 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4970
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4971 # func_cygming_dll_for_implib ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4972 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4973 # Platform-specific function to extract the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4974 # name of the DLL associated with the specified
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4975 # import library ARG.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4976 # Invoked by eval'ing the libtool variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4977 # $sharedlib_from_linklib_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4978 # Result is available in the variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4979 # $sharedlib_from_linklib_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4980 func_cygming_dll_for_implib ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4981 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4982 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4983
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4984 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4985 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4986
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4987 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4988 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4989 # The is the core of a fallback implementation of a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4990 # platform-specific function to extract the name of the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4991 # DLL associated with the specified import library LIBNAME.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4992 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4993 # SECTION_NAME is either .idata$6 or .idata$7, depending
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4994 # on the platform and compiler that created the implib.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4995 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4996 # Echos the name of the DLL associated with the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4997 # specified import library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4998 func_cygming_dll_for_implib_fallback_core ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4999 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5000 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5001
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5002 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5003 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5004 $SED '/^Contents of section '"$match_literal"':/{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5005 # Place marker at beginning of archive member dllname section
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5006 s/.*/====MARK====/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5007 p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5008 d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5009 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5010 # These lines can sometimes be longer than 43 characters, but
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5011 # are always uninteresting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5012 /:[ ]*file format pe[i]\{,1\}-/d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5013 /^In archive [^:]*:/d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5014 # Ensure marker is printed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5015 /^====MARK====/p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5016 # Remove all lines with less than 43 characters
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5017 /^.\{43\}/!d
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5018 # From remaining lines, remove first 43 characters
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5019 s/^.\{43\}//' |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5020 $SED -n '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5021 # Join marker and all lines until next marker into a single line
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5022 /^====MARK====/ b para
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5023 H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5024 $ b para
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5025 b
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5026 :para
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5027 x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5028 s/\n//g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5029 # Remove the marker
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5030 s/^====MARK====//
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5031 # Remove trailing dots and whitespace
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5032 s/[\. \t]*$//
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5033 # Print
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5034 /./p' |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5035 # we now have a list, one entry per line, of the stringified
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5036 # contents of the appropriate section of all members of the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5037 # archive that possess that section. Heuristic: eliminate
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5038 # all those that have a first or second character that is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5039 # a '.' (that is, objdump's representation of an unprintable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5040 # character.) This should work for all archives with less than
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5041 # 0x302f exports -- but will fail for DLLs whose name actually
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5042 # begins with a literal '.' or a single character followed by
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5043 # a '.'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5044 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5045 # Of those that remain, print the first one.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5046 $SED -e '/^\./d;/^.\./d;q'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5047 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5048
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5049 # func_cygming_dll_for_implib_fallback ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5050 # Platform-specific function to extract the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5051 # name of the DLL associated with the specified
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5052 # import library ARG.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5053 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5054 # This fallback implementation is for use when $DLLTOOL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5055 # does not support the --identify-strict option.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5056 # Invoked by eval'ing the libtool variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5057 # $sharedlib_from_linklib_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5058 # Result is available in the variable
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5059 # $sharedlib_from_linklib_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5060 func_cygming_dll_for_implib_fallback ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5061 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5062 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5063
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5064 if func_cygming_gnu_implib_p "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5065 # binutils import library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5066 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5067 elif func_cygming_ms_implib_p "$1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5068 # ms-generated import library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5069 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5070 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5071 # unknown
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5072 sharedlib_from_linklib_result=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5073 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5074 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5075
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5076
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5077 # func_extract_an_archive dir oldlib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5078 func_extract_an_archive ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5079 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5080 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5081
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5082 f_ex_an_ar_dir=$1; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5083 f_ex_an_ar_oldlib=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5084 if test yes = "$lock_old_archive_extraction"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5085 lockfile=$f_ex_an_ar_oldlib.lock
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5086 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5087 func_echo "Waiting for $lockfile to be removed"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5088 sleep 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5089 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5090 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5091 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5092 'stat=$?; rm -f "$lockfile"; exit $stat'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5093 if test yes = "$lock_old_archive_extraction"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5094 $opt_dry_run || rm -f "$lockfile"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5095 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5096 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5097 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5098 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5099 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5100 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5101 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5102
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5103
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5104 # func_extract_archives gentop oldlib ...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5105 func_extract_archives ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5106 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5107 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5109 my_gentop=$1; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5110 my_oldlibs=${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5111 my_oldobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5112 my_xlib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5113 my_xabs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5114 my_xdir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5115
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5116 for my_xlib in $my_oldlibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5117 # Extract the objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5118 case $my_xlib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5119 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5120 *) my_xabs=`pwd`"/$my_xlib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5121 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5122 func_basename "$my_xlib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5123 my_xlib=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5124 my_xlib_u=$my_xlib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5125 while :; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5126 case " $extracted_archives " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5127 *" $my_xlib_u "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5128 func_arith $extracted_serial + 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5129 extracted_serial=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5130 my_xlib_u=lt$extracted_serial-$my_xlib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5131 *) break ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5132 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5133 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5134 extracted_archives="$extracted_archives $my_xlib_u"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5135 my_xdir=$my_gentop/$my_xlib_u
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5136
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5137 func_mkdir_p "$my_xdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5138
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5139 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5140 *-darwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5141 func_verbose "Extracting $my_xabs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5142 # Do not bother doing anything if just a dry run
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5143 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5144 darwin_orig_dir=`pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5145 cd $my_xdir || exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5146 darwin_archive=$my_xabs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5147 darwin_curdir=`pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5148 func_basename "$darwin_archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5149 darwin_base_archive=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5150 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5151 if test -n "$darwin_arches"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5152 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5153 darwin_arch=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5154 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5155 for darwin_arch in $darwin_arches; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5156 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5157 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5158 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5159 func_extract_an_archive "`pwd`" "$darwin_base_archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5160 cd "$darwin_curdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5161 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5162 done # $darwin_arches
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5163 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5164 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5165 darwin_file=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5166 darwin_files=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5167 for darwin_file in $darwin_filelist; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5168 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5169 $LIPO -create -output "$darwin_file" $darwin_files
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5170 done # $darwin_filelist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5171 $RM -rf unfat-$$
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5172 cd "$darwin_orig_dir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5173 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5174 cd $darwin_orig_dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5175 func_extract_an_archive "$my_xdir" "$my_xabs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5176 fi # $darwin_arches
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5177 } # !$opt_dry_run
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5178 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5179 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5180 func_extract_an_archive "$my_xdir" "$my_xabs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5181 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5182 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5183 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5184 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5185
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5186 func_extract_archives_result=$my_oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5187 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5188
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5189
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5190 # func_emit_wrapper [arg=no]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5191 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5192 # Emit a libtool wrapper script on stdout.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5193 # Don't directly open a file because we may want to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5194 # incorporate the script contents within a cygwin/mingw
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5195 # wrapper executable. Must ONLY be called from within
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5196 # func_mode_link because it depends on a number of variables
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5197 # set therein.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5198 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5199 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5200 # variable will take. If 'yes', then the emitted script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5201 # will assume that the directory where it is stored is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5202 # the $objdir directory. This is a cygwin/mingw-specific
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5203 # behavior.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5204 func_emit_wrapper ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5205 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5206 func_emit_wrapper_arg1=${1-no}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5207
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5208 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5209 #! $SHELL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5210
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5211 # $output - temporary wrapper script for $objdir/$outputname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5212 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5213 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5214 # The $output program cannot be directly executed until all the libtool
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5215 # libraries that it depends on are installed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5216 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5217 # This wrapper script should never be moved out of the build directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5218 # If it is, it will not operate correctly.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5219
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5220 # Sed substitution that helps us do robust quoting. It backslashifies
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5221 # metacharacters that are still active within double-quoted strings.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5222 sed_quote_subst='$sed_quote_subst'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5223
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5224 # Be Bourne compatible
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5225 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5226 emulate sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5227 NULLCMD=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5228 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5229 # is contrary to our usage. Disable this feature.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5230 alias -g '\${1+\"\$@\"}'='\"\$@\"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5231 setopt NO_GLOB_SUBST
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5232 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5233 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5234 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5235 BIN_SH=xpg4; export BIN_SH # for Tru64
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5236 DUALCASE=1; export DUALCASE # for MKS sh
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5237
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5238 # The HP-UX ksh and POSIX shell print the target directory to stdout
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5239 # if CDPATH is set.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5240 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5241
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5242 relink_command=\"$relink_command\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5243
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5244 # This environment variable determines our operation mode.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5245 if test \"\$libtool_install_magic\" = \"$magic\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5246 # install mode needs the following variables:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5247 generated_by_libtool_version='$macro_version'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5248 notinst_deplibs='$notinst_deplibs'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5249 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5250 # When we are sourced in execute mode, \$file and \$ECHO are already set.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5251 if test \"\$libtool_execute_magic\" != \"$magic\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5252 file=\"\$0\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5253
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5254 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5255 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5256
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5257 # A function that is used when there is no print builtin or printf.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5258 func_fallback_echo ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5259 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5260 eval 'cat <<_LTECHO_EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5261 \$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5262 _LTECHO_EOF'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5263 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5264 ECHO=\"$qECHO\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5265 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5266
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5267 # Very basic option parsing. These options are (a) specific to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5268 # the libtool wrapper, (b) are identical between the wrapper
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5269 # /script/ and the wrapper /executable/ that is used only on
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5270 # windows platforms, and (c) all begin with the string "--lt-"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5271 # (application programs are unlikely to have options that match
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5272 # this pattern).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5273 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5274 # There are only two supported options: --lt-debug and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5275 # --lt-dump-script. There is, deliberately, no --lt-help.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5276 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5277 # The first argument to this parsing function should be the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5278 # script's $0 value, followed by "$@".
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5279 lt_option_debug=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5280 func_parse_lt_options ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5281 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5282 lt_script_arg0=\$0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5283 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5284 for lt_opt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5285 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5286 case \"\$lt_opt\" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5287 --lt-debug) lt_option_debug=1 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5288 --lt-dump-script)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5289 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5290 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5291 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5292 cat \"\$lt_dump_D/\$lt_dump_F\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5293 exit 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5294 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5295 --lt-*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5296 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5297 exit 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5298 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5299 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5300 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5301
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5302 # Print the debug banner immediately:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5303 if test -n \"\$lt_option_debug\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5304 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5305 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5306 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5307
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5308 # Used when --lt-debug. Prints its arguments to stdout
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5309 # (redirection is the responsibility of the caller)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5310 func_lt_dump_args ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5311 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5312 lt_dump_args_N=1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5313 for lt_arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5314 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5315 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5316 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5317 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5318 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5319
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5320 # Core function for launching the target application
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5321 func_exec_program_core ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5322 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5323 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5324 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5325 # Backslashes separate directories on plain windows
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5326 *-*-mingw | *-*-os2* | *-cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5327 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5328 if test -n \"\$lt_option_debug\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5329 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5330 func_lt_dump_args \${1+\"\$@\"} 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5331 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5332 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5333 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5334 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5335
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5336 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5337 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5338 if test -n \"\$lt_option_debug\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5339 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5340 func_lt_dump_args \${1+\"\$@\"} 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5341 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5342 exec \"\$progdir/\$program\" \${1+\"\$@\"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5343 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5344 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5345 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5346 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5347 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5348 exit 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5349 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5350
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5351 # A function to encapsulate launching the target application
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5352 # Strips options in the --lt-* namespace from \$@ and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5353 # launches target application with the remaining arguments.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5354 func_exec_program ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5355 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5356 case \" \$* \" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5357 *\\ --lt-*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5358 for lt_wr_arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5359 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5360 case \$lt_wr_arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5361 --lt-*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5362 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5363 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5364 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5365 done ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5366 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5367 func_exec_program_core \${1+\"\$@\"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5368 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5369
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5370 # Parse options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5371 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5372
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5373 # Find the directory that this script lives in.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5374 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5375 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5376
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5377 # Follow symbolic links until we get to the real thisdir.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5378 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5379 while test -n \"\$file\"; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5380 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5381
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5382 # If there was a directory component, then change thisdir.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5383 if test \"x\$destdir\" != \"x\$file\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5384 case \"\$destdir\" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5385 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5386 *) thisdir=\"\$thisdir/\$destdir\" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5387 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5388 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5389
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5390 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5391 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5392 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5393
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5394 # Usually 'no', except on cygwin/mingw when embedded into
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5395 # the cwrapper.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5396 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5397 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5398 # special case for '.'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5399 if test \"\$thisdir\" = \".\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5400 thisdir=\`pwd\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5401 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5402 # remove .libs from thisdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5403 case \"\$thisdir\" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5404 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5405 $objdir ) thisdir=. ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5406 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5407 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5408
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5409 # Try to get the absolute directory name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5410 absdir=\`cd \"\$thisdir\" && pwd\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5411 test -n \"\$absdir\" && thisdir=\"\$absdir\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5412 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5413
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5414 if test yes = "$fast_install"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5415 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5416 program=lt-'$outputname'$exeext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5417 progdir=\"\$thisdir/$objdir\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5418
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5419 if test ! -f \"\$progdir/\$program\" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5420 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5421 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5422
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5423 file=\"\$\$-\$program\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5424
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5425 if test ! -d \"\$progdir\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5426 $MKDIR \"\$progdir\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5427 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5428 $RM \"\$progdir/\$file\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5429 fi"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5430
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5431 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5432
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5433 # relink executable if necessary
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5434 if test -n \"\$relink_command\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5435 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5436 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5437 \$ECHO \"\$relink_command_output\" >&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5438 $RM \"\$progdir/\$file\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5439 exit 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5440 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5441 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5442
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5443 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5444 { $RM \"\$progdir/\$program\";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5445 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5446 $RM \"\$progdir/\$file\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5447 fi"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5448 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5449 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5450 program='$outputname'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5451 progdir=\"\$thisdir/$objdir\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5452 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5453 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5454
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5455 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5456
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5457 if test -f \"\$progdir/\$program\"; then"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5458
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5459 # fixup the dll searchpath if we need to.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5460 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5461 # Fix the DLL searchpath if we need to. Do this before prepending
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5462 # to shlibpath, because on Windows, both are PATH and uninstalled
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5463 # libraries must come first.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5464 if test -n "$dllsearchpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5465 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5466 # Add the dll search path components to the executable PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5467 PATH=$dllsearchpath:\$PATH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5468 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5469 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5470
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5471 # Export our shlibpath_var if we have one.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5472 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5473 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5474 # Add our own library path to $shlibpath_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5475 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5476
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5477 # Some systems cannot cope with colon-terminated $shlibpath_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5478 # The second colon is a workaround for a bug in BeOS R4 sed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5479 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5480
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5481 export $shlibpath_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5482 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5483 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5484
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5485 $ECHO "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5486 if test \"\$libtool_execute_magic\" != \"$magic\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5487 # Run the actual program with our arguments.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5488 func_exec_program \${1+\"\$@\"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5489 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5490 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5491 # The program doesn't exist.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5492 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5493 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5494 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5495 exit 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5496 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5497 fi\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5498 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5499 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5500
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5501
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5502 # func_emit_cwrapperexe_src
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5503 # emit the source code for a wrapper executable on stdout
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5504 # Must ONLY be called from within func_mode_link because
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5505 # it depends on a number of variable set therein.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5506 func_emit_cwrapperexe_src ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5507 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5508 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5509
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5510 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5511 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5512
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5513 The $output program cannot be directly executed until all the libtool
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5514 libraries that it depends on are installed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5515
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5516 This wrapper executable should never be moved out of the build directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5517 If it is, it will not operate correctly.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5518 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5519 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5520 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5521 #ifdef _MSC_VER
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5522 # define _CRT_SECURE_NO_DEPRECATE 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5523 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5524 #include <stdio.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5525 #include <stdlib.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5526 #ifdef _MSC_VER
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5527 # include <direct.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5528 # include <process.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5529 # include <io.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5530 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5531 # include <unistd.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5532 # include <stdint.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5533 # ifdef __CYGWIN__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5534 # include <io.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5535 # endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5536 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5537 #include <malloc.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5538 #include <stdarg.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5539 #include <assert.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5540 #include <string.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5541 #include <ctype.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5542 #include <errno.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5543 #include <fcntl.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5544 #include <sys/stat.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5545
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5546 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5547
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5548 /* declarations of non-ANSI functions */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5549 #if defined __MINGW32__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5550 # ifdef __STRICT_ANSI__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5551 int _putenv (const char *);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5552 # endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5553 #elif defined __CYGWIN__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5554 # ifdef __STRICT_ANSI__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5555 char *realpath (const char *, char *);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5556 int putenv (char *);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5557 int setenv (const char *, const char *, int);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5558 # endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5559 /* #elif defined other_platform || defined ... */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5560 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5561
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5562 /* portability defines, excluding path handling macros */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5563 #if defined _MSC_VER
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5564 # define setmode _setmode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5565 # define stat _stat
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5566 # define chmod _chmod
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5567 # define getcwd _getcwd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5568 # define putenv _putenv
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5569 # define S_IXUSR _S_IEXEC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5570 #elif defined __MINGW32__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5571 # define setmode _setmode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5572 # define stat _stat
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5573 # define chmod _chmod
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5574 # define getcwd _getcwd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5575 # define putenv _putenv
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5576 #elif defined __CYGWIN__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5577 # define HAVE_SETENV
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5578 # define FOPEN_WB "wb"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5579 /* #elif defined other platforms ... */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5580 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5581
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5582 #if defined PATH_MAX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5583 # define LT_PATHMAX PATH_MAX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5584 #elif defined MAXPATHLEN
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5585 # define LT_PATHMAX MAXPATHLEN
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5586 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5587 # define LT_PATHMAX 1024
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5588 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5589
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5590 #ifndef S_IXOTH
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5591 # define S_IXOTH 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5592 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5593 #ifndef S_IXGRP
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5594 # define S_IXGRP 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5595 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5596
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5597 /* path handling portability macros */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5598 #ifndef DIR_SEPARATOR
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5599 # define DIR_SEPARATOR '/'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5600 # define PATH_SEPARATOR ':'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5601 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5602
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5603 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5604 defined __OS2__
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5605 # define HAVE_DOS_BASED_FILE_SYSTEM
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5606 # define FOPEN_WB "wb"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5607 # ifndef DIR_SEPARATOR_2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5608 # define DIR_SEPARATOR_2 '\\'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5609 # endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5610 # ifndef PATH_SEPARATOR_2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5611 # define PATH_SEPARATOR_2 ';'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5612 # endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5613 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5614
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5615 #ifndef DIR_SEPARATOR_2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5616 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5617 #else /* DIR_SEPARATOR_2 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5618 # define IS_DIR_SEPARATOR(ch) \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5619 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5620 #endif /* DIR_SEPARATOR_2 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5621
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5622 #ifndef PATH_SEPARATOR_2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5623 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5624 #else /* PATH_SEPARATOR_2 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5625 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5626 #endif /* PATH_SEPARATOR_2 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5627
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5628 #ifndef FOPEN_WB
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5629 # define FOPEN_WB "w"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5630 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5631 #ifndef _O_BINARY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5632 # define _O_BINARY 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5633 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5634
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5635 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5636 #define XFREE(stale) do { \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5637 if (stale) { free (stale); stale = 0; } \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5638 } while (0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5639
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5640 #if defined LT_DEBUGWRAPPER
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5641 static int lt_debug = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5642 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5643 static int lt_debug = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5644 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5645
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5646 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5647
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5648 void *xmalloc (size_t num);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5649 char *xstrdup (const char *string);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5650 const char *base_name (const char *name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5651 char *find_executable (const char *wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5652 char *chase_symlinks (const char *pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5653 int make_executable (const char *path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5654 int check_executable (const char *path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5655 char *strendzap (char *str, const char *pat);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5656 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5657 void lt_fatal (const char *file, int line, const char *message, ...);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5658 static const char *nonnull (const char *s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5659 static const char *nonempty (const char *s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5660 void lt_setenv (const char *name, const char *value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5661 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5662 void lt_update_exe_path (const char *name, const char *value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5663 void lt_update_lib_path (const char *name, const char *value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5664 char **prepare_spawn (char **argv);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5665 void lt_dump_script (FILE *f);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5666 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5667
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5668 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5669 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5670 # define externally_visible volatile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5671 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5672 # define externally_visible __attribute__((externally_visible)) volatile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5673 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5674 externally_visible const char * MAGIC_EXE = "$magic_exe";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5675 const char * LIB_PATH_VARNAME = "$shlibpath_var";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5676 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5677
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5678 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5679 func_to_host_path "$temp_rpath"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5680 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5681 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5682 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5683 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5684 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5685 const char * LIB_PATH_VALUE = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5686 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5687 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5688
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5689 if test -n "$dllsearchpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5690 func_to_host_path "$dllsearchpath:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5691 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5692 const char * EXE_PATH_VARNAME = "PATH";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5693 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5694 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5695 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5696 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5697 const char * EXE_PATH_VARNAME = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5698 const char * EXE_PATH_VALUE = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5699 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5700 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5701
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5702 if test yes = "$fast_install"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5703 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5704 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5705 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5706 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5707 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5708 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5709 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5710 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5711
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5712
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5713 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5714
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5715 #define LTWRAPPER_OPTION_PREFIX "--lt-"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5716
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5717 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5718 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5719 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5720
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5721 int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5722 main (int argc, char *argv[])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5723 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5724 char **newargz;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5725 int newargc;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5726 char *tmp_pathspec;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5727 char *actual_cwrapper_path;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5728 char *actual_cwrapper_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5729 char *target_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5730 char *lt_argv_zero;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5731 int rval = 127;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5732
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5733 int i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5734
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5735 program_name = (char *) xstrdup (base_name (argv[0]));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5736 newargz = XMALLOC (char *, (size_t) argc + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5737
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5738 /* very simple arg parsing; don't want to rely on getopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5739 * also, copy all non cwrapper options to newargz, except
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5740 * argz[0], which is handled differently
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5741 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5742 newargc=0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5743 for (i = 1; i < argc; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5744 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5745 if (STREQ (argv[i], dumpscript_opt))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5746 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5747 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5748 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5749 *mingw* | *cygwin* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5750 # make stdout use "unix" line endings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5751 echo " setmode(1,_O_BINARY);"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5752 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5753 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5754
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5755 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5756 lt_dump_script (stdout);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5757 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5758 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5759 if (STREQ (argv[i], debug_opt))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5760 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5761 lt_debug = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5762 continue;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5763 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5764 if (STREQ (argv[i], ltwrapper_option_prefix))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5765 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5766 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5767 namespace, but it is not one of the ones we know about and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5768 have already dealt with, above (inluding dump-script), then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5769 report an error. Otherwise, targets might begin to believe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5770 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5771 namespace. The first time any user complains about this, we'll
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5772 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5773 or a configure.ac-settable value.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5774 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5775 lt_fatal (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5776 "unrecognized %s option: '%s'",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5777 ltwrapper_option_prefix, argv[i]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5778 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5779 /* otherwise ... */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5780 newargz[++newargc] = xstrdup (argv[i]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5781 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5782 newargz[++newargc] = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5783
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5784 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5785 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5786 /* The GNU banner must be the first non-error debug message */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5787 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5788 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5789 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5790 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5791 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5792
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5793 tmp_pathspec = find_executable (argv[0]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5794 if (tmp_pathspec == NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5795 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5796 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5797 "(main) found exe (before symlink chase) at: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5798 tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5799
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5800 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5801 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5802 "(main) found exe (after symlink chase) at: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5803 actual_cwrapper_path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5804 XFREE (tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5805
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5806 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5807 strendzap (actual_cwrapper_path, actual_cwrapper_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5808
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5809 /* wrapper name transforms */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5810 strendzap (actual_cwrapper_name, ".exe");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5811 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5812 XFREE (actual_cwrapper_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5813 actual_cwrapper_name = tmp_pathspec;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5814 tmp_pathspec = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5815
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5816 /* target_name transforms -- use actual target program name; might have lt- prefix */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5817 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5818 strendzap (target_name, ".exe");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5819 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5820 XFREE (target_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5821 target_name = tmp_pathspec;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5822 tmp_pathspec = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5823
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5824 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5825 "(main) libtool target name: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5826 target_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5827 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5828
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5829 cat <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5830 newargz[0] =
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5831 XMALLOC (char, (strlen (actual_cwrapper_path) +
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5832 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5833 strcpy (newargz[0], actual_cwrapper_path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5834 strcat (newargz[0], "$objdir");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5835 strcat (newargz[0], "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5836 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5837
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5838 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5839 /* stop here, and copy so we don't have to do this twice */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5840 tmp_pathspec = xstrdup (newargz[0]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5841
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5842 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5843 strcat (newargz[0], actual_cwrapper_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5844
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5845 /* DO want the lt- prefix here if it exists, so use target_name */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5846 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5847 XFREE (tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5848 tmp_pathspec = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5849 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5850
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5851 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5852 mingw*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5853 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5854 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5855 char* p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5856 while ((p = strchr (newargz[0], '\\')) != NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5857 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5858 *p = '/';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5859 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5860 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5861 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5862 *p = '/';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5863 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5864 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5865 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5866 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5867 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5868
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5869 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5870 XFREE (target_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5871 XFREE (actual_cwrapper_path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5872 XFREE (actual_cwrapper_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5873
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5874 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5875 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5876 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5877 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5878 because on Windows, both *_VARNAMEs are PATH but uninstalled
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5879 libraries must come first. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5880 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5881 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5882
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5883 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5884 nonnull (lt_argv_zero));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5885 for (i = 0; i < newargc; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5886 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5887 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5888 i, nonnull (newargz[i]));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5889 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5890
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5891 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5892
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5893 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5894 mingw*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5895 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5896 /* execv doesn't actually work on mingw as expected on unix */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5897 newargz = prepare_spawn (newargz);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5898 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5899 if (rval == -1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5900 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5901 /* failed to start process */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5902 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5903 "(main) failed to launch target \"%s\": %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5904 lt_argv_zero, nonnull (strerror (errno)));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5905 return 127;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5906 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5907 return rval;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5908 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5909 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5910 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5911 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5912 execv (lt_argv_zero, newargz);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5913 return rval; /* =127, but avoids unused variable warning */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5914 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5915 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5916 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5917
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5918 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5919 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5920
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5921 void *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5922 xmalloc (size_t num)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5923 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5924 void *p = (void *) malloc (num);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5925 if (!p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5926 lt_fatal (__FILE__, __LINE__, "memory exhausted");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5927
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5928 return p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5929 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5930
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5931 char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5932 xstrdup (const char *string)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5933 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5934 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5935 string) : NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5936 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5937
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5938 const char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5939 base_name (const char *name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5940 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5941 const char *base;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5942
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5943 #if defined HAVE_DOS_BASED_FILE_SYSTEM
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5944 /* Skip over the disk name in MSDOS pathnames. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5945 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5946 name += 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5947 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5948
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5949 for (base = name; *name; name++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5950 if (IS_DIR_SEPARATOR (*name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5951 base = name + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5952 return base;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5953 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5954
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5955 int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5956 check_executable (const char *path)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5957 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5958 struct stat st;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5959
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5960 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5961 nonempty (path));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5962 if ((!path) || (!*path))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5963 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5964
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5965 if ((stat (path, &st) >= 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5966 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5967 return 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5968 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5969 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5970 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5971
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5972 int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5973 make_executable (const char *path)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5974 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5975 int rval = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5976 struct stat st;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5977
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5978 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5979 nonempty (path));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5980 if ((!path) || (!*path))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5981 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5982
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5983 if (stat (path, &st) >= 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5984 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5985 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5986 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5987 return rval;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5988 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5989
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5990 /* Searches for the full path of the wrapper. Returns
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5991 newly allocated full path name if found, NULL otherwise
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5992 Does not chase symlinks, even on platforms that support them.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5993 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5994 char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5995 find_executable (const char *wrapper)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5996 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5997 int has_slash = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5998 const char *p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5999 const char *p_next;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6000 /* static buffer for getcwd */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6001 char tmp[LT_PATHMAX + 1];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6002 size_t tmp_len;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6003 char *concat_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6004
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6005 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6006 nonempty (wrapper));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6007
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6008 if ((wrapper == NULL) || (*wrapper == '\0'))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6009 return NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6010
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6011 /* Absolute path? */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6012 #if defined HAVE_DOS_BASED_FILE_SYSTEM
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6013 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6014 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6015 concat_name = xstrdup (wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6016 if (check_executable (concat_name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6017 return concat_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6018 XFREE (concat_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6019 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6020 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6021 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6022 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6023 if (IS_DIR_SEPARATOR (wrapper[0]))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6024 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6025 concat_name = xstrdup (wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6026 if (check_executable (concat_name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6027 return concat_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6028 XFREE (concat_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6029 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6030 #if defined HAVE_DOS_BASED_FILE_SYSTEM
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6031 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6032 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6033
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6034 for (p = wrapper; *p; p++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6035 if (*p == '/')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6036 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6037 has_slash = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6038 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6039 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6040 if (!has_slash)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6041 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6042 /* no slashes; search PATH */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6043 const char *path = getenv ("PATH");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6044 if (path != NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6045 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6046 for (p = path; *p; p = p_next)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6047 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6048 const char *q;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6049 size_t p_len;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6050 for (q = p; *q; q++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6051 if (IS_PATH_SEPARATOR (*q))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6052 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6053 p_len = (size_t) (q - p);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6054 p_next = (*q == '\0' ? q : q + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6055 if (p_len == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6056 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6057 /* empty path: current directory */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6058 if (getcwd (tmp, LT_PATHMAX) == NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6059 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6060 nonnull (strerror (errno)));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6061 tmp_len = strlen (tmp);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6062 concat_name =
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6063 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6064 memcpy (concat_name, tmp, tmp_len);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6065 concat_name[tmp_len] = '/';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6066 strcpy (concat_name + tmp_len + 1, wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6067 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6068 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6069 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6070 concat_name =
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6071 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6072 memcpy (concat_name, p, p_len);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6073 concat_name[p_len] = '/';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6074 strcpy (concat_name + p_len + 1, wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6075 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6076 if (check_executable (concat_name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6077 return concat_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6078 XFREE (concat_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6079 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6080 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6081 /* not found in PATH; assume curdir */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6082 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6083 /* Relative path | not found in path: prepend cwd */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6084 if (getcwd (tmp, LT_PATHMAX) == NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6085 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6086 nonnull (strerror (errno)));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6087 tmp_len = strlen (tmp);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6088 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6089 memcpy (concat_name, tmp, tmp_len);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6090 concat_name[tmp_len] = '/';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6091 strcpy (concat_name + tmp_len + 1, wrapper);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6092
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6093 if (check_executable (concat_name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6094 return concat_name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6095 XFREE (concat_name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6096 return NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6097 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6098
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6099 char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6100 chase_symlinks (const char *pathspec)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6101 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6102 #ifndef S_ISLNK
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6103 return xstrdup (pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6104 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6105 char buf[LT_PATHMAX];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6106 struct stat s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6107 char *tmp_pathspec = xstrdup (pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6108 char *p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6109 int has_symlinks = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6110 while (strlen (tmp_pathspec) && !has_symlinks)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6111 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6112 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6113 "checking path component for symlinks: %s\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6114 tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6115 if (lstat (tmp_pathspec, &s) == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6116 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6117 if (S_ISLNK (s.st_mode) != 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6118 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6119 has_symlinks = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6120 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6121 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6122
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6123 /* search backwards for last DIR_SEPARATOR */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6124 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6125 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6126 p--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6127 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6128 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6129 /* no more DIR_SEPARATORS left */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6130 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6131 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6132 *p = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6133 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6134 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6135 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6136 lt_fatal (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6137 "error accessing file \"%s\": %s",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6138 tmp_pathspec, nonnull (strerror (errno)));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6139 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6140 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6141 XFREE (tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6142
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6143 if (!has_symlinks)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6144 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6145 return xstrdup (pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6146 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6147
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6148 tmp_pathspec = realpath (pathspec, buf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6149 if (tmp_pathspec == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6150 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6151 lt_fatal (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6152 "could not follow symlinks for %s", pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6153 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6154 return xstrdup (tmp_pathspec);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6155 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6156 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6157
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6158 char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6159 strendzap (char *str, const char *pat)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6160 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6161 size_t len, patlen;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6162
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6163 assert (str != NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6164 assert (pat != NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6165
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6166 len = strlen (str);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6167 patlen = strlen (pat);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6168
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6169 if (patlen <= len)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6170 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6171 str += len - patlen;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6172 if (STREQ (str, pat))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6173 *str = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6174 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6175 return str;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6176 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6177
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6178 void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6179 lt_debugprintf (const char *file, int line, const char *fmt, ...)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6180 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6181 va_list args;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6182 if (lt_debug)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6183 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6184 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6185 va_start (args, fmt);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6186 (void) vfprintf (stderr, fmt, args);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6187 va_end (args);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6188 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6189 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6190
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6191 static void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6192 lt_error_core (int exit_status, const char *file,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6193 int line, const char *mode,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6194 const char *message, va_list ap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6195 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6196 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6197 vfprintf (stderr, message, ap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6198 fprintf (stderr, ".\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6199
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6200 if (exit_status >= 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6201 exit (exit_status);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6202 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6203
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6204 void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6205 lt_fatal (const char *file, int line, const char *message, ...)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6206 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6207 va_list ap;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6208 va_start (ap, message);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6209 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6210 va_end (ap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6211 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6212
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6213 static const char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6214 nonnull (const char *s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6215 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6216 return s ? s : "(null)";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6217 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6218
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6219 static const char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6220 nonempty (const char *s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6221 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6222 return (s && !*s) ? "(empty)" : nonnull (s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6223 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6224
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6225 void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6226 lt_setenv (const char *name, const char *value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6227 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6228 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6229 "(lt_setenv) setting '%s' to '%s'\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6230 nonnull (name), nonnull (value));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6231 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6232 #ifdef HAVE_SETENV
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6233 /* always make a copy, for consistency with !HAVE_SETENV */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6234 char *str = xstrdup (value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6235 setenv (name, str, 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6236 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6237 size_t len = strlen (name) + 1 + strlen (value) + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6238 char *str = XMALLOC (char, len);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6239 sprintf (str, "%s=%s", name, value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6240 if (putenv (str) != EXIT_SUCCESS)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6241 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6242 XFREE (str);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6243 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6244 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6245 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6246 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6247
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6248 char *
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6249 lt_extend_str (const char *orig_value, const char *add, int to_end)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6250 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6251 char *new_value;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6252 if (orig_value && *orig_value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6253 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6254 size_t orig_value_len = strlen (orig_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6255 size_t add_len = strlen (add);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6256 new_value = XMALLOC (char, add_len + orig_value_len + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6257 if (to_end)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6258 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6259 strcpy (new_value, orig_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6260 strcpy (new_value + orig_value_len, add);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6261 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6262 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6263 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6264 strcpy (new_value, add);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6265 strcpy (new_value + add_len, orig_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6266 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6267 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6268 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6269 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6270 new_value = xstrdup (add);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6271 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6272 return new_value;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6273 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6274
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6275 void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6276 lt_update_exe_path (const char *name, const char *value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6277 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6278 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6279 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6280 nonnull (name), nonnull (value));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6281
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6282 if (name && *name && value && *value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6283 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6284 char *new_value = lt_extend_str (getenv (name), value, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6285 /* some systems can't cope with a ':'-terminated path #' */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6286 size_t len = strlen (new_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6287 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6288 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6289 new_value[--len] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6290 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6291 lt_setenv (name, new_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6292 XFREE (new_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6293 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6294 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6295
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6296 void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6297 lt_update_lib_path (const char *name, const char *value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6298 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6299 lt_debugprintf (__FILE__, __LINE__,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6300 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6301 nonnull (name), nonnull (value));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6302
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6303 if (name && *name && value && *value)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6304 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6305 char *new_value = lt_extend_str (getenv (name), value, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6306 lt_setenv (name, new_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6307 XFREE (new_value);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6308 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6309 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6310
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6311 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6312 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6313 mingw*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6314 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6315
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6316 /* Prepares an argument vector before calling spawn().
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6317 Note that spawn() does not by itself call the command interpreter
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6318 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6319 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6320 GetVersionEx(&v);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6321 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6322 }) ? "cmd.exe" : "command.com").
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6323 Instead it simply concatenates the arguments, separated by ' ', and calls
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6324 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6325 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6326 special way:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6327 - Space and tab are interpreted as delimiters. They are not treated as
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6328 delimiters if they are surrounded by double quotes: "...".
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6329 - Unescaped double quotes are removed from the input. Their only effect is
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6330 that within double quotes, space and tab are treated like normal
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6331 characters.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6332 - Backslashes not followed by double quotes are not special.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6333 - But 2*n+1 backslashes followed by a double quote become
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6334 n backslashes followed by a double quote (n >= 0):
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6335 \" -> "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6336 \\\" -> \"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6337 \\\\\" -> \\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6338 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6339 #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"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6340 #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"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6341 char **
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6342 prepare_spawn (char **argv)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6343 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6344 size_t argc;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6345 char **new_argv;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6346 size_t i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6347
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6348 /* Count number of arguments. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6349 for (argc = 0; argv[argc] != NULL; argc++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6350 ;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6351
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6352 /* Allocate new argument vector. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6353 new_argv = XMALLOC (char *, argc + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6354
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6355 /* Put quoted arguments into the new argument vector. */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6356 for (i = 0; i < argc; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6357 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6358 const char *string = argv[i];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6359
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6360 if (string[0] == '\0')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6361 new_argv[i] = xstrdup ("\"\"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6362 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6363 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6364 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6365 size_t length;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6366 unsigned int backslashes;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6367 const char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6368 char *quoted_string;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6369 char *p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6370
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6371 length = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6372 backslashes = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6373 if (quote_around)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6374 length++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6375 for (s = string; *s != '\0'; s++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6376 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6377 char c = *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6378 if (c == '"')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6379 length += backslashes + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6380 length++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6381 if (c == '\\')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6382 backslashes++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6383 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6384 backslashes = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6385 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6386 if (quote_around)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6387 length += backslashes + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6388
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6389 quoted_string = XMALLOC (char, length + 1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6390
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6391 p = quoted_string;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6392 backslashes = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6393 if (quote_around)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6394 *p++ = '"';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6395 for (s = string; *s != '\0'; s++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6396 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6397 char c = *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6398 if (c == '"')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6399 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6400 unsigned int j;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6401 for (j = backslashes + 1; j > 0; j--)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6402 *p++ = '\\';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6403 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6404 *p++ = c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6405 if (c == '\\')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6406 backslashes++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6407 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6408 backslashes = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6409 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6410 if (quote_around)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6411 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6412 unsigned int j;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6413 for (j = backslashes; j > 0; j--)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6414 *p++ = '\\';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6415 *p++ = '"';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6416 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6417 *p = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6418
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6419 new_argv[i] = quoted_string;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6420 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6421 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6422 new_argv[i] = (char *) string;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6423 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6424 new_argv[argc] = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6425
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6426 return new_argv;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6427 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6428 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6429 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6430 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6431
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6432 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6433 void lt_dump_script (FILE* f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6434 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6435 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6436 func_emit_wrapper yes |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6437 $SED -n -e '
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6438 s/^\(.\{79\}\)\(..*\)/\1\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6439 \2/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6440 h
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6441 s/\([\\"]\)/\\\1/g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6442 s/$/\\n/
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6443 s/\([^\n]*\).*/ fputs ("\1", f);/p
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6444 g
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6445 D'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6446 cat <<"EOF"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6447 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6448 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6449 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6450 # end: func_emit_cwrapperexe_src
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6451
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6452 # func_win32_import_lib_p ARG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6453 # True if ARG is an import lib, as indicated by $file_magic_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6454 func_win32_import_lib_p ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6455 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6456 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6457
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6458 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6459 *import*) : ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6460 *) false ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6461 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6462 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6463
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6464 # func_suncc_cstd_abi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6465 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6466 # Several compiler flags select an ABI that is incompatible with the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6467 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6468 func_suncc_cstd_abi ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6469 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6470 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6471
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6472 case " $compile_command " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6473 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6474 suncc_use_cstd_abi=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6475 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6476 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6477 suncc_use_cstd_abi=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6478 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6479 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6480 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6481
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6482 # func_mode_link arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6483 func_mode_link ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6484 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6485 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6486
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6487 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6488 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6489 # It is impossible to link a dll without this setting, and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6490 # we shouldn't force the makefile maintainer to figure out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6491 # what system we are compiling for in order to pass an extra
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6492 # flag for every libtool invocation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6493 # allow_undefined=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6494
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6495 # FIXME: Unfortunately, there are problems with the above when trying
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6496 # to make a dll that has undefined symbols, in which case not
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6497 # even a static library is built. For now, we need to specify
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6498 # -no-undefined on the libtool link line when we can be certain
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6499 # that all symbols are satisfied, otherwise we get a static library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6500 allow_undefined=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6501 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6502 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6503 allow_undefined=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6504 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6505 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6506 libtool_args=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6507 base_compile="$nonopt $@"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6508 compile_command=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6509 finalize_command=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6510
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6511 compile_rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6512 finalize_rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6513 compile_shlibpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6514 finalize_shlibpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6515 convenience=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6516 old_convenience=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6517 deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6518 old_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6519 compiler_flags=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6520 linker_flags=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6521 dllsearchpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6522 lib_search_path=`pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6523 inst_prefix_dir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6524 new_inherited_linker_flags=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6525
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6526 avoid_version=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6527 bindir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6528 dlfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6529 dlprefiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6530 dlself=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6531 export_dynamic=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6532 export_symbols=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6533 export_symbols_regex=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6534 generated=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6535 libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6536 ltlibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6537 module=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6538 no_install=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6539 objs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6540 os2dllname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6541 non_pic_objects=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6542 precious_files_regex=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6543 prefer_static_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6544 preload=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6545 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6546 prevarg=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6547 release=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6548 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6549 xrpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6550 perm_rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6551 temp_rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6552 thread_safe=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6553 vinfo=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6554 vinfo_number=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6555 weak_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6556 single_module=$wl-single_module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6557 func_infer_tag $base_compile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6558
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6559 # We need to know -static, to get the right output filenames.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6560 for arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6561 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6562 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6563 -shared)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6564 test yes != "$build_libtool_libs" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6565 && func_fatal_configuration "cannot build a shared library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6566 build_old_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6567 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6568 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6569 -all-static | -static | -static-libtool-libs)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6570 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6571 -all-static)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6572 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6573 func_warning "complete static linking is impossible in this configuration"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6574 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6575 if test -n "$link_static_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6576 dlopen_self=$dlopen_self_static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6577 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6578 prefer_static_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6579 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6580 -static)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6581 if test -z "$pic_flag" && test -n "$link_static_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6582 dlopen_self=$dlopen_self_static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6583 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6584 prefer_static_libs=built
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6585 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6586 -static-libtool-libs)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6587 if test -z "$pic_flag" && test -n "$link_static_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6588 dlopen_self=$dlopen_self_static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6589 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6590 prefer_static_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6591 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6592 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6593 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6594 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6595 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6596 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6597 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6598 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6599
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6600 # See if our shared archives depend on static archives.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6601 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6602
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6603 # Go through the arguments, transforming them on the way.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6604 while test "$#" -gt 0; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6605 arg=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6606 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6607 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6608 qarg=$func_quote_for_eval_unquoted_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6609 func_append libtool_args " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6610
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6611 # If the previous option needs an argument, assign it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6612 if test -n "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6613 case $prev in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6614 output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6615 func_append compile_command " @OUTPUT@"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6616 func_append finalize_command " @OUTPUT@"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6617 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6618 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6619
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6620 case $prev in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6621 bindir)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6622 bindir=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6623 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6624 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6625 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6626 dlfiles|dlprefiles)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6627 $preload || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6628 # Add the symbol object into the linking commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6629 func_append compile_command " @SYMFILE@"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6630 func_append finalize_command " @SYMFILE@"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6631 preload=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6632 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6633 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6634 *.la | *.lo) ;; # We handle these cases below.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6635 force)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6636 if test no = "$dlself"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6637 dlself=needless
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6638 export_dynamic=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6639 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6640 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6641 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6642 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6643 self)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6644 if test dlprefiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6645 dlself=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6646 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6647 dlself=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6648 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6649 dlself=needless
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6650 export_dynamic=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6651 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6652 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6653 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6654 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6655 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6656 if test dlfiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6657 func_append dlfiles " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6658 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6659 func_append dlprefiles " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6660 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6661 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6662 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6663 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6664 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6665 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6666 expsyms)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6667 export_symbols=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6668 test -f "$arg" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6669 || func_fatal_error "symbol file '$arg' does not exist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6670 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6671 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6672 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6673 expsyms_regex)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6674 export_symbols_regex=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6675 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6676 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6677 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6678 framework)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6679 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6680 *-*-darwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6681 case "$deplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6682 *" $qarg.ltframework "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6683 *) func_append deplibs " $qarg.ltframework" # this is fixed later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6684 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6685 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6686 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6687 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6688 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6689 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6690 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6691 inst_prefix)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6692 inst_prefix_dir=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6693 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6694 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6695 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6696 mllvm)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6697 # Clang does not use LLVM to link, so we can simply discard any
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6698 # '-mllvm $arg' options when doing the link step.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6699 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6700 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6701 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6702 objectlist)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6703 if test -f "$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6704 save_arg=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6705 moreargs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6706 for fil in `cat "$save_arg"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6707 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6708 # func_append moreargs " $fil"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6709 arg=$fil
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6710 # A libtool-controlled object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6711
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6712 # Check to see that this really is a libtool object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6713 if func_lalib_unsafe_p "$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6714 pic_object=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6715 non_pic_object=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6716
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6717 # Read the .lo file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6718 func_source "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6719
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6720 if test -z "$pic_object" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6721 test -z "$non_pic_object" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6722 test none = "$pic_object" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6723 test none = "$non_pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6724 func_fatal_error "cannot find name of object for '$arg'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6725 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6726
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6727 # Extract subdirectory from the argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6728 func_dirname "$arg" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6729 xdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6730
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6731 if test none != "$pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6732 # Prepend the subdirectory the object is found in.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6733 pic_object=$xdir$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6734
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6735 if test dlfiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6736 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6737 func_append dlfiles " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6738 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6739 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6740 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6741 # If libtool objects are unsupported, then we need to preload.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6742 prev=dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6743 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6744 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6745
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6746 # CHECK ME: I think I busted this. -Ossama
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6747 if test dlprefiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6748 # Preload the old-style object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6749 func_append dlprefiles " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6750 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6751 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6752
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6753 # A PIC object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6754 func_append libobjs " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6755 arg=$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6756 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6757
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6758 # Non-PIC object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6759 if test none != "$non_pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6760 # Prepend the subdirectory the object is found in.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6761 non_pic_object=$xdir$non_pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6762
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6763 # A standard non-PIC object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6764 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6765 if test -z "$pic_object" || test none = "$pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6766 arg=$non_pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6767 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6768 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6769 # If the PIC object exists, use it instead.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6770 # $xdir was prepended to $pic_object above.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6771 non_pic_object=$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6772 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6773 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6774 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6775 # Only an error if not doing a dry-run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6776 if $opt_dry_run; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6777 # Extract subdirectory from the argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6778 func_dirname "$arg" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6779 xdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6780
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6781 func_lo2o "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6782 pic_object=$xdir$objdir/$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6783 non_pic_object=$xdir$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6784 func_append libobjs " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6785 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6786 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6787 func_fatal_error "'$arg' is not a valid libtool object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6788 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6789 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6790 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6791 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6792 func_fatal_error "link input file '$arg' does not exist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6793 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6794 arg=$save_arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6795 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6796 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6797 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6798 os2dllname)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6799 os2dllname=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6800 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6801 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6802 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6803 precious_regex)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6804 precious_files_regex=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6805 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6806 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6807 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6808 release)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6809 release=-$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6810 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6811 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6812 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6813 rpath | xrpath)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6814 # We need an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6815 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6816 [\\/]* | [A-Za-z]:[\\/]*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6817 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6818 func_fatal_error "only absolute run-paths are allowed"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6819 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6820 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6821 if test rpath = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6822 case "$rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6823 *" $arg "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6824 *) func_append rpath " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6825 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6826 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6827 case "$xrpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6828 *" $arg "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6829 *) func_append xrpath " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6830 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6831 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6832 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6833 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6834 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6835 shrext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6836 shrext_cmds=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6837 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6838 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6839 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6840 weak)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6841 func_append weak_libs " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6842 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6843 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6844 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6845 xcclinker)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6846 func_append linker_flags " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6847 func_append compiler_flags " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6848 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6849 func_append compile_command " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6850 func_append finalize_command " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6851 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6852 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6853 xcompiler)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6854 func_append compiler_flags " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6855 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6856 func_append compile_command " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6857 func_append finalize_command " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6858 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6859 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6860 xlinker)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6861 func_append linker_flags " $qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6862 func_append compiler_flags " $wl$qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6863 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6864 func_append compile_command " $wl$qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6865 func_append finalize_command " $wl$qarg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6866 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6867 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6868 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6869 eval "$prev=\"\$arg\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6870 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6871 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6872 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6873 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6874 fi # test -n "$prev"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6875
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6876 prevarg=$arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6877
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6878 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6879 -all-static)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6880 if test -n "$link_static_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6881 # See comment for -static flag below, for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6882 func_append compile_command " $link_static_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6883 func_append finalize_command " $link_static_flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6884 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6885 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6886 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6887
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6888 -allow-undefined)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6889 # FIXME: remove this flag sometime in the future.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6890 func_fatal_error "'-allow-undefined' must not be used because it is the default"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6891 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6892
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6893 -avoid-version)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6894 avoid_version=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6895 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6896 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6897
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6898 -bindir)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6899 prev=bindir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6900 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6901 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6902
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6903 -dlopen)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6904 prev=dlfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6905 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6906 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6907
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6908 -dlpreopen)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6909 prev=dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6910 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6911 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6912
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6913 -export-dynamic)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6914 export_dynamic=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6915 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6916 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6917
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6918 -export-symbols | -export-symbols-regex)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6919 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6920 func_fatal_error "more than one -exported-symbols argument is not allowed"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6921 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6922 if test X-export-symbols = "X$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6923 prev=expsyms
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6924 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6925 prev=expsyms_regex
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6926 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6927 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6928 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6929
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6930 -framework)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6931 prev=framework
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6932 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6933 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6934
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6935 -inst-prefix-dir)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6936 prev=inst_prefix
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6937 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6938 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6939
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6940 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6941 # so, if we see these flags be careful not to treat them like -L
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6942 -L[A-Z][A-Z]*:*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6943 case $with_gcc/$host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6944 no/*-*-irix* | /*-*-irix*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6945 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6946 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6947 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6948 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6949 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6950 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6951
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6952 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6953 func_stripname "-L" '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6954 if test -z "$func_stripname_result"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6955 if test "$#" -gt 0; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6956 func_fatal_error "require no space between '-L' and '$1'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6957 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6958 func_fatal_error "need path for '-L' option"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6959 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6960 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6961 func_resolve_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6962 dir=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6963 # We need an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6964 case $dir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6965 [\\/]* | [A-Za-z]:[\\/]*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6966 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6967 absdir=`cd "$dir" && pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6968 test -z "$absdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6969 func_fatal_error "cannot determine absolute directory name of '$dir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6970 dir=$absdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6971 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6972 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6973 case "$deplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6974 *" -L$dir "* | *" $arg "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6975 # Will only happen for absolute or sysroot arguments
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6976 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6977 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6978 # Preserve sysroot, but never include relative directories
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6979 case $dir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6980 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6981 *) func_append deplibs " -L$dir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6982 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6983 func_append lib_search_path " $dir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6984 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6985 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6986 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6987 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6988 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6989 case :$dllsearchpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6990 *":$dir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6991 ::) dllsearchpath=$dir;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6992 *) func_append dllsearchpath ":$dir";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6993 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6994 case :$dllsearchpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6995 *":$testbindir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6996 ::) dllsearchpath=$testbindir;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6997 *) func_append dllsearchpath ":$testbindir";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6998 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6999 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7000 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7001 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7002 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7003
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7004 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7005 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7006 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7007 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7008 # These systems don't actually have a C or math library (as such)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7009 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7010 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7011 *-*-os2*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7012 # These systems don't actually have a C library (as such)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7013 test X-lc = "X$arg" && continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7014 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7015 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7016 # Do not include libc due to us having libc/libc_r.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7017 test X-lc = "X$arg" && continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7018 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7019 *-*-rhapsody* | *-*-darwin1.[012])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7020 # Rhapsody C and math libraries are in the System framework
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7021 func_append deplibs " System.ltframework"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7022 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7023 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7024 *-*-sco3.2v5* | *-*-sco5v6*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7025 # Causes problems with __ctype
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7026 test X-lc = "X$arg" && continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7027 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7028 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7029 # Compiler inserts libc in the correct place for threads to work
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7030 test X-lc = "X$arg" && continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7031 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7032 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7033 elif test X-lc_r = "X$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7034 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7035 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7036 # Do not include libc_r directly, use -pthread flag.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7037 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7038 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7039 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7040 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7041 func_append deplibs " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7042 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7043 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7044
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7045 -mllvm)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7046 prev=mllvm
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7047 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7048 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7049
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7050 -module)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7051 module=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7052 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7053 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7054
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7055 # Tru64 UNIX uses -model [arg] to determine the layout of C++
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7056 # classes, name mangling, and exception handling.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7057 # Darwin uses the -arch flag to determine output architecture.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7058 -model|-arch|-isysroot|--sysroot)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7059 func_append compiler_flags " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7060 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7061 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7062 prev=xcompiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7063 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7064 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7065
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7066 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7067 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7068 func_append compiler_flags " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7069 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7070 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7071 case "$new_inherited_linker_flags " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7072 *" $arg "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7073 * ) func_append new_inherited_linker_flags " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7074 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7075 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7076 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7077
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7078 -multi_module)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7079 single_module=$wl-multi_module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7080 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7081 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7082
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7083 -no-fast-install)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7084 fast_install=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7085 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7086 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7087
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7088 -no-install)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7089 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7090 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7091 # The PATH hackery in wrapper scripts is required on Windows
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7092 # and Darwin in order for the loader to find any dlls it needs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7093 func_warning "'-no-install' is ignored for $host"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7094 func_warning "assuming '-no-fast-install' instead"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7095 fast_install=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7096 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7097 *) no_install=yes ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7098 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7099 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7100 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7101
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7102 -no-undefined)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7103 allow_undefined=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7104 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7105 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7106
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7107 -objectlist)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7108 prev=objectlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7109 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7110 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7111
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7112 -os2dllname)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7113 prev=os2dllname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7114 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7115 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7116
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7117 -o) prev=output ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7118
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7119 -precious-files-regex)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7120 prev=precious_regex
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7121 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7122 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7123
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7124 -release)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7125 prev=release
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7126 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7127 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7128
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7129 -rpath)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7130 prev=rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7131 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7132 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7133
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7134 -R)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7135 prev=xrpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7136 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7137 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7138
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7139 -R*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7140 func_stripname '-R' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7141 dir=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7142 # We need an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7143 case $dir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7144 [\\/]* | [A-Za-z]:[\\/]*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7145 =*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7146 func_stripname '=' '' "$dir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7147 dir=$lt_sysroot$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7148 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7149 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7150 func_fatal_error "only absolute run-paths are allowed"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7151 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7152 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7153 case "$xrpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7154 *" $dir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7155 *) func_append xrpath " $dir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7156 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7157 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7158 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7159
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7160 -shared)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7161 # The effects of -shared are defined in a previous loop.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7162 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7163 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7164
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7165 -shrext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7166 prev=shrext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7167 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7168 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7169
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7170 -static | -static-libtool-libs)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7171 # The effects of -static are defined in a previous loop.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7172 # We used to do the same as -all-static on platforms that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7173 # didn't have a PIC flag, but the assumption that the effects
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7174 # would be equivalent was wrong. It would break on at least
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7175 # Digital Unix and AIX.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7176 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7177 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7178
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7179 -thread-safe)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7180 thread_safe=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7181 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7182 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7183
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7184 -version-info)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7185 prev=vinfo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7186 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7187 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7188
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7189 -version-number)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7190 prev=vinfo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7191 vinfo_number=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7192 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7193 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7194
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7195 -weak)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7196 prev=weak
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7197 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7198 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7199
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7200 -Wc,*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7201 func_stripname '-Wc,' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7202 args=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7203 arg=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7204 save_ifs=$IFS; IFS=,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7205 for flag in $args; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7206 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7207 func_quote_for_eval "$flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7208 func_append arg " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7209 func_append compiler_flags " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7210 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7211 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7212 func_stripname ' ' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7213 arg=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7214 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7215
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7216 -Wl,*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7217 func_stripname '-Wl,' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7218 args=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7219 arg=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7220 save_ifs=$IFS; IFS=,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7221 for flag in $args; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7222 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7223 func_quote_for_eval "$flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7224 func_append arg " $wl$func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7225 func_append compiler_flags " $wl$func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7226 func_append linker_flags " $func_quote_for_eval_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7227 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7228 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7229 func_stripname ' ' '' "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7230 arg=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7231 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7232
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7233 -Xcompiler)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7234 prev=xcompiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7235 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7236 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7237
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7238 -Xlinker)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7239 prev=xlinker
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7240 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7241 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7242
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7243 -XCClinker)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7244 prev=xcclinker
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7245 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7246 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7247
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7248 # -msg_* for osf cc
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7249 -msg_*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7250 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7251 arg=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7252 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7253
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7254 # Flags to be passed through unchanged, with rationale:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7255 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7256 # -r[0-9][0-9]* specify processor for the SGI compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7257 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7258 # +DA*, +DD* enable 64-bit mode for the HP compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7259 # -q* compiler args for the IBM compiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7260 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7261 # -F/path path to uninstalled frameworks, gcc on darwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7262 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7263 # -fstack-protector* stack protector flags for GCC
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7264 # @file GCC response files
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7265 # -tp=* Portland pgcc target processor selection
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7266 # --sysroot=* for sysroot support
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7267 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7268 # -stdlib=* select c++ std lib with clang
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7269 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7270 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7271 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7272 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7273 arg=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7274 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7275 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7276 func_append compiler_flags " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7277 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7278 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7279
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7280 -Z*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7281 if test os2 = "`expr $host : '.*\(os2\)'`"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7282 # OS/2 uses -Zxxx to specify OS/2-specific options
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7283 compiler_flags="$compiler_flags $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7284 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7285 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7286 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7287 -Zlinker | -Zstack)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7288 prev=xcompiler
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7289 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7290 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7291 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7292 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7293 # Otherwise treat like 'Some other compiler flag' below
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7294 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7295 arg=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7296 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7297 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7298
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7299 # Some other compiler flag.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7300 -* | +*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7301 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7302 arg=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7303 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7304
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7305 *.$objext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7306 # A standard object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7307 func_append objs " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7308 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7309
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7310 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7311 # A libtool-controlled object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7312
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7313 # Check to see that this really is a libtool object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7314 if func_lalib_unsafe_p "$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7315 pic_object=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7316 non_pic_object=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7317
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7318 # Read the .lo file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7319 func_source "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7320
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7321 if test -z "$pic_object" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7322 test -z "$non_pic_object" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7323 test none = "$pic_object" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7324 test none = "$non_pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7325 func_fatal_error "cannot find name of object for '$arg'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7326 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7327
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7328 # Extract subdirectory from the argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7329 func_dirname "$arg" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7330 xdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7331
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7332 test none = "$pic_object" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7333 # Prepend the subdirectory the object is found in.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7334 pic_object=$xdir$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7335
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7336 if test dlfiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7337 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7338 func_append dlfiles " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7339 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7340 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7341 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7342 # If libtool objects are unsupported, then we need to preload.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7343 prev=dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7344 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7345 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7346
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7347 # CHECK ME: I think I busted this. -Ossama
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7348 if test dlprefiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7349 # Preload the old-style object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7350 func_append dlprefiles " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7351 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7352 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7353
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7354 # A PIC object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7355 func_append libobjs " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7356 arg=$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7357 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7358
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7359 # Non-PIC object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7360 if test none != "$non_pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7361 # Prepend the subdirectory the object is found in.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7362 non_pic_object=$xdir$non_pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7363
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7364 # A standard non-PIC object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7365 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7366 if test -z "$pic_object" || test none = "$pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7367 arg=$non_pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7368 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7369 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7370 # If the PIC object exists, use it instead.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7371 # $xdir was prepended to $pic_object above.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7372 non_pic_object=$pic_object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7373 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7374 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7375 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7376 # Only an error if not doing a dry-run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7377 if $opt_dry_run; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7378 # Extract subdirectory from the argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7379 func_dirname "$arg" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7380 xdir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7381
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7382 func_lo2o "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7383 pic_object=$xdir$objdir/$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7384 non_pic_object=$xdir$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7385 func_append libobjs " $pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7386 func_append non_pic_objects " $non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7387 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7388 func_fatal_error "'$arg' is not a valid libtool object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7389 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7390 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7391 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7392
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7393 *.$libext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7394 # An archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7395 func_append deplibs " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7396 func_append old_deplibs " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7397 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7398 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7399
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7400 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7401 # A libtool-controlled library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7402
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7403 func_resolve_sysroot "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7404 if test dlfiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7405 # This library was specified with -dlopen.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7406 func_append dlfiles " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7407 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7408 elif test dlprefiles = "$prev"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7409 # The library was specified with -dlpreopen.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7410 func_append dlprefiles " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7411 prev=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7412 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7413 func_append deplibs " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7414 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7415 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7416 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7417
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7418 # Some other compiler argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7419 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7420 # Unknown arguments in both finalize_command and compile_command need
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7421 # to be aesthetically quoted because they are evaled later.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7422 func_quote_for_eval "$arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7423 arg=$func_quote_for_eval_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7424 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7425 esac # arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7426
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7427 # Now actually substitute the argument into the commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7428 if test -n "$arg"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7429 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7430 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7431 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7432 done # argument parsing loop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7433
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7434 test -n "$prev" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7435 func_fatal_help "the '$prevarg' option requires an argument"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7436
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7437 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7438 eval arg=\"$export_dynamic_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7439 func_append compile_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7440 func_append finalize_command " $arg"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7441 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7442
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7443 oldlibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7444 # calculate the name of the file, without its directory
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7445 func_basename "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7446 outputname=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7447 libobjs_save=$libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7448
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7449 if test -n "$shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7450 # get the directories listed in $shlibpath_var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7451 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7452 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7453 shlib_search_path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7454 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7455 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7456 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7457
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7458 # Definition is injected by LT_CONFIG during libtool generation.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7459 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7460
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7461 func_dirname "$output" "/" ""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7462 output_objdir=$func_dirname_result$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7463 func_to_tool_file "$output_objdir/"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7464 tool_output_objdir=$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7465 # Create the object directory.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7466 func_mkdir_p "$output_objdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7467
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7468 # Determine the type of output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7469 case $output in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7470 "")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7471 func_fatal_help "you must specify an output file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7472 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7473 *.$libext) linkmode=oldlib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7474 *.lo | *.$objext) linkmode=obj ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7475 *.la) linkmode=lib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7476 *) linkmode=prog ;; # Anything else should be a program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7477 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7478
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7479 specialdeplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7480
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7481 libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7482 # Find all interdependent deplibs by searching for libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7483 # that are linked more than once (e.g. -la -lb -la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7484 for deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7485 if $opt_preserve_dup_deps; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7486 case "$libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7487 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7488 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7489 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7490 func_append libs " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7491 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7492
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7493 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7494 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7495
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7496 # Compute libraries that are listed more than once in $predeps
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7497 # $postdeps and mark them as special (i.e., whose duplicates are
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7498 # not to be eliminated).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7499 pre_post_deps=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7500 if $opt_duplicate_compiler_generated_deps; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7501 for pre_post_dep in $predeps $postdeps; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7502 case "$pre_post_deps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7503 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7504 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7505 func_append pre_post_deps " $pre_post_dep"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7506 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7507 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7508 pre_post_deps=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7509 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7510
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7511 deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7512 newdependency_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7513 newlib_search_path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7514 need_relink=no # whether we're linking any uninstalled libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7515 notinst_deplibs= # not-installed libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7516 notinst_path= # paths that contain not-installed libtool libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7517
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7518 case $linkmode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7519 lib)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7520 passes="conv dlpreopen link"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7521 for file in $dlfiles $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7522 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7523 *.la) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7524 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7525 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7526 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7527 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7528 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7529 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7530 prog)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7531 compile_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7532 finalize_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7533 alldeplibs=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7534 newdlfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7535 newdlprefiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7536 passes="conv scan dlopen dlpreopen link"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7537 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7538 *) passes="conv"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7539 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7540 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7541
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7542 for pass in $passes; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7543 # The preopen pass in lib mode reverses $deplibs; put it back here
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7544 # so that -L comes before libs that need it for instance...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7545 if test lib,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7546 ## FIXME: Find the place where the list is rebuilt in the wrong
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7547 ## order, and fix it there properly
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7548 tmp_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7549 for deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7550 tmp_deplibs="$deplib $tmp_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7551 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7552 deplibs=$tmp_deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7553 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7554
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7555 if test lib,link = "$linkmode,$pass" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7556 test prog,scan = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7557 libs=$deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7558 deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7559 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7560 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7561 case $pass in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7562 dlopen) libs=$dlfiles ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7563 dlpreopen) libs=$dlprefiles ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7564 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7565 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7566 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7567 if test lib,dlpreopen = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7568 # Collect and forward deplibs of preopened libtool libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7569 for lib in $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7570 # Ignore non-libtool-libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7571 dependency_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7572 func_resolve_sysroot "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7573 case $lib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7574 *.la) func_source "$func_resolve_sysroot_result" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7575 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7576
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7577 # Collect preopened libtool deplibs, except any this library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7578 # has declared as weak libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7579 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7580 func_basename "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7581 deplib_base=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7582 case " $weak_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7583 *" $deplib_base "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7584 *) func_append deplibs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7585 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7586 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7587 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7588 libs=$dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7589 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7590 if test dlopen = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7591 # Collect dlpreopened libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7592 save_deplibs=$deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7593 deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7594 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7595
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7596 for deplib in $libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7597 lib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7598 found=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7599 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7600 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7601 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7602 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7603 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7604 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7605 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7606 func_append compiler_flags " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7607 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7608 case "$new_inherited_linker_flags " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7609 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7610 * ) func_append new_inherited_linker_flags " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7611 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7612 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7613 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7614 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7615 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7616 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7617 if test lib != "$linkmode" && test prog != "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7618 func_warning "'-l' is ignored for archives/objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7619 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7620 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7621 func_stripname '-l' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7622 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7623 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7624 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7625 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7626 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7627 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7628 for searchdir in $searchdirs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7629 for search_ext in .la $std_shrext .so .a; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7630 # Search the libtool library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7631 lib=$searchdir/lib$name$search_ext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7632 if test -f "$lib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7633 if test .la = "$search_ext"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7634 found=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7635 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7636 found=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7637 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7638 break 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7639 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7640 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7641 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7642 if $found; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7643 # deplib is a libtool library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7644 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7645 # We need to do some special things here, and not later.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7646 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7647 case " $predeps $postdeps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7648 *" $deplib "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7649 if func_lalib_p "$lib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7650 library_names=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7651 old_library=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7652 func_source "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7653 for l in $old_library $library_names; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7654 ll=$l
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7655 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7656 if test "X$ll" = "X$old_library"; then # only static version available
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7657 found=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7658 func_dirname "$lib" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7659 ladir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7660 lib=$ladir/$old_library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7661 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7662 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7663 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7664 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7665 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7666 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7667 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7668 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7669 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7670 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7671 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7672 *) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7673 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7674 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7675 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7676 # deplib doesn't seem to be a libtool library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7677 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7678 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7679 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7680 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7681 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7682 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7683 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7684 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7685 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7686 ;; # -l
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7687 *.ltframework)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7688 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7689 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7690 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7691 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7692 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7693 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7694 case "$new_inherited_linker_flags " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7695 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7696 * ) func_append new_inherited_linker_flags " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7697 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7698 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7699 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7700 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7701 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7702 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7703 case $linkmode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7704 lib)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7705 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7706 test conv = "$pass" && continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7707 newdependency_libs="$deplib $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7708 func_stripname '-L' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7709 func_resolve_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7710 func_append newlib_search_path " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7711 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7712 prog)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7713 if test conv = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7714 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7715 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7716 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7717 if test scan = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7718 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7719 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7720 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7721 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7722 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7723 func_stripname '-L' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7724 func_resolve_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7725 func_append newlib_search_path " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7726 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7727 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7728 func_warning "'-L' is ignored for archives/objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7729 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7730 esac # linkmode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7731 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7732 ;; # -L
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7733 -R*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7734 if test link = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7735 func_stripname '-R' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7736 func_resolve_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7737 dir=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7738 # Make sure the xrpath contains only unique directories.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7739 case "$xrpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7740 *" $dir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7741 *) func_append xrpath " $dir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7742 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7743 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7744 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7745 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7746 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7747 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7748 func_resolve_sysroot "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7749 lib=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7750 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7751 *.$libext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7752 if test conv = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7753 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7754 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7755 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7756 case $linkmode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7757 lib)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7758 # Linking convenience modules into shared libraries is allowed,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7759 # but linking other static libraries is non-portable.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7760 case " $dlpreconveniencelibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7761 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7762 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7763 valid_a_lib=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7764 case $deplibs_check_method in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7765 match_pattern*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7766 set dummy $deplibs_check_method; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7767 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7768 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7769 | $EGREP "$match_pattern_regex" > /dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7770 valid_a_lib=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7771 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7772 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7773 pass_all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7774 valid_a_lib=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7775 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7776 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7777 if $valid_a_lib; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7778 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7779 $ECHO "*** Warning: Linking the shared library $output against the"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7780 $ECHO "*** static library $deplib is not portable!"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7781 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7782 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7783 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7784 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7785 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7786 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7787 echo "*** shared version of the library, which you do not appear to have"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7788 echo "*** because the file extensions .$libext of this argument makes me believe"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7789 echo "*** that it is just a static archive that I should not use here."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7790 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7791 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7792 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7793 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7794 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7795 prog)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7796 if test link != "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7797 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7798 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7799 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7800 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7801 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7802 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7803 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7804 esac # linkmode
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7805 ;; # *.$libext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7806 *.lo | *.$objext)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7807 if test conv = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7808 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7809 elif test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7810 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7811 # If there is no dlopen support or we're linking statically,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7812 # we need to preload.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7813 func_append newdlprefiles " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7814 compile_deplibs="$deplib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7815 finalize_deplibs="$deplib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7816 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7817 func_append newdlfiles " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7818 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7819 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7820 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7821 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7822 %DEPLIBS%)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7823 alldeplibs=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7824 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7825 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7826 esac # case $deplib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7827
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7828 $found || test -f "$lib" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7829 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7830
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7831 # Check to see that this really is a libtool archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7832 func_lalib_unsafe_p "$lib" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7833 || func_fatal_error "'$lib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7834
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7835 func_dirname "$lib" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7836 ladir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7837
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7838 dlname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7839 dlopen=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7840 dlpreopen=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7841 libdir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7842 library_names=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7843 old_library=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7844 inherited_linker_flags=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7845 # If the library was installed with an old release of libtool,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7846 # it will not redefine variables installed, or shouldnotlink
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7847 installed=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7848 shouldnotlink=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7849 avoidtemprpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7850
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7851
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7852 # Read the .la file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7853 func_source "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7854
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7855 # Convert "-framework foo" to "foo.ltframework"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7856 if test -n "$inherited_linker_flags"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7857 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7858 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7859 case " $new_inherited_linker_flags " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7860 *" $tmp_inherited_linker_flag "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7861 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7862 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7863 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7864 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7865 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7866 if test lib,link = "$linkmode,$pass" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7867 test prog,scan = "$linkmode,$pass" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7868 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7869 test -n "$dlopen" && func_append dlfiles " $dlopen"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7870 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7871 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7872
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7873 if test conv = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7874 # Only check for convenience libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7875 deplibs="$lib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7876 if test -z "$libdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7877 if test -z "$old_library"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7878 func_fatal_error "cannot find name of link library for '$lib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7879 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7880 # It is a libtool convenience library, so add in its objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7881 func_append convenience " $ladir/$objdir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7882 func_append old_convenience " $ladir/$objdir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7883 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7884 func_fatal_error "'$lib' is not a convenience library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7885 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7886 tmp_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7887 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7888 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7889 if $opt_preserve_dup_deps; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7890 case "$tmp_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7891 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7892 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7893 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7894 func_append tmp_libs " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7895 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7896 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7897 fi # $pass = conv
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7898
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7899
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7900 # Get the name of the library we link against.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7901 linklib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7902 if test -n "$old_library" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7903 { test yes = "$prefer_static_libs" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7904 test built,no = "$prefer_static_libs,$installed"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7905 linklib=$old_library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7906 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7907 for l in $old_library $library_names; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7908 linklib=$l
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7909 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7910 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7911 if test -z "$linklib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7912 func_fatal_error "cannot find name of link library for '$lib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7913 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7914
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7915 # This library was specified with -dlopen.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7916 if test dlopen = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7917 test -z "$libdir" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7918 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7919 if test -z "$dlname" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7920 test yes != "$dlopen_support" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7921 test no = "$build_libtool_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7922 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7923 # If there is no dlname, no dlopen support or we're linking
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7924 # statically, we need to preload. We also need to preload any
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7925 # dependent libraries so libltdl's deplib preloader doesn't
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7926 # bomb out in the load deplibs phase.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7927 func_append dlprefiles " $lib $dependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7928 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7929 func_append newdlfiles " $lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7930 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7931 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7932 fi # $pass = dlopen
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7933
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7934 # We need an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7935 case $ladir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7936 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7937 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7938 abs_ladir=`cd "$ladir" && pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7939 if test -z "$abs_ladir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7940 func_warning "cannot determine absolute directory name of '$ladir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7941 func_warning "passing it literally to the linker, although it might fail"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7942 abs_ladir=$ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7943 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7944 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7945 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7946 func_basename "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7947 laname=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7948
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7949 # Find the relevant object directory and library name.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7950 if test yes = "$installed"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7951 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7952 func_warning "library '$lib' was moved."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7953 dir=$ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7954 absdir=$abs_ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7955 libdir=$abs_ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7956 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7957 dir=$lt_sysroot$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7958 absdir=$lt_sysroot$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7959 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7960 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7961 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7962 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7963 dir=$ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7964 absdir=$abs_ladir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7965 # Remove this search path later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7966 func_append notinst_path " $abs_ladir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7967 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7968 dir=$ladir/$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7969 absdir=$abs_ladir/$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7970 # Remove this search path later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7971 func_append notinst_path " $abs_ladir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7972 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7973 fi # $installed = yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7974 func_stripname 'lib' '.la' "$laname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7975 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7976
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7977 # This library was specified with -dlpreopen.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7978 if test dlpreopen = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7979 if test -z "$libdir" && test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7980 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7981 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7982 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7983 # special handling for platforms with PE-DLLs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7984 *cygwin* | *mingw* | *cegcc* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7985 # Linker will automatically link against shared library if both
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7986 # static and shared are present. Therefore, ensure we extract
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7987 # symbols from the import library if a shared library is present
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7988 # (otherwise, the dlopen module name will be incorrect). We do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7989 # this by putting the import library name into $newdlprefiles.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7990 # We recover the dlopen module name by 'saving' the la file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7991 # name in a special purpose variable, and (later) extracting the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7992 # dlname from the la file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7993 if test -n "$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7994 func_tr_sh "$dir/$linklib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7995 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7996 func_append newdlprefiles " $dir/$linklib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7997 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7998 func_append newdlprefiles " $dir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7999 # Keep a list of preopened convenience libraries to check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8000 # that they are being used correctly in the link pass.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8001 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8002 func_append dlpreconveniencelibs " $dir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8003 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8004 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8005 * )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8006 # Prefer using a static library (so that no silly _DYNAMIC symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8007 # are required to link).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8008 if test -n "$old_library"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8009 func_append newdlprefiles " $dir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8010 # Keep a list of preopened convenience libraries to check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8011 # that they are being used correctly in the link pass.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8012 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8013 func_append dlpreconveniencelibs " $dir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8014 # Otherwise, use the dlname, so that lt_dlopen finds it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8015 elif test -n "$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8016 func_append newdlprefiles " $dir/$dlname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8017 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8018 func_append newdlprefiles " $dir/$linklib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8019 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8020 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8021 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8022 fi # $pass = dlpreopen
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8023
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8024 if test -z "$libdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8025 # Link the convenience library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8026 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8027 deplibs="$dir/$old_library $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8028 elif test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8029 compile_deplibs="$dir/$old_library $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8030 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8031 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8032 deplibs="$lib $deplibs" # used for prog,scan pass
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8033 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8034 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8035 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8036
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8037
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8038 if test prog = "$linkmode" && test link != "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8039 func_append newlib_search_path " $ladir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8040 deplibs="$lib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8041
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8042 linkalldeplibs=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8043 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8044 test no = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8045 linkalldeplibs=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8046 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8047
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8048 tmp_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8049 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8050 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8051 -L*) func_stripname '-L' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8052 func_resolve_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8053 func_append newlib_search_path " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8054 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8055 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8056 # Need to link against all dependency_libs?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8057 if $linkalldeplibs; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8058 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8059 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8060 # Need to hardcode shared library paths
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8061 # or/and link against static libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8062 newdependency_libs="$deplib $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8063 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8064 if $opt_preserve_dup_deps; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8065 case "$tmp_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8066 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8067 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8068 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8069 func_append tmp_libs " $deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8070 done # for deplib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8071 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8072 fi # $linkmode = prog...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8073
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8074 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8075 if test -n "$library_names" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8076 { { test no = "$prefer_static_libs" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8077 test built,yes = "$prefer_static_libs,$installed"; } ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8078 test -z "$old_library"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8079 # We need to hardcode the library path
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8080 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8081 # Make sure the rpath contains only unique directories.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8082 case $temp_rpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8083 *"$absdir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8084 *) func_append temp_rpath "$absdir:" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8085 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8086 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8087
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8088 # Hardcode the library path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8089 # Skip directories that are in the system default run-time
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8090 # search path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8091 case " $sys_lib_dlsearch_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8092 *" $absdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8093 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8094 case "$compile_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8095 *" $absdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8096 *) func_append compile_rpath " $absdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8097 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8098 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8099 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8100 case " $sys_lib_dlsearch_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8101 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8102 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8103 case "$finalize_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8104 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8105 *) func_append finalize_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8106 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8107 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8108 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8109 fi # $linkmode,$pass = prog,link...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8110
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8111 if $alldeplibs &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8112 { test pass_all = "$deplibs_check_method" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8113 { test yes = "$build_libtool_libs" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8114 test -n "$library_names"; }; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8115 # We only need to search for static libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8116 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8117 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8118 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8119
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8120 link_static=no # Whether the deplib will be linked statically
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8121 use_static_libs=$prefer_static_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8122 if test built = "$use_static_libs" && test yes = "$installed"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8123 use_static_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8124 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8125 if test -n "$library_names" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8126 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8127 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8128 *cygwin* | *mingw* | *cegcc* | *os2*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8129 # No point in relinking DLLs because paths are not encoded
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8130 func_append notinst_deplibs " $lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8131 need_relink=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8132 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8133 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8134 if test no = "$installed"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8135 func_append notinst_deplibs " $lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8136 need_relink=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8137 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8138 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8139 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8140 # This is a shared library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8141
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8142 # Warn about portability, can't link against -module's on some
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8143 # systems (darwin). Don't bleat about dlopened modules though!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8144 dlopenmodule=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8145 for dlpremoduletest in $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8146 if test "X$dlpremoduletest" = "X$lib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8147 dlopenmodule=$dlpremoduletest
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8148 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8149 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8150 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8151 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8152 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8153 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8154 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8155 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8156 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8157 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8158 $ECHO "*** $linklib is not portable!"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8159 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8160 if test lib = "$linkmode" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8161 test yes = "$hardcode_into_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8162 # Hardcode the library path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8163 # Skip directories that are in the system default run-time
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8164 # search path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8165 case " $sys_lib_dlsearch_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8166 *" $absdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8167 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8168 case "$compile_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8169 *" $absdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8170 *) func_append compile_rpath " $absdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8171 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8172 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8173 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8174 case " $sys_lib_dlsearch_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8175 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8176 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8177 case "$finalize_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8178 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8179 *) func_append finalize_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8180 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8181 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8182 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8183 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8184
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8185 if test -n "$old_archive_from_expsyms_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8186 # figure out the soname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8187 set dummy $library_names
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8188 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8189 realname=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8190 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8191 libname=`eval "\\$ECHO \"$libname_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8192 # use dlname if we got it. it's perfectly good, no?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8193 if test -n "$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8194 soname=$dlname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8195 elif test -n "$soname_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8196 # bleh windows
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8197 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8198 *cygwin* | mingw* | *cegcc* | *os2*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8199 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8200 major=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8201 versuffix=-$major
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8202 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8203 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8204 eval soname=\"$soname_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8205 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8206 soname=$realname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8207 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8208
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8209 # Make a new name for the extract_expsyms_cmds to use
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8210 soroot=$soname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8211 func_basename "$soroot"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8212 soname=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8213 func_stripname 'lib' '.dll' "$soname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8214 newlib=libimp-$func_stripname_result.a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8215
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8216 # If the library has no export list, then create one now
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8217 if test -f "$output_objdir/$soname-def"; then :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8218 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8219 func_verbose "extracting exported symbol list from '$soname'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8220 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8221 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8222
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8223 # Create $newlib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8224 if test -f "$output_objdir/$newlib"; then :; else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8225 func_verbose "generating import library for '$soname'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8226 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8227 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8228 # make sure the library variables are pointing to the new library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8229 dir=$output_objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8230 linklib=$newlib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8231 fi # test -n "$old_archive_from_expsyms_cmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8232
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8233 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8234 add_shlibpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8235 add_dir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8236 add=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8237 lib_linked=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8238 case $hardcode_action in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8239 immediate | unsupported)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8240 if test no = "$hardcode_direct"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8241 add=$dir/$linklib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8242 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8243 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8244 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8245 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8246 *-*-unixware7*) add_dir=-L$dir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8247 *-*-darwin* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8248 # if the lib is a (non-dlopened) module then we cannot
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8249 # link against it, someone is ignoring the earlier warnings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8250 if /usr/bin/file -L $add 2> /dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8251 $GREP ": [^:]* bundle" >/dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8252 if test "X$dlopenmodule" != "X$lib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8253 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8254 if test -z "$old_library"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8255 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8256 echo "*** And there doesn't seem to be a static archive available"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8257 echo "*** The link will probably fail, sorry"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8258 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8259 add=$dir/$old_library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8260 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8261 elif test -n "$old_library"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8262 add=$dir/$old_library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8263 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8264 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8265 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8266 elif test no = "$hardcode_minus_L"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8267 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8268 *-*-sunos*) add_shlibpath=$dir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8269 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8270 add_dir=-L$dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8271 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8272 elif test no = "$hardcode_shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8273 add_shlibpath=$dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8274 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8275 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8276 lib_linked=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8277 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8278 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8279 relink)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8280 if test yes = "$hardcode_direct" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8281 test no = "$hardcode_direct_absolute"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8282 add=$dir/$linklib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8283 elif test yes = "$hardcode_minus_L"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8284 add_dir=-L$absdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8285 # Try looking first in the location we're being installed to.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8286 if test -n "$inst_prefix_dir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8287 case $libdir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8288 [\\/]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8289 func_append add_dir " -L$inst_prefix_dir$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8290 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8291 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8292 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8293 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8294 elif test yes = "$hardcode_shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8295 add_shlibpath=$dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8296 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8297 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8298 lib_linked=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8299 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8300 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8301 *) lib_linked=no ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8302 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8303
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8304 if test yes != "$lib_linked"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8305 func_fatal_configuration "unsupported hardcode properties"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8306 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8307
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8308 if test -n "$add_shlibpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8309 case :$compile_shlibpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8310 *":$add_shlibpath:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8311 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8312 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8313 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8314 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8315 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8316 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8317 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8318 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8319 test -n "$add" && deplibs="$add $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8320 if test yes != "$hardcode_direct" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8321 test yes != "$hardcode_minus_L" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8322 test yes = "$hardcode_shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8323 case :$finalize_shlibpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8324 *":$libdir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8325 *) func_append finalize_shlibpath "$libdir:" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8326 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8327 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8328 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8329 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8330
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8331 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8332 add_shlibpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8333 add_dir=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8334 add=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8335 # Finalize command for both is simple: just hardcode it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8336 if test yes = "$hardcode_direct" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8337 test no = "$hardcode_direct_absolute"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8338 add=$libdir/$linklib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8339 elif test yes = "$hardcode_minus_L"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8340 add_dir=-L$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8341 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8342 elif test yes = "$hardcode_shlibpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8343 case :$finalize_shlibpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8344 *":$libdir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8345 *) func_append finalize_shlibpath "$libdir:" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8346 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8347 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8348 elif test yes = "$hardcode_automatic"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8349 if test -n "$inst_prefix_dir" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8350 test -f "$inst_prefix_dir$libdir/$linklib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8351 add=$inst_prefix_dir$libdir/$linklib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8352 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8353 add=$libdir/$linklib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8354 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8355 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8356 # We cannot seem to hardcode it, guess we'll fake it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8357 add_dir=-L$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8358 # Try looking first in the location we're being installed to.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8359 if test -n "$inst_prefix_dir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8360 case $libdir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8361 [\\/]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8362 func_append add_dir " -L$inst_prefix_dir$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8363 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8364 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8365 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8366 add=-l$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8367 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8368
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8369 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8370 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8371 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8372 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8373 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8374 test -n "$add" && deplibs="$add $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8375 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8376 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8377 elif test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8378 # Here we assume that one of hardcode_direct or hardcode_minus_L
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8379 # is not unsupported. This is valid on all known static and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8380 # shared platforms.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8381 if test unsupported != "$hardcode_direct"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8382 test -n "$old_library" && linklib=$old_library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8383 compile_deplibs="$dir/$linklib $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8384 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8385 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8386 compile_deplibs="-l$name -L$dir $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8387 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8388 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8389 elif test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8390 # Not a shared library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8391 if test pass_all != "$deplibs_check_method"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8392 # We're trying link a shared library against a static one
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8393 # but the system doesn't support it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8394
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8395 # Just print a warning and add the library to dependency_libs so
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8396 # that the program can be linked against the static library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8397 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8398 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8399 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8400 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8401 echo "*** shared version of the library, which you do not appear to have."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8402 if test yes = "$module"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8403 echo "*** But as you try to build a module library, libtool will still create "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8404 echo "*** a static module, that should work as long as the dlopening application"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8405 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8406 if test -z "$global_symbol_pipe"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8407 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8408 echo "*** However, this would only work if libtool was able to extract symbol"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8409 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8410 echo "*** not find such a program. So, this module is probably useless."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8411 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8412 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8413 if test no = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8414 build_libtool_libs=module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8415 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8416 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8417 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8418 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8419 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8420 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8421 deplibs="$dir/$old_library $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8422 link_static=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8423 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8424 fi # link shared/static library?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8425
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8426 if test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8427 if test -n "$dependency_libs" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8428 { test yes != "$hardcode_into_libs" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8429 test yes = "$build_old_libs" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8430 test yes = "$link_static"; }; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8431 # Extract -R from dependency_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8432 temp_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8433 for libdir in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8434 case $libdir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8435 -R*) func_stripname '-R' '' "$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8436 temp_xrpath=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8437 case " $xrpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8438 *" $temp_xrpath "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8439 *) func_append xrpath " $temp_xrpath";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8440 esac;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8441 *) func_append temp_deplibs " $libdir";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8442 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8443 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8444 dependency_libs=$temp_deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8445 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8446
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8447 func_append newlib_search_path " $absdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8448 # Link against this library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8449 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8450 # ... and its dependency_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8451 tmp_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8452 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8453 newdependency_libs="$deplib $newdependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8454 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8455 -L*) func_stripname '-L' '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8456 func_resolve_sysroot "$func_stripname_result";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8457 *) func_resolve_sysroot "$deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8458 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8459 if $opt_preserve_dup_deps; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8460 case "$tmp_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8461 *" $func_resolve_sysroot_result "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8462 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8463 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8464 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8465 func_append tmp_libs " $func_resolve_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8466 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8467
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8468 if test no != "$link_all_deplibs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8469 # Add the search paths of all dependency libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8470 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8471 path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8472 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8473 -L*) path=$deplib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8474 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8475 func_resolve_sysroot "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8476 deplib=$func_resolve_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8477 func_dirname "$deplib" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8478 dir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8479 # We need an absolute path.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8480 case $dir in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8481 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8482 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8483 absdir=`cd "$dir" && pwd`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8484 if test -z "$absdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8485 func_warning "cannot determine absolute directory name of '$dir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8486 absdir=$dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8487 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8488 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8489 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8490 if $GREP "^installed=no" $deplib > /dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8491 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8492 *-*-darwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8493 depdepl=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8494 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8495 if test -n "$deplibrary_names"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8496 for tmp in $deplibrary_names; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8497 depdepl=$tmp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8498 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8499 if test -f "$absdir/$objdir/$depdepl"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8500 depdepl=$absdir/$objdir/$depdepl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8501 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8502 if test -z "$darwin_install_name"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8503 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8504 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8505 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8506 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8507 path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8508 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8509 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8510 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8511 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8512 path=-L$absdir/$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8513 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8514 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8515 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8516 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8517 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8518 func_fatal_error "'$deplib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8519 test "$absdir" != "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8520 func_warning "'$deplib' seems to be moved"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8521
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8522 path=-L$absdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8523 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8524 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8525 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8526 case " $deplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8527 *" $path "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8528 *) deplibs="$path $deplibs" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8529 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8530 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8531 fi # link_all_deplibs != no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8532 fi # linkmode = lib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8533 done # for deplib in $libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8534 if test link = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8535 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8536 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8537 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8538 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8539 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8540 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8541 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8542 dependency_libs=$newdependency_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8543 if test dlpreopen = "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8544 # Link the dlpreopened libraries before other libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8545 for deplib in $save_deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8546 deplibs="$deplib $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8547 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8548 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8549 if test dlopen != "$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8550 test conv = "$pass" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8551 # Make sure lib_search_path contains only unique directories.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8552 lib_search_path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8553 for dir in $newlib_search_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8554 case "$lib_search_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8555 *" $dir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8556 *) func_append lib_search_path " $dir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8557 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8558 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8559 newlib_search_path=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8560 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8561
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8562 if test prog,link = "$linkmode,$pass"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8563 vars="compile_deplibs finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8564 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8565 vars=deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8566 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8567 for var in $vars dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8568 # Add libraries to $var in reverse order
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8569 eval tmp_libs=\"\$$var\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8570 new_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8571 for deplib in $tmp_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8572 # FIXME: Pedantically, this is the right thing to do, so
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8573 # that some nasty dependency loop isn't accidentally
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8574 # broken:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8575 #new_libs="$deplib $new_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8576 # Pragmatically, this seems to cause very few problems in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8577 # practice:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8578 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8579 -L*) new_libs="$deplib $new_libs" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8580 -R*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8581 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8582 # And here is the reason: when a library appears more
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8583 # than once as an explicit dependence of a library, or
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8584 # is implicitly linked in more than once by the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8585 # compiler, it is considered special, and multiple
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8586 # occurrences thereof are not removed. Compare this
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8587 # with having the same library being listed as a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8588 # dependency of multiple other libraries: in this case,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8589 # we know (pedantically, we assume) the library does not
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8590 # need to be listed more than once, so we keep only the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8591 # last copy. This is not always right, but it is rare
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8592 # enough that we require users that really mean to play
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8593 # such unportable linking tricks to link the library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8594 # using -Wl,-lname, so that libtool does not consider it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8595 # for duplicate removal.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8596 case " $specialdeplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8597 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8598 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8599 case " $new_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8600 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8601 *) new_libs="$deplib $new_libs" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8602 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8603 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8604 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8605 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8606 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8607 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8608 tmp_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8609 for deplib in $new_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8610 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8611 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8612 case " $tmp_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8613 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8614 *) func_append tmp_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8615 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8616 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8617 *) func_append tmp_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8618 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8619 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8620 eval $var=\"$tmp_libs\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8621 done # for var
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8622 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8623
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8624 # Add Sun CC postdeps if required:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8625 test CXX = "$tagname" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8626 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8627 linux*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8628 case `$CC -V 2>&1 | sed 5q` in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8629 *Sun\ C*) # Sun C++ 5.9
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8630 func_suncc_cstd_abi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8631
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8632 if test no != "$suncc_use_cstd_abi"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8633 func_append postdeps ' -library=Cstd -library=Crun'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8634 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8635 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8636 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8637 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8638
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8639 solaris*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8640 func_cc_basename "$CC"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8641 case $func_cc_basename_result in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8642 CC* | sunCC*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8643 func_suncc_cstd_abi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8644
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8645 if test no != "$suncc_use_cstd_abi"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8646 func_append postdeps ' -library=Cstd -library=Crun'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8647 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8648 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8649 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8650 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8651 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8652 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8653
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8654 # Last step: remove runtime libs from dependency_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8655 # (they stay in deplibs)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8656 tmp_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8657 for i in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8658 case " $predeps $postdeps $compiler_lib_search_path " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8659 *" $i "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8660 i=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8661 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8662 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8663 if test -n "$i"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8664 func_append tmp_libs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8665 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8666 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8667 dependency_libs=$tmp_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8668 done # for pass
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8669 if test prog = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8670 dlfiles=$newdlfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8671 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8672 if test prog = "$linkmode" || test lib = "$linkmode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8673 dlprefiles=$newdlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8674 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8675
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8676 case $linkmode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8677 oldlib)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8678 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8679 func_warning "'-dlopen' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8680 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8681
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8682 case " $deplibs" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8683 *\ -l* | *\ -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8684 func_warning "'-l' and '-L' are ignored for archives" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8685 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8686
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8687 test -n "$rpath" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8688 func_warning "'-rpath' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8689
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8690 test -n "$xrpath" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8691 func_warning "'-R' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8692
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8693 test -n "$vinfo" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8694 func_warning "'-version-info/-version-number' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8695
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8696 test -n "$release" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8697 func_warning "'-release' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8698
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8699 test -n "$export_symbols$export_symbols_regex" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8700 func_warning "'-export-symbols' is ignored for archives"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8701
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8702 # Now set the variables for building old libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8703 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8704 oldlibs=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8705 func_append objs "$old_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8706 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8707
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8708 lib)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8709 # Make sure we only generate libraries of the form 'libNAME.la'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8710 case $outputname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8711 lib*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8712 func_stripname 'lib' '.la' "$outputname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8713 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8714 eval shared_ext=\"$shrext_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8715 eval libname=\"$libname_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8716 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8717 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8718 test no = "$module" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8719 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8720
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8721 if test no != "$need_lib_prefix"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8722 # Add the "lib" prefix for modules if required
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8723 func_stripname '' '.la' "$outputname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8724 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8725 eval shared_ext=\"$shrext_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8726 eval libname=\"$libname_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8727 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8728 func_stripname '' '.la' "$outputname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8729 libname=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8730 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8731 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8732 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8733
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8734 if test -n "$objs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8735 if test pass_all != "$deplibs_check_method"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8736 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8737 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8738 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8739 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8740 $ECHO "*** objects $objs is not portable!"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8741 func_append libobjs " $objs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8742 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8743 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8744
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8745 test no = "$dlself" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8746 || func_warning "'-dlopen self' is ignored for libtool libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8747
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8748 set dummy $rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8749 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8750 test 1 -lt "$#" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8751 && func_warning "ignoring multiple '-rpath's for a libtool library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8752
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8753 install_libdir=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8754
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8755 oldlibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8756 if test -z "$rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8757 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8758 # Building a libtool convenience library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8759 # Some compilers have problems with a '.al' extension so
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8760 # convenience libraries should have the same extension an
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8761 # archive normally would.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8762 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8763 build_libtool_libs=convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8764 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8765 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8766
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8767 test -n "$vinfo" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8768 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8769
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8770 test -n "$release" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8771 func_warning "'-release' is ignored for convenience libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8772 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8773
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8774 # Parse the version information argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8775 save_ifs=$IFS; IFS=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8776 set dummy $vinfo 0 0 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8777 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8778 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8779
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8780 test -n "$7" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8781 func_fatal_help "too many parameters to '-version-info'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8782
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8783 # convert absolute version numbers to libtool ages
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8784 # this retains compatibility with .la files and attempts
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8785 # to make the code below a bit more comprehensible
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8786
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8787 case $vinfo_number in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8788 yes)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8789 number_major=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8790 number_minor=$2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8791 number_revision=$3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8792 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8793 # There are really only two kinds -- those that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8794 # use the current revision as the major version
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8795 # and those that subtract age and use age as
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8796 # a minor version. But, then there is irix
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8797 # that has an extra 1 added just for fun
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8798 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8799 case $version_type in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8800 # correct linux to gnu/linux during the next big refactor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8801 darwin|freebsd-elf|linux|osf|windows|none)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8802 func_arith $number_major + $number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8803 current=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8804 age=$number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8805 revision=$number_revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8806 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8807 freebsd-aout|qnx|sunos)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8808 current=$number_major
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8809 revision=$number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8810 age=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8811 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8812 irix|nonstopux)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8813 func_arith $number_major + $number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8814 current=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8815 age=$number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8816 revision=$number_minor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8817 lt_irix_increment=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8818 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8819 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8820 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8821 no)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8822 current=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8823 revision=$2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8824 age=$3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8825 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8826 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8827
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8828 # Check that each of the things are valid numbers.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8829 case $current in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8830 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]) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8831 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8832 func_error "CURRENT '$current' must be a nonnegative integer"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8833 func_fatal_error "'$vinfo' is not valid version information"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8834 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8835 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8836
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8837 case $revision in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8838 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]) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8839 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8840 func_error "REVISION '$revision' must be a nonnegative integer"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8841 func_fatal_error "'$vinfo' is not valid version information"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8842 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8843 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8844
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8845 case $age in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8846 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]) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8847 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8848 func_error "AGE '$age' must be a nonnegative integer"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8849 func_fatal_error "'$vinfo' is not valid version information"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8850 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8851 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8852
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8853 if test "$age" -gt "$current"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8854 func_error "AGE '$age' is greater than the current interface number '$current'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8855 func_fatal_error "'$vinfo' is not valid version information"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8856 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8857
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8858 # Calculate the version variables.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8859 major=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8860 versuffix=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8861 verstring=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8862 case $version_type in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8863 none) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8864
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8865 darwin)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8866 # Like Linux, but with the current version available in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8867 # verstring for coding it into the library header
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8868 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8869 major=.$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8870 versuffix=$major.$age.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8871 # Darwin ld doesn't like 0 for these options...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8872 func_arith $current + 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8873 minor_current=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8874 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8875 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8876 # On Darwin other compilers
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8877 case $CC in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8878 nagfor*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8879 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8880 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8881 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8882 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8883 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8884 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8885 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8886
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8887 freebsd-aout)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8888 major=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8889 versuffix=.$current.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8890 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8891
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8892 freebsd-elf)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8893 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8894 major=.$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8895 versuffix=$major.$age.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8896 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8897
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8898 irix | nonstopux)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8899 if test no = "$lt_irix_increment"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8900 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8901 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8902 func_arith $current - $age + 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8903 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8904 major=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8905
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8906 case $version_type in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8907 nonstopux) verstring_prefix=nonstopux ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8908 *) verstring_prefix=sgi ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8909 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8910 verstring=$verstring_prefix$major.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8911
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8912 # Add in all the interfaces that we are compatible with.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8913 loop=$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8914 while test 0 -ne "$loop"; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8915 func_arith $revision - $loop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8916 iface=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8917 func_arith $loop - 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8918 loop=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8919 verstring=$verstring_prefix$major.$iface:$verstring
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8920 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8921
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8922 # Before this point, $major must not contain '.'.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8923 major=.$major
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8924 versuffix=$major.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8925 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8926
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8927 linux) # correct to gnu/linux during the next big refactor
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8928 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8929 major=.$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8930 versuffix=$major.$age.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8931 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8932
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8933 osf)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8934 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8935 major=.$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8936 versuffix=.$current.$age.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8937 verstring=$current.$age.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8938
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8939 # Add in all the interfaces that we are compatible with.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8940 loop=$age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8941 while test 0 -ne "$loop"; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8942 func_arith $current - $loop
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8943 iface=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8944 func_arith $loop - 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8945 loop=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8946 verstring=$verstring:$iface.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8947 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8948
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8949 # Make executables depend on our current version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8950 func_append verstring ":$current.0"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8951 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8952
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8953 qnx)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8954 major=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8955 versuffix=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8956 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8957
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8958 sco)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8959 major=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8960 versuffix=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8961 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8962
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8963 sunos)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8964 major=.$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8965 versuffix=.$current.$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8966 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8967
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8968 windows)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8969 # Use '-' rather than '.', since we only want one
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8970 # extension on DOS 8.3 file systems.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8971 func_arith $current - $age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8972 major=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8973 versuffix=-$major
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8974 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8975
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8976 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8977 func_fatal_configuration "unknown library version type '$version_type'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8978 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8979 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8980
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8981 # Clear the version info if we defaulted, and they specified a release.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8982 if test -z "$vinfo" && test -n "$release"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8983 major=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8984 case $version_type in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8985 darwin)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8986 # we can't check for "0.0" in archive_cmds due to quoting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8987 # problems, so we reset it completely
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8988 verstring=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8989 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8990 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8991 verstring=0.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8992 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8993 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8994 if test no = "$need_version"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8995 versuffix=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8996 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8997 versuffix=.0.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8998 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8999 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9000
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9001 # Remove version info from name if versioning should be avoided
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9002 if test yes,no = "$avoid_version,$need_version"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9003 major=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9004 versuffix=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9005 verstring=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9006 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9007
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9008 # Check to see if the archive will have undefined symbols.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9009 if test yes = "$allow_undefined"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9010 if test unsupported = "$allow_undefined_flag"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9011 if test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9012 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9013 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9014 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9015 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9016 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9017 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9018 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9019 # Don't allow undefined symbols.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9020 allow_undefined_flag=$no_undefined_flag
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9021 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9022
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9023 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9024
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9025 func_generate_dlsyms "$libname" "$libname" :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9026 func_append libobjs " $symfileobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9027 test " " = "$libobjs" && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9028
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9029 if test relink != "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9030 # Remove our outputs, but don't remove object files since they
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9031 # may have been created when compiling PIC objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9032 removelist=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9033 tempremovelist=`$ECHO "$output_objdir/*"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9034 for p in $tempremovelist; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9035 case $p in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9036 *.$objext | *.gcno)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9037 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9038 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9039 if test -n "$precious_files_regex"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9040 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9041 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9042 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9043 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9044 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9045 func_append removelist " $p"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9046 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9047 *) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9048 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9049 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9050 test -n "$removelist" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9051 func_show_eval "${RM}r \$removelist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9052 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9053
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9054 # Now set the variables for building old libraries.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9055 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9056 func_append oldlibs " $output_objdir/$libname.$libext"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9057
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9058 # Transform .lo files to .o files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9059 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9060 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9061
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9062 # Eliminate all temporary directories.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9063 #for path in $notinst_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9064 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9065 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9066 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9067 #done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9068
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9069 if test -n "$xrpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9070 # If the user specified any rpath flags, then add them.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9071 temp_xrpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9072 for libdir in $xrpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9073 func_replace_sysroot "$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9074 func_append temp_xrpath " -R$func_replace_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9075 case "$finalize_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9076 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9077 *) func_append finalize_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9078 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9079 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9080 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9081 dependency_libs="$temp_xrpath $dependency_libs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9082 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9083 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9084
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9085 # Make sure dlfiles contains only unique files that won't be dlpreopened
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9086 old_dlfiles=$dlfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9087 dlfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9088 for lib in $old_dlfiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9089 case " $dlprefiles $dlfiles " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9090 *" $lib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9091 *) func_append dlfiles " $lib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9092 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9093 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9094
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9095 # Make sure dlprefiles contains only unique files
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9096 old_dlprefiles=$dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9097 dlprefiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9098 for lib in $old_dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9099 case "$dlprefiles " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9100 *" $lib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9101 *) func_append dlprefiles " $lib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9102 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9103 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9104
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9105 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9106 if test -n "$rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9107 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9108 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9109 # these systems don't actually have a c library (as such)!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9110 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9111 *-*-rhapsody* | *-*-darwin1.[012])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9112 # Rhapsody C library is in the System framework
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9113 func_append deplibs " System.ltframework"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9114 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9115 *-*-netbsd*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9116 # Don't link with libc until the a.out ld.so is fixed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9117 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9118 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9119 # Do not include libc due to us having libc/libc_r.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9120 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9121 *-*-sco3.2v5* | *-*-sco5v6*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9122 # Causes problems with __ctype
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9123 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9124 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9125 # Compiler inserts libc in the correct place for threads to work
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9126 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9127 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9128 # Add libc to deplibs on all other systems if necessary.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9129 if test yes = "$build_libtool_need_lc"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9130 func_append deplibs " -lc"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9131 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9132 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9133 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9134 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9135
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9136 # Transform deplibs into only deplibs that can be linked in shared.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9137 name_save=$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9138 libname_save=$libname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9139 release_save=$release
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9140 versuffix_save=$versuffix
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9141 major_save=$major
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9142 # I'm not sure if I'm treating the release correctly. I think
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9143 # release should show up in the -l (ie -lgmp5) so we don't want to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9144 # add it in twice. Is that correct?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9145 release=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9146 versuffix=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9147 major=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9148 newdeplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9149 droppeddeps=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9150 case $deplibs_check_method in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9151 pass_all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9152 # Don't check for shared/static. Everything works.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9153 # This might be a little naive. We might want to check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9154 # whether the library exists or not. But this is on
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9155 # osf3 & osf4 and I'm not really sure... Just
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9156 # implementing what was already the behavior.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9157 newdeplibs=$deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9158 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9159 test_compile)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9160 # This code stresses the "libraries are programs" paradigm to its
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9161 # limits. Maybe even breaks it. We compile a program, linking it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9162 # against the deplibs as a proxy for the library. Then we can check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9163 # whether they linked in statically or dynamically with ldd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9164 $opt_dry_run || $RM conftest.c
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9165 cat > conftest.c <<EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9166 int main() { return 0; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9167 EOF
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9168 $opt_dry_run || $RM conftest
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9169 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9170 ldd_output=`ldd conftest`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9171 for i in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9172 case $i in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9173 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9174 func_stripname -l '' "$i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9175 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9176 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9177 case " $predeps $postdeps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9178 *" $i "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9179 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9180 i=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9181 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9182 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9183 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9184 if test -n "$i"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9185 libname=`eval "\\$ECHO \"$libname_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9186 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9187 set dummy $deplib_matches; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9188 deplib_match=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9189 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9190 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9191 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9192 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9193 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9194 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9195 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9196 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9197 echo "*** shared version of the library, which I believe you do not have"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9198 echo "*** because a test_compile did reveal that the linker did not use it for"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9199 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9200 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9201 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9202 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9203 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9204 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9205 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9206 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9207 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9208 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9209 # Error occurred in the first compile. Let's try to salvage
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9210 # the situation: Compile a separate program for each library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9211 for i in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9212 case $i in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9213 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9214 func_stripname -l '' "$i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9215 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9216 $opt_dry_run || $RM conftest
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9217 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9218 ldd_output=`ldd conftest`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9219 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9220 case " $predeps $postdeps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9221 *" $i "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9222 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9223 i=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9224 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9225 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9226 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9227 if test -n "$i"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9228 libname=`eval "\\$ECHO \"$libname_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9229 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9230 set dummy $deplib_matches; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9231 deplib_match=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9232 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9233 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9234 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9235 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9236 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9237 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9238 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9239 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9240 echo "*** shared version of the library, which you do not appear to have"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9241 echo "*** because a test_compile did reveal that the linker did not use this one"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9242 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9243 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9244 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9245 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9246 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9247 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9248 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9249 echo "*** make it link in! You will probably need to install it or some"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9250 echo "*** library that it depends on before this library will be fully"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9251 echo "*** functional. Installing it before continuing would be even better."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9252 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9253 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9254 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9255 func_append newdeplibs " $i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9256 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9257 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9258 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9259 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9260 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9261 file_magic*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9262 set dummy $deplibs_check_method; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9263 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9264 for a_deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9265 case $a_deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9266 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9267 func_stripname -l '' "$a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9268 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9269 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9270 case " $predeps $postdeps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9271 *" $a_deplib "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9272 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9273 a_deplib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9274 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9275 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9276 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9277 if test -n "$a_deplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9278 libname=`eval "\\$ECHO \"$libname_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9279 if test -n "$file_magic_glob"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9280 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9281 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9282 libnameglob=$libname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9283 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9284 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9285 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9286 if test yes = "$want_nocaseglob"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9287 shopt -s nocaseglob
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9288 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9289 $nocaseglob
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9290 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9291 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9292 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9293 for potent_lib in $potential_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9294 # Follow soft links.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9295 if ls -lLd "$potent_lib" 2>/dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9296 $GREP " -> " >/dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9297 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9298 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9299 # The statement above tries to avoid entering an
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9300 # endless loop below, in case of cyclic links.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9301 # We might still enter an endless loop, since a link
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9302 # loop can be closed while we follow links,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9303 # but so what?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9304 potlib=$potent_lib
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9305 while test -h "$potlib" 2>/dev/null; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9306 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9307 case $potliblink in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9308 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9309 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9310 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9311 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9312 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9313 $SED -e 10q |
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9314 $EGREP "$file_magic_regex" > /dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9315 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9316 a_deplib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9317 break 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9318 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9319 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9320 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9321 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9322 if test -n "$a_deplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9323 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9324 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9325 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9326 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9327 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9328 echo "*** shared version of the library, which you do not appear to have"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9329 echo "*** because I did check the linker path looking for a file starting"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9330 if test -z "$potlib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9331 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9332 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9333 $ECHO "*** with $libname and none of the candidates passed a file format test"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9334 $ECHO "*** using a file magic. Last file checked: $potlib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9335 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9336 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9337 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9338 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9339 # Add a -L argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9340 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9341 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9342 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9343 done # Gone through all deplibs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9344 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9345 match_pattern*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9346 set dummy $deplibs_check_method; shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9347 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9348 for a_deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9349 case $a_deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9350 -l*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9351 func_stripname -l '' "$a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9352 name=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9353 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9354 case " $predeps $postdeps " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9355 *" $a_deplib "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9356 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9357 a_deplib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9358 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9359 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9360 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9361 if test -n "$a_deplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9362 libname=`eval "\\$ECHO \"$libname_spec\""`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9363 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9364 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9365 for potent_lib in $potential_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9366 potlib=$potent_lib # see symlink-check above in file_magic test
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9367 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9368 $EGREP "$match_pattern_regex" > /dev/null; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9369 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9370 a_deplib=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9371 break 2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9372 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9373 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9374 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9375 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9376 if test -n "$a_deplib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9377 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9378 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9379 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9380 echo "*** I have the capability to make that library automatically link in when"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9381 echo "*** you link to this library. But I can only do this if you have a"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9382 echo "*** shared version of the library, which you do not appear to have"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9383 echo "*** because I did check the linker path looking for a file starting"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9384 if test -z "$potlib"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9385 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9386 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9387 $ECHO "*** with $libname and none of the candidates passed a file format test"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9388 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9389 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9390 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9391 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9392 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9393 # Add a -L argument.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9394 func_append newdeplibs " $a_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9395 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9396 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9397 done # Gone through all deplibs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9398 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9399 none | unknown | *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9400 newdeplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9401 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9402 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9403 for i in $predeps $postdeps; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9404 # can't use Xsed below, because $i might contain '/'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9405 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9406 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9407 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9408 case $tmp_deplibs in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9409 *[!\ \ ]*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9410 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9411 if test none = "$deplibs_check_method"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9412 echo "*** Warning: inter-library dependencies are not supported in this platform."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9413 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9414 echo "*** Warning: inter-library dependencies are not known to be supported."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9415 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9416 echo "*** All declared inter-library dependencies are being dropped."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9417 droppeddeps=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9418 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9419 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9420 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9421 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9422 versuffix=$versuffix_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9423 major=$major_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9424 release=$release_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9425 libname=$libname_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9426 name=$name_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9427
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9428 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9429 *-*-rhapsody* | *-*-darwin1.[012])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9430 # On Rhapsody replace the C library with the System framework
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9431 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9432 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9433 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9434
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9435 if test yes = "$droppeddeps"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9436 if test yes = "$module"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9437 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9438 echo "*** Warning: libtool could not satisfy all declared inter-library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9439 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9440 echo "*** a static module, that should work as long as the dlopening"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9441 echo "*** application is linked with the -dlopen flag."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9442 if test -z "$global_symbol_pipe"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9443 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9444 echo "*** However, this would only work if libtool was able to extract symbol"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9445 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9446 echo "*** not find such a program. So, this module is probably useless."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9447 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9448 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9449 if test no = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9450 oldlibs=$output_objdir/$libname.$libext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9451 build_libtool_libs=module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9452 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9453 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9454 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9455 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9456 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9457 echo "*** The inter-library dependencies that have been dropped here will be"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9458 echo "*** automatically added whenever a program is linked with this library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9459 echo "*** or is declared to -dlopen it."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9460
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9461 if test no = "$allow_undefined"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9462 echo
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9463 echo "*** Since this library must not contain undefined symbols,"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9464 echo "*** because either the platform does not support them or"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9465 echo "*** it was explicitly requested with -no-undefined,"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9466 echo "*** libtool will only create a static version of it."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9467 if test no = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9468 oldlibs=$output_objdir/$libname.$libext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9469 build_libtool_libs=module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9470 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9471 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9472 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9473 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9474 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9475 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9476 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9477 # Done checking deplibs!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9478 deplibs=$newdeplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9479 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9480 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9481 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9482 *-*-darwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9483 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9484 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9485 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9486 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9487 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9488
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9489 # move library search paths that coincide with paths to not yet
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9490 # installed libraries to the beginning of the library search list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9491 new_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9492 for path in $notinst_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9493 case " $new_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9494 *" -L$path/$objdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9495 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9496 case " $deplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9497 *" -L$path/$objdir "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9498 func_append new_libs " -L$path/$objdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9499 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9500 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9501 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9502 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9503 for deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9504 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9505 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9506 case " $new_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9507 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9508 *) func_append new_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9509 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9510 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9511 *) func_append new_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9512 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9513 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9514 deplibs=$new_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9515
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9516 # All the library-specific variables (install_libdir is set above).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9517 library_names=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9518 old_library=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9519 dlname=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9520
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9521 # Test again, we may have decided not to build it any more
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9522 if test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9523 # Remove $wl instances when linking with ld.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9524 # FIXME: should test the right _cmds variable.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9525 case $archive_cmds in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9526 *\$LD\ *) wl= ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9527 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9528 if test yes = "$hardcode_into_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9529 # Hardcode the library paths
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9530 hardcode_libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9531 dep_rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9532 rpath=$finalize_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9533 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9534 for libdir in $rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9535 if test -n "$hardcode_libdir_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9536 if test -n "$hardcode_libdir_separator"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9537 func_replace_sysroot "$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9538 libdir=$func_replace_sysroot_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9539 if test -z "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9540 hardcode_libdirs=$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9541 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9542 # Just accumulate the unique libdirs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9543 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9544 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9545 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9546 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9547 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9548 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9549 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9550 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9551 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9552 eval flag=\"$hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9553 func_append dep_rpath " $flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9554 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9555 elif test -n "$runpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9556 case "$perm_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9557 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9558 *) func_append perm_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9559 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9560 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9561 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9562 # Substitute the hardcoded libdirs into the rpath.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9563 if test -n "$hardcode_libdir_separator" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9564 test -n "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9565 libdir=$hardcode_libdirs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9566 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9567 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9568 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9569 # We should set the runpath_var.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9570 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9571 for dir in $perm_rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9572 func_append rpath "$dir:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9573 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9574 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9575 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9576 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9577 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9578
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9579 shlibpath=$finalize_shlibpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9580 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9581 if test -n "$shlibpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9582 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9583 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9584
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9585 # Get the real and link names of the library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9586 eval shared_ext=\"$shrext_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9587 eval library_names=\"$library_names_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9588 set dummy $library_names
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9589 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9590 realname=$1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9591 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9592
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9593 if test -n "$soname_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9594 eval soname=\"$soname_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9595 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9596 soname=$realname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9597 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9598 if test -z "$dlname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9599 dlname=$soname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9600 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9601
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9602 lib=$output_objdir/$realname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9603 linknames=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9604 for link
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9605 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9606 func_append linknames " $link"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9607 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9608
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9609 # Use standard objects if they are pic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9610 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9611 test "X$libobjs" = "X " && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9612
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9613 delfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9614 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9615 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9616 export_symbols=$output_objdir/$libname.uexp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9617 func_append delfiles " $export_symbols"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9618 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9619
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9620 orig_export_symbols=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9621 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9622 cygwin* | mingw* | cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9623 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9624 # exporting using user supplied symfile
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9625 func_dll_def_p "$export_symbols" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9626 # and it's NOT already a .def file. Must figure out
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9627 # which of the given symbols are data symbols and tag
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9628 # them as such. So, trigger use of export_symbols_cmds.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9629 # export_symbols gets reassigned inside the "prepare
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9630 # the list of exported symbols" if statement, so the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9631 # include_expsyms logic still works.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9632 orig_export_symbols=$export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9633 export_symbols=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9634 always_export_symbols=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9635 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9636 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9637 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9638 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9639
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9640 # Prepare the list of exported symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9641 if test -z "$export_symbols"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9642 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9643 func_verbose "generating symbol list for '$libname.la'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9644 export_symbols=$output_objdir/$libname.exp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9645 $opt_dry_run || $RM $export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9646 cmds=$export_symbols_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9647 save_ifs=$IFS; IFS='~'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9648 for cmd1 in $cmds; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9649 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9650 # Take the normal branch if the nm_file_list_spec branch
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9651 # doesn't work or if tool conversion is not needed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9652 case $nm_file_list_spec~$to_tool_file_cmd in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9653 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9654 try_normal_branch=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9655 eval cmd=\"$cmd1\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9656 func_len " $cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9657 len=$func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9658 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9659 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9660 try_normal_branch=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9661 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9662 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9663 if test yes = "$try_normal_branch" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9664 && { test "$len" -lt "$max_cmd_len" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9665 || test "$max_cmd_len" -le -1; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9666 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9667 func_show_eval "$cmd" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9668 skipped_export=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9669 elif test -n "$nm_file_list_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9670 func_basename "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9671 output_la=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9672 save_libobjs=$libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9673 save_output=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9674 output=$output_objdir/$output_la.nm
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9675 func_to_tool_file "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9676 libobjs=$nm_file_list_spec$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9677 func_append delfiles " $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9678 func_verbose "creating $NM input file list: $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9679 for obj in $save_libobjs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9680 func_to_tool_file "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9681 $ECHO "$func_to_tool_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9682 done > "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9683 eval cmd=\"$cmd1\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9684 func_show_eval "$cmd" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9685 output=$save_output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9686 libobjs=$save_libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9687 skipped_export=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9688 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9689 # The command line is too long to execute in one step.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9690 func_verbose "using reloadable object file for export list..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9691 skipped_export=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9692 # Break out early, otherwise skipped_export may be
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9693 # set to false by a later but shorter cmd.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9694 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9695 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9696 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9697 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9698 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9699 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9700 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9701 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9702 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9703 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9704
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9705 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9706 tmp_export_symbols=$export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9707 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9708 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9709 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9710
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9711 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9712 # The given exports_symbols file has to be filtered, so filter it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9713 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9714 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9715 # 's' commands, which not all seds can handle. GNU sed should be fine
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9716 # though. Also, the filter scales superlinearly with the number of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9717 # global variables. join(1) would be nice here, but unfortunately
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9718 # isn't a blessed tool.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9719 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9720 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9721 export_symbols=$output_objdir/$libname.def
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9722 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9723 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9724
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9725 tmp_deplibs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9726 for test_deplib in $deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9727 case " $convenience " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9728 *" $test_deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9729 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9730 func_append tmp_deplibs " $test_deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9731 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9732 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9733 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9734 deplibs=$tmp_deplibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9735
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9736 if test -n "$convenience"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9737 if test -n "$whole_archive_flag_spec" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9738 test yes = "$compiler_needs_object" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9739 test -z "$libobjs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9740 # extract the archives, so we have objects to list.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9741 # TODO: could optimize this to just extract one archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9742 whole_archive_flag_spec=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9743 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9744 if test -n "$whole_archive_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9745 save_libobjs=$libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9746 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9747 test "X$libobjs" = "X " && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9748 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9749 gentop=$output_objdir/${outputname}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9750 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9751
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9752 func_extract_archives $gentop $convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9753 func_append libobjs " $func_extract_archives_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9754 test "X$libobjs" = "X " && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9755 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9756 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9757
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9758 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9759 eval flag=\"$thread_safe_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9760 func_append linker_flags " $flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9761 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9762
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9763 # Make a backup of the uninstalled library when relinking
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9764 if test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9765 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9766 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9767
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9768 # Do each of the archive commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9769 if test yes = "$module" && test -n "$module_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9770 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9771 eval test_cmds=\"$module_expsym_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9772 cmds=$module_expsym_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9773 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9774 eval test_cmds=\"$module_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9775 cmds=$module_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9776 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9777 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9778 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9779 eval test_cmds=\"$archive_expsym_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9780 cmds=$archive_expsym_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9781 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9782 eval test_cmds=\"$archive_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9783 cmds=$archive_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9784 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9785 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9786
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9787 if test : != "$skipped_export" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9788 func_len " $test_cmds" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9789 len=$func_len_result &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9790 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9791 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9792 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9793 # The command line is too long to link in one step, link piecewise
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9794 # or, if using GNU ld and skipped_export is not :, use a linker
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9795 # script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9796
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9797 # Save the value of $output and $libobjs because we want to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9798 # use them later. If we have whole_archive_flag_spec, we
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9799 # want to use save_libobjs as it was before
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9800 # whole_archive_flag_spec was expanded, because we can't
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9801 # assume the linker understands whole_archive_flag_spec.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9802 # This may have to be revisited, in case too many
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9803 # convenience libraries get linked in and end up exceeding
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9804 # the spec.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9805 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9806 save_libobjs=$libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9807 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9808 save_output=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9809 func_basename "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9810 output_la=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9811
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9812 # Clear the reloadable object creation command queue and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9813 # initialize k to one.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9814 test_cmds=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9815 concat_cmds=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9816 objlist=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9817 last_robj=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9818 k=1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9819
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9820 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9821 output=$output_objdir/$output_la.lnkscript
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9822 func_verbose "creating GNU ld script: $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9823 echo 'INPUT (' > $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9824 for obj in $save_libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9825 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9826 func_to_tool_file "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9827 $ECHO "$func_to_tool_file_result" >> $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9828 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9829 echo ')' >> $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9830 func_append delfiles " $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9831 func_to_tool_file "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9832 output=$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9833 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9834 output=$output_objdir/$output_la.lnk
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9835 func_verbose "creating linker input file list: $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9836 : > $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9837 set x $save_libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9838 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9839 firstobj=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9840 if test yes = "$compiler_needs_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9841 firstobj="$1 "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9842 shift
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9843 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9844 for obj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9845 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9846 func_to_tool_file "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9847 $ECHO "$func_to_tool_file_result" >> $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9848 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9849 func_append delfiles " $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9850 func_to_tool_file "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9851 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9852 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9853 if test -n "$save_libobjs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9854 func_verbose "creating reloadable object files..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9855 output=$output_objdir/$output_la-$k.$objext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9856 eval test_cmds=\"$reload_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9857 func_len " $test_cmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9858 len0=$func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9859 len=$len0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9860
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9861 # Loop over the list of objects to be linked.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9862 for obj in $save_libobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9863 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9864 func_len " $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9865 func_arith $len + $func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9866 len=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9867 if test -z "$objlist" ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9868 test "$len" -lt "$max_cmd_len"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9869 func_append objlist " $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9870 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9871 # The command $test_cmds is almost too long, add a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9872 # command to the queue.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9873 if test 1 -eq "$k"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9874 # The first file doesn't have a previous command to add.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9875 reload_objs=$objlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9876 eval concat_cmds=\"$reload_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9877 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9878 # All subsequent reloadable object files will link in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9879 # the last one created.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9880 reload_objs="$objlist $last_robj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9881 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9882 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9883 last_robj=$output_objdir/$output_la-$k.$objext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9884 func_arith $k + 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9885 k=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9886 output=$output_objdir/$output_la-$k.$objext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9887 objlist=" $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9888 func_len " $last_robj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9889 func_arith $len0 + $func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9890 len=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9891 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9892 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9893 # Handle the remaining objects by creating one last
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9894 # reloadable object file. All subsequent reloadable object
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9895 # files will link in the last one created.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9896 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9897 reload_objs="$objlist $last_robj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9898 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9899 if test -n "$last_robj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9900 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9901 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9902 func_append delfiles " $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9903
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9904 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9905 output=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9906 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9907
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9908 ${skipped_export-false} && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9909 func_verbose "generating symbol list for '$libname.la'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9910 export_symbols=$output_objdir/$libname.exp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9911 $opt_dry_run || $RM $export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9912 libobjs=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9913 # Append the command to create the export file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9914 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9915 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9916 if test -n "$last_robj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9917 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9918 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9919 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9920
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9921 test -n "$save_libobjs" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9922 func_verbose "creating a temporary reloadable object file: $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9923
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9924 # Loop through the commands generated above and execute them.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9925 save_ifs=$IFS; IFS='~'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9926 for cmd in $concat_cmds; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9927 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9928 $opt_quiet || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9929 func_quote_for_expand "$cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9930 eval "func_echo $func_quote_for_expand_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9931 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9932 $opt_dry_run || eval "$cmd" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9933 lt_exit=$?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9934
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9935 # Restore the uninstalled library and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9936 if test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9937 ( cd "$output_objdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9938 $RM "${realname}T" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9939 $MV "${realname}U" "$realname" )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9940 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9941
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9942 exit $lt_exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9943 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9944 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9945 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9946
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9947 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9948 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9949 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9950 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9951 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9952
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9953 ${skipped_export-false} && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9954 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9955 tmp_export_symbols=$export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9956 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9957 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9958 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9959
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9960 if test -n "$orig_export_symbols"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9961 # The given exports_symbols file has to be filtered, so filter it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9962 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9963 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9964 # 's' commands, which not all seds can handle. GNU sed should be fine
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9965 # though. Also, the filter scales superlinearly with the number of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9966 # global variables. join(1) would be nice here, but unfortunately
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9967 # isn't a blessed tool.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9968 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9969 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9970 export_symbols=$output_objdir/$libname.def
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9971 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9972 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9973 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9974
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9975 libobjs=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9976 # Restore the value of output.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9977 output=$save_output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9978
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9979 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9980 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9981 test "X$libobjs" = "X " && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9982 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9983 # Expand the library linking commands again to reset the
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9984 # value of $libobjs for piecewise linking.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9985
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9986 # Do each of the archive commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9987 if test yes = "$module" && test -n "$module_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9988 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9989 cmds=$module_expsym_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9990 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9991 cmds=$module_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9992 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9993 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9994 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9995 cmds=$archive_expsym_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9996 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9997 cmds=$archive_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9998 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9999 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10000 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10001
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10002 if test -n "$delfiles"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10003 # Append the command to remove temporary files to $cmds.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10004 eval cmds=\"\$cmds~\$RM $delfiles\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10005 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10006
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10007 # Add any objects from preloaded convenience libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10008 if test -n "$dlprefiles"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10009 gentop=$output_objdir/${outputname}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10010 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10011
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10012 func_extract_archives $gentop $dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10013 func_append libobjs " $func_extract_archives_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10014 test "X$libobjs" = "X " && libobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10015 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10016
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10017 save_ifs=$IFS; IFS='~'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10018 for cmd in $cmds; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10019 IFS=$sp$nl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10020 eval cmd=\"$cmd\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10021 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10022 $opt_quiet || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10023 func_quote_for_expand "$cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10024 eval "func_echo $func_quote_for_expand_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10025 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10026 $opt_dry_run || eval "$cmd" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10027 lt_exit=$?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10028
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10029 # Restore the uninstalled library and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10030 if test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10031 ( cd "$output_objdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10032 $RM "${realname}T" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10033 $MV "${realname}U" "$realname" )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10034 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10035
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10036 exit $lt_exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10037 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10038 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10039 IFS=$save_ifs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10040
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10041 # Restore the uninstalled library and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10042 if test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10043 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10044
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10045 if test -n "$convenience"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10046 if test -z "$whole_archive_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10047 func_show_eval '${RM}r "$gentop"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10048 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10049 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10050
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10051 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10052 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10053
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10054 # Create links to the real library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10055 for linkname in $linknames; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10056 if test "$realname" != "$linkname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10057 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10058 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10059 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10060
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10061 # If -module or -export-dynamic was specified, set the dlname.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10062 if test yes = "$module" || test yes = "$export_dynamic"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10063 # On all known operating systems, these are identical.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10064 dlname=$soname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10065 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10066 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10067 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10068
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10069 obj)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10070 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10071 func_warning "'-dlopen' is ignored for objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10072 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10073
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10074 case " $deplibs" in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10075 *\ -l* | *\ -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10076 func_warning "'-l' and '-L' are ignored for objects" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10077 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10078
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10079 test -n "$rpath" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10080 func_warning "'-rpath' is ignored for objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10081
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10082 test -n "$xrpath" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10083 func_warning "'-R' is ignored for objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10084
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10085 test -n "$vinfo" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10086 func_warning "'-version-info' is ignored for objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10087
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10088 test -n "$release" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10089 func_warning "'-release' is ignored for objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10090
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10091 case $output in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10092 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10093 test -n "$objs$old_deplibs" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10094 func_fatal_error "cannot build library object '$output' from non-libtool objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10095
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10096 libobj=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10097 func_lo2o "$libobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10098 obj=$func_lo2o_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10099 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10100 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10101 libobj=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10102 obj=$output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10103 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10104 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10105
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10106 # Delete the old objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10107 $opt_dry_run || $RM $obj $libobj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10109 # Objects from convenience libraries. This assumes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10110 # single-version convenience libraries. Whenever we create
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10111 # different ones for PIC/non-PIC, this we'll have to duplicate
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10112 # the extraction.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10113 reload_conv_objs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10114 gentop=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10115 # if reload_cmds runs $LD directly, get rid of -Wl from
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10116 # whole_archive_flag_spec and hope we can get by with turning comma
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10117 # into space.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10118 case $reload_cmds in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10119 *\$LD[\ \$]*) wl= ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10120 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10121 if test -n "$convenience"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10122 if test -n "$whole_archive_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10123 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10124 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10125 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10126 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10127 gentop=$output_objdir/${obj}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10128 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10129
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10130 func_extract_archives $gentop $convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10131 reload_conv_objs="$reload_objs $func_extract_archives_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10132 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10133 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10134
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10135 # If we're not building shared, we need to use non_pic_objs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10136 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10137
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10138 # Create the old-style object.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10139 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10140
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10141 output=$obj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10142 func_execute_cmds "$reload_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10143
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10144 # Exit if we aren't doing a library object file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10145 if test -z "$libobj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10146 if test -n "$gentop"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10147 func_show_eval '${RM}r "$gentop"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10148 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10149
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10150 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10151 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10152
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10153 test yes = "$build_libtool_libs" || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10154 if test -n "$gentop"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10155 func_show_eval '${RM}r "$gentop"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10156 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10157
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10158 # Create an invalid libtool object if no PIC, so that we don't
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10159 # accidentally link it into a program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10160 # $show "echo timestamp > $libobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10161 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10162 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10163 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10164
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10165 if test -n "$pic_flag" || test default != "$pic_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10166 # Only do commands if we really have different PIC objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10167 reload_objs="$libobjs $reload_conv_objs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10168 output=$libobj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10169 func_execute_cmds "$reload_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10170 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10171
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10172 if test -n "$gentop"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10173 func_show_eval '${RM}r "$gentop"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10174 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10175
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10176 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10177 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10178
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10179 prog)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10180 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10181 *cygwin*) func_stripname '' '.exe' "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10182 output=$func_stripname_result.exe;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10183 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10184 test -n "$vinfo" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10185 func_warning "'-version-info' is ignored for programs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10186
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10187 test -n "$release" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10188 func_warning "'-release' is ignored for programs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10189
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10190 $preload \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10191 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10192 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10193
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10194 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10195 *-*-rhapsody* | *-*-darwin1.[012])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10196 # On Rhapsody replace the C library is the System framework
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10197 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10198 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10199 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10200 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10201
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10202 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10203 *-*-darwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10204 # Don't allow lazy linking, it breaks C++ global constructors
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10205 # But is supposedly fixed on 10.4 or later (yay!).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10206 if test CXX = "$tagname"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10207 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10208 10.[0123])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10209 func_append compile_command " $wl-bind_at_load"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10210 func_append finalize_command " $wl-bind_at_load"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10211 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10212 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10213 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10214 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10215 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10216 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10217 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10218 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10219
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10220
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10221 # move library search paths that coincide with paths to not yet
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10222 # installed libraries to the beginning of the library search list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10223 new_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10224 for path in $notinst_path; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10225 case " $new_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10226 *" -L$path/$objdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10227 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10228 case " $compile_deplibs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10229 *" -L$path/$objdir "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10230 func_append new_libs " -L$path/$objdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10231 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10232 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10233 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10234 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10235 for deplib in $compile_deplibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10236 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10237 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10238 case " $new_libs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10239 *" $deplib "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10240 *) func_append new_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10241 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10242 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10243 *) func_append new_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10244 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10245 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10246 compile_deplibs=$new_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10247
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10248
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10249 func_append compile_command " $compile_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10250 func_append finalize_command " $finalize_deplibs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10251
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10252 if test -n "$rpath$xrpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10253 # If the user specified any rpath flags, then add them.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10254 for libdir in $rpath $xrpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10255 # This is the magic to use -rpath.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10256 case "$finalize_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10257 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10258 *) func_append finalize_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10259 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10260 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10261 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10262
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10263 # Now hardcode the library paths
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10264 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10265 hardcode_libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10266 for libdir in $compile_rpath $finalize_rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10267 if test -n "$hardcode_libdir_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10268 if test -n "$hardcode_libdir_separator"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10269 if test -z "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10270 hardcode_libdirs=$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10271 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10272 # Just accumulate the unique libdirs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10273 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10274 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10275 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10276 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10277 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10278 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10279 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10280 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10281 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10282 eval flag=\"$hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10283 func_append rpath " $flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10284 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10285 elif test -n "$runpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10286 case "$perm_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10287 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10288 *) func_append perm_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10289 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10290 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10291 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10292 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10293 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10294 case :$dllsearchpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10295 *":$libdir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10296 ::) dllsearchpath=$libdir;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10297 *) func_append dllsearchpath ":$libdir";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10298 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10299 case :$dllsearchpath: in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10300 *":$testbindir:"*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10301 ::) dllsearchpath=$testbindir;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10302 *) func_append dllsearchpath ":$testbindir";;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10303 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10304 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10305 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10306 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10307 # Substitute the hardcoded libdirs into the rpath.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10308 if test -n "$hardcode_libdir_separator" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10309 test -n "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10310 libdir=$hardcode_libdirs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10311 eval rpath=\" $hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10312 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10313 compile_rpath=$rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10314
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10315 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10316 hardcode_libdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10317 for libdir in $finalize_rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10318 if test -n "$hardcode_libdir_flag_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10319 if test -n "$hardcode_libdir_separator"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10320 if test -z "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10321 hardcode_libdirs=$libdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10322 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10323 # Just accumulate the unique libdirs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10324 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10325 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10326 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10327 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10328 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10329 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10330 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10331 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10332 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10333 eval flag=\"$hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10334 func_append rpath " $flag"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10335 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10336 elif test -n "$runpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10337 case "$finalize_perm_rpath " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10338 *" $libdir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10339 *) func_append finalize_perm_rpath " $libdir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10340 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10341 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10342 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10343 # Substitute the hardcoded libdirs into the rpath.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10344 if test -n "$hardcode_libdir_separator" &&
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10345 test -n "$hardcode_libdirs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10346 libdir=$hardcode_libdirs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10347 eval rpath=\" $hardcode_libdir_flag_spec\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10348 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10349 finalize_rpath=$rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10350
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10351 if test -n "$libobjs" && test yes = "$build_old_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10352 # Transform all the library objects into standard objects.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10353 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10354 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10355 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10356
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10357 func_generate_dlsyms "$outputname" "@PROGRAM@" false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10358
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10359 # template prelinking step
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10360 if test -n "$prelink_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10361 func_execute_cmds "$prelink_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10362 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10363
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10364 wrappers_required=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10365 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10366 *cegcc* | *mingw32ce*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10367 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10368 wrappers_required=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10369 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10370 *cygwin* | *mingw* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10371 test yes = "$build_libtool_libs" || wrappers_required=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10372 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10373 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10374 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10375 wrappers_required=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10376 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10377 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10378 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10379 $wrappers_required || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10380 # Replace the output file specification.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10381 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10382 link_command=$compile_command$compile_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10383
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10384 # We have no uninstalled library dependencies, so finalize right now.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10385 exit_status=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10386 func_show_eval "$link_command" 'exit_status=$?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10387
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10388 if test -n "$postlink_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10389 func_to_tool_file "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10390 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10391 func_execute_cmds "$postlink_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10392 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10393
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10394 # Delete the generated files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10395 if test -f "$output_objdir/${outputname}S.$objext"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10396 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10397 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10398
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10399 exit $exit_status
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10400 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10401
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10402 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10403 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10404 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10405 if test -n "$finalize_shlibpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10406 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10407 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10408
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10409 compile_var=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10410 finalize_var=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10411 if test -n "$runpath_var"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10412 if test -n "$perm_rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10413 # We should set the runpath_var.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10414 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10415 for dir in $perm_rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10416 func_append rpath "$dir:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10417 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10418 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10419 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10420 if test -n "$finalize_perm_rpath"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10421 # We should set the runpath_var.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10422 rpath=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10423 for dir in $finalize_perm_rpath; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10424 func_append rpath "$dir:"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10425 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10426 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10427 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10428 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10429
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10430 if test yes = "$no_install"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10431 # We don't need to create a wrapper script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10432 link_command=$compile_var$compile_command$compile_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10433 # Replace the output file specification.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10434 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10435 # Delete the old output file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10436 $opt_dry_run || $RM $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10437 # Link the executable and exit
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10438 func_show_eval "$link_command" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10439
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10440 if test -n "$postlink_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10441 func_to_tool_file "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10442 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10443 func_execute_cmds "$postlink_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10444 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10445
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10446 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10447 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10448
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10449 case $hardcode_action,$fast_install in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10450 relink,*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10451 # Fast installation is not supported
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10452 link_command=$compile_var$compile_command$compile_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10453 relink_command=$finalize_var$finalize_command$finalize_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10454
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10455 func_warning "this platform does not like uninstalled shared libraries"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10456 func_warning "'$output' will be relinked during installation"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10457 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10458 *,yes)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10459 link_command=$finalize_var$compile_command$finalize_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10460 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10461 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10462 *,no)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10463 link_command=$compile_var$compile_command$compile_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10464 relink_command=$finalize_var$finalize_command$finalize_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10465 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10466 *,needless)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10467 link_command=$finalize_var$compile_command$finalize_rpath
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10468 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10469 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10470 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10471
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10472 # Replace the output file specification.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10473 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10474
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10475 # Delete the old output files.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10476 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10477
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10478 func_show_eval "$link_command" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10479
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10480 if test -n "$postlink_cmds"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10481 func_to_tool_file "$output_objdir/$outputname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10482 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'`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10483 func_execute_cmds "$postlink_cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10484 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10485
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10486 # Now create the wrapper script.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10487 func_verbose "creating $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10488
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10489 # Quote the relink command for shipping.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10490 if test -n "$relink_command"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10491 # Preserve any variables that may affect compiler behavior
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10492 for var in $variables_saved_for_relink; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10493 if eval test -z \"\${$var+set}\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10494 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10495 elif eval var_value=\$$var; test -z "$var_value"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10496 relink_command="$var=; export $var; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10497 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10498 func_quote_for_eval "$var_value"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10499 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10500 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10501 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10502 relink_command="(cd `pwd`; $relink_command)"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10503 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10504 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10505
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10506 # Only actually do things if not in dry run mode.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10507 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10508 # win32 will think the script is a binary if it has
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10509 # a .exe suffix, so we strip it off here.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10510 case $output in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10511 *.exe) func_stripname '' '.exe' "$output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10512 output=$func_stripname_result ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10513 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10514 # test for cygwin because mv fails w/o .exe extensions
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10515 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10516 *cygwin*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10517 exeext=.exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10518 func_stripname '' '.exe' "$outputname"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10519 outputname=$func_stripname_result ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10520 *) exeext= ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10521 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10522 case $host in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10523 *cygwin* | *mingw* )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10524 func_dirname_and_basename "$output" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10525 output_name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10526 output_path=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10527 cwrappersource=$output_path/$objdir/lt-$output_name.c
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10528 cwrapper=$output_path/$output_name.exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10529 $RM $cwrappersource $cwrapper
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10530 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10531
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10532 func_emit_cwrapperexe_src > $cwrappersource
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10533
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10534 # The wrapper executable is built using the $host compiler,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10535 # because it contains $host paths and files. If cross-
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10536 # compiling, it, like the target executable, must be
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10537 # executed on the $host or under an emulation environment.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10538 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10539 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10540 $STRIP $cwrapper
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10541 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10542
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10543 # Now, create the wrapper script for func_source use:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10544 func_ltwrapper_scriptname $cwrapper
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10545 $RM $func_ltwrapper_scriptname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10546 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10547 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10548 # note: this script will not be executed, so do not chmod.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10549 if test "x$build" = "x$host"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10550 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10551 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10552 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10553 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10554 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10555 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10556 * )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10557 $RM $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10558 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10559
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10560 func_emit_wrapper no > $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10561 chmod +x $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10562 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10563 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10564 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10565 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10566 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10567 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10568
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10569 # See if we need to build an old-fashioned archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10570 for oldlib in $oldlibs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10571
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10572 case $build_libtool_libs in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10573 convenience)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10574 oldobjs="$libobjs_save $symfileobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10575 addlibs=$convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10576 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10577 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10578 module)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10579 oldobjs=$libobjs_save
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10580 addlibs=$old_convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10581 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10582 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10583 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10584 oldobjs="$old_deplibs $non_pic_objects"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10585 $preload && test -f "$symfileobj" \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10586 && func_append oldobjs " $symfileobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10587 addlibs=$old_convenience
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10588 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10589 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10590
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10591 if test -n "$addlibs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10592 gentop=$output_objdir/${outputname}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10593 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10594
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10595 func_extract_archives $gentop $addlibs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10596 func_append oldobjs " $func_extract_archives_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10597 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10598
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10599 # Do each command in the archive commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10600 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10601 cmds=$old_archive_from_new_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10602 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10603
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10604 # Add any objects from preloaded convenience libraries
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10605 if test -n "$dlprefiles"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10606 gentop=$output_objdir/${outputname}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10607 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10608
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10609 func_extract_archives $gentop $dlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10610 func_append oldobjs " $func_extract_archives_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10611 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10612
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10613 # POSIX demands no paths to be encoded in archives. We have
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10614 # to avoid creating archives with duplicate basenames if we
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10615 # might have to extract them afterwards, e.g., when creating a
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10616 # static archive out of a convenience library, or when linking
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10617 # the entirety of a libtool archive into another (currently
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10618 # not supported by libtool).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10619 if (for obj in $oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10620 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10621 func_basename "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10622 $ECHO "$func_basename_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10623 done | sort | sort -uc >/dev/null 2>&1); then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10624 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10625 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10626 echo "copying selected object files to avoid basename conflicts..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10627 gentop=$output_objdir/${outputname}x
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10628 func_append generated " $gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10629 func_mkdir_p "$gentop"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10630 save_oldobjs=$oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10631 oldobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10632 counter=1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10633 for obj in $save_oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10634 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10635 func_basename "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10636 objbase=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10637 case " $oldobjs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10638 " ") oldobjs=$obj ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10639 *[\ /]"$objbase "*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10640 while :; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10641 # Make sure we don't pick an alternate name that also
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10642 # overlaps.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10643 newobj=lt$counter-$objbase
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10644 func_arith $counter + 1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10645 counter=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10646 case " $oldobjs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10647 *[\ /]"$newobj "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10648 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10649 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10650 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10651 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10652 func_append oldobjs " $gentop/$newobj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10653 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10654 *) func_append oldobjs " $obj" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10655 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10656 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10657 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10658 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10659 tool_oldlib=$func_to_tool_file_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10660 eval cmds=\"$old_archive_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10661
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10662 func_len " $cmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10663 len=$func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10664 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10665 cmds=$old_archive_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10666 elif test -n "$archiver_list_spec"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10667 func_verbose "using command file archive linking..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10668 for obj in $oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10669 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10670 func_to_tool_file "$obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10671 $ECHO "$func_to_tool_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10672 done > $output_objdir/$libname.libcmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10673 func_to_tool_file "$output_objdir/$libname.libcmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10674 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10675 cmds=$old_archive_cmds
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10676 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10677 # the command line is too long to link in one step, link in parts
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10678 func_verbose "using piecewise archive linking..."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10679 save_RANLIB=$RANLIB
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10680 RANLIB=:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10681 objlist=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10682 concat_cmds=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10683 save_oldobjs=$oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10684 oldobjs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10685 # Is there a better way of finding the last object in the list?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10686 for obj in $save_oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10687 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10688 last_oldobj=$obj
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10689 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10690 eval test_cmds=\"$old_archive_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10691 func_len " $test_cmds"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10692 len0=$func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10693 len=$len0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10694 for obj in $save_oldobjs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10695 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10696 func_len " $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10697 func_arith $len + $func_len_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10698 len=$func_arith_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10699 func_append objlist " $obj"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10700 if test "$len" -lt "$max_cmd_len"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10701 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10702 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10703 # the above command should be used before it gets too long
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10704 oldobjs=$objlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10705 if test "$obj" = "$last_oldobj"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10706 RANLIB=$save_RANLIB
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10707 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10708 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10709 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10710 objlist=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10711 len=$len0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10712 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10713 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10714 RANLIB=$save_RANLIB
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10715 oldobjs=$objlist
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10716 if test -z "$oldobjs"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10717 eval cmds=\"\$concat_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10718 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10719 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10720 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10721 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10722 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10723 func_execute_cmds "$cmds" 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10724 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10725
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10726 test -n "$generated" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10727 func_show_eval "${RM}r$generated"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10728
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10729 # Now create the libtool archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10730 case $output in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10731 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10732 old_library=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10733 test yes = "$build_old_libs" && old_library=$libname.$libext
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10734 func_verbose "creating $output"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10735
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10736 # Preserve any variables that may affect compiler behavior
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10737 for var in $variables_saved_for_relink; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10738 if eval test -z \"\${$var+set}\"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10739 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10740 elif eval var_value=\$$var; test -z "$var_value"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10741 relink_command="$var=; export $var; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10742 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10743 func_quote_for_eval "$var_value"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10744 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10745 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10746 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10747 # Quote the link command for shipping.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10748 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10749 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10750 if test yes = "$hardcode_automatic"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10751 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10752 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10753
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10754 # Only create the output if not a dry run.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10755 $opt_dry_run || {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10756 for installed in no yes; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10757 if test yes = "$installed"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10758 if test -z "$install_libdir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10759 break
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10760 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10761 output=$output_objdir/${outputname}i
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10762 # Replace all uninstalled libtool libraries with the installed ones
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10763 newdependency_libs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10764 for deplib in $dependency_libs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10765 case $deplib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10766 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10767 func_basename "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10768 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10769 func_resolve_sysroot "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10770 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10771 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10772 func_fatal_error "'$deplib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10773 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10774 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10775 -L*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10776 func_stripname -L '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10777 func_replace_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10778 func_append newdependency_libs " -L$func_replace_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10779 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10780 -R*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10781 func_stripname -R '' "$deplib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10782 func_replace_sysroot "$func_stripname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10783 func_append newdependency_libs " -R$func_replace_sysroot_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10784 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10785 *) func_append newdependency_libs " $deplib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10786 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10787 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10788 dependency_libs=$newdependency_libs
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10789 newdlfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10790
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10791 for lib in $dlfiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10792 case $lib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10793 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10794 func_basename "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10795 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10796 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10797 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10798 func_fatal_error "'$lib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10799 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10800 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10801 *) func_append newdlfiles " $lib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10802 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10803 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10804 dlfiles=$newdlfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10805 newdlprefiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10806 for lib in $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10807 case $lib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10808 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10809 # Only pass preopened files to the pseudo-archive (for
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10810 # eventual linking with the app. that links it) if we
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10811 # didn't already link the preopened objects directly into
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10812 # the library:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10813 func_basename "$lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10814 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10815 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10816 test -z "$libdir" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10817 func_fatal_error "'$lib' is not a valid libtool archive"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10818 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10819 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10820 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10821 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10822 dlprefiles=$newdlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10823 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10824 newdlfiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10825 for lib in $dlfiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10826 case $lib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10827 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10828 *) abs=`pwd`"/$lib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10829 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10830 func_append newdlfiles " $abs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10831 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10832 dlfiles=$newdlfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10833 newdlprefiles=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10834 for lib in $dlprefiles; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10835 case $lib in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10836 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10837 *) abs=`pwd`"/$lib" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10838 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10839 func_append newdlprefiles " $abs"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10840 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10841 dlprefiles=$newdlprefiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10842 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10843 $RM $output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10844 # place dlname in correct position for cygwin
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10845 # In fact, it would be nice if we could use this code for all target
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10846 # systems that can't hard-code library paths into their executables
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10847 # and that have no shared library path variable independent of PATH,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10848 # but it turns out we can't easily determine that from inspecting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10849 # libtool variables, so we have to hard-code the OSs to which it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10850 # applies here; at the moment, that means platforms that use the PE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10851 # object format with DLL files. See the long comment at the top of
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10852 # tests/bindir.at for full details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10853 tdlname=$dlname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10854 case $host,$output,$installed,$module,$dlname in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10855 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10856 # If a -bindir argument was supplied, place the dll there.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10857 if test -n "$bindir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10858 func_relative_path "$install_libdir" "$bindir"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10859 tdlname=$func_relative_path_result/$dlname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10860 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10861 # Otherwise fall back on heuristic.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10862 tdlname=../bin/$dlname
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10863 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10864 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10865 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10866 $ECHO > $output "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10867 # $outputname - a libtool library file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10868 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10869 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10870 # Please DO NOT delete this file!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10871 # It is necessary for linking the library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10872
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10873 # The name that we can dlopen(3).
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10874 dlname='$tdlname'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10875
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10876 # Names of this library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10877 library_names='$library_names'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10878
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10879 # The name of the static archive.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10880 old_library='$old_library'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10881
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10882 # Linker flags that cannot go in dependency_libs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10883 inherited_linker_flags='$new_inherited_linker_flags'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10884
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10885 # Libraries that this one depends upon.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10886 dependency_libs='$dependency_libs'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10887
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10888 # Names of additional weak libraries provided by this library
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10889 weak_library_names='$weak_libs'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10890
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10891 # Version information for $libname.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10892 current=$current
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10893 age=$age
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10894 revision=$revision
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10895
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10896 # Is this an already installed library?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10897 installed=$installed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10898
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10899 # Should we warn about portability when linking against -modules?
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10900 shouldnotlink=$module
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10901
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10902 # Files to dlopen/dlpreopen
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10903 dlopen='$dlfiles'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10904 dlpreopen='$dlprefiles'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10905
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10906 # Directory that this library needs to be installed in:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10907 libdir='$install_libdir'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10908 if test no,yes = "$installed,$need_relink"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10909 $ECHO >> $output "\
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10910 relink_command=\"$relink_command\""
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10911 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10912 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10913 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10914
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10915 # Do a symbolic link so that the libtool archive can be found in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10916 # LD_LIBRARY_PATH before the program is installed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10917 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10918 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10919 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10920 exit $EXIT_SUCCESS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10921 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10922
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10923 if test link = "$opt_mode" || test relink = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10924 func_mode_link ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10925 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10926
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10927
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10928 # func_mode_uninstall arg...
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10929 func_mode_uninstall ()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10930 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10931 $debug_cmd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10932
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10933 RM=$nonopt
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10934 files=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10935 rmforce=false
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10936 exit_status=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10937
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10938 # This variable tells wrapper scripts just to set variables rather
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10939 # than running their programs.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10940 libtool_install_magic=$magic
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10941
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10942 for arg
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10943 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10944 case $arg in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10945 -f) func_append RM " $arg"; rmforce=: ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10946 -*) func_append RM " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10947 *) func_append files " $arg" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10948 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10949 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10950
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10951 test -z "$RM" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10952 func_fatal_help "you must specify an RM program"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10953
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10954 rmdirs=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10955
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10956 for file in $files; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10957 func_dirname "$file" "" "."
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10958 dir=$func_dirname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10959 if test . = "$dir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10960 odir=$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10961 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10962 odir=$dir/$objdir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10963 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10964 func_basename "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10965 name=$func_basename_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10966 test uninstall = "$opt_mode" && odir=$dir
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10967
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10968 # Remember odir for removal later, being careful to avoid duplicates
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10969 if test clean = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10970 case " $rmdirs " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10971 *" $odir "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10972 *) func_append rmdirs " $odir" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10973 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10974 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10975
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10976 # Don't error if the file doesn't exist and rm -f was used.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10977 if { test -L "$file"; } >/dev/null 2>&1 ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10978 { test -h "$file"; } >/dev/null 2>&1 ||
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10979 test -f "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10980 :
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10981 elif test -d "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10982 exit_status=1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10983 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10984 elif $rmforce; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10985 continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10986 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10987
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10988 rmfiles=$file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10989
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10990 case $name in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10991 *.la)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10992 # Possibly a libtool archive, so verify it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10993 if func_lalib_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10994 func_source $dir/$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10995
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10996 # Delete the libtool libraries and symlinks.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10997 for n in $library_names; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10998 func_append rmfiles " $odir/$n"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10999 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11000 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11001
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11002 case $opt_mode in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11003 clean)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11004 case " $library_names " in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11005 *" $dlname "*) ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11006 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11007 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11008 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11009 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11010 uninstall)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11011 if test -n "$library_names"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11012 # Do each command in the postuninstall commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11013 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11014 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11015
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11016 if test -n "$old_library"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11017 # Do each command in the old_postuninstall commands.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11018 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11019 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11020 # FIXME: should reinstall the best remaining shared library.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11021 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11022 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11023 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11024 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11025
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11026 *.lo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11027 # Possibly a libtool object, so verify it.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11028 if func_lalib_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11029
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11030 # Read the .lo file
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11031 func_source $dir/$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11032
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11033 # Add PIC object to the list of files to remove.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11034 if test -n "$pic_object" && test none != "$pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11035 func_append rmfiles " $dir/$pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11036 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11037
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11038 # Add non-PIC object to the list of files to remove.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11039 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11040 func_append rmfiles " $dir/$non_pic_object"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11041 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11042 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11043 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11044
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11045 *)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11046 if test clean = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11047 noexename=$name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11048 case $file in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11049 *.exe)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11050 func_stripname '' '.exe' "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11051 file=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11052 func_stripname '' '.exe' "$name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11053 noexename=$func_stripname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11054 # $file with .exe has already been added to rmfiles,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11055 # add $file without .exe
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11056 func_append rmfiles " $file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11057 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11058 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11059 # Do a test to see if this is a libtool program.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11060 if func_ltwrapper_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11061 if func_ltwrapper_executable_p "$file"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11062 func_ltwrapper_scriptname "$file"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11063 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11064 func_source $func_ltwrapper_scriptname_result
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11065 func_append rmfiles " $func_ltwrapper_scriptname_result"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11066 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11067 relink_command=
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11068 func_source $dir/$noexename
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11069 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11070
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11071 # note $name still contains .exe if it was in $file originally
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11072 # as does the version of $file that was added into $rmfiles
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11073 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11074 if test yes = "$fast_install" && test -n "$relink_command"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11075 func_append rmfiles " $odir/lt-$name"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11076 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11077 if test "X$noexename" != "X$name"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11078 func_append rmfiles " $odir/lt-$noexename.c"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11079 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11080 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11081 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11082 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11083 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11084 func_show_eval "$RM $rmfiles" 'exit_status=1'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11085 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11086
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11087 # Try to remove the $objdir's in the directories where we deleted files
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11088 for dir in $rmdirs; do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11089 if test -d "$dir"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11090 func_show_eval "rmdir $dir >/dev/null 2>&1"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11091 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11092 done
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11093
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11094 exit $exit_status
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11095 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11096
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11097 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11098 func_mode_uninstall ${1+"$@"}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11099 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11100
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11101 test -z "$opt_mode" && {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11102 help=$generic_help
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11103 func_fatal_help "you must specify a MODE"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11104 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11105
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11106 test -z "$exec_cmd" && \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11107 func_fatal_help "invalid operation mode '$opt_mode'"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11109 if test -n "$exec_cmd"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11110 eval exec "$exec_cmd"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11111 exit $EXIT_FAILURE
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11112 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11113
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11114 exit $exit_status
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11115
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11116
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11117 # The TAGs below are defined such that we never get into a situation
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11118 # where we disable both kinds of libraries. Given conflicting
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11119 # choices, we go for a static library, that is the most portable,
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11120 # since we can't tell whether shared libraries were disabled because
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11121 # the user asked for that or because the platform doesn't support
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11122 # them. This is particularly important on AIX, because we don't
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11123 # support having both static and shared libraries enabled at the same
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11124 # time on that platform, so we default to a shared-only configuration.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11125 # If a disable-shared tag is given, we'll fallback to a static-only
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11126 # configuration. But we'll never go from static-only to shared-only.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11127
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11128 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11129 build_libtool_libs=no
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11130 build_old_libs=yes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11131 # ### END LIBTOOL TAG CONFIG: disable-shared
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11132
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11133 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11134 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11135 # ### END LIBTOOL TAG CONFIG: disable-static
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11136
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11137 # Local Variables:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11138 # mode:shell-script
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11139 # sh-indentation:2
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11140 # End: