tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

configure.ac (42699B)


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