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