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