intl/icu/source/configure.ac

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

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

mercurial