4 # BEGIN of icu-config-top
5 #******************************************************************************
6 # Copyright (C) 1999-2004, International Business Machines
7 # Corporation and others. All Rights Reserved.
8 #******************************************************************************
9 # This script is designed to aid configuration of ICU.
10 # rpath links a library search path right into the binaries.
13 ### END of icu-config-top
16 exec_prefix=`pkg-config --variable=exec_prefix icu`
17 execprefix=$exec_prefix
18 prefix=`pkg-config --variable=prefix icu`
23 LDLIBRARYPATH_ENVVAR="LD_LIBRARY_PATH"
24 bindir=`pkg-config --variable=bindir icu`
25 sbindir=`pkg-config --variable=sbindir icu`
26 libdir=`pkg-config --variable=libdir icu`
27 sysconfdir=`pkg-config --variable=sysconfdir icu`
28 mandir=`pkg-config --variable=mandir icu`
29 datadir=`pkg-config --variable=datadir icu`
30 pkglibdir=`pkg-config --variable=pkglibdir icu`
31 ICULIBS_COMMON_LIB_NAME=`pkg-config --variable=ICULIBS_COMMON_LIB_NAME icu`
32 UNICODE_VERSION=`pkg-config --variable=UNICODE_VERSION icu`
33 VERSION=`pkg-config --modversion icu`
34 SO=`pkg-config --variable=SO icu`
37 ## BEGIN of icu-config-bottom.
38 ## Copyright (c) 2002-2004, International Business Machines Corporation and
39 ## others. All Rights Reserved.
41 ICUUC_FILE=${libdir}/${ICULIBS_COMMON_LIB_NAME}
43 # echo ENABLE RPATH $ENABLE_RPATH and RPATHLDFLAGS=${RPATH_LDFLAGS}
44 if [ "x$PKGDATA_MODE" = "x" ]; then
50 ## The actual code of icu-config goes here.
56 echo " --bindir Print binary directory path (bin)"
57 echo " --cc Print C compiler used [CC]"
58 echo " --cflags Print C compiler flags [CFLAGS]"
59 echo " --cflags-dynamic Print additional C flags for"
60 echo " building shared libraries."
61 echo " --cppflags Print C Preprocessor flags [CPPFLAGS]"
62 echo " --cppflags-dynamic Print additional C Preprocessor flags for"
63 echo " building shared libraries."
64 echo " --cppflags-searchpath Print only -I include directives (-Iinclude)"
65 echo " --cxx Print C++ compiler used [CXX]"
66 echo " --cxxflags Print C++ compiler flags [CXXFLAGS]"
67 echo " --cxxflags-dynamic Print additional C++ flags for"
68 echo " building shared libraries."
69 echo " --detect-prefix Attempt to detect prefix based on PATH"
70 echo " --exec-prefix Print prefix for executables (/bin)"
71 echo " --exists Return with 0 status if ICU exists else fail"
72 echo " --help, -?, --usage Print this message"
73 echo " --icudata Print shortname of ICU data file (icudt21l)"
74 echo " --icudata-install-dir Print path to install data to - use as --install option to pkgdata(1)"
75 echo " --icudata-mode Print default ICU pkgdata mode (dll) - use as --mode option to pkgdata(1)."
76 echo " --icudatadir Print path to packaged archive data. Can set as [ICU_DATA]"
77 echo " --invoke Print commands to invoke an ICU program"
78 echo " --invoke=<prog> Print commands to invoke an ICU program named <prog> (ex: genrb)"
79 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. "
80 echo " --ldflags-layout Print ICU layout engine link directive. Use in addition to --ldflags"
81 echo " --ldflags-libsonly Same as --ldflags, but only the -l directives"
82 echo " --ldflags-searchpath Print only -L (search path) directive"
83 echo " --ldflags-system Print only system libs ICU links with (-lpthread, -lm)"
84 echo " --ldflags-icuio Print ICU icuio link directive. Use in addition to --ldflags "
85 echo " --ldflags-obsolete Print ICU obsolete link directive. Use in addition to --ldflags. (requires icuapps/obsolete to be built and installed.) "
86 echo " --mandir Print manpage (man) path"
87 echo " --prefix Print PREFIX to icu install (/usr/local)"
88 echo " --prefix=XXX Set prefix to XXX for remainder of command"
89 echo " --sbindir Print system binary path (sbin) "
90 echo " --shared-datadir Print shared data (share) path. This is NOT the ICU data dir."
91 echo " --shlib-c Print the command to compile and build C shared libraries with ICU"
92 echo " --shlib-cc Print the command to compile and build C++ shared libraries with ICU"
93 echo " --sysconfdir Print system config (etc) path"
94 echo " --unicode-version Print version of Unicode data used in ICU ($UNICODE_VERSION)"
95 echo " --version Print ICU version ($VERSION)"
96 echo " --incfile Print path to Makefile.inc (for -O option of pkgdata)"
97 echo " --incpkgdatafile Print path to pkgdata.inc (for -O option of pkgdata)"
100 ## Print the normal usage message
103 echo "usage: ${ME} " `allflags | cut -c-25 | sed -e 's%.*%[ & ]%'`
109 echo "${ME}: icu-config: ICU configuration helper script"
111 echo "The most commonly used options will be --cflags, --cxxflags, --cppflags, and --ldflags."
112 echo 'Example (in make): CPFLAGS=$(shell icu-config --cppflags)'
113 echo ' LDFLAGS=$(shell icu-config --ldflags)'
120 echo " [Brackets] show MAKE variable equivalents, (parenthesis) show example output"
122 echo "Copyright (c) 2002, International Business Machines Corporation and others. All Rights Reserved."
125 ## Check the sanity of current variables
128 if [ ! -f ${ICUUC_FILE} ];
130 echo "### $ME: Can't find ${ICUUC_FILE} - ICU prefix is wrong." 1>&2
131 echo "### Try the --prefix= or --exec-prefix= options " 1>&2
132 echo "### or --detect-prefix"
133 echo "### $ME: Exitting." 1>&2
140 if [ $# -lt 1 ]; then
146 # Load our variables from autoconf
147 # ALWAYS load twice because of dependencies
155 var=`echo $arg | sed -e 's/^[^=]*=//'`
156 # echo "### processing $arg" 1>&2
188 # If it's not a locally executable command (1st choice) then
189 # search for it in the ICU directories.
190 if [ ! -x ${CMD} ]; then
191 if [ -x ${bindir}/${var} ]; then
192 CMD="${bindir}/${var}"
194 if [ -x ${sbindir}/${var} ]; then
195 CMD="${sbindir}/${var}"
199 echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ${CMD}
204 echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT}
208 pkg-config --variable=CFLAGS icu
220 pkg-config --variable=CXXFLAGS icu
224 # Don't echo the -I. - it's unneeded.
225 CPPFLAGS=`pkg-config --variable=CPPFLAGS icu`
226 echo $CPPFLAGS | sed -e 's/-I. //'
229 --cppflags-searchpath)
230 echo -I${prefix}/include
234 pkg-config --variable=SHAREDLIBCPPFLAGS icu
238 pkg-config --variable=SHAREDLIBCXXFLAGS icu
242 pkg-config --variable=SHAREDLIBCFLAGS icu
246 pkg-config --variable=ICULIBS_SYSTEMLIBS icu
250 pkg-config --libs icu
255 pkg-config --variable=ICULIBS_LIBSONLY icu
259 pkg-config --variable=ICULIBS_ICUIO icu
263 pkg-config --variable=ICULIBS_OBSOLETE icu
267 pkg-config --variable=ICULIBS_TOOLUTIL icu
271 pkg-config --variable=ICULIBS_LAYOUT icu
274 --ldflags-searchpath)
279 HERE=`echo $0 | sed -e "s/$ME//g"`
280 if [ -f $HERE/../lib/${ICULIBS_COMMON_LIB_NAME} ]; then
282 echo "## Using --prefix=${prefix}" 1>&2
317 echo $pkglibdir/Makefile.inc
321 echo $pkglibdir/pkgdata.inc
325 pkg-config --variable=ICUDATA_NAME icu
332 --icudata-install-dir)
333 pkg-config --variable=ICUPKGDATA_DIR icu
337 pkg-config --variable=ICUDATA_DIR icu
341 pkg-config --variable=SHLIB_c icu
345 pkg-config --variable=SHLIB_cc icu
353 echo $UNICODE_VERSION
377 echo ${ME}: ERROR Unknown Option $arg 1>&2
380 echo "### $ME: Exitting." 1>&2
387 # Check once before we quit (will check last used prefix)
389 ## END of icu-config-bottom