]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | ## -*-sh-*- |
374ca955 A |
2 | ## BEGIN of icu-config-bottom. |
3 | ## Copyright (c) 2002-2004, International Business Machines Corporation and | |
b75a7d8f A |
4 | ## others. All Rights Reserved. |
5 | ||
6 | ICUUC_FILE=${libdir}/${ICULIBS_COMMON_LIB_NAME} | |
7 | ||
8 | # echo ENABLE RPATH $ENABLE_RPATH and RPATHLDFLAGS=${RPATH_LDFLAGS} | |
9 | if [ "x$PKGDATA_MODE" = "x" ]; then | |
10 | PKGDATA_MODE=dll | |
11 | fi | |
12 | ||
13 | } | |
14 | ||
15 | ## The actual code of icu-config goes here. | |
16 | ||
17 | ME=`basename $0` | |
18 | ||
19 | allflags() | |
20 | { | |
21 | echo " --bindir Print binary directory path (bin)" | |
22 | echo " --cc Print C compiler used [CC]" | |
23 | echo " --cflags Print C compiler flags [CFLAGS]" | |
24 | echo " --cflags-dynamic Print additional C flags for" | |
25 | echo " building shared libraries." | |
26 | echo " --cppflags Print C Preprocessor flags [CPPFLAGS]" | |
27 | echo " --cppflags-dynamic Print additional C Preprocessor flags for" | |
28 | echo " building shared libraries." | |
29 | echo " --cppflags-searchpath Print only -I include directives (-Iinclude)" | |
30 | echo " --cxx Print C++ compiler used [CXX]" | |
31 | echo " --cxxflags Print C++ compiler flags [CXXFLAGS]" | |
32 | echo " --cxxflags-dynamic Print additional C++ flags for" | |
33 | echo " building shared libraries." | |
34 | echo " --detect-prefix Attempt to detect prefix based on PATH" | |
35 | echo " --exec-prefix Print prefix for executables (/bin)" | |
36 | echo " --exists Return with 0 status if ICU exists else fail" | |
37 | echo " --help, -?, --usage Print this message" | |
38 | echo " --icudata Print shortname of ICU data file (icudt21l)" | |
39 | echo " --icudata-install-dir Print path to install data to - use as --install option to pkgdata(1)" | |
40 | echo " --icudata-mode Print default ICU pkgdata mode (dll) - use as --mode option to pkgdata(1)." | |
41 | echo " --icudatadir Print path to packaged archive data. Can set as [ICU_DATA]" | |
42 | echo " --invoke Print commands to invoke an ICU program" | |
43 | echo " --invoke=<prog> Print commands to invoke an ICU program named <prog> (ex: genrb)" | |
44 | echo " --ldflags Print -L search path and -l libraries to link with ICU [LDFLAGS]. This is for the data, uc (common), and i18n libraries only. " | |
45 | echo " --ldflags-layout Print ICU layout engine link directive. Use in addition to --ldflags" | |
46 | echo " --ldflags-libsonly Same as --ldflags, but only the -l directives" | |
47 | echo " --ldflags-searchpath Print only -L (search path) directive" | |
48 | echo " --ldflags-system Print only system libs ICU links with (-lpthread, -lm)" | |
374ca955 | 49 | echo " --ldflags-icuio Print ICU icuio link directive. Use in addition to --ldflags " |
b75a7d8f A |
50 | echo " --ldflags-obsolete Print ICU obsolete link directive. Use in addition to --ldflags. (requires icuapps/obsolete to be built and installed.) " |
51 | echo " --mandir Print manpage (man) path" | |
52 | echo " --prefix Print PREFIX to icu install (/usr/local)" | |
53 | echo " --prefix=XXX Set prefix to XXX for remainder of command" | |
54 | echo " --sbindir Print system binary path (sbin) " | |
55 | echo " --shared-datadir Print shared data (share) path. This is NOT the ICU data dir." | |
56 | echo " --shlib-c Print the command to compile and build C shared libraries with ICU" | |
57 | echo " --shlib-cc Print the command to compile and build C++ shared libraries with ICU" | |
58 | echo " --sysconfdir Print system config (etc) path" | |
59 | echo " --unicode-version Print version of Unicode data used in ICU ($UNICODE_VERSION)" | |
60 | echo " --version Print ICU version ($VERSION)" | |
61 | echo " --incfile Print path to Makefile.inc (for -O option of pkgdata)" | |
62 | } | |
63 | ||
64 | ## Print the normal usage message | |
65 | shortusage() | |
66 | { | |
67 | echo "usage: ${ME} " `allflags | cut -c-25 | sed -e 's%.*%[ & ]%'` | |
68 | } | |
69 | ||
70 | ||
71 | usage() | |
72 | { | |
73 | echo "${ME}: icu-config: ICU configuration helper script" | |
74 | echo | |
75 | echo "The most commonly used options will be --cflags, --cxxflags, --cppflags, and --ldflags." | |
76 | echo 'Example (in make): CPFLAGS=$(shell icu-config --cppflags)' | |
77 | echo ' LDFLAGS=$(shell icu-config --ldflags)' | |
78 | echo " (etc).." | |
79 | echo | |
80 | echo "Usage:" | |
81 | allflags | |
82 | ||
83 | echo | |
84 | echo " [Brackets] show MAKE variable equivalents, (parenthesis) show example output" | |
85 | echo | |
86 | echo "Copyright (c) 2002, International Business Machines Corporation and others. All Rights Reserved." | |
87 | } | |
88 | ||
89 | ## Check the sanity of current variables | |
90 | sanity() | |
91 | { | |
92 | if [ ! -f ${ICUUC_FILE} ]; | |
93 | then | |
94 | echo "### $ME: Can't find ${ICUUC_FILE} - ICU prefix is wrong." 1>&2 | |
95 | echo "### Try the --prefix= or --exec-prefix= options " 1>&2 | |
96 | echo "### or --detect-prefix" | |
97 | echo "### $ME: Exitting." 1>&2 | |
98 | exit 2 | |
99 | fi | |
100 | } | |
101 | ||
102 | ## Main starts here. | |
103 | ||
104 | if [ $# -lt 1 ]; then | |
105 | shortusage | |
106 | exit 1 | |
107 | fi | |
108 | ||
109 | ||
110 | # Load our variables from autoconf | |
111 | # ALWAYS load twice because of dependencies | |
112 | loaddefs | |
113 | loaddefs | |
114 | sanity | |
115 | ||
116 | while [ $# -gt 0 ]; | |
117 | do | |
118 | arg="$1" | |
119 | var=`echo $arg | sed -e 's/^[^=]*=//'` | |
120 | # echo "### processing $arg" 1>&2 | |
121 | case "$arg" in | |
122 | ||
123 | # undocumented. | |
124 | --debug) | |
125 | set -x | |
126 | ;; | |
127 | ||
128 | --so) | |
129 | echo $SO | |
130 | ;; | |
131 | ||
132 | --bindir) | |
133 | echo $bindir | |
134 | ;; | |
135 | ||
136 | --libdir) | |
137 | echo $libdir | |
138 | ;; | |
139 | ||
140 | --exists) | |
141 | sanity | |
142 | ;; | |
143 | ||
144 | --sbindir) | |
145 | echo $sbindir | |
146 | ;; | |
147 | ||
148 | --invoke=*) | |
149 | QUOT="'" | |
150 | CMD="${var}" | |
151 | ||
152 | # If it's not a locally executable command (1st choice) then | |
153 | # search for it in the ICU directories. | |
154 | if [ ! -x ${CMD} ]; then | |
155 | if [ -x ${bindir}/${var} ]; then | |
156 | CMD="${bindir}/${var}" | |
157 | fi | |
158 | if [ -x ${sbindir}/${var} ]; then | |
159 | CMD="${sbindir}/${var}" | |
160 | fi | |
161 | fi | |
162 | ||
163 | echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ${CMD} | |
164 | ;; | |
165 | ||
166 | --invoke) | |
167 | QUOT="'" | |
168 | echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} | |
169 | ;; | |
170 | ||
171 | --cflags) | |
172 | echo $CFLAGS | |
173 | ;; | |
174 | ||
175 | --cc) | |
176 | echo $CC | |
177 | ;; | |
178 | ||
179 | --cxx) | |
180 | echo $CXX | |
181 | ;; | |
182 | ||
183 | --cxxflags) | |
184 | echo $CXXFLAGS | |
185 | ;; | |
186 | ||
187 | --cppflags) | |
188 | # Don't echo the -I. - it's unneeded. | |
189 | echo $CPPFLAGS | sed -e 's/-I. //' | |
190 | ;; | |
191 | ||
192 | --cppflags-searchpath) | |
193 | echo -I${prefix}/include | |
194 | ;; | |
195 | ||
196 | --cppflags-dynamic) | |
197 | echo $SHAREDLIBCPPFLAGS | |
198 | ;; | |
199 | ||
200 | --cxxflags-dynamic) | |
201 | echo $SHAREDLIBCXXFLAGS | |
202 | ;; | |
203 | ||
204 | --cflags-dynamic) | |
205 | echo $SHAREDLIBCFLAGS | |
206 | ;; | |
207 | ||
208 | --ldflags-system) | |
209 | echo $LIBS | |
210 | ;; | |
211 | ||
212 | --ldflags) | |
213 | echo $LDFLAGS $ICULIBS $LIBS | |
214 | # $RPATH_LDFLAGS | |
215 | ;; | |
216 | ||
217 | --ldflags-libsonly) | |
218 | echo $ICULIBS_I18N $ICULIBS_COMMON $ICULIBS_DATA | |
219 | ;; | |
220 | ||
374ca955 A |
221 | --ldflags-icuio) |
222 | echo $ICULIBS_ICUIO | |
b75a7d8f A |
223 | ;; |
224 | ||
225 | --ldflags-obsolete) | |
226 | echo $ICULIBS_OBSOLETE | |
227 | ;; | |
228 | ||
229 | --ldflags-toolutil) | |
230 | echo $ICULIBS_TOOLUTIL | |
231 | ;; | |
232 | ||
233 | --ldflags-layout) | |
234 | echo $ICULIBS_LAYOUT $ICULIBS_LAYOUTEX | |
235 | ;; | |
236 | ||
237 | --ldflags-searchpath) | |
238 | echo -L${libdir} | |
239 | ;; | |
240 | ||
241 | --detect-prefix) | |
242 | HERE=`echo $0 | sed -e "s/$ME//g"` | |
243 | if [ -f $HERE/../lib/${ICULIBS_COMMON_LIB_NAME} ]; then | |
244 | prefix=$HERE/.. | |
245 | echo "## Using --prefix=${prefix}" 1>&2 | |
246 | fi | |
247 | loaddefs | |
248 | loaddefs | |
249 | sanity | |
250 | ;; | |
251 | ||
252 | --exec-prefix) | |
253 | echo $exec_prefix | |
254 | ;; | |
255 | ||
256 | --prefix) | |
257 | echo $prefix | |
258 | ;; | |
259 | ||
260 | --prefix=*) | |
261 | prefix=$var | |
262 | loaddefs | |
263 | loaddefs | |
264 | sanity | |
265 | ;; | |
266 | ||
267 | --sysconfdir) | |
268 | echo $sysconfdir | |
269 | ;; | |
270 | ||
271 | --mandir) | |
272 | echo $mandir | |
273 | ;; | |
274 | ||
275 | --shared-datadir) | |
276 | echo $datadir | |
277 | ;; | |
278 | ||
279 | --incfile) | |
280 | echo $pkglibdir/Makefile.inc | |
281 | ;; | |
282 | ||
283 | --icudata) | |
284 | echo $ICUDATA_NAME | |
285 | ;; | |
286 | ||
287 | --icudata-mode) | |
288 | echo $PKGDATA_MODE | |
289 | ;; | |
290 | ||
291 | --icudata-install-dir) | |
374ca955 | 292 | echo $ICUPKGDATA_DIR |
b75a7d8f A |
293 | ;; |
294 | ||
295 | --icudatadir) | |
374ca955 | 296 | echo $ICUDATA_DIR |
b75a7d8f A |
297 | ;; |
298 | ||
299 | --shlib-c) | |
300 | echo $SHLIB_c | |
301 | ;; | |
302 | ||
303 | --shlib-cc) | |
304 | echo $SHLIB_cc | |
305 | ;; | |
306 | ||
307 | --version) | |
308 | echo $VERSION | |
309 | ;; | |
310 | ||
311 | --unicode-version) | |
312 | echo $UNICODE_VERSION | |
313 | ;; | |
314 | ||
315 | --help) | |
316 | usage | |
317 | exit 0 | |
318 | ;; | |
319 | ||
320 | --usage) | |
321 | usage | |
322 | exit 0 | |
323 | ;; | |
324 | ||
325 | # --enable-rpath=*) | |
326 | # ENABLE_RPATH=$var | |
327 | # loaddefs | |
328 | # ;; | |
329 | ||
330 | -?) | |
331 | usage | |
332 | exit 0 | |
333 | ;; | |
334 | ||
335 | *) | |
336 | echo ${ME}: ERROR Unknown Option $arg 1>&2 | |
337 | echo 1>&2 | |
338 | shortusage 1>&2 | |
339 | echo "### $ME: Exitting." 1>&2 | |
340 | exit 1; | |
341 | ;; | |
342 | esac | |
343 | shift | |
344 | done | |
345 | ||
346 | # Check once before we quit (will check last used prefix) | |
347 | sanity | |
348 | ## END of icu-config-bottom | |
349 | ||
350 | exit 0 | |
351 |