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