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