]>
Commit | Line | Data |
---|---|---|
729e4ab9 | 1 | # -*-autoconf-*- |
2ca993e8 | 2 | AC_COPYRIGHT([ Copyright (c) 1999-2015, International Business Machines Corporation and others. All Rights Reserved. ]) |
729e4ab9 A |
3 | # configure.in for ICU |
4 | # Stephen F. Booth, heavily modified by Yves and others | |
b75a7d8f | 5 | |
2ca993e8 A |
6 | # NOTE: please use 'autoreconf' to rebuild, otherwise 'aclocal && autoconf'. |
7 | ||
729e4ab9 | 8 | # Check for autoconf version |
2ca993e8 | 9 | AC_PREREQ(2.69) |
729e4ab9 | 10 | |
2ca993e8 | 11 | # Process this file with autoreconf to produce a configure script |
b331163b A |
12 | AC_INIT([ICU], |
13 | m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"), | |
14 | [http://icu-project.org/bugs], | |
15 | [International Components for Unicode], | |
16 | [http://icu-project.org]) | |
4388f060 | 17 | |
b331163b | 18 | AC_CONFIG_MACRO_DIR([config/m4]) |
729e4ab9 A |
19 | AC_CONFIG_SRCDIR([common/unicode/utypes.h]) |
20 | ||
b75a7d8f A |
21 | PACKAGE="icu" |
22 | AC_SUBST(PACKAGE) | |
23 | ||
729e4ab9 A |
24 | # Use custom echo test for newline option |
25 | # Current autoconf (2.65) gives incorrect echo newline option | |
26 | # for icu-config | |
27 | # This may be removed later - mow (June 17, 2010) | |
28 | ICU_ECHO_C= ICU_ECHO_N= ICU_ECHO_T= | |
29 | case `/bin/sh -c "echo -n x"` in | |
30 | -n*) | |
31 | case `/bin/sh -c "echo 'x\c'"` in | |
32 | *c*) ICU_ECHO_T=' ';; # ECHO_T is single tab character. | |
33 | *) ICU_ECHO_C='\c';; | |
34 | esac;; | |
35 | *) | |
36 | ICU_ECHO_N='-n';; | |
37 | esac | |
38 | AC_SUBST(ICU_ECHO_N) | |
39 | AC_SUBST(ICU_ECHO_C) | |
40 | AC_SUBST(ICU_ECHO_T) | |
41 | ||
b75a7d8f A |
42 | AC_MSG_CHECKING(for ICU version numbers) |
43 | ||
729e4ab9 | 44 | # Get the ICU version from uversion.h or other headers |
b75a7d8f A |
45 | geticuversion() { |
46 | [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"] | |
47 | } | |
729e4ab9 A |
48 | getuversion() { |
49 | [sed -n 's/^[ ]*#[ ]*define[ ]*U_UNICODE_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"] | |
50 | } | |
51 | VERSION=`geticuversion $srcdir/common/unicode/uvernum.h` | |
b75a7d8f | 52 | if test x"$VERSION" = x; then |
4388f060 | 53 | as_fn_error $? "Cannot determine ICU version number from uvernum.h header file" "$LINENO" 5 |
729e4ab9 A |
54 | fi |
55 | ||
4388f060 A |
56 | #TODO: IcuBug:8502 |
57 | #if test "$VERSION" != "$PACKAGE_VERSION"; then | |
58 | # AC_MSG_ERROR([configure was generated for $PACKAGE_VERSION but uvernum.h has $VERSION - please rerun autoconf]) | |
59 | #fi | |
60 | ||
729e4ab9 A |
61 | UNICODE_VERSION=`getuversion $srcdir/common/unicode/uchar.h` |
62 | if test x"$UNICODE_VERSION" = x; then | |
4388f060 | 63 | AC_MSG_ERROR([Cannot determine Unicode version number from uchar.h header file]) |
b75a7d8f | 64 | fi |
729e4ab9 A |
65 | # Compute a reasonable library version from the release version. This is |
66 | # very bad, but that's wanted... We want to make sure that the LIB_VERSION | |
67 | # has at least a dot in it, so we'll add a .0 if needed. | |
4388f060 A |
68 | #[LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`] |
69 | LIB_VERSION=$VERSION | |
b75a7d8f A |
70 | LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'` |
71 | AC_SUBST(VERSION) | |
72 | AC_SUBST(LIB_VERSION) | |
73 | AC_SUBST(LIB_VERSION_MAJOR) | |
729e4ab9 | 74 | AC_MSG_RESULT([release $VERSION, library $LIB_VERSION, unicode version $UNICODE_VERSION]) |
b75a7d8f | 75 | |
b75a7d8f A |
76 | AC_SUBST(UNICODE_VERSION) |
77 | ||
729e4ab9 | 78 | # Determine the host system |
4388f060 | 79 | AC_CANONICAL_HOST |
73c04bcf | 80 | |
b75a7d8f A |
81 | AC_SUBST(CPPFLAGS) |
82 | ||
729e4ab9 A |
83 | # This variable is needed on z/OS because the C++ compiler only recognizes .C |
84 | _CXX_CXXSUFFIX=cpp | |
73c04bcf | 85 | export _CXX_CXXSUFFIX |
729e4ab9 | 86 | |
4388f060 | 87 | # Accumulate #defines |
57a6839d A |
88 | |
89 | # CONFIG_CPPFLAGS: These are defines that are set for ICU Build time only. | |
90 | # They are only needed for building ICU itself. Example: platform stuff | |
4388f060 | 91 | CONFIG_CPPFLAGS="" |
57a6839d A |
92 | # UCONFIG_CPPFLAGS: These are defines which are set for ICU build time, |
93 | # and also a notice is output that they need to be set | |
94 | # for end-users of ICU also. uconfig.h.prepend is generated | |
95 | # with, for example, "#define U_DISABLE_RENAMING 1" | |
96 | # Example: ICU configuration stuff | |
4388f060 | 97 | UCONFIG_CPPFLAGS="" |
57a6839d A |
98 | # UCONFIG_CFLAGS: contains a copy of anything that needs to be set by end users |
99 | # such as -std | |
100 | UCONFIG_CFLAGS="" | |
4388f060 | 101 | |
729e4ab9 A |
102 | # Check whether to build debug libraries |
103 | AC_MSG_CHECKING([whether to build debug libraries]) | |
104 | enabled=no | |
105 | ENABLE_DEBUG=0 | |
106 | AC_ARG_ENABLE(debug, | |
4388f060 | 107 | [ --enable-debug build debug libraries and enable the U_DEBUG define [default=no]], |
729e4ab9 | 108 | [ case "${enableval}" in |
4388f060 | 109 | yes|"") enabled=yes; ENABLE_DEBUG=1; CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEBUG=1" ;; |
57a6839d A |
110 | *) ;; |
111 | esac], | |
729e4ab9 A |
112 | ) |
113 | AC_MSG_RESULT($enabled) | |
114 | AC_SUBST(ENABLE_DEBUG) | |
115 | ||
116 | # Check whether to build release libraries | |
117 | AC_MSG_CHECKING([whether to build release libraries]) | |
118 | enabled=yes | |
119 | ENABLE_RELEASE=1 | |
120 | AC_ARG_ENABLE(release, | |
121 | [ --enable-release build release libraries [default=yes]], | |
122 | [ case "${enableval}" in | |
123 | no) enabled=no; ENABLE_RELEASE=0 ;; | |
57a6839d A |
124 | *) ;; |
125 | esac], | |
729e4ab9 A |
126 | ) |
127 | AC_MSG_RESULT($enabled) | |
128 | AC_SUBST(ENABLE_RELEASE) | |
129 | ||
130 | # Don't use the default C/CXXFLags | |
131 | : ${CFLAGS=""} | |
132 | : ${CXXFLAGS=""} | |
133 | ||
51004dcb A |
134 | # Checks for compilers |
135 | AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc]) | |
136 | # Make sure that we try clang++ first, which provides C++11 support. | |
137 | # The g++ compiler is less likely to support C++11. | |
138 | AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC]) | |
729e4ab9 | 139 | |
b331163b A |
140 | # pkg-config is needed for harfbuzz support |
141 | PKG_PROG_PKG_CONFIG([0.20]) | |
142 | PKG_CHECK_MODULES(ICULEHB, icu-le-hb, have_icu_le_hb=true, :) | |
143 | ||
729e4ab9 A |
144 | # Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option |
145 | # The release mode use is the default one for autoconf | |
146 | if test "$GCC" = yes; then | |
147 | if test "$CFLAGS" = ""; then | |
148 | if test "$ENABLE_DEBUG" = 1; then | |
149 | CFLAGS=-g | |
150 | fi | |
151 | if test "$ENABLE_RELEASE" = 1; then | |
152 | CFLAGS="$CFLAGS -O2" | |
153 | fi | |
154 | fi | |
155 | if test "$CXXFLAGS" = ""; then | |
156 | if test "$ENABLE_DEBUG" = 1; then | |
157 | CXXFLAGS=-g | |
158 | fi | |
159 | if test "$ENABLE_RELEASE" = 1; then | |
160 | CXXFLAGS="$CXXFLAGS -O2" | |
161 | fi | |
162 | fi | |
163 | fi | |
164 | ||
165 | AC_PROG_CPP | |
166 | ||
b75a7d8f A |
167 | AC_PROG_INSTALL |
168 | ||
729e4ab9 A |
169 | AC_SUBST(cross_compiling) |
170 | ||
171 | dnl use the pld hack to get ac_fn_cxx_try_link defined globally and not local | |
172 | AC_LANG_PUSH([C++]) | |
173 | AC_LINK_IFELSE([AC_LANG_PROGRAM()]) | |
174 | AC_LANG_POP([C++]) | |
175 | ||
b75a7d8f A |
176 | # make sure install is relative to srcdir - if a script |
177 | if test "$srcdir" = "."; then | |
178 | # If srcdir isn't just ., then (srcdir) is already prepended. | |
179 | if test "${ac_install_sh}" = "${INSTALL}"; then | |
180 | INSTALL="\\\$(top_srcdir)/${ac_install_sh}" | |
181 | fi | |
182 | fi | |
183 | ||
374ca955 | 184 | #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) |
73c04bcf | 185 | #AC_CHECK_PROG(STRIP, strip, strip, true) |
b75a7d8f | 186 | |
729e4ab9 | 187 | # Check for the platform make |
b75a7d8f A |
188 | AC_PATH_PROGS(U_MAKE, gmake gnumake, make) |
189 | AC_SUBST(U_MAKE) | |
190 | ||
729e4ab9 A |
191 | |
192 | AC_ARG_WITH(cross-build, | |
193 | [ --with-cross-build=dir specify an absolute path to the build directory of an ICU built for the current platform [default=no cross dir]], | |
57a6839d | 194 | [cross_buildroot="${withval}"], |
729e4ab9 A |
195 | [cross_buildroot=""]) |
196 | ||
197 | if test "X$cross_buildroot" = "X"; then | |
198 | if test "$cross_compiling" = "yes"; then | |
199 | AC_MSG_ERROR([Error! Cross compiling but no --with-cross-build option specified - please supply the path to an executable ICU's build root]) | |
200 | dnl ' | |
201 | fi | |
202 | else | |
203 | if test -f "${cross_buildroot}/config/icucross.mk"; then | |
204 | AC_MSG_RESULT([Using cross buildroot: $cross_buildroot]) | |
205 | else | |
206 | if test -d "${cross_buildroot}"; then | |
207 | AC_MSG_ERROR([${cross_buildroot}/config/icucross.mk not found. Please build ICU in ${cross_buildroot} first.]) | |
208 | else | |
209 | AC_MSG_ERROR([No such directory ${cross_buildroot} supplied as the argument to --with-cross-build. Use an absolute path.]) | |
210 | fi | |
211 | fi | |
212 | fi | |
213 | AC_SUBST(cross_buildroot) | |
214 | ||
215 | # Check for doxygen to generate documentation | |
b75a7d8f A |
216 | AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin) |
217 | ||
729e4ab9 | 218 | # Check that the linker is usable |
73c04bcf A |
219 | ICU_PROG_LINK |
220 | ||
729e4ab9 A |
221 | # Determine the executable suffix |
222 | # We don't use AC_EXEEXT because some compilers output separate debugging | |
223 | # files, which confuses the AC_EXEEXT macro. | |
73c04bcf A |
224 | AC_MSG_CHECKING(checking for executable suffix) |
225 | case "${host}" in | |
226 | *-*-cygwin*|*-*-mingw*) EXEEXT=.exe ;; | |
227 | *) EXEEXT="" ;; | |
228 | esac | |
229 | ac_exeext=$EXEEXT | |
230 | AC_MSG_RESULT($EXEEXT) | |
231 | AC_SUBST(EXEEXT) | |
b75a7d8f | 232 | |
729e4ab9 | 233 | # Determine how strict we want to be when compiling |
b75a7d8f A |
234 | AC_CHECK_STRICT_COMPILE |
235 | ||
729e4ab9 | 236 | # Check if we can build and use 64-bit libraries |
b75a7d8f A |
237 | AC_CHECK_64BIT_LIBS |
238 | AC_SUBST(ARFLAGS) | |
239 | AC_SUBST(COMPILE_LINK_ENVVAR) | |
240 | ||
729e4ab9 | 241 | # Determine the Makefile fragment |
b75a7d8f A |
242 | ICU_CHECK_MH_FRAG |
243 | ||
729e4ab9 A |
244 | # Checks for libraries and other host specific stuff |
245 | # On HP/UX, don't link to -lm from a shared lib because it isn't | |
246 | # PIC (at least on 10.2) | |
b75a7d8f | 247 | case "${host}" in |
b75a7d8f | 248 | *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; |
57a6839d A |
249 | |
250 | *) AC_CHECK_LIB(m, floor) | |
b75a7d8f A |
251 | LIB_M="" ;; |
252 | esac | |
253 | AC_SUBST(LIB_M) | |
254 | ||
729e4ab9 | 255 | # Check whether to build shared libraries |
b75a7d8f A |
256 | AC_MSG_CHECKING([whether to build shared libraries]) |
257 | enabled=no | |
258 | AC_ARG_ENABLE(shared, | |
374ca955 | 259 | [ --enable-shared build shared libraries [default=yes]], |
b75a7d8f A |
260 | [ case "${enableval}" in |
261 | yes|"") enabled=yes; ENABLE_SHARED=YES ;; | |
262 | no);; | |
263 | *) ;; | |
264 | esac], | |
265 | [enabled=yes; ENABLE_SHARED=YES] | |
266 | ) | |
267 | AC_MSG_RESULT($enabled) | |
268 | AC_SUBST(ENABLE_SHARED) | |
269 | ||
729e4ab9 | 270 | # Check whether to build static libraries |
b75a7d8f A |
271 | AC_MSG_CHECKING([whether to build static libraries]) |
272 | enabled=no | |
273 | AC_ARG_ENABLE(static, | |
374ca955 | 274 | [ --enable-static build static libraries [default=no]], |
b75a7d8f A |
275 | [ case "${enableval}" in |
276 | yes|"") enabled=yes; ENABLE_STATIC=YES ;; | |
277 | no) ;; | |
278 | *) ;; | |
279 | esac], | |
280 | ) | |
281 | AC_MSG_RESULT($enabled) | |
282 | AC_SUBST(ENABLE_STATIC) | |
283 | ||
4388f060 A |
284 | # When building release static library, there might be some optimization flags we can use |
285 | if test "$ENABLE_STATIC" = "YES"; then | |
286 | if test "$ENABLE_SHARED" != "YES"; then | |
287 | if test "$ENABLE_RELEASE" = 1; then | |
288 | AC_MSG_CHECKING([whether we can use static library optimization option]) | |
289 | CHECK_STATIC_OPT_FLAG=no | |
57a6839d | 290 | |
4388f060 A |
291 | OLD_CPPFLAGS="${CPPFLAGS}" |
292 | OLD_LDFLAGS="${LDFLAGS}" | |
57a6839d | 293 | |
4388f060 A |
294 | case "${host}" in |
295 | *-linux*|i*86-*-*bsd*|i*86-pc-gnu) | |
51004dcb | 296 | if test "$GCC" = yes; then |
4388f060 A |
297 | CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections" |
298 | LDFLAGS="${LDFLAGS} -Wl,--gc-sections" | |
299 | fi | |
300 | ;; | |
301 | *) | |
302 | ;; | |
303 | esac | |
57a6839d | 304 | |
4388f060 A |
305 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [CHECK_STATIC_OPT_FLAG=yes], [CHECK_STATIC_OPT_FLAG=no]) |
306 | AC_MSG_RESULT($CHECK_STATIC_OPT_FLAG) | |
307 | if test "$CHECK_STATIC_OPT_FLAG" = no; then | |
308 | CPPFLAGS="${OLD_CPPFLAGS}" | |
309 | LDFLAGS="${OLD_LDFLAGS}" | |
310 | fi | |
311 | fi | |
312 | fi | |
313 | fi | |
314 | ||
315 | ||
729e4ab9 A |
316 | # Check whether to enable auto cleanup of libraries |
317 | AC_MSG_CHECKING([whether to enable auto cleanup of libraries]) | |
374ca955 | 318 | enabled=no |
729e4ab9 A |
319 | UCLN_NO_AUTO_CLEANUP=1 |
320 | AC_ARG_ENABLE(auto-cleanup, | |
321 | [ --enable-auto-cleanup enable auto cleanup of libraries [default=no]], | |
374ca955 | 322 | [ case "${enableval}" in |
57a6839d | 323 | yes) enabled=yes; |
4388f060 A |
324 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DUCLN_NO_AUTO_CLEANUP=0"; |
325 | UCLN_NO_AUTO_CLEANUP=0 | |
326 | ;; | |
374ca955 A |
327 | *) ;; |
328 | esac], | |
329 | ) | |
330 | AC_MSG_RESULT($enabled) | |
729e4ab9 | 331 | AC_SUBST(UCLN_NO_AUTO_CLEANUP) |
374ca955 | 332 | |
729e4ab9 A |
333 | # MSVC floating-point option |
334 | MSVC_RELEASE_FLAG="" | |
335 | if test $enabled = yes | |
57a6839d | 336 | then |
b331163b | 337 | if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc |
729e4ab9 A |
338 | then |
339 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
340 | #if defined _MSC_VER && _MSC_VER >= 1400 | |
341 | #else | |
342 | Microsoft Visual C++ < 2005 | |
343 | #endif | |
344 | ]], [[]])],[MSVC_RELEASE_FLAG="/fp:precise"],[MSVC_RELEASE_FLAG="/Op"]) | |
57a6839d | 345 | |
729e4ab9 A |
346 | CFLAGS="${CFLAGS} ${MSVC_RELEASE_FLAG}" |
347 | CXXFLAGS="${CXXFLAGS} ${MSVC_RELEASE_FLAG}" | |
348 | fi | |
349 | fi | |
374ca955 | 350 | |
729e4ab9 | 351 | # Check whether to enabled draft APIs |
73c04bcf A |
352 | AC_MSG_CHECKING([whether to enable draft APIs]) |
353 | enabled=yes | |
354 | U_DEFAULT_SHOW_DRAFT=1 | |
355 | AC_ARG_ENABLE(draft, | |
729e4ab9 | 356 | [ --enable-draft enable draft APIs (and internal APIs) [default=yes]], |
73c04bcf | 357 | [ case "${enableval}" in |
4388f060 A |
358 | no) enabled=no; U_DEFAULT_SHOW_DRAFT=0; |
359 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEFAULT_SHOW_DRAFT=0" | |
360 | ;; | |
73c04bcf A |
361 | *) ;; |
362 | esac], | |
363 | ) | |
364 | AC_MSG_RESULT($enabled) | |
729e4ab9 | 365 | # Make sure that we can use draft API in ICU. |
73c04bcf | 366 | if test "$U_DEFAULT_SHOW_DRAFT" = 0; then |
4388f060 | 367 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API" |
73c04bcf A |
368 | fi |
369 | AC_SUBST(U_DEFAULT_SHOW_DRAFT) | |
370 | ||
b75a7d8f | 371 | AC_PROG_RANLIB |
729e4ab9 A |
372 | |
373 | # look for 'ar' the proper way | |
4388f060 | 374 | AC_CHECK_TOOL(AR, ar, false) |
b75a7d8f A |
375 | |
376 | AC_MSG_CHECKING([whether to enable renaming of symbols]) | |
377 | enabled=yes | |
378 | U_DISABLE_RENAMING=0 | |
379 | AC_ARG_ENABLE(renaming, | |
380 | [ --enable-renaming add a version suffix to symbols [default=yes]], | |
381 | [ case "${enableval}" in | |
382 | yes|"") enabled=yes ;; | |
4388f060 A |
383 | no) enabled=no; U_DISABLE_RENAMING=1; |
384 | UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_DISABLE_RENAMING=1" | |
385 | ;; | |
b75a7d8f A |
386 | *) ;; |
387 | esac], | |
388 | ) | |
389 | AC_MSG_RESULT($enabled) | |
390 | AC_SUBST(U_DISABLE_RENAMING) | |
391 | ||
374ca955 | 392 | AC_MSG_CHECKING([whether to enable function and data tracing]) |
729e4ab9 | 393 | enabled=no |
46f4442e | 394 | U_ENABLE_TRACING=0 |
374ca955 | 395 | AC_ARG_ENABLE(tracing, |
46f4442e | 396 | [ --enable-tracing enable function and data tracing [default=no]], |
374ca955 | 397 | [ case "${enableval}" in |
57a6839d | 398 | yes|"") enabled=yes; |
4388f060 A |
399 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_TRACING=1"; |
400 | U_ENABLE_TRACING=1 ;; | |
374ca955 A |
401 | no) enabled=no; U_ENABLE_TRACING=0 ;; |
402 | *) ;; | |
403 | esac], | |
404 | ) | |
405 | AC_MSG_RESULT($enabled) | |
406 | AC_SUBST(U_ENABLE_TRACING) | |
407 | ||
57a6839d A |
408 | # check if elf.h is present. |
409 | AC_CHECK_HEADERS([elf.h]) | |
410 | if test "x$ac_cv_header_elf_h" = "xyes"; then | |
411 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_HAVE_ELF_H=1"; | |
412 | fi | |
729e4ab9 | 413 | |
2ca993e8 A |
414 | # Enable/disable plugins |
415 | AC_ARG_ENABLE(plugins, | |
416 | [ --enable-plugins enable plugins [default=no]], | |
417 | [case "${enableval}" in | |
418 | yes) plugins=true ;; | |
419 | no) plugins=false ;; | |
420 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugins) ;; | |
421 | esac], | |
422 | plugins=false) | |
423 | ICU_CONDITIONAL(PLUGINS, test "$plugins" = true) | |
424 | ||
425 | if test "x$plugins" = "xtrue"; then | |
426 | UCONFIG_CPPFLAGS="$UCONFIG_CPPFLAGS -DUCONFIG_ENABLE_PLUGINS=1" | |
427 | fi | |
428 | ||
429 | ||
729e4ab9 | 430 | U_ENABLE_DYLOAD=1 |
4388f060 | 431 | enable=yes |
2ca993e8 | 432 | AC_MSG_CHECKING([whether to enable dynamic loading of plugins. Ignored if plugins disabled.]) |
729e4ab9 A |
433 | AC_ARG_ENABLE(dyload, |
434 | [ --disable-dyload disable dynamic loading [default=no]], | |
435 | [ case "${enableval}" in | |
57a6839d | 436 | yes|"") |
729e4ab9 | 437 | U_ENABLE_DYLOAD=1 |
4388f060 A |
438 | enable=yes |
439 | ;; | |
57a6839d | 440 | no) |
729e4ab9 | 441 | U_ENABLE_DYLOAD=0; |
4388f060 A |
442 | enable=no; |
443 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_DYLOAD=0"; | |
444 | ;; | |
729e4ab9 A |
445 | *) ;; |
446 | esac], | |
447 | ) | |
4388f060 | 448 | AC_MSG_RESULT($enable) |
729e4ab9 A |
449 | AC_SUBST(U_ENABLE_DYLOAD) |
450 | ||
4388f060 A |
451 | if test "$enable" = "yes"; then |
452 | AC_CHECK_HEADERS([dlfcn.h]) | |
453 | #AC_MSG_RESULT($enabled) | |
454 | AC_SEARCH_LIBS([dlopen], [dl]) | |
455 | AC_CHECK_FUNCS([dlopen]) | |
456 | ||
457 | if test "x$ac_cv_func_dlopen" != xyes; then | |
458 | CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DHAVE_DLOPEN=0" | |
459 | fi | |
729e4ab9 | 460 | fi |
729e4ab9 A |
461 | |
462 | # Check for miscellanous functions. | |
729e4ab9 A |
463 | # So, use for putil / tools only. |
464 | # Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY | |
729e4ab9 A |
465 | AC_CHECK_FUNCS([gettimeofday]) |
466 | ||
4388f060 | 467 | |
729e4ab9 | 468 | # Check whether to use the evil rpath or not |
b75a7d8f A |
469 | AC_ARG_ENABLE(rpath, |
470 | [ --enable-rpath use rpath when linking [default is only if necessary]], | |
471 | [ case "${enableval}" in | |
472 | yes|"") ENABLE_RPATH=YES ;; | |
473 | no) ;; | |
474 | *) ;; | |
475 | esac], | |
476 | [ENABLE_RPATH=NO] | |
477 | ) | |
478 | AC_SUBST(ENABLE_RPATH) | |
479 | ||
480 | ||
b75a7d8f | 481 | |
729e4ab9 A |
482 | AC_LANG_PUSH([C++]) |
483 | AC_MSG_CHECKING([[if we have a C++ compiler]]) | |
484 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx_okay=yes],[cxx_okay=no]) | |
485 | if test $cxx_okay = yes | |
486 | then | |
4388f060 | 487 | AC_MSG_RESULT([[Good]]) |
729e4ab9 A |
488 | else |
489 | AC_MSG_RESULT([[no]]) | |
490 | AC_MSG_ERROR([[C++ compiler $CXX does not work or no compiler found]]) | |
491 | fi | |
492 | ||
57a6839d A |
493 | if [[ "$GXX" = yes ]]; then |
494 | # if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x, | |
495 | # and check that the compiler still works. | |
496 | if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then | |
497 | OLD_CXXFLAGS="${CXXFLAGS}" | |
498 | CXXFLAGS="$CXXFLAGS --std=c++0x" | |
499 | AC_MSG_CHECKING([[if we have a C++11 compiler]]) | |
500 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no]) | |
501 | AC_MSG_RESULT($cxx11_okay) | |
502 | if [[ $cxx11_okay = yes ]]; then | |
503 | AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x]) | |
504 | UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x" | |
505 | else | |
506 | CXXFLAGS="$OLD_CXXFLAGS" | |
507 | fi | |
508 | fi | |
509 | fi | |
510 | ||
729e4ab9 A |
511 | AC_MSG_CHECKING([[if #include <string> works]]) |
512 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no]) | |
513 | AC_MSG_RESULT($ac_cv_header_stdstring) | |
514 | if test $ac_cv_header_stdstring = yes | |
515 | then | |
516 | U_HAVE_STD_STRING=1 | |
4388f060 A |
517 | else |
518 | U_HAVE_STD_STRING=0 | |
519 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0" | |
729e4ab9 A |
520 | fi |
521 | AC_SUBST(U_HAVE_STD_STRING) | |
57a6839d A |
522 | |
523 | ||
524 | AC_MSG_CHECKING([[if #include <atomic> works]]) | |
525 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <atomic>]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no]) | |
526 | AC_MSG_RESULT($ac_cv_header_atomic) | |
527 | if test $ac_cv_header_atomic = yes | |
528 | then | |
529 | U_HAVE_ATOMIC=1 | |
530 | else | |
531 | U_HAVE_ATOMIC=0 | |
532 | fi | |
533 | # Make this available via CPPFLAGS | |
534 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}" | |
535 | AC_SUBST(U_HAVE_ATOMIC) | |
536 | ||
729e4ab9 A |
537 | AC_LANG_POP([C++]) |
538 | ||
51004dcb | 539 | # Always build ICU with multi-threading support. |
46f4442e | 540 | OLD_LIBS=${LIBS} |
b75a7d8f | 541 | |
2ca993e8 A |
542 | # For Compaq Tru64 (OSF1), we must look for pthread_attr_init |
543 | # and must do this before seaching for pthread_mutex_destroy, or | |
544 | # we will pick up libpthreads.so not libpthread.so | |
545 | # If this fails, then we must test for HPUX specials, before | |
546 | # moving on to a more generic test | |
57a6839d | 547 | |
2ca993e8 A |
548 | AC_CHECK_LIB(pthread, pthread_attr_init) |
549 | if test $ac_cv_lib_pthread_pthread_attr_init = yes; then | |
550 | : | |
551 | else | |
552 | # Locate the right library for POSIX threads. We look for the | |
553 | # symbols in the libraries first, because on Solaris libc provides | |
554 | # pthread_create but libpthread has the real code :( | |
555 | # AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread | |
556 | # FreeBSD users may need libpthread if they do not have libc_r. | |
b75a7d8f | 557 | |
2ca993e8 | 558 | AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r ) |
b75a7d8f | 559 | |
2ca993e8 A |
560 | if test "$ac_cv_search_pthread_mutex_destroy" != no; then |
561 | : | |
562 | else | |
563 | # For HP 11 | |
564 | AC_CHECK_LIB(pthread, pthread_mutex_init) | |
565 | if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then | |
566 | : | |
73c04bcf | 567 | fi |
2ca993e8 | 568 | fi |
73c04bcf | 569 | |
2ca993e8 | 570 | AC_CHECK_FUNC(pthread_mutex_lock) |
73c04bcf | 571 | |
2ca993e8 A |
572 | if test $ac_cv_func_pthread_mutex_lock = yes; then |
573 | : | |
b75a7d8f | 574 | fi |
2ca993e8 A |
575 | fi |
576 | # Check to see if we are using CygWin with MSVC | |
577 | case "${host}" in | |
578 | *-pc-cygwin*|*-pc-mingw*) | |
579 | # For gcc, the thread options are set by mh-mingw/mh-cygwin | |
580 | # For msvc, the thread options are set by runConfigureICU | |
581 | : | |
582 | ;; | |
583 | *-*-hpux*) | |
584 | # Add -mt because it does several nice things on newer compilers. | |
585 | case "${icu_cv_host_frag}" in | |
586 | mh-hpux-acc) | |
587 | OLD_CXXFLAGS="${CXXFLAGS}" | |
588 | CXXFLAGS="${CXXFLAGS} -mt" | |
589 | if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then | |
590 | CXXFLAGS="${OLD_CXXFLAGS}" | |
591 | else | |
592 | UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" | |
593 | fi | |
73c04bcf | 594 | ;; |
2ca993e8 A |
595 | esac |
596 | ;; | |
597 | *-*-solaris*) | |
598 | case "${icu_cv_host_frag}" in | |
599 | mh-solaris) | |
600 | LIBS="${LIBS} -mt" | |
729e4ab9 | 601 | ;; |
73c04bcf | 602 | esac |
2ca993e8 A |
603 | ;; |
604 | esac | |
b75a7d8f | 605 | |
46f4442e A |
606 | AC_ARG_ENABLE(weak-threads, |
607 | [ --enable-weak-threads weakly reference the threading library [default=no]], | |
608 | [case "${enableval}" in | |
609 | yes) | |
610 | LIB_THREAD="${LIBS%${OLD_LIBS}}" | |
611 | LIBS=${OLD_LIBS} | |
612 | ;; | |
613 | no) ;; | |
614 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-weak-threads) ;; | |
615 | esac]) | |
616 | AC_SUBST(LIB_THREAD) | |
617 | ||
729e4ab9 | 618 | # Check for mmap() |
b75a7d8f A |
619 | |
620 | # The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific. | |
621 | # Do this check instead. | |
622 | HAVE_MMAP=0 | |
623 | AC_MSG_CHECKING([for mmap]) | |
624 | AC_CACHE_VAL(ac_cv_func_mmap_ok, | |
729e4ab9 | 625 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <unistd.h> |
b75a7d8f A |
626 | #include <sys/mman.h> |
627 | #include <sys/stat.h> | |
729e4ab9 | 628 | #include <fcntl.h>], [mmap((void *)0, 0, PROT_READ, 0, 0, 0);])],[ac_cv_func_mmap_ok=yes],[ac_cv_func_mmap_ok=no])] ) |
b75a7d8f A |
629 | AC_MSG_RESULT($ac_cv_func_mmap_ok) |
630 | if test $ac_cv_func_mmap_ok = yes | |
631 | then | |
632 | HAVE_MMAP=1 | |
4388f060 A |
633 | else |
634 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_MMAP=0" | |
b75a7d8f A |
635 | fi |
636 | AC_SUBST(HAVE_MMAP) | |
637 | ||
729e4ab9 A |
638 | AC_MSG_CHECKING([for genccode assembly]) |
639 | ||
640 | # Check to see if genccode can generate simple assembly. | |
374ca955 A |
641 | GENCCODE_ASSEMBLY= |
642 | case "${host}" in | |
4388f060 | 643 | *-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu) |
374ca955 | 644 | if test "$GCC" = yes; then |
729e4ab9 | 645 | # We're using gcc, and the simple -a gcc command line works for genccode |
374ca955 A |
646 | GENCCODE_ASSEMBLY="-a gcc" |
647 | fi ;; | |
46f4442e A |
648 | i*86-*-solaris*) |
649 | if test "$GCC" = yes; then | |
729e4ab9 A |
650 | # When using gcc, look if we're also using GNU as. |
651 | # When using GNU as, the simple -a gcc command line works for genccode. | |
46f4442e A |
652 | asv=`"${CC}" -print-prog-name=as 2>/dev/null` |
653 | asv=`"${asv}" --version 2>/dev/null` | |
654 | case "X${asv}" in | |
655 | X*GNU*) GENCCODE_ASSEMBLY="-a gcc" ;; | |
656 | X*) GENCCODE_ASSEMBLY="-a sun-x86" ;; | |
657 | esac | |
658 | unset asv | |
659 | else | |
660 | GENCCODE_ASSEMBLY="-a sun-x86" | |
661 | fi ;; | |
73c04bcf A |
662 | sparc-*-solaris*) |
663 | GENCCODE_ASSEMBLY="-a sun" | |
664 | ;; | |
46f4442e | 665 | ia64-*-hpux*) |
2ca993e8 A |
666 | # There has been some issues with building ICU data on HPUX ia64 aCC |
667 | # when using the assemble code setting below. For now, build without | |
668 | # assemble code for this platform. This will increase the build time. | |
669 | # GENCCODE_ASSEMBLY="-a aCC-ia64" | |
46f4442e | 670 | ;; |
374ca955 A |
671 | esac |
672 | AC_SUBST(GENCCODE_ASSEMBLY) | |
673 | ||
729e4ab9 | 674 | AC_MSG_RESULT($GENCCODE_ASSEMBLY) |
374ca955 | 675 | |
729e4ab9 | 676 | # Checks for header files |
b75a7d8f A |
677 | AC_CHECK_HEADERS(inttypes.h) |
678 | if test $ac_cv_header_inttypes_h = no; then | |
679 | U_HAVE_INTTYPES_H=0 | |
57a6839d | 680 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0" |
b75a7d8f A |
681 | else |
682 | U_HAVE_INTTYPES_H=1 | |
683 | fi | |
684 | if test "$CC" = ccc; then | |
685 | AC_MSG_RESULT("C compiler set to CCC ${CC}" ) | |
686 | case "${host}" in | |
687 | alpha*-*-*) U_HAVE_INTTYPES_H=0; | |
4388f060 | 688 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0" |
b75a7d8f A |
689 | esac |
690 | fi | |
691 | ||
692 | AC_SUBST(U_HAVE_INTTYPES_H) | |
693 | ||
729e4ab9 A |
694 | AC_CHECK_HEADERS(dirent.h) |
695 | if test $ac_cv_header_dirent_h = no; then | |
57a6839d A |
696 | U_HAVE_DIRENT_H=0 |
697 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_DIRENT_H=0" | |
729e4ab9 A |
698 | else |
699 | U_HAVE_DIRENT_H=1 | |
700 | fi | |
701 | ||
702 | AC_SUBST(U_HAVE_DIRENT_H) | |
703 | ||
729e4ab9 | 704 | # Check for endianness |
b75a7d8f A |
705 | AC_C_BIGENDIAN() |
706 | if test $ac_cv_c_bigendian = no; then | |
707 | U_IS_BIG_ENDIAN=0 | |
708 | U_ENDIAN_CHAR="l" | |
709 | else | |
710 | U_IS_BIG_ENDIAN=1 | |
711 | U_ENDIAN_CHAR="b" | |
712 | fi | |
713 | AC_SUBST(U_IS_BIG_ENDIAN) | |
714 | ||
729e4ab9 | 715 | # Do various POSIX related checks |
b75a7d8f A |
716 | U_HAVE_NL_LANGINFO_CODESET=0 |
717 | U_NL_LANGINFO_CODESET=-1 | |
718 | AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0]) | |
46f4442e | 719 | dnl AC_SUBST(U_HAVE_NL_LANGINFO) |
b75a7d8f A |
720 | if test $U_HAVE_NL_LANGINFO -eq 1; then |
721 | AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset], | |
722 | ac_cv_nl_langinfo_codeset, | |
723 | [ac_cv_nl_langinfo_codeset="unknown" | |
724 | for a in CODESET _NL_CTYPE_CODESET_NAME; do | |
729e4ab9 | 725 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo($a);]])],[ac_cv_nl_langinfo_codeset="$a"; break],[])] |
b75a7d8f A |
726 | done) |
727 | if test x$ac_cv_nl_langinfo_codeset != xunknown | |
728 | then | |
729 | U_HAVE_NL_LANGINFO_CODESET=1 | |
730 | U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset | |
4388f060 A |
731 | if test "x${ac_cv_nl_langinfo_codeset}" != "xCODESET" |
732 | then | |
733 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DNL_LANGINFO_CODESET=${ac_cv_nl_langinfo_codeset}" | |
734 | fi | |
735 | else | |
736 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_NL_LANGINFO_CODESET=0" | |
b75a7d8f A |
737 | fi |
738 | fi | |
739 | AC_SUBST(U_HAVE_NL_LANGINFO_CODESET) | |
740 | AC_SUBST(U_NL_LANGINFO_CODESET) | |
741 | ||
729e4ab9 A |
742 | # Namespace support checks |
743 | AC_LANG(C++) | |
b75a7d8f A |
744 | AC_MSG_CHECKING([for namespace support]) |
745 | AC_CACHE_VAL(ac_cv_namespace_ok, | |
729e4ab9 | 746 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace x_version {void f(){}} |
b75a7d8f A |
747 | namespace x = x_version; |
748 | using namespace x_version; | |
729e4ab9 | 749 | ], [f();])],[ac_cv_namespace_ok=yes],[ac_cv_namespace_ok=no])] ) |
b75a7d8f | 750 | AC_MSG_RESULT($ac_cv_namespace_ok) |
b75a7d8f A |
751 | if test $ac_cv_namespace_ok = no |
752 | then | |
4388f060 | 753 | AC_MSG_ERROR(Namespace support is required to build ICU.) |
b75a7d8f | 754 | fi |
b75a7d8f A |
755 | |
756 | AC_MSG_CHECKING([for properly overriding new and delete]) | |
757 | U_OVERRIDE_CXX_ALLOCATION=0 | |
758 | U_HAVE_PLACEMENT_NEW=0 | |
759 | AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok, | |
729e4ab9 | 760 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> |
374ca955 A |
761 | class UMemory { |
762 | public: | |
b75a7d8f A |
763 | void *operator new(size_t size) {return malloc(size);} |
764 | void *operator new[](size_t size) {return malloc(size);} | |
765 | void operator delete(void *p) {free(p);} | |
766 | void operator delete[](void *p) {free(p);} | |
767 | }; | |
729e4ab9 | 768 | ]], [])],[ac_cv_override_cxx_allocation_ok=yes],[ac_cv_override_cxx_allocation_ok=no])] ) |
b75a7d8f A |
769 | AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok) |
770 | if test $ac_cv_override_cxx_allocation_ok = yes | |
771 | then | |
772 | U_OVERRIDE_CXX_ALLOCATION=1 | |
773 | AC_MSG_CHECKING([for placement new and delete]) | |
774 | AC_CACHE_VAL(ac_cv_override_placement_new_ok, | |
729e4ab9 | 775 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> |
374ca955 A |
776 | class UMemory { |
777 | public: | |
b75a7d8f A |
778 | void *operator new(size_t size) {return malloc(size);} |
779 | void *operator new[](size_t size) {return malloc(size);} | |
780 | void operator delete(void *p) {free(p);} | |
781 | void operator delete[](void *p) {free(p);} | |
782 | void * operator new(size_t, void *ptr) { return ptr; } | |
783 | void operator delete(void *, void *) {} | |
784 | }; | |
729e4ab9 | 785 | ]], [])],[ac_cv_override_placement_new_ok=yes],[ac_cv_override_placement_new_ok=no])] ) |
b75a7d8f A |
786 | AC_MSG_RESULT($ac_cv_override_placement_new_ok) |
787 | if test $ac_cv_override_placement_new_ok = yes | |
788 | then | |
789 | U_HAVE_PLACEMENT_NEW=1 | |
4388f060 A |
790 | else |
791 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_PLACEMENT_NEW=0" | |
b75a7d8f | 792 | fi |
4388f060 A |
793 | else |
794 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_OVERRIDE_CXX_ALLOCATION=0" | |
b75a7d8f A |
795 | fi |
796 | AC_SUBST(U_OVERRIDE_CXX_ALLOCATION) | |
797 | AC_SUBST(U_HAVE_PLACEMENT_NEW) | |
798 | ||
729e4ab9 | 799 | AC_LANG(C) |
b75a7d8f A |
800 | AC_CHECK_FUNC(popen) |
801 | if test x$ac_cv_func_popen = xyes | |
802 | then | |
803 | U_HAVE_POPEN=1 | |
804 | else | |
4388f060 | 805 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_POPEN=0" |
b75a7d8f A |
806 | U_HAVE_POPEN=0 |
807 | fi | |
808 | AC_SUBST(U_HAVE_POPEN) | |
809 | ||
810 | AC_CHECK_FUNC(tzset) | |
374ca955 | 811 | U_HAVE_TZSET=0 |
b75a7d8f A |
812 | if test x$ac_cv_func_tzset = xyes |
813 | then | |
814 | U_TZSET=tzset | |
374ca955 | 815 | U_HAVE_TZSET=1 |
b75a7d8f A |
816 | else |
817 | AC_CHECK_FUNC(_tzset) | |
818 | if test x$ac_cv_func__tzset = xyes | |
819 | then | |
374ca955 A |
820 | U_TZSET=_tzset |
821 | U_HAVE_TZSET=1 | |
4388f060 A |
822 | else |
823 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0" | |
b75a7d8f A |
824 | fi |
825 | fi | |
374ca955 | 826 | AC_SUBST(U_HAVE_TZSET) |
b75a7d8f | 827 | AC_SUBST(U_TZSET) |
374ca955 A |
828 | |
829 | U_HAVE_TZNAME=0 | |
b75a7d8f | 830 | AC_CACHE_CHECK(for tzname,ac_cv_var_tzname, |
729e4ab9 | 831 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef __USE_POSIX |
b75a7d8f A |
832 | #define __USE_POSIX |
833 | #endif | |
374ca955 | 834 | #include <stdlib.h> |
b75a7d8f A |
835 | #include <time.h> |
836 | #ifndef tzname /* For SGI. */ | |
837 | extern char *tzname[]; /* RS6000 and others reject char **tzname. */ | |
729e4ab9 | 838 | #endif]], [atoi(*tzname);])],[ac_cv_var_tzname=yes],[ac_cv_var_tzname=no])]) |
b75a7d8f A |
839 | if test $ac_cv_var_tzname = yes; then |
840 | U_TZNAME=tzname | |
374ca955 | 841 | U_HAVE_TZNAME=1 |
b75a7d8f A |
842 | else |
843 | AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname, | |
729e4ab9 | 844 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> |
374ca955 | 845 | #include <time.h> |
729e4ab9 | 846 | extern char *_tzname[];]], [atoi(*_tzname);])],[ac_cv_var__tzname=yes],[ac_cv_var__tzname=no])]) |
b75a7d8f A |
847 | if test $ac_cv_var__tzname = yes; then |
848 | U_TZNAME=_tzname | |
374ca955 | 849 | U_HAVE_TZNAME=1 |
4388f060 A |
850 | else |
851 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0" | |
b75a7d8f A |
852 | fi |
853 | fi | |
374ca955 | 854 | AC_SUBST(U_HAVE_TZNAME) |
b75a7d8f A |
855 | AC_SUBST(U_TZNAME) |
856 | ||
857 | AC_CACHE_CHECK(for timezone,ac_cv_var_timezone, | |
729e4ab9 | 858 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifndef __USE_POSIX |
b75a7d8f A |
859 | #define __USE_POSIX |
860 | #endif | |
861 | #ifndef __USE_XOPEN | |
862 | #define __USE_XOPEN | |
863 | #endif | |
864 | #include <time.h> | |
729e4ab9 | 865 | ], [[timezone = 1;]])],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no])]) |
b75a7d8f A |
866 | U_HAVE_TIMEZONE=0 |
867 | if test $ac_cv_var_timezone = yes; then | |
868 | U_TIMEZONE=timezone | |
869 | U_HAVE_TIMEZONE=1 | |
870 | else | |
871 | AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone, | |
729e4ab9 | 872 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[__timezone = 1;]])],[ac_cv_var___timezone=yes],[ac_cv_var___timezone=no])]) |
b75a7d8f A |
873 | if test $ac_cv_var___timezone = yes; then |
874 | U_TIMEZONE=__timezone | |
875 | U_HAVE_TIMEZONE=1 | |
876 | else | |
877 | AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone, | |
729e4ab9 | 878 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[_timezone = 1;]])],[ac_cv_var__timezone=yes],[ac_cv_var__timezone=no])]) |
b75a7d8f A |
879 | if test $ac_cv_var__timezone = yes; then |
880 | U_TIMEZONE=_timezone | |
881 | U_HAVE_TIMEZONE=1 | |
4388f060 A |
882 | else |
883 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TIMEZONE=0" | |
b75a7d8f A |
884 | fi |
885 | fi | |
886 | fi | |
887 | AC_SUBST(U_HAVE_TIMEZONE) | |
888 | AC_SUBST(U_TIMEZONE) | |
889 | ||
729e4ab9 | 890 | # Checks for typedefs |
b75a7d8f A |
891 | AC_CHECK_TYPE(int8_t,signed char) |
892 | AC_CHECK_TYPE(uint8_t,unsigned char) | |
893 | AC_CHECK_TYPE(int16_t,signed short) | |
894 | AC_CHECK_TYPE(uint16_t,unsigned short) | |
895 | AC_CHECK_TYPE(int32_t,signed long) | |
896 | AC_CHECK_TYPE(uint32_t,unsigned long) | |
897 | AC_CHECK_TYPE(int64_t,signed long long) | |
898 | AC_CHECK_TYPE(uint64_t,unsigned long long) | |
899 | ||
900 | if test $ac_cv_type_int8_t = no; then | |
4388f060 | 901 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT8_T=0" |
b75a7d8f | 902 | fi |
b75a7d8f A |
903 | |
904 | if test $ac_cv_type_uint8_t = no; then | |
4388f060 | 905 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT8_T=0" |
b75a7d8f | 906 | fi |
b75a7d8f A |
907 | |
908 | if test $ac_cv_type_int16_t = no; then | |
4388f060 | 909 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT16_T=0" |
b75a7d8f | 910 | fi |
b75a7d8f A |
911 | |
912 | if test $ac_cv_type_uint16_t = no; then | |
4388f060 | 913 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT16_T=0" |
b75a7d8f | 914 | fi |
b75a7d8f A |
915 | |
916 | if test $ac_cv_type_int32_t = no; then | |
4388f060 | 917 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT32_T=0" |
b75a7d8f | 918 | fi |
b75a7d8f A |
919 | |
920 | if test $ac_cv_type_uint32_t = no; then | |
4388f060 | 921 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT32_T=0" |
b75a7d8f | 922 | fi |
b75a7d8f A |
923 | |
924 | if test $ac_cv_type_int64_t = no; then | |
4388f060 | 925 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT64_T=0" |
b75a7d8f | 926 | fi |
b75a7d8f A |
927 | |
928 | if test $ac_cv_type_uint64_t = no; then | |
4388f060 | 929 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT64_T=0" |
b75a7d8f | 930 | fi |
b75a7d8f | 931 | |
729e4ab9 | 932 | # Do various wchar_t related checks |
b75a7d8f A |
933 | AC_CHECK_HEADER(wchar.h) |
934 | if test "$ac_cv_header_wchar_h" = no | |
935 | then | |
936 | U_HAVE_WCHAR_H=0 | |
937 | U_HAVE_WCSCPY=0 | |
4388f060 | 938 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCHAR_H=0 -DU_HAVE_WCSCPY=0" |
b75a7d8f | 939 | else |
729e4ab9 | 940 | AC_DEFINE([HAVE_WCHAR_H], [1], [wchar.h was found.]) |
b75a7d8f | 941 | U_HAVE_WCHAR_H=1 |
729e4ab9 | 942 | # Some broken systems have wchar.h but not some of its functions... |
b75a7d8f A |
943 | AC_SEARCH_LIBS(wcscpy, wcs w) |
944 | if test "$ac_cv_search_wcscpy" != no; then | |
945 | U_HAVE_WCSCPY=1 | |
946 | else | |
947 | U_HAVE_WCSCPY=0 | |
4388f060 | 948 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCSCPY=0" |
b75a7d8f A |
949 | fi |
950 | fi | |
951 | AC_SUBST(U_HAVE_WCHAR_H) | |
952 | AC_SUBST(U_HAVE_WCSCPY) | |
953 | ||
46f4442e | 954 | AC_CHECK_SIZEOF([wchar_t], 0, [ |
b75a7d8f A |
955 | #if STDC_HEADERS |
956 | #include <stddef.h> | |
957 | #endif | |
73c04bcf | 958 | #include <stdlib.h> |
b75a7d8f A |
959 | #if HAVE_WCHAR_H |
960 | #include <string.h> | |
961 | #include <wchar.h> | |
962 | #endif]) | |
b75a7d8f | 963 | U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t |
46f4442e | 964 | # We do this check to verify that everything is okay. |
b75a7d8f | 965 | if test $U_SIZEOF_WCHAR_T = 0; then |
46f4442e A |
966 | if test $U_HAVE_WCHAR_H=1; then |
967 | AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0) | |
968 | fi | |
b75a7d8f | 969 | fi |
b75a7d8f | 970 | |
46f4442e A |
971 | AC_MSG_CHECKING([for UTF-16 string literal support]) |
972 | U_CHECK_UTF16_STRING=1 | |
973 | CHECK_UTF16_STRING_RESULT="unknown" | |
729e4ab9 | 974 | |
46f4442e A |
975 | case "${host}" in |
976 | *-*-aix*|powerpc64-*-linux*) | |
51004dcb | 977 | if test "$GCC" = no; then |
46f4442e A |
978 | OLD_CFLAGS="${CFLAGS}" |
979 | OLD_CXXFLAGS="${CXXFLAGS}" | |
980 | CFLAGS="${CFLAGS} -qutf" | |
981 | CXXFLAGS="${CXXFLAGS} -qutf" | |
729e4ab9 | 982 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = u"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0]) |
46f4442e A |
983 | if test "$U_CHECK_UTF16_STRING" = 0; then |
984 | CFLAGS="${OLD_CFLAGS}" | |
985 | CXXFLAGS="${OLD_CXXFLAGS}" | |
986 | else | |
57a6839d | 987 | UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -qutf" |
46f4442e A |
988 | CHECK_UTF16_STRING_RESULT="-qutf" |
989 | fi | |
990 | fi | |
991 | ;; | |
992 | *-*-solaris*) | |
51004dcb | 993 | if test "$GCC" = no; then |
46f4442e A |
994 | OLD_CFLAGS="${CFLAGS}" |
995 | OLD_CXXFLAGS="${CXXFLAGS}" | |
996 | CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort" | |
997 | CXXFLAGS="${CXXFLAGS} -xustr=ascii_utf16_ushort" | |
729e4ab9 | 998 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = U"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0]) |
46f4442e A |
999 | if test "$U_CHECK_UTF16_STRING" = 0; then |
1000 | CFLAGS="${OLD_CFLAGS}" | |
1001 | CXXFLAGS="${OLD_CXXFLAGS}" | |
1002 | else | |
1003 | CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort" | |
57a6839d A |
1004 | UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -xustr=ascii_utf16_ushort" |
1005 | UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -xustr=ascii_utf16_ushort" | |
46f4442e A |
1006 | # Since we can't detect the availability of this UTF-16 syntax at compile time, |
1007 | # we depend on configure telling us that we can use it. | |
1008 | # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort, | |
1009 | # we only use this macro within ICU. | |
1010 | # If an ICU user uses icu-config, this feature will be enabled. | |
4388f060 | 1011 | CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_CHECK_UTF16_STRING=1" |
46f4442e A |
1012 | U_CHECK_UTF16_STRING=0 |
1013 | fi | |
1014 | fi | |
1015 | ;; | |
1016 | *-*-hpux*) | |
51004dcb | 1017 | if test "$GCC" = no; then |
729e4ab9 | 1018 | # The option will be detected at compile time without additional compiler options. |
46f4442e A |
1019 | CHECK_UTF16_STRING_RESULT="available" |
1020 | fi | |
1021 | ;; | |
1022 | *-*-cygwin) | |
729e4ab9 | 1023 | # wchar_t can be used |
46f4442e A |
1024 | CHECK_UTF16_STRING_RESULT="available" |
1025 | ;; | |
1026 | *) | |
1027 | ;; | |
1028 | esac | |
729e4ab9 A |
1029 | |
1030 | # GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future. | |
51004dcb A |
1031 | if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then |
1032 | if test "$GCC" = yes; then | |
729e4ab9 | 1033 | OLD_CFLAGS="${CFLAGS}" |
51004dcb | 1034 | CFLAGS="${CFLAGS} -std=gnu99" |
729e4ab9 | 1035 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
51004dcb A |
1036 | static const char16_t test[] = u"This is a UTF16 literal string."; |
1037 | ]], [[]])],[CC_UTF16_STRING=1],[CC_UTF16_STRING=0]) | |
1038 | if test "$CC_UTF16_STRING" = 1; then | |
57a6839d | 1039 | UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -std=gnu99" |
51004dcb | 1040 | CHECK_UTF16_STRING_RESULT="C only"; |
729e4ab9 A |
1041 | else |
1042 | CFLAGS="${OLD_CFLAGS}" | |
51004dcb A |
1043 | fi |
1044 | fi | |
1045 | if test "$GXX" = yes; then | |
51004dcb | 1046 | # -Wno-return-type-c-linkage is desired so that stable ICU API is not warned about. |
51004dcb A |
1047 | AC_LANG_PUSH([C++]) |
1048 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1049 | static const char16_t test[] = u"This is a UTF16 literal string."; | |
1050 | ]], [[]])],[CXX_UTF16_STRING=1],[CXX_UTF16_STRING=0]) | |
1051 | AC_LANG_POP([C++]) | |
1052 | if test "$CXX_UTF16_STRING" = 1; then | |
1053 | if test "$CC_UTF16_STRING" = 1; then | |
1054 | CHECK_UTF16_STRING_RESULT="available"; | |
1055 | else | |
1056 | CHECK_UTF16_STRING_RESULT="C++ only"; | |
1057 | fi | |
729e4ab9 A |
1058 | fi |
1059 | fi | |
1060 | fi | |
46f4442e | 1061 | AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT) |
b75a7d8f | 1062 | |
729e4ab9 | 1063 | # Enable/disable extras |
b75a7d8f A |
1064 | AC_ARG_ENABLE(extras, |
1065 | [ --enable-extras build ICU extras [default=yes]], | |
1066 | [case "${enableval}" in | |
1067 | yes) extras=true ;; | |
1068 | no) extras=false ;; | |
1069 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;; | |
57a6839d | 1070 | esac], |
b75a7d8f A |
1071 | extras=true) |
1072 | ICU_CONDITIONAL(EXTRAS, test "$extras" = true) | |
73c04bcf | 1073 | AC_ARG_ENABLE(icuio, |
374ca955 | 1074 | [ --enable-icuio build ICU's icuio library [default=yes]], |
b75a7d8f | 1075 | [case "${enableval}" in |
374ca955 A |
1076 | yes) icuio=true ;; |
1077 | no) icuio=false ;; | |
1078 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;; | |
57a6839d | 1079 | esac], |
374ca955 A |
1080 | icuio=true) |
1081 | ICU_CONDITIONAL(ICUIO, test "$icuio" = true) | |
b75a7d8f | 1082 | |
729e4ab9 | 1083 | # Enable/disable layout |
b75a7d8f | 1084 | AC_ARG_ENABLE(layout, |
b331163b | 1085 | [ --enable-layout build ICU's DEPRECATED layout library [default=yes]], |
b75a7d8f A |
1086 | [case "${enableval}" in |
1087 | yes) layout=true ;; | |
1088 | no) layout=false ;; | |
1089 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;; | |
57a6839d | 1090 | esac], |
b75a7d8f A |
1091 | layout=true) |
1092 | ICU_CONDITIONAL(LAYOUT, test "$layout" = true) | |
1093 | ||
b331163b A |
1094 | # Enable/disable layoutex |
1095 | AC_ARG_ENABLE(layoutex, | |
1096 | [ --enable-layoutex build ICU's Paragraph Layout library [default=same-as-layout]. | |
1097 | If not building with the ICU Layout library, then icu-le-hb must be installed via pkg-config. | |
1098 | See http://harfbuzz.org], | |
1099 | [case "${enableval}" in | |
1100 | yes) layoutex=true ;; | |
1101 | no) layoutex=false ;; | |
1102 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-layoutex) ;; | |
1103 | esac], | |
1104 | layoutex=$layout) | |
1105 | ICU_CONDITIONAL(LAYOUTEX, test "$layoutex" = true) | |
1106 | ||
57a6839d A |
1107 | # Enable/disable tools |
1108 | AC_ARG_ENABLE(tools, | |
1109 | [ --enable-tools build ICU's tools [default=yes]], | |
1110 | [case "${enableval}" in | |
1111 | yes) tools=true ;; | |
1112 | no) tools=false ;; | |
1113 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;; | |
1114 | esac], | |
1115 | tools=true) | |
1116 | ICU_CONDITIONAL(TOOLS, test "$tools" = true) | |
1117 | ||
b75a7d8f | 1118 | AC_ARG_WITH(data-packaging, |
b331163b A |
1119 | [ --with-data-packaging specify how to package ICU data. Possible values: |
1120 | files raw files (.res, etc) | |
1121 | archive build a single icudtXX.dat file | |
1122 | library shared library (.dll/.so/etc.) | |
1123 | static static library (.a/.lib/etc.) | |
1124 | auto build shared if possible (default) | |
1125 | See http://userguide.icu-project.org/icudata for more info.], | |
b75a7d8f A |
1126 | [case "${withval}" in |
1127 | files|archive|library) datapackaging=$withval ;; | |
1128 | auto) datapackaging=$withval ;; | |
1129 | common) datapackaging=archive ;; | |
1130 | dll) datapackaging=library ;; | |
374ca955 A |
1131 | static) datapackaging=static ;; |
1132 | *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;; | |
57a6839d | 1133 | esac], |
b75a7d8f A |
1134 | [datapackaging=]) |
1135 | ||
57a6839d | 1136 | # Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc.. |
729e4ab9 A |
1137 | # thesysconfdir=`eval echo $sysconfdir` |
1138 | dnl# AC_SUBST(thesysconfdir) | |
1139 | dnl# thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir` | |
1140 | dnl# AC_SUBST(thelibdir) | |
b75a7d8f | 1141 | thedatadir=`eval echo $datadir` |
729e4ab9 | 1142 | dnl# AC_SUBST(thedatadir) |
57a6839d | 1143 | # Always put raw data files in share/icu/{version}, etc. Never use lib/icu/{version} for data files.. Actual shared libraries will go in {libdir}. |
374ca955 A |
1144 | pkgicudatadir=$datadir |
1145 | thepkgicudatadir=$thedatadir | |
b75a7d8f A |
1146 | AC_SUBST(pkgicudatadir) |
1147 | AC_SUBST(thepkgicudatadir) | |
1148 | ||
729e4ab9 | 1149 | dnl# Shouldn't need the AC_SUBST |
b75a7d8f A |
1150 | |
1151 | if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then | |
729e4ab9 | 1152 | # default to library |
b75a7d8f | 1153 | datapackaging=library |
729e4ab9 A |
1154 | if test "$ENABLE_STATIC" = "YES"; then |
1155 | if test "$ENABLE_SHARED" != "YES"; then | |
1156 | datapackaging=static | |
1157 | fi | |
1158 | fi | |
b75a7d8f A |
1159 | fi |
1160 | ||
729e4ab9 A |
1161 | datapackaging_dir=`eval echo $thedatadir`"/icu/${VERSION}" |
1162 | ||
1163 | datapackaging_msg="(No explaination for mode $datapackaging.)" | |
1164 | ||
1165 | datapackaging_msg_path="ICU will look in $datapackaging_dir which is the installation location. Call u_setDataDirectory() or use the ICU_DATA environment variable to override." | |
57a6839d | 1166 | datapackaging_msg_set="ICU will use the linked data library. If linked with the stub library located in stubdata/, the application can use udata_setCommonData() or set a data path to override." |
729e4ab9 A |
1167 | datapackaging_howfound="(unknown)" |
1168 | ||
b75a7d8f A |
1169 | case "$datapackaging" in |
1170 | files) | |
729e4ab9 A |
1171 | DATA_PACKAGING_MODE=files |
1172 | datapackaging_msg="ICU data will be stored in individual files." | |
1173 | datapackaging_howfound="$datapackaging_msg_path" | |
1174 | ;; | |
b75a7d8f | 1175 | archive) |
729e4ab9 A |
1176 | DATA_PACKAGING_MODE=common |
1177 | datapackaging_msg="ICU data will be stored in a single .dat file." | |
1178 | datapackaging_howfound="$datapackaging_msg_path" | |
1179 | ;; | |
b75a7d8f | 1180 | library) |
729e4ab9 A |
1181 | DATA_PACKAGING_MODE=dll |
1182 | datapackaging_msg="ICU data will be linked with ICU." | |
1183 | if test "$ENABLE_STATIC" = "YES"; then | |
1184 | datapackaging_msg="$datapackaging_msg A static data library will be built. " | |
1185 | fi | |
1186 | if test "$ENABLE_SHARED" = "YES"; then | |
1187 | datapackaging_msg="$datapackaging_msg A shared data library will be built. " | |
1188 | fi | |
1189 | datapackaging_howfound="$datapackaging_msg_set" | |
1190 | ;; | |
1191 | static) | |
1192 | DATA_PACKAGING_MODE=static | |
1193 | datapackaging_msg="ICU data will be stored in a static library." | |
1194 | datapackaging_howfound="$datapackaging_msg_set" | |
1195 | ;; | |
b75a7d8f | 1196 | esac |
b75a7d8f A |
1197 | AC_SUBST(DATA_PACKAGING_MODE) |
1198 | ||
729e4ab9 | 1199 | # Sets a library suffix |
b75a7d8f A |
1200 | AC_MSG_CHECKING([for a library suffix to use]) |
1201 | AC_ARG_WITH(library-suffix, | |
1202 | [ --with-library-suffix=suffix tag a suffix to the library names [default=]], | |
1203 | [ICULIBSUFFIX="${withval}"], | |
1204 | [ICULIBSUFFIX=]) | |
1205 | msg=$ICULIBSUFFIX | |
1206 | if test "$msg" = ""; then | |
1207 | msg=none | |
1208 | fi | |
1209 | AC_MSG_RESULT($msg) | |
1210 | AC_SUBST(ICULIBSUFFIX) | |
b75a7d8f A |
1211 | if test "$ICULIBSUFFIX" != "" |
1212 | then | |
1213 | U_HAVE_LIB_SUFFIX=1 | |
1214 | ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'` | |
4388f060 | 1215 | UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} " |
b75a7d8f A |
1216 | else |
1217 | U_HAVE_LIB_SUFFIX=0 | |
1218 | fi | |
b75a7d8f A |
1219 | AC_SUBST(U_HAVE_LIB_SUFFIX) |
1220 | AC_SUBST(ICULIBSUFFIXCNAME) | |
1221 | ||
729e4ab9 | 1222 | # Enable/disable tests |
b75a7d8f A |
1223 | AC_ARG_ENABLE(tests, |
1224 | [ --enable-tests build ICU tests [default=yes]], | |
1225 | [case "${enableval}" in | |
1226 | yes) tests=true ;; | |
1227 | no) tests=false ;; | |
1228 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; | |
57a6839d | 1229 | esac], |
b75a7d8f A |
1230 | tests=true) |
1231 | ICU_CONDITIONAL(TESTS, test "$tests" = true) | |
1232 | ||
729e4ab9 | 1233 | # Enable/disable samples |
b75a7d8f | 1234 | AC_ARG_ENABLE(samples, |
57a6839d | 1235 | [ --enable-samples build ICU samples [default=yes] |
46f4442e A |
1236 | |
1237 | Additionally, the variable FORCE_LIBS may be set before calling configure. | |
1238 | If set, it will REPLACE any automatic list of libraries.], | |
b75a7d8f A |
1239 | [case "${enableval}" in |
1240 | yes) samples=true ;; | |
1241 | no) samples=false ;; | |
1242 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;; | |
57a6839d | 1243 | esac], |
b75a7d8f A |
1244 | samples=true) |
1245 | ICU_CONDITIONAL(SAMPLES, test "$samples" = true) | |
1246 | ||
1247 | ICUDATA_CHAR=$U_ENDIAN_CHAR | |
1248 | ||
729e4ab9 A |
1249 | # Platform-specific Makefile setup |
1250 | # set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform. | |
b75a7d8f A |
1251 | case "${host}" in |
1252 | *-*-solaris*) platform=U_SOLARIS ;; | |
729e4ab9 | 1253 | *-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) platform=U_LINUX ;; |
73c04bcf | 1254 | *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;; |
374ca955 A |
1255 | *-*-aix*) platform=U_AIX ;; |
1256 | *-*-hpux*) platform=U_HPUX ;; | |
b75a7d8f | 1257 | *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; |
4388f060 A |
1258 | *-*-cygwin*) platform=U_CYGWIN ;; |
1259 | *-*-mingw*) platform=U_MINGW ;; | |
b75a7d8f | 1260 | *-*ibm-openedition*|*-*-os390*) platform=OS390 |
73c04bcf A |
1261 | if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then |
1262 | ICUDATA_CHAR="e" | |
1263 | fi ;; | |
b75a7d8f | 1264 | *-*-os400*) platform=OS400 |
73c04bcf A |
1265 | if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then |
1266 | ICUDATA_CHAR="e" | |
1267 | fi ;; | |
b75a7d8f A |
1268 | *-*-nto*) platform=U_QNX ;; |
1269 | *-dec-osf*) platform=U_OSF ;; | |
374ca955 A |
1270 | *-*-beos) platform=U_BEOS ;; |
1271 | *-*-irix*) platform=U_IRIX ;; | |
1272 | *-ncr-*) platform=U_MPRAS ;; | |
b75a7d8f A |
1273 | *) platform=U_UNKNOWN_PLATFORM ;; |
1274 | esac | |
1275 | AC_SUBST(ICUDATA_CHAR) | |
1276 | AC_SUBST(platform) | |
1277 | platform_make_fragment_name="$icu_cv_host_frag" | |
1278 | platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name" | |
1279 | AC_SUBST(platform_make_fragment_name) | |
1280 | AC_SUBST(platform_make_fragment) | |
1281 | ||
b75a7d8f A |
1282 | if test "${FORCE_LIBS}" != ""; then |
1283 | echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6 | |
1284 | LIBS=${FORCE_LIBS} | |
1285 | fi | |
1286 | ||
729e4ab9 A |
1287 | # Now that we're done using CPPFLAGS etc. for tests, we can change it |
1288 | # for build. | |
b75a7d8f | 1289 | |
57a6839d A |
1290 | if test "${CC}" == "clang"; then |
1291 | CLANGCFLAGS="-Qunused-arguments -Wno-parentheses-equality" | |
1292 | else | |
1293 | CLANGCFLAGS="" | |
1294 | fi | |
1295 | ||
1296 | if test "${CXX}" == "clang++"; then | |
1297 | CLANGCXXFLAGS="-Qunused-arguments -Wno-parentheses-equality" | |
1298 | else | |
1299 | CLANGCXXFLAGS="" | |
1300 | fi | |
1301 | ||
51004dcb | 1302 | CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)" |
57a6839d A |
1303 | CFLAGS="$CFLAGS \$(THREADSCFLAGS) $CLANGCFLAGS" |
1304 | CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS) $CLANGCXXFLAGS" | |
b75a7d8f | 1305 | |
4388f060 A |
1306 | AC_SUBST(LIBCFLAGS) |
1307 | AC_SUBST(LIBCXXFLAGS) | |
1308 | ||
1309 | # append all config cppflags | |
1310 | CPPFLAGS="$CPPFLAGS $CONFIG_CPPFLAGS $UCONFIG_CPPFLAGS" | |
1311 | ||
1312 | echo "CPPFLAGS=$CPPFLAGS" | |
1313 | echo "CFLAGS=$CFLAGS" | |
1314 | echo "CXXFLAGS=$CXXFLAGS" | |
1315 | ||
1316 | ||
729e4ab9 A |
1317 | # output the Makefiles |
1318 | AC_CONFIG_FILES([icudefs.mk \ | |
b75a7d8f | 1319 | Makefile \ |
729e4ab9 | 1320 | data/pkgdataMakefile \ |
374ca955 | 1321 | config/Makefile.inc \ |
729e4ab9 A |
1322 | config/icu.pc \ |
1323 | config/pkgdataMakefile \ | |
374ca955 A |
1324 | data/Makefile \ |
1325 | stubdata/Makefile \ | |
1326 | common/Makefile \ | |
1327 | i18n/Makefile \ | |
b75a7d8f A |
1328 | layout/Makefile \ |
1329 | layoutex/Makefile \ | |
374ca955 A |
1330 | io/Makefile \ |
1331 | extra/Makefile \ | |
73c04bcf | 1332 | extra/uconv/Makefile \ |
729e4ab9 | 1333 | extra/uconv/pkgdataMakefile \ |
73c04bcf A |
1334 | extra/scrptrun/Makefile \ |
1335 | tools/Makefile \ | |
1336 | tools/ctestfw/Makefile \ | |
1337 | tools/toolutil/Makefile \ | |
374ca955 A |
1338 | tools/makeconv/Makefile \ |
1339 | tools/genrb/Makefile \ | |
374ca955 A |
1340 | tools/genccode/Makefile \ |
1341 | tools/gencmn/Makefile \ | |
1342 | tools/gencnval/Makefile \ | |
51004dcb | 1343 | tools/gendict/Makefile \ |
b75a7d8f | 1344 | tools/gentest/Makefile \ |
729e4ab9 | 1345 | tools/gennorm2/Makefile \ |
b75a7d8f | 1346 | tools/genbrk/Makefile \ |
374ca955 | 1347 | tools/gensprep/Makefile \ |
729e4ab9 | 1348 | tools/icuinfo/Makefile \ |
73c04bcf | 1349 | tools/icupkg/Makefile \ |
374ca955 A |
1350 | tools/icuswap/Makefile \ |
1351 | tools/pkgdata/Makefile \ | |
73c04bcf | 1352 | tools/tzcode/Makefile \ |
729e4ab9 | 1353 | tools/gencfu/Makefile \ |
374ca955 | 1354 | test/Makefile \ |
46f4442e | 1355 | test/compat/Makefile \ |
374ca955 | 1356 | test/testdata/Makefile \ |
729e4ab9 | 1357 | test/testdata/pkgdataMakefile \ |
374ca955 | 1358 | test/hdrtst/Makefile \ |
b75a7d8f A |
1359 | test/intltest/Makefile \ |
1360 | test/cintltst/Makefile \ | |
1361 | test/iotest/Makefile \ | |
b75a7d8f | 1362 | test/letest/Makefile \ |
46f4442e A |
1363 | test/perf/Makefile \ |
1364 | test/perf/collationperf/Makefile \ | |
51004dcb | 1365 | test/perf/collperf/Makefile \ |
57a6839d | 1366 | test/perf/collperf2/Makefile \ |
4388f060 | 1367 | test/perf/dicttrieperf/Makefile \ |
46f4442e A |
1368 | test/perf/ubrkperf/Makefile \ |
1369 | test/perf/charperf/Makefile \ | |
1370 | test/perf/convperf/Makefile \ | |
1371 | test/perf/normperf/Makefile \ | |
729e4ab9 | 1372 | test/perf/DateFmtPerf/Makefile \ |
4388f060 | 1373 | test/perf/howExpensiveIs/Makefile \ |
46f4442e A |
1374 | test/perf/strsrchperf/Makefile \ |
1375 | test/perf/unisetperf/Makefile \ | |
1376 | test/perf/usetperf/Makefile \ | |
1377 | test/perf/ustrperf/Makefile \ | |
1378 | test/perf/utfperf/Makefile \ | |
729e4ab9 | 1379 | test/perf/utrie2perf/Makefile \ |
57a6839d | 1380 | test/perf/leperf/Makefile \ |
b75a7d8f | 1381 | samples/Makefile samples/date/Makefile \ |
4388f060 | 1382 | samples/cal/Makefile samples/layout/Makefile]) |
729e4ab9 A |
1383 | AC_OUTPUT |
1384 | ||
57a6839d | 1385 | echo |
729e4ab9 A |
1386 | echo "ICU for C/C++ $VERSION is ready to be built." |
1387 | echo "=== Important Notes: ===" | |
b75a7d8f | 1388 | |
729e4ab9 A |
1389 | echo "Data Packaging: $datapackaging" |
1390 | echo " This means: $datapackaging_msg" | |
1391 | echo " To locate data: $datapackaging_howfound" | |
1392 | ||
73c04bcf | 1393 | if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then |
729e4ab9 | 1394 | echo "Building ICU: Use a GNU make such as $U_MAKE to build ICU." |
73c04bcf | 1395 | else |
729e4ab9 | 1396 | echo "** WARNING: $U_MAKE may not be GNU make." |
73c04bcf | 1397 | echo "This may cause ICU to fail to build. Please make sure that GNU make" |
729e4ab9 A |
1398 | echo "is in your PATH so that the configure script can detect its location." |
1399 | fi | |
4388f060 A |
1400 | if test "x$AR" = "xfalse"; then |
1401 | echo "*** WARNING: Archiver ar not found. Set AR= or fix PATH. Some builds (such as static) may fail." | |
1402 | fi | |
729e4ab9 A |
1403 | |
1404 | AC_MSG_CHECKING([the version of "$U_MAKE"]) | |
1405 | if "$U_MAKE" -f "$srcdir/config/gmakever.mk" PLATFORM="$platform"; then | |
1406 | AC_MSG_RESULT([ok]) | |
1407 | else | |
1408 | AC_MSG_RESULT([too old or test failed - try upgrading GNU Make]) | |
73c04bcf A |
1409 | fi |
1410 | ||
57a6839d | 1411 | AC_SUBST(UCONFIG_CPPFLAGS) |
4388f060 A |
1412 | if test -n "$UCONFIG_CPPFLAGS"; then |
1413 | HDRFILE="uconfig.h.prepend" | |
1414 | echo "*** WARNING: You must set the following flags before code compiled against this ICU will function properly:" | |
57a6839d | 1415 | echo |
4388f060 A |
1416 | echo " ${UCONFIG_CPPFLAGS}" |
1417 | echo | |
1418 | echo 'The recommended way to do this is to prepend the following lines to source/common/unicode/uconfig.h or #include them near the top of that file.' | |
1419 | echo "Creating the file ${HDRFILE}" | |
1420 | echo | |
1421 | echo '--------------- ' "${HDRFILE}" | |
1422 | echo > "${HDRFILE}" | |
1423 | echo '/* ICU customizations: put these lines at the top of uconfig.h */' >> "${HDRFILE}" | |
1424 | echo >> "${HDRFILE}" | |
1425 | for flag in ${UCONFIG_CPPFLAGS}; | |
1426 | do | |
1427 | echo " /* $flag */" >> "${HDRFILE}" | |
1428 | case "${flag}" in | |
1429 | -D*=*) | |
1430 | [ \echo "${flag}" | sed -n 's%-D\([^=]*\)=%#define \1 %p' >> "${HDRFILE}" ] | |
1431 | \echo >> "${HDRFILE}" | |
1432 | ;; | |
1433 | -D*) | |
1434 | [ \echo "${flag}" | sed -n 's%-D\([^=]*\)%#define \1 %p' >> "${HDRFILE}" ] | |
1435 | \echo >> "${HDRFILE}" | |
1436 | ;; | |
1437 | *) | |
1438 | \echo "/* Not sure how to handle this argument: ${flag} */" >> "${HDRFILE}" | |
1439 | \echo >> "${HDRFILE}" | |
1440 | ;; | |
1441 | esac | |
1442 | done | |
1443 | cat "${HDRFILE}" | |
1444 | \echo "/* End of ${HDRFILE} ------------ */" >> "${HDRFILE}" | |
1445 | echo >> "${HDRFILE}" | |
1446 | echo '--------------- end ' "${HDRFILE}" | |
1447 | fi | |
1448 | ||
57a6839d A |
1449 | AC_SUBST(UCONFIG_CFLAGS) |
1450 | if test -n "$UCONFIG_CFLAGS"; then | |
1451 | echo "C apps may want to build with CFLAGS = ${UCONFIG_CFLAGS}" | |
1452 | fi | |
1453 | AC_SUBST(UCONFIG_CXXFLAGS) | |
1454 | if test -n "$UCONFIG_CXXFLAGS"; then | |
1455 | echo "C++ apps may want to build with CXXFLAGS = ${UCONFIG_CXXFLAGS}" | |
1456 | fi | |
1457 | ||
1458 | if test "$tools" = false; | |
1459 | then | |
1460 | echo "## Note: you have disabled ICU's tools. This ICU cannot build its own data or tests." | |
1461 | echo "## Expect build failures in the 'data', 'test', and other directories." | |
1462 | fi | |
1463 | ||
73c04bcf | 1464 | $as_unset _CXX_CXXSUFFIX |