]> git.saurik.com Git - apple/icu.git/blob - icuSources/config/icu-config-bottom
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / config / icu-config-bottom
1 ## -*-sh-*-
2 ## BEGIN of icu-config-bottom. $Revision: 1.1.1.2 $
3 ## Copyright (c) 2002-2003, International Business Machines Corporation and
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)"
49 echo " --ldflags-ustdio Print ICU ustdio link directive. Use in addition to --ldflags "
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
221 --ldflags-ustdio)
222 echo $ICULIBS_USTDIO
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)
292 case "$PKGDATA_MODE" in
293
294 common)
295 echo "$pkgdatadir"
296 ;;
297
298 dll)
299 echo "$libdir"
300 ;;
301
302 *)
303 echo "## ${ME} Unknown pkgdata mode $PKGDATA_MODE" 1>&2
304 exit 4
305 ;;
306 esac
307 ;;
308
309 --icudatadir)
310 echo $pkgdatadir
311 ;;
312
313 --shlib-c)
314 echo $SHLIB_c
315 ;;
316
317 --shlib-cc)
318 echo $SHLIB_cc
319 ;;
320
321 --version)
322 echo $VERSION
323 ;;
324
325 --unicode-version)
326 echo $UNICODE_VERSION
327 ;;
328
329 --help)
330 usage
331 exit 0
332 ;;
333
334 --usage)
335 usage
336 exit 0
337 ;;
338
339 # --enable-rpath=*)
340 # ENABLE_RPATH=$var
341 # loaddefs
342 # ;;
343
344 -?)
345 usage
346 exit 0
347 ;;
348
349 *)
350 echo ${ME}: ERROR Unknown Option $arg 1>&2
351 echo 1>&2
352 shortusage 1>&2
353 echo "### $ME: Exitting." 1>&2
354 exit 1;
355 ;;
356 esac
357 shift
358 done
359
360 # Check once before we quit (will check last used prefix)
361 sanity
362 ## END of icu-config-bottom
363
364 exit 0
365