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