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