2 dnl configure.in for ICU
3 dnl Copyright (c) 1999-2008, International Business Machines Corporation and
4 dnl others. All Rights Reserved.
5 dnl Stephen F. Booth, heavily modified by Yves and others
7 dnl Process this file with autoconf to produce a configure script
8 AC_INIT(common/unicode/utypes.h)
10 AC_CONFIG_HEADER(common/icucfg.h)
14 AC_MSG_CHECKING(for ICU version numbers)
16 dnl Get the ICU version from uversion.h or other headers
18 [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"]
20 VERSION=`geticuversion $srcdir/common/unicode/uversion.h`
21 if test x"$VERSION" = x; then
22 VERSION=`geticuversion $srcdir/common/unicode/*.h`
23 if test x"$VERSION" = x; then
24 AC_MSG_ERROR([Cannot determine ICU version number from header files])
27 dnl Compute a reasonable library version from the release version. This is
28 dnl very bad, but that's wanted... We want to make sure that the LIB_VERSION
29 dnl has at least a dot in it, so we'll add a .0 if needed.
30 [LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`]
31 LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'`
34 AC_SUBST(LIB_VERSION_MAJOR)
35 AC_MSG_RESULT([release $VERSION, library $LIB_VERSION])
38 AC_SUBST(UNICODE_VERSION)
40 dnl Determine the host system
45 dnl This variable is needed on z/OS because the C++ compiler only recognizes .C
48 dnl Checks for programs
53 # make sure install is relative to srcdir - if a script
54 if test "$srcdir" = "."; then
55 # If srcdir isn't just ., then (srcdir) is already prepended.
56 if test "${ac_install_sh}" = "${INSTALL}"; then
57 INSTALL="\\\$(top_srcdir)/${ac_install_sh}"
61 #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
62 #AC_CHECK_PROG(STRIP, strip, strip, true)
64 dnl Check for the platform make
65 AC_PATH_PROGS(U_MAKE, gmake gnumake, make)
68 dnl Check for doxygen to generate documentation
69 AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin)
71 dnl Check that the linker is usable
74 dnl Determine the executable suffix
75 dnl We don't use AC_EXEEXT because some compilers output separate debugging
76 dnl files, which confuses the AC_EXEEXT macro.
77 AC_MSG_CHECKING(checking for executable suffix)
79 *-*-cygwin*|*-*-mingw*) EXEEXT=.exe ;;
83 AC_MSG_RESULT($EXEEXT)
86 dnl Determine how strict we want to be when compiling
87 AC_CHECK_STRICT_COMPILE
89 dnl Check if we can build and use 64-bit libraries
92 AC_SUBST(COMPILE_LINK_ENVVAR)
94 dnl Determine the Makefile fragment
97 dnl Checks for libraries and other host specific stuff
98 dnl On HP/UX, don't link to -lm from a shared lib because it isn't
99 dnl PIC (at least on 10.2)
101 *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
103 *) AC_CHECK_LIB(m, floor)
108 dnl Check whether to build shared libraries
109 AC_MSG_CHECKING([whether to build shared libraries])
111 AC_ARG_ENABLE(shared,
112 [ --enable-shared build shared libraries [default=yes]],
113 [ case "${enableval}" in
114 yes|"") enabled=yes; ENABLE_SHARED=YES ;;
118 [enabled=yes; ENABLE_SHARED=YES]
120 AC_MSG_RESULT($enabled)
121 AC_SUBST(ENABLE_SHARED)
123 dnl Check whether to build static libraries
124 AC_MSG_CHECKING([whether to build static libraries])
126 AC_ARG_ENABLE(static,
127 [ --enable-static build static libraries [default=no]],
128 [ case "${enableval}" in
129 yes|"") enabled=yes; ENABLE_STATIC=YES ;;
134 AC_MSG_RESULT($enabled)
135 AC_SUBST(ENABLE_STATIC)
137 dnl Check whether to build debug libraries
138 AC_MSG_CHECKING([whether to build debug libraries])
142 [ --enable-debug build debug libraries [default=no]],
143 [ case "${enableval}" in
144 yes|"") enabled=yes; ENABLE_DEBUG=1 ;;
148 AC_MSG_RESULT($enabled)
149 AC_SUBST(ENABLE_DEBUG)
151 dnl Check whether to build release libraries
152 AC_MSG_CHECKING([whether to build release libraries])
155 AC_ARG_ENABLE(release,
156 [ --enable-release build release libraries [default=yes]],
157 [ case "${enableval}" in
158 no) enabled=no; ENABLE_RELEASE=0 ;;
162 AC_MSG_RESULT($enabled)
163 AC_SUBST(ENABLE_RELEASE)
165 dnl Check whether to enabled draft APIs
166 AC_MSG_CHECKING([whether to enable draft APIs])
168 U_DEFAULT_SHOW_DRAFT=1
170 [ --enable-draft enable draft APIs [default=yes]],
171 [ case "${enableval}" in
172 no) enabled=no; U_DEFAULT_SHOW_DRAFT=0 ;;
176 AC_MSG_RESULT($enabled)
177 dnl Make sure that we can use draft API in ICU.
178 if test "$U_DEFAULT_SHOW_DRAFT" = 0; then
179 CPPFLAGS="$CPPFLAGS -DU_SHOW_DRAFT_API"
181 AC_SUBST(U_DEFAULT_SHOW_DRAFT)
183 dnl Check if we can hide variables from
184 AC_MSG_CHECKING([for library API export])
186 U_USE_GCC_VISIBILITY_ATTRIBUTE=0
187 OLD_CFLAGS="${CFLAGS}"
188 OLD_CXXFLAGS="${CXXFLAGS}"
189 if test "$ac_cv_c_compiler_gnu" = yes; then
190 LIBCFLAGS="-fvisibility=hidden"
191 LIBCXXFLAGS="-fvisibility=hidden"
192 CFLAGS="${CFLAGS} ${LIBCFLAGS}"
193 CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
194 AC_TRY_LINK([__attribute__ ((visibility ("default"))) void f(void);
195 #include <stdlib.h>],[exit(0);],
196 [SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
197 if test "$SHAREDLIBEXPORT" = no; then
201 U_USE_GCC_VISIBILITY_ATTRIBUTE=1
206 LIBCFLAGS="-xldscope=hidden"
207 LIBCXXFLAGS="-xldscope=hidden"
208 CFLAGS="${CFLAGS} ${LIBCFLAGS}"
209 CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
210 AC_TRY_LINK([__global void f(void);
211 #include <stdlib.h>],[exit(0);],
212 [SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
213 if test "$SHAREDLIBEXPORT" = no; then
219 dnl ICU isn't set up to follow the HP syntax yet.
224 # Restore to their original state because the Intel compiler chokes
225 # on this option when checking for the wchar_t size, but the
226 # option otherwise works.
227 CFLAGS="${OLD_CFLAGS}"
228 CXXFLAGS="${OLD_CXXFLAGS}"
229 AC_MSG_RESULT($SHAREDLIBEXPORT)
230 AC_SUBST(U_USE_GCC_VISIBILITY_ATTRIBUTE)
232 AC_SUBST(LIBCXXFLAGS)
235 AC_PATH_PROG(AR,ar,[echo archiver ar not found re-run configure ; false],$PATH:/bin:/usr/bin:/usr/ccs/bin)
237 AC_MSG_CHECKING([whether to enable renaming of symbols])
240 AC_ARG_ENABLE(renaming,
241 [ --enable-renaming add a version suffix to symbols [default=yes]],
242 [ case "${enableval}" in
243 yes|"") enabled=yes ;;
244 no) enabled=no; U_DISABLE_RENAMING=1 ;;
248 AC_MSG_RESULT($enabled)
249 AC_SUBST(U_DISABLE_RENAMING)
251 AC_MSG_CHECKING([whether to enable function and data tracing])
254 AC_ARG_ENABLE(tracing,
255 [ --enable-tracing enable function and data tracing [default=no]],
256 [ case "${enableval}" in
257 yes|"") enabled=yes ;;
258 no) enabled=no; U_ENABLE_TRACING=0 ;;
262 AC_MSG_RESULT($enabled)
263 AC_SUBST(U_ENABLE_TRACING)
265 dnl Check whether to use the evil rpath or not
267 [ --enable-rpath use rpath when linking [default is only if necessary]],
268 [ case "${enableval}" in
269 yes|"") ENABLE_RPATH=YES ;;
275 AC_SUBST(ENABLE_RPATH)
279 dnl Copy the definition of AC_C_INLINE, with slight mods.
281 AC_CACHE_CHECK([for definition of U_INLINE for C], ac_cv_c_inline,
283 for ac_kw in inline __inline__ __inline; do
284 AC_TRY_COMPILE(, [return 0;} $ac_kw int foo() {], [ac_cv_c_inline=$ac_kw; break])
287 case "$ac_cv_c_inline" in
288 yes) U_INLINE= "inline" ;;
290 *) U_INLINE=$ac_cv_c_inline ;;
296 dnl Enable/disable threads
297 AC_ARG_ENABLE(threads,
298 [ --enable-threads build ICU with thread safety [default=yes]],
299 [case "${enableval}" in
302 *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
305 ICU_CONDITIONAL(THREADS, test "$threads" = true)
310 if test $threads = true; then
311 dnl For Compaq Tru64 (OSF1), we must look for pthread_attr_init
312 dnl and must do this before seaching for pthread_mutex_destroy, or
313 dnl we will pick up libpthreads.so not libpthread.so
314 dnl If this fails, then we must test for HPUX specials, before
315 dnl moving on to a more generic test
317 AC_CHECK_LIB(pthread, pthread_attr_init)
318 if test $ac_cv_lib_pthread_pthread_attr_init = yes; then
321 dnl Locate the right library for POSIX threads. We look for the
322 dnl symbols in the libraries first, because on Solaris libc provides
323 dnl pthread_create but libpthread has the real code :(
324 dnl AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread
325 dnl FreeBSD users may need libpthread if they do not have libc_r.
327 AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r )
329 if test "$ac_cv_search_pthread_mutex_destroy" != no; then
333 AC_CHECK_LIB(pthread, pthread_mutex_init)
334 if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
339 AC_CHECK_FUNC(pthread_mutex_lock)
341 if test $ac_cv_func_pthread_mutex_lock = yes; then
345 dnl Check to see if we are using CygWin with MSVC
347 *-pc-cygwin*|*-pc-mingw*)
348 dnl For gcc, the thread options are set by mh-mingw/mh-cygwin
350 if test "$ac_cv_prog_gcc" = no; then
351 dnl We're using normal windows compilers. Threading is available.
353 if test $ENABLE_DEBUG = 1; then
354 dnl /MDd means 'compiles and links a debugable multithreaded program with DLL'
355 CFLAGS="${CFLAGS} /MDd"
356 CXXFLAGS="${CXXFLAGS} /MDd"
358 dnl /MD means 'compiles and links a multithreaded program with DLL'
359 CFLAGS="${CFLAGS} /MD"
360 CXXFLAGS="${CXXFLAGS} /MD"
364 dnl Add -mt because it does several nice things on newer compilers.
365 case "${icu_cv_host_frag}" in
367 OLD_CXXFLAGS="${CXXFLAGS}"
368 CXXFLAGS="${CXXFLAGS} -mt"
369 if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then
370 CXXFLAGS="${OLD_CXXFLAGS}"
378 AC_SUBST(ICU_USE_THREADS)
380 AC_ARG_ENABLE(weak-threads,
381 [ --enable-weak-threads weakly reference the threading library [default=no]],
382 [case "${enableval}" in
384 LIB_THREAD="${LIBS%${OLD_LIBS}}"
388 *) AC_MSG_ERROR(bad value ${enableval} for --enable-weak-threads) ;;
394 # The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific.
395 # Do this check instead.
397 AC_MSG_CHECKING([for mmap])
398 AC_CACHE_VAL(ac_cv_func_mmap_ok,
400 changequote(<<, >>)dnl
403 #include <sys/mman.h>
404 #include <sys/stat.h>
408 [mmap((void *)0, 0, PROT_READ, 0, 0, 0);],
409 ac_cv_func_mmap_ok=yes,
410 ac_cv_func_mmap_ok=no)] )
411 AC_MSG_RESULT($ac_cv_func_mmap_ok)
412 if test $ac_cv_func_mmap_ok = yes
418 dnl Check to see if genccode can generate simple assembly.
421 i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
422 if test "$GCC" = yes; then
423 dnl We're using gcc, and the simple -a gcc command line works for genccode
424 GENCCODE_ASSEMBLY="-a gcc"
427 if test "$GCC" = yes; then
428 dnl When using gcc, look if we're also using GNU as.
429 dnl When using GNU as, the simple -a gcc command line works for genccode.
430 asv=`"${CC}" -print-prog-name=as 2>/dev/null`
431 asv=`"${asv}" --version 2>/dev/null`
433 X*GNU*) GENCCODE_ASSEMBLY="-a gcc" ;;
434 X*) GENCCODE_ASSEMBLY="-a sun-x86" ;;
438 GENCCODE_ASSEMBLY="-a sun-x86"
441 GENCCODE_ASSEMBLY="-a sun"
444 GENCCODE_ASSEMBLY="-a aCC-ia64"
447 AC_SUBST(GENCCODE_ASSEMBLY)
450 dnl Checks for header files
451 AC_CHECK_HEADERS(inttypes.h)
452 if test $ac_cv_header_inttypes_h = no; then
457 if test "$CC" = ccc; then
458 AC_MSG_RESULT("C compiler set to CCC ${CC}" )
460 alpha*-*-*) U_HAVE_INTTYPES_H=0;
464 AC_SUBST(U_HAVE_INTTYPES_H)
466 AC_ARG_WITH(iostream,
467 [ --with-iostream=version specify the version of iostream to use (none, old, std, auto) [default=auto]],
468 [case "${withval}" in
469 none) streams=none ;;
470 old) streams=198506 ;;
471 std) streams=199711 ;;
473 *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;;
478 if test x$streams != xnone
482 OLD_CXXFLAGS="${CXXFLAGS}"
483 case "${icu_cv_host_frag}" in
485 CXXFLAGS="${CXXFLAGS} -AA"
488 AC_MSG_CHECKING([for iostream usability])
489 AC_TRY_COMPILE([#include <iostream>],[],
490 [ac_cv_header_iostream=yes],[ac_cv_header_iostream=no])
491 if test $icu_cv_host_frag = mh-cygwin-msvc
493 dnl <iostream> is always there on Windows.
494 dnl We do this to prevent the C++ preprocessor from being used because
495 dnl autoconf can't deal with the Windows C++ preprocessor
496 ac_cv_header_iostream=yes
498 AC_MSG_RESULT($ac_cv_header_iostream)
499 if test $ac_cv_header_iostream = yes
501 U_IOSTREAM_SOURCE=199711
503 CXXFLAGS="${OLD_CXXFLAGS}"
504 AC_MSG_CHECKING([whether ostream in iostream.h is really defined])
505 AC_CACHE_VAL(ac_cv_iostream_ok,
506 AC_TRY_LINK([#include <iostream.h>],[ostream &testout = cout; testout << "test" << endl;],ac_cv_iostream_ok=yes,ac_cv_iostream_ok=no))
507 AC_MSG_RESULT($ac_cv_iostream_ok)
508 if test $ac_cv_iostream_ok = yes
510 U_IOSTREAM_SOURCE=198506
513 if test x$streams != x
515 if test $U_IOSTREAM_SOURCE -ge $streams
517 U_IOSTREAM_SOURCE=$streams
518 case "${icu_cv_host_frag}" in
520 if test $U_IOSTREAM_SOURCE -lt 199711; then
521 CXXFLAGS=${OLD_CXXFLAGS}
526 AC_MSG_ERROR(${withval} iostream is not available)
530 AC_SUBST(U_IOSTREAM_SOURCE)
533 dnl Check for endianness
535 if test $ac_cv_c_bigendian = no; then
542 AC_SUBST(U_IS_BIG_ENDIAN)
544 dnl Do various POSIX related checks
545 U_HAVE_NL_LANGINFO_CODESET=0
546 U_NL_LANGINFO_CODESET=-1
547 AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0])
548 dnl AC_SUBST(U_HAVE_NL_LANGINFO)
549 if test $U_HAVE_NL_LANGINFO -eq 1; then
550 AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset],
551 ac_cv_nl_langinfo_codeset,
552 [ac_cv_nl_langinfo_codeset="unknown"
553 for a in CODESET _NL_CTYPE_CODESET_NAME; do
554 AC_TRY_LINK([#include <langinfo.h>],[nl_langinfo($a);],[ac_cv_nl_langinfo_codeset="$a"; break])]
556 if test x$ac_cv_nl_langinfo_codeset != xunknown
558 U_HAVE_NL_LANGINFO_CODESET=1
559 U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset
562 AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
563 AC_SUBST(U_NL_LANGINFO_CODESET)
565 dnl Namespace support checks
567 AC_MSG_CHECKING([for namespace support])
568 AC_CACHE_VAL(ac_cv_namespace_ok,
570 changequote(<<, >>)dnl
571 <<namespace x_version {void f(){}}
572 namespace x = x_version;
573 using namespace x_version;
576 [f();], ac_cv_namespace_ok=yes, ac_cv_namespace_ok=no)] )
577 AC_MSG_RESULT($ac_cv_namespace_ok)
579 if test $ac_cv_namespace_ok = no
583 AC_SUBST(U_HAVE_NAMESPACE)
585 AC_MSG_CHECKING([for properly overriding new and delete])
586 U_OVERRIDE_CXX_ALLOCATION=0
587 U_HAVE_PLACEMENT_NEW=0
588 AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok,
590 changequote(<<, >>)dnl
591 <<#include <stdlib.h>
594 void *operator new(size_t size) {return malloc(size);}
595 void *operator new[](size_t size) {return malloc(size);}
596 void operator delete(void *p) {free(p);}
597 void operator delete[](void *p) {free(p);}
601 [], ac_cv_override_cxx_allocation_ok=yes, ac_cv_override_cxx_allocation_ok=no)] )
602 AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok)
603 if test $ac_cv_override_cxx_allocation_ok = yes
605 U_OVERRIDE_CXX_ALLOCATION=1
606 AC_MSG_CHECKING([for placement new and delete])
607 AC_CACHE_VAL(ac_cv_override_placement_new_ok,
609 changequote(<<, >>)dnl
610 <<#include <stdlib.h>
613 void *operator new(size_t size) {return malloc(size);}
614 void *operator new[](size_t size) {return malloc(size);}
615 void operator delete(void *p) {free(p);}
616 void operator delete[](void *p) {free(p);}
617 void * operator new(size_t, void *ptr) { return ptr; }
618 void operator delete(void *, void *) {}
622 [], ac_cv_override_placement_new_ok=yes, ac_cv_override_placement_new_ok=no)] )
623 AC_MSG_RESULT($ac_cv_override_placement_new_ok)
624 if test $ac_cv_override_placement_new_ok = yes
626 U_HAVE_PLACEMENT_NEW=1
629 AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
630 AC_SUBST(U_HAVE_PLACEMENT_NEW)
634 if test x$ac_cv_func_popen = xyes
640 AC_SUBST(U_HAVE_POPEN)
644 if test x$ac_cv_func_tzset = xyes
649 AC_CHECK_FUNC(_tzset)
650 if test x$ac_cv_func__tzset = xyes
656 AC_SUBST(U_HAVE_TZSET)
660 AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
662 changequote(<<, >>)dnl
663 <<#ifndef __USE_POSIX
668 #ifndef tzname /* For SGI. */
669 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
672 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
673 if test $ac_cv_var_tzname = yes; then
677 AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
679 changequote(<<, >>)dnl
680 <<#include <stdlib.h>
682 extern char *_tzname[];
685 [atoi(*_tzname);], ac_cv_var__tzname=yes, ac_cv_var__tzname=no)])
686 if test $ac_cv_var__tzname = yes; then
691 AC_SUBST(U_HAVE_TZNAME)
694 AC_CACHE_CHECK(for timezone,ac_cv_var_timezone,
696 changequote(<<, >>)dnl
697 <<#ifndef __USE_POSIX
706 [timezone = 1;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
708 if test $ac_cv_var_timezone = yes; then
712 AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone,
713 [AC_TRY_LINK([#include <time.h>],
714 [__timezone = 1;], ac_cv_var___timezone=yes, ac_cv_var___timezone=no)])
715 if test $ac_cv_var___timezone = yes; then
716 U_TIMEZONE=__timezone
719 AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone,
720 [AC_TRY_LINK([#include <time.h>],
721 [_timezone = 1;], ac_cv_var__timezone=yes, ac_cv_var__timezone=no)])
722 if test $ac_cv_var__timezone = yes; then
728 AC_SUBST(U_HAVE_TIMEZONE)
731 dnl Checks for typedefs
732 AC_CHECK_TYPE(int8_t,signed char)
733 AC_CHECK_TYPE(uint8_t,unsigned char)
734 AC_CHECK_TYPE(int16_t,signed short)
735 AC_CHECK_TYPE(uint16_t,unsigned short)
736 AC_CHECK_TYPE(int32_t,signed long)
737 AC_CHECK_TYPE(uint32_t,unsigned long)
738 AC_CHECK_TYPE(int64_t,signed long long)
739 AC_CHECK_TYPE(uint64_t,unsigned long long)
741 if test $ac_cv_type_int8_t = no; then
746 AC_SUBST(HAVE_INT8_T)
748 if test $ac_cv_type_uint8_t = no; then
753 AC_SUBST(HAVE_UINT8_T)
755 if test $ac_cv_type_int16_t = no; then
760 AC_SUBST(HAVE_INT16_T)
762 if test $ac_cv_type_uint16_t = no; then
767 AC_SUBST(HAVE_UINT16_T)
769 if test $ac_cv_type_int32_t = no; then
774 AC_SUBST(HAVE_INT32_T)
776 if test $ac_cv_type_uint32_t = no; then
781 AC_SUBST(HAVE_UINT32_T)
783 if test $ac_cv_type_int64_t = no; then
788 AC_SUBST(HAVE_INT64_T)
790 if test $ac_cv_type_uint64_t = no; then
795 AC_SUBST(HAVE_UINT64_T)
797 dnl Do various wchar_t related checks
798 AC_CHECK_HEADER(wchar.h)
799 if test "$ac_cv_header_wchar_h" = no
804 AC_DEFINE(HAVE_WCHAR_H)
806 dnl Some broken systems have wchar.h but not some of its functions...
807 AC_SEARCH_LIBS(wcscpy, wcs w)
808 if test "$ac_cv_search_wcscpy" != no; then
814 AC_SUBST(U_HAVE_WCHAR_H)
815 AC_SUBST(U_HAVE_WCSCPY)
817 AC_CHECK_SIZEOF([wchar_t], 0, [
826 U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
827 # We do this check to verify that everything is okay.
828 if test $U_SIZEOF_WCHAR_T = 0; then
829 if test $U_HAVE_WCHAR_H=1; then
830 AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0)
833 AC_SUBST(U_SIZEOF_WCHAR_T)
835 AC_MSG_CHECKING([for UTF-16 string literal support])
836 U_CHECK_UTF16_STRING=1
837 CHECK_UTF16_STRING_RESULT="unknown"
839 *-*-aix*|powerpc64-*-linux*)
840 if test "$ac_cv_prog_gcc" = no; then
841 OLD_CFLAGS="${CFLAGS}"
842 OLD_CXXFLAGS="${CXXFLAGS}"
843 CFLAGS="${CFLAGS} -qutf"
844 CXXFLAGS="${CXXFLAGS} -qutf"
845 AC_TRY_COMPILE([const unsigned short hello[] = u"hello";],[],
846 [U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
847 if test "$U_CHECK_UTF16_STRING" = 0; then
848 CFLAGS="${OLD_CFLAGS}"
849 CXXFLAGS="${OLD_CXXFLAGS}"
851 CHECK_UTF16_STRING_RESULT="-qutf"
856 if test "$ac_cv_prog_gcc" = no; then
857 OLD_CFLAGS="${CFLAGS}"
858 OLD_CXXFLAGS="${CXXFLAGS}"
859 CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort"
860 CXXFLAGS="${CXXFLAGS} -xustr=ascii_utf16_ushort"
861 AC_TRY_COMPILE([const unsigned short hello[] = U"hello";],[],
862 [U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
863 if test "$U_CHECK_UTF16_STRING" = 0; then
864 CFLAGS="${OLD_CFLAGS}"
865 CXXFLAGS="${OLD_CXXFLAGS}"
867 CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort"
869 # Since we can't detect the availability of this UTF-16 syntax at compile time,
870 # we depend on configure telling us that we can use it.
871 # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort,
872 # we only use this macro within ICU.
873 # If an ICU user uses icu-config, this feature will be enabled.
874 CPPFLAGS="${CPPFLAGS} -DU_CHECK_UTF16_STRING=1"
875 U_CHECK_UTF16_STRING=0
880 if test "$ac_cv_prog_gcc" = no; then
881 dnl The option will be detected at compile time without additional compiler options.
882 CHECK_UTF16_STRING_RESULT="available"
886 dnl wchar_t can be used
887 CHECK_UTF16_STRING_RESULT="available"
892 AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT)
893 AC_SUBST(U_CHECK_UTF16_STRING)
895 dnl Enable/disable extras
896 AC_ARG_ENABLE(extras,
897 [ --enable-extras build ICU extras [default=yes]],
898 [case "${enableval}" in
901 *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;;
904 ICU_CONDITIONAL(EXTRAS, test "$extras" = true)
906 [ --enable-icuio build ICU's icuio library [default=yes]],
907 [case "${enableval}" in
910 *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;;
913 ICU_CONDITIONAL(ICUIO, test "$icuio" = true)
915 dnl Enable/disable layout
916 AC_ARG_ENABLE(layout,
917 [ --enable-layout build ICU's layout library [default=yes]],
918 [case "${enableval}" in
921 *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;;
924 ICU_CONDITIONAL(LAYOUT, test "$layout" = true)
926 AC_ARG_WITH(data-packaging,
927 [ --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) [default=auto]],
928 [case "${withval}" in
929 files|archive|library) datapackaging=$withval ;;
930 auto) datapackaging=$withval ;;
931 common) datapackaging=archive ;;
932 dll) datapackaging=library ;;
933 static) datapackaging=static ;;
934 *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;;
938 dnl Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc..
939 dnl thesysconfdir=`eval echo $sysconfdir`
940 dnl AC_SUBST(thesysconfdir)
941 dnl thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir`
942 dnl AC_SUBST(thelibdir)
943 thedatadir=`eval echo $datadir`
944 dnl AC_SUBST(thedatadir)
945 dnl 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}.
946 pkgicudatadir=$datadir
947 thepkgicudatadir=$thedatadir
948 AC_SUBST(pkgicudatadir)
949 AC_SUBST(thepkgicudatadir)
951 dnl Shouldn't need the AC_SUBST
953 if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then
954 datapackaging=library
957 case "$datapackaging" in
959 DATA_PACKAGING_MODE=files
962 DATA_PACKAGING_MODE=common
965 DATA_PACKAGING_MODE=dll
968 AC_SUBST(DATA_PACKAGING_MODE)
970 dnl Sets a library suffix
971 AC_MSG_CHECKING([for a library suffix to use])
972 AC_ARG_WITH(library-suffix,
973 [ --with-library-suffix=suffix tag a suffix to the library names [default=]],
974 [ICULIBSUFFIX="${withval}"],
977 if test "$msg" = ""; then
981 AC_SUBST(ICULIBSUFFIX)
982 changequote(<<, >>)dnl
983 if test "$ICULIBSUFFIX" != ""
986 ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
991 AC_SUBST(U_HAVE_LIB_SUFFIX)
992 AC_SUBST(ICULIBSUFFIXCNAME)
994 dnl Enable/disable tests
996 [ --enable-tests build ICU tests [default=yes]],
997 [case "${enableval}" in
1000 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
1003 ICU_CONDITIONAL(TESTS, test "$tests" = true)
1005 dnl Enable/disable samples
1006 AC_ARG_ENABLE(samples,
1007 [ --enable-samples build ICU samples [default=yes]
1009 Additionally, the variable FORCE_LIBS may be set before calling configure.
1010 If set, it will REPLACE any automatic list of libraries.],
1011 [case "${enableval}" in
1012 yes) samples=true ;;
1013 no) samples=false ;;
1014 *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;;
1017 ICU_CONDITIONAL(SAMPLES, test "$samples" = true)
1019 ICUDATA_CHAR=$U_ENDIAN_CHAR
1021 dnl Platform-specific Makefile setup
1022 dnl set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform.
1024 *-*-solaris*) platform=U_SOLARIS ;;
1025 *-*-linux*) platform=U_LINUX ;;
1026 *-pc-gnu) platform=U_HURD ;;
1027 *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;;
1028 *-*-aix*) platform=U_AIX ;;
1029 *-*-hpux*) platform=U_HPUX ;;
1030 *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;;
1031 *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;;
1032 *-*ibm-openedition*|*-*-os390*) platform=OS390
1033 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1036 *-*-os400*) platform=OS400
1037 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1040 *-*-nto*) platform=U_QNX ;;
1041 *-dec-osf*) platform=U_OSF ;;
1042 *-*-beos) platform=U_BEOS ;;
1043 *-*-irix*) platform=U_IRIX ;;
1044 *-ncr-*) platform=U_MPRAS ;;
1045 *) platform=U_UNKNOWN_PLATFORM ;;
1047 AC_SUBST(ICUDATA_CHAR)
1049 platform_make_fragment_name="$icu_cv_host_frag"
1050 platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name"
1051 AC_SUBST(platform_make_fragment_name)
1052 AC_SUBST(platform_make_fragment)
1054 if test "${FORCE_LIBS}" != ""; then
1055 echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
1060 dnl Now that we're done using CPPFLAGS etc. for tests, we can change it
1063 if test $ICU_USE_THREADS -ne 0
1065 CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
1066 CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
1067 CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
1070 dnl output the Makefiles
1071 AC_OUTPUT([icudefs.mk \
1074 config/Makefile.inc \
1083 extra/uconv/Makefile \
1084 extra/scrptrun/Makefile \
1086 tools/ctestfw/Makefile \
1087 tools/toolutil/Makefile \
1088 tools/makeconv/Makefile \
1089 tools/genrb/Makefile \
1090 tools/genuca/Makefile \
1091 tools/genccode/Makefile \
1092 tools/gencmn/Makefile \
1093 tools/gencnval/Makefile \
1094 tools/genctd/Makefile \
1095 tools/gennames/Makefile \
1096 tools/gentest/Makefile \
1097 tools/gennorm/Makefile \
1098 tools/genprops/Makefile \
1099 tools/gencase/Makefile \
1100 tools/genbidi/Makefile \
1101 tools/genpname/Makefile \
1102 tools/genbrk/Makefile \
1103 tools/gensprep/Makefile \
1104 tools/icupkg/Makefile \
1105 tools/icuswap/Makefile \
1106 tools/pkgdata/Makefile \
1107 tools/tzcode/Makefile \
1109 test/compat/Makefile \
1110 test/testdata/Makefile \
1111 test/testdata/pkgdata.inc \
1112 test/hdrtst/Makefile \
1113 test/intltest/Makefile \
1114 test/cintltst/Makefile \
1115 test/iotest/Makefile \
1116 test/letest/Makefile \
1117 test/perf/Makefile \
1118 test/perf/collationperf/Makefile \
1119 test/perf/ubrkperf/Makefile \
1120 test/perf/charperf/Makefile \
1121 test/perf/convperf/Makefile \
1122 test/perf/normperf/Makefile \
1123 test/perf/strsrchperf/Makefile \
1124 test/perf/unisetperf/Makefile \
1125 test/perf/usetperf/Makefile \
1126 test/perf/ustrperf/Makefile \
1127 test/perf/utfperf/Makefile \
1128 samples/Makefile samples/date/Makefile \
1129 samples/cal/Makefile samples/layout/Makefile \
1130 common/unicode/platform.h])
1132 if test $ICU_USE_THREADS = 0; then
1133 echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages [above] to see why we couldn't find pthread_create()" 1>&6
1136 if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then
1137 echo "You must use $U_MAKE to build ICU."
1139 echo "WARNING: $U_MAKE may not be GNU make."
1140 echo "This may cause ICU to fail to build. Please make sure that GNU make"
1141 echo "is in your PATH so that this configure script can detect its location."
1144 $as_unset _CXX_CXXSUFFIX