]> git.saurik.com Git - apple/icu.git/blame - icuSources/config/icu-config-bottom
ICU-551.24.tar.gz
[apple/icu.git] / icuSources / config / icu-config-bottom
CommitLineData
b75a7d8f 1## -*-sh-*-
374ca955 2## BEGIN of icu-config-bottom.
57a6839d 3## Copyright (c) 2002-2013, International Business Machines Corporation and
b75a7d8f
A
4## others. All Rights Reserved.
5
729e4ab9
A
6ICUUC_FILE="${libdir}/${ICULIBS_COMMON_LIB_NAME}"
7ICUUC_FILE_A="${libdir}/${ICULIBS_COMMON_LIB_NAME_A}"
57a6839d 8
b75a7d8f
A
9# echo ENABLE RPATH $ENABLE_RPATH and RPATHLDFLAGS=${RPATH_LDFLAGS}
10if [ "x$PKGDATA_MODE" = "x" ]; then
11 PKGDATA_MODE=dll
12fi
13
14}
15
16## The actual code of icu-config goes here.
17
73c04bcf 18ME=`basename "$0"`
b75a7d8f
A
19
20allflags()
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"
57a6839d 45 echo " --invoke=<prog> Print commands to invoke an ICU program named <prog> (ex: genrb)"
b75a7d8f
A
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
70shortusage()
71{
72 echo "usage: ${ME} " `allflags | cut -c-25 | sed -e 's%.*%[ & ]%'`
73}
74
75
76usage()
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
57a6839d 88 echo
b75a7d8f
A
89 echo " [Brackets] show MAKE variable equivalents, (parenthesis) show example output"
90 echo
57a6839d
A
91 echo "Copyright (c) 2002-2013, International Business Machines Corporation and others. All Rights Reserved."
92 echo
93 echo "NOTE: Please consider using the pkg-config (.pc) files instead of icu-config."
94 echo " See: <http://userguide.icu-project.org/howtouseicu#TOC-pkg-config> "
b75a7d8f
A
95}
96
97## Check the sanity of current variables
98sanity()
99{
729e4ab9 100 if [ ! -f "${ICUUC_FILE}" -a ! -f "${ICUUC_FILE_A}" ] && [ ${IGNORE_ICUUC_FILE_CHECK} = "no" ] && [ ${SANITY} = "sane" ];
b75a7d8f
A
101 then
102 echo "### $ME: Can't find ${ICUUC_FILE} - ICU prefix is wrong." 1>&2
729e4ab9
A
103 echo "### Try the --prefix= option " 1>&2
104 echo "### or --detect-prefix" 1>&2
105 echo "### (If you want to disable this check, use the --noverify option)" 1>&2
b75a7d8f
A
106 echo "### $ME: Exitting." 1>&2
107 exit 2
108 fi
109}
110
111## Main starts here.
112
113if [ $# -lt 1 ]; then
114 shortusage
115 exit 1
116fi
117
729e4ab9
A
118# For certain options (e.g. --detect-prefix) don't check for icuuc library file.
119
120IGNORE_ICUUC_FILE_CHECK="no";
121
122SANITY="sane"
123
124case "$1" in
125--noverify)
126 SANITY="nosanity"
127 shift
128 ;;
129esac
130
57a6839d 131case "$1" in
729e4ab9
A
132*prefix*)
133 IGNORE_ICUUC_FILE_CHECK="yes"
134 ;;
135esac
b75a7d8f
A
136
137# Load our variables from autoconf
138# ALWAYS load twice because of dependencies
139loaddefs
140loaddefs
729e4ab9
A
141
142if [ $# -gt 0 -a $1 = "--selfcheck" ];
143then
144 echo "passed"
57a6839d 145 exit
729e4ab9
A
146 # EXIT for self check
147fi
148
b75a7d8f
A
149sanity
150
151while [ $# -gt 0 ];
152do
153 arg="$1"
154 var=`echo $arg | sed -e 's/^[^=]*=//'`
155# echo "### processing $arg" 1>&2
156 case "$arg" in
157
158 # undocumented.
729e4ab9 159 --debug)
b75a7d8f
A
160 set -x
161 ;;
57a6839d 162
729e4ab9
A
163 --noverify)
164 echo "### $ME: Error: --noverify must be the first argument." 1>&2
165 exit 1
b75a7d8f 166 ;;
57a6839d 167
729e4ab9
A
168 --so)
169 echo $SO
170 ;;
b75a7d8f
A
171
172 --bindir)
173 echo $bindir
174 ;;
175
176 --libdir)
177 echo $libdir
178 ;;
179
180 --exists)
181 sanity
182 ;;
183
184 --sbindir)
185 echo $sbindir
186 ;;
187
46f4442e
A
188 --mkinstalldirs)
189 echo ${MKINSTALLDIRS}
190 ;;
191
192 --install)
193 echo ${INSTALL}
194 ;;
195
b75a7d8f 196 --invoke=*)
46f4442e 197 QUOT="\""
b75a7d8f
A
198 CMD="${var}"
199
57a6839d
A
200 # If it's not a locally executable command (1st choice) then
201 # search for it in the ICU directories.
b75a7d8f
A
202 if [ ! -x ${CMD} ]; then
203 if [ -x ${bindir}/${var} ]; then
204 CMD="${bindir}/${var}"
205 fi
206 if [ -x ${sbindir}/${var} ]; then
207 CMD="${sbindir}/${var}"
208 fi
209 fi
210
211 echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ${CMD}
212 ;;
213
214 --invoke)
46f4442e 215 QUOT="\""
b75a7d8f
A
216 echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT}
217 ;;
218
219 --cflags)
729e4ab9 220 echo $ECHO_N "${CFLAGS} ${ECHO_C}"
b75a7d8f 221 ;;
57a6839d 222
b75a7d8f 223 --cc)
729e4ab9 224 echo $ECHO_N "${CC} ${ECHO_C}"
b75a7d8f 225 ;;
57a6839d 226
b75a7d8f 227 --cxx)
729e4ab9 228 echo $ECHO_N "${CXX} ${ECHO_C}"
b75a7d8f
A
229 ;;
230
231 --cxxflags)
729e4ab9 232 echo $ECHO_N "${CXXFLAGS} ${ECHO_C}"
b75a7d8f
A
233 ;;
234
235 --cppflags)
236 # Don't echo the -I. - it's unneeded.
729e4ab9 237 echo $ECHO_N "${CPPFLAGS} ${ECHO_C}" | sed -e 's/-I. //'
b75a7d8f
A
238 ;;
239
240 --cppflags-searchpath)
729e4ab9 241 echo $ECHO_N "-I${prefix}/include ${ECHO_C}"
b75a7d8f
A
242 ;;
243
244 --cppflags-dynamic)
729e4ab9 245 echo $ECHO_N "${SHAREDLIBCPPFLAGS} ${ECHO_C}"
b75a7d8f
A
246 ;;
247
248 --cxxflags-dynamic)
729e4ab9 249 echo $ECHO_N "${SHAREDLIBCXXFLAGS} ${ECHO_C}"
b75a7d8f
A
250 ;;
251
252 --cflags-dynamic)
729e4ab9 253 echo $ECHO_N "${SHAREDLIBCFLAGS} ${ECHO_C}"
b75a7d8f
A
254 ;;
255
256 --ldflags-system)
729e4ab9 257 echo $ECHO_N "${LIBS} ${ECHO_C}"
b75a7d8f
A
258 ;;
259
260 --ldflags)
57a6839d 261 echo $ECHO_N "${LDFLAGS} ${ICULIBS} ${ECHO_C}"
b75a7d8f
A
262# $RPATH_LDFLAGS
263 ;;
264
265 --ldflags-libsonly)
729e4ab9 266 echo $ECHO_N "${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} ${ECHO_C}"
b75a7d8f
A
267 ;;
268
374ca955 269 --ldflags-icuio)
729e4ab9 270 echo $ECHO_N " ${ICULIBS_ICUIO} ${ECHO_C}"
b75a7d8f
A
271 ;;
272
273 --ldflags-obsolete)
729e4ab9 274 echo $ECHO_N "${ICULIBS_OBSOLETE} ${ECHO_C}"
b75a7d8f
A
275 ;;
276
277 --ldflags-toolutil)
729e4ab9 278 echo $ECHO_N " ${ICULIBS_TOOLUTIL} ${ECHO_C}"
b75a7d8f
A
279 ;;
280
281 --ldflags-layout)
729e4ab9 282 echo $ECHO_N "${ICULIBS_LAYOUT} ${ICULIBS_LAYOUTEX} ${ECHO_C}"
b75a7d8f
A
283 ;;
284
285 --ldflags-searchpath)
729e4ab9 286 echo $ECHO_N "-L${libdir} ${ECHO_C}"
b75a7d8f
A
287 ;;
288
289 --detect-prefix)
290 HERE=`echo $0 | sed -e "s/$ME//g"`
729e4ab9
A
291 if [ -f "${HERE}/../lib/${ICULIBS_COMMON_LIB_NAME}" -o -f "${HERE}/../lib/${ICULIBS_COMMON_LIB_NAME_A}" ]; then
292 prefix="${HERE}/.."
b75a7d8f
A
293 echo "## Using --prefix=${prefix}" 1>&2
294 fi
295 loaddefs
296 loaddefs
b75a7d8f
A
297 ;;
298
299 --exec-prefix)
300 echo $exec_prefix
301 ;;
302
303 --prefix)
304 echo $prefix
305 ;;
306
307 --prefix=*)
308 prefix=$var
309 loaddefs
310 loaddefs
b75a7d8f
A
311 ;;
312
313 --sysconfdir)
314 echo $sysconfdir
315 ;;
316
317 --mandir)
318 echo $mandir
319 ;;
320
321 --shared-datadir)
729e4ab9 322 echo $ECHO_N "${datadir} ${ECHO_C}"
b75a7d8f
A
323 ;;
324
325 --incfile)
729e4ab9
A
326 echo $ECHO_N "${pkglibdir}/Makefile.inc ${ECHO_C}"
327 ;;
328
329 --incpkgdatafile)
330 echo $ECHO_N "${pkglibdir}/pkgdata.inc ${ECHO_C}"
b75a7d8f
A
331 ;;
332
333 --icudata)
729e4ab9 334 echo $ECHO_N "${ICUDATA_NAME} ${ECHO_C}"
b75a7d8f
A
335 ;;
336
337 --icudata-mode)
729e4ab9 338 echo $ECHO_N "${PKGDATA_MODE} ${ECHO_C}"
b75a7d8f
A
339 ;;
340
341 --icudata-install-dir)
729e4ab9 342 echo $ECHO_N "${ICUPKGDATA_DIR} ${ECHO_C}"
b75a7d8f 343 ;;
57a6839d 344
b75a7d8f 345 --icudatadir)
729e4ab9 346 echo $ECHO_N "${ICUDATA_DIR} ${ECHO_C}"
b75a7d8f
A
347 ;;
348
349 --shlib-c)
729e4ab9 350 echo $ECHO_N "${SHLIB_c} ${ECHO_C}"
b75a7d8f
A
351 ;;
352
353 --shlib-cc)
729e4ab9 354 echo $ECHO_N "${SHLIB_cc} ${ECHO_C}"
b75a7d8f
A
355 ;;
356
357 --version)
4388f060
A
358 echo $ECHO_N $VERSION
359 ;;
b75a7d8f 360
4388f060
A
361 --unicode-version)
362 echo $ECHO_N $UNICODE_VERSION
363 ;;
57a6839d 364
4388f060
A
365 --host)
366 echo $host
367 exit 0
368 ;;
b75a7d8f
A
369
370 --help)
371 usage
372 exit 0
373 ;;
374
375 --usage)
376 usage
377 exit 0
378 ;;
379
380# --enable-rpath=*)
381# ENABLE_RPATH=$var
382# loaddefs
383# ;;
384
385 -?)
386 usage
387 exit 0
388 ;;
389
390 *)
391 echo ${ME}: ERROR Unknown Option $arg 1>&2
392 echo 1>&2
393 shortusage 1>&2
394 echo "### $ME: Exitting." 1>&2
395 exit 1;
396 ;;
397 esac
398 shift
57a6839d 399
729e4ab9
A
400 # Reset the ignore icuuc file check flag
401 if [ $IGNORE_ICUUC_FILE_CHECK = "yes" ]; then
402 IGNORE_ICUUC_FILE_CHECK="no"
403 sanity
404 fi
b75a7d8f 405done
729e4ab9 406echo
b75a7d8f
A
407# Check once before we quit (will check last used prefix)
408sanity
409## END of icu-config-bottom
410
411exit 0