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