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