]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | ## -*-sh-*- |
374ca955 | 2 | ## BEGIN of icu-config-bottom. |
46f4442e | 3 | ## Copyright (c) 2002-2007, 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 | ||
73c04bcf | 17 | ME=`basename "$0"` |
b75a7d8f A |
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)" | |
46f4442e A |
62 | echo " --install Print path to install-sh" |
63 | echo " --mkinstalldirs Print path to mkinstalldirs" | |
b75a7d8f A |
64 | } |
65 | ||
66 | ## Print the normal usage message | |
67 | shortusage() | |
68 | { | |
69 | echo "usage: ${ME} " `allflags | cut -c-25 | sed -e 's%.*%[ & ]%'` | |
70 | } | |
71 | ||
72 | ||
73 | usage() | |
74 | { | |
75 | echo "${ME}: icu-config: ICU configuration helper script" | |
76 | echo | |
77 | echo "The most commonly used options will be --cflags, --cxxflags, --cppflags, and --ldflags." | |
78 | echo 'Example (in make): CPFLAGS=$(shell icu-config --cppflags)' | |
79 | echo ' LDFLAGS=$(shell icu-config --ldflags)' | |
80 | echo " (etc).." | |
81 | echo | |
82 | echo "Usage:" | |
83 | allflags | |
84 | ||
85 | echo | |
86 | echo " [Brackets] show MAKE variable equivalents, (parenthesis) show example output" | |
87 | echo | |
88 | echo "Copyright (c) 2002, International Business Machines Corporation and others. All Rights Reserved." | |
89 | } | |
90 | ||
91 | ## Check the sanity of current variables | |
92 | sanity() | |
93 | { | |
94 | if [ ! -f ${ICUUC_FILE} ]; | |
95 | then | |
96 | echo "### $ME: Can't find ${ICUUC_FILE} - ICU prefix is wrong." 1>&2 | |
97 | echo "### Try the --prefix= or --exec-prefix= options " 1>&2 | |
98 | echo "### or --detect-prefix" | |
99 | echo "### $ME: Exitting." 1>&2 | |
100 | exit 2 | |
101 | fi | |
102 | } | |
103 | ||
104 | ## Main starts here. | |
105 | ||
106 | if [ $# -lt 1 ]; then | |
107 | shortusage | |
108 | exit 1 | |
109 | fi | |
110 | ||
111 | ||
112 | # Load our variables from autoconf | |
113 | # ALWAYS load twice because of dependencies | |
114 | loaddefs | |
115 | loaddefs | |
116 | sanity | |
117 | ||
118 | while [ $# -gt 0 ]; | |
119 | do | |
120 | arg="$1" | |
121 | var=`echo $arg | sed -e 's/^[^=]*=//'` | |
122 | # echo "### processing $arg" 1>&2 | |
123 | case "$arg" in | |
124 | ||
125 | # undocumented. | |
126 | --debug) | |
127 | set -x | |
128 | ;; | |
129 | ||
130 | --so) | |
131 | echo $SO | |
132 | ;; | |
133 | ||
134 | --bindir) | |
135 | echo $bindir | |
136 | ;; | |
137 | ||
138 | --libdir) | |
139 | echo $libdir | |
140 | ;; | |
141 | ||
142 | --exists) | |
143 | sanity | |
144 | ;; | |
145 | ||
146 | --sbindir) | |
147 | echo $sbindir | |
148 | ;; | |
149 | ||
46f4442e A |
150 | --mkinstalldirs) |
151 | echo ${MKINSTALLDIRS} | |
152 | ;; | |
153 | ||
154 | --install) | |
155 | echo ${INSTALL} | |
156 | ;; | |
157 | ||
b75a7d8f | 158 | --invoke=*) |
46f4442e | 159 | QUOT="\"" |
b75a7d8f A |
160 | CMD="${var}" |
161 | ||
162 | # If it's not a locally executable command (1st choice) then | |
163 | # search for it in the ICU directories. | |
164 | if [ ! -x ${CMD} ]; then | |
165 | if [ -x ${bindir}/${var} ]; then | |
166 | CMD="${bindir}/${var}" | |
167 | fi | |
168 | if [ -x ${sbindir}/${var} ]; then | |
169 | CMD="${sbindir}/${var}" | |
170 | fi | |
171 | fi | |
172 | ||
173 | echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ${CMD} | |
174 | ;; | |
175 | ||
176 | --invoke) | |
46f4442e | 177 | QUOT="\"" |
b75a7d8f A |
178 | echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} |
179 | ;; | |
180 | ||
181 | --cflags) | |
182 | echo $CFLAGS | |
183 | ;; | |
184 | ||
185 | --cc) | |
186 | echo $CC | |
187 | ;; | |
188 | ||
189 | --cxx) | |
190 | echo $CXX | |
191 | ;; | |
192 | ||
193 | --cxxflags) | |
194 | echo $CXXFLAGS | |
195 | ;; | |
196 | ||
197 | --cppflags) | |
198 | # Don't echo the -I. - it's unneeded. | |
199 | echo $CPPFLAGS | sed -e 's/-I. //' | |
200 | ;; | |
201 | ||
202 | --cppflags-searchpath) | |
203 | echo -I${prefix}/include | |
204 | ;; | |
205 | ||
206 | --cppflags-dynamic) | |
207 | echo $SHAREDLIBCPPFLAGS | |
208 | ;; | |
209 | ||
210 | --cxxflags-dynamic) | |
211 | echo $SHAREDLIBCXXFLAGS | |
212 | ;; | |
213 | ||
214 | --cflags-dynamic) | |
215 | echo $SHAREDLIBCFLAGS | |
216 | ;; | |
217 | ||
218 | --ldflags-system) | |
219 | echo $LIBS | |
220 | ;; | |
221 | ||
222 | --ldflags) | |
223 | echo $LDFLAGS $ICULIBS $LIBS | |
224 | # $RPATH_LDFLAGS | |
225 | ;; | |
226 | ||
227 | --ldflags-libsonly) | |
228 | echo $ICULIBS_I18N $ICULIBS_COMMON $ICULIBS_DATA | |
229 | ;; | |
230 | ||
374ca955 A |
231 | --ldflags-icuio) |
232 | echo $ICULIBS_ICUIO | |
b75a7d8f A |
233 | ;; |
234 | ||
235 | --ldflags-obsolete) | |
236 | echo $ICULIBS_OBSOLETE | |
237 | ;; | |
238 | ||
239 | --ldflags-toolutil) | |
240 | echo $ICULIBS_TOOLUTIL | |
241 | ;; | |
242 | ||
243 | --ldflags-layout) | |
244 | echo $ICULIBS_LAYOUT $ICULIBS_LAYOUTEX | |
245 | ;; | |
246 | ||
247 | --ldflags-searchpath) | |
248 | echo -L${libdir} | |
249 | ;; | |
250 | ||
251 | --detect-prefix) | |
252 | HERE=`echo $0 | sed -e "s/$ME//g"` | |
253 | if [ -f $HERE/../lib/${ICULIBS_COMMON_LIB_NAME} ]; then | |
254 | prefix=$HERE/.. | |
255 | echo "## Using --prefix=${prefix}" 1>&2 | |
256 | fi | |
257 | loaddefs | |
258 | loaddefs | |
259 | sanity | |
260 | ;; | |
261 | ||
262 | --exec-prefix) | |
263 | echo $exec_prefix | |
264 | ;; | |
265 | ||
266 | --prefix) | |
267 | echo $prefix | |
268 | ;; | |
269 | ||
270 | --prefix=*) | |
271 | prefix=$var | |
272 | loaddefs | |
273 | loaddefs | |
274 | sanity | |
275 | ;; | |
276 | ||
277 | --sysconfdir) | |
278 | echo $sysconfdir | |
279 | ;; | |
280 | ||
281 | --mandir) | |
282 | echo $mandir | |
283 | ;; | |
284 | ||
285 | --shared-datadir) | |
286 | echo $datadir | |
287 | ;; | |
288 | ||
289 | --incfile) | |
290 | echo $pkglibdir/Makefile.inc | |
291 | ;; | |
292 | ||
293 | --icudata) | |
294 | echo $ICUDATA_NAME | |
295 | ;; | |
296 | ||
297 | --icudata-mode) | |
298 | echo $PKGDATA_MODE | |
299 | ;; | |
300 | ||
301 | --icudata-install-dir) | |
374ca955 | 302 | echo $ICUPKGDATA_DIR |
b75a7d8f A |
303 | ;; |
304 | ||
305 | --icudatadir) | |
374ca955 | 306 | echo $ICUDATA_DIR |
b75a7d8f A |
307 | ;; |
308 | ||
309 | --shlib-c) | |
310 | echo $SHLIB_c | |
311 | ;; | |
312 | ||
313 | --shlib-cc) | |
314 | echo $SHLIB_cc | |
315 | ;; | |
316 | ||
317 | --version) | |
318 | echo $VERSION | |
319 | ;; | |
320 | ||
321 | --unicode-version) | |
322 | echo $UNICODE_VERSION | |
323 | ;; | |
324 | ||
325 | --help) | |
326 | usage | |
327 | exit 0 | |
328 | ;; | |
329 | ||
330 | --usage) | |
331 | usage | |
332 | exit 0 | |
333 | ;; | |
334 | ||
335 | # --enable-rpath=*) | |
336 | # ENABLE_RPATH=$var | |
337 | # loaddefs | |
338 | # ;; | |
339 | ||
340 | -?) | |
341 | usage | |
342 | exit 0 | |
343 | ;; | |
344 | ||
345 | *) | |
346 | echo ${ME}: ERROR Unknown Option $arg 1>&2 | |
347 | echo 1>&2 | |
348 | shortusage 1>&2 | |
349 | echo "### $ME: Exitting." 1>&2 | |
350 | exit 1; | |
351 | ;; | |
352 | esac | |
353 | shift | |
354 | done | |
355 | ||
356 | # Check once before we quit (will check last used prefix) | |
357 | sanity | |
358 | ## END of icu-config-bottom | |
359 | ||
360 | exit 0 | |
361 |