X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/57a6839dcb3bba09e8228b822b290604668416fe..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/configure.ac diff --git a/icuSources/configure.ac b/icuSources/configure.ac index d52b1e69..8cd270b0 100644 --- a/icuSources/configure.ac +++ b/icuSources/configure.ac @@ -1,21 +1,26 @@ # -*-autoconf-*- -AC_COPYRIGHT([ Copyright (c) 1999-2013, International Business Machines Corporation and others. All Rights Reserved. ]) +AC_COPYRIGHT([ Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html ]) +# AC_COPYRIGHT([ Copyright (c) 1999-2015, International Business Machines Corporation and others. All Rights Reserved. ]) # configure.in for ICU # Stephen F. Booth, heavily modified by Yves and others +# NOTE: please use 'autoreconf' to rebuild, otherwise 'aclocal && autoconf'. + # Check for autoconf version -AC_PREREQ(2.68) +AC_PREREQ(2.69) -# Process this file with autoconf to produce a configure script -AC_INIT([ICU]) +# Process this file with autoreconf to produce a configure script +AC_INIT([ICU], + m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"), + [http://icu-project.org/bugs], + [International Components for Unicode], + [http://icu-project.org]) -#TODO: IcuBug:8502 -#AC_INIT([ICU], -# m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"), -# [http://icu-project.org/bugs], -# [International Components for Unicode], -# [http://icu-project.org]) +# Instruct Python to never write any byte code to the ICU source tree. +PYTHONDONTWRITEBYTECODE=1 +export PYTHONDONTWRITEBYTECODE +AC_CONFIG_MACRO_DIR([config/m4]) AC_CONFIG_SRCDIR([common/unicode/utypes.h]) PACKAGE="icu" @@ -99,6 +104,16 @@ UCONFIG_CPPFLAGS="" # such as -std UCONFIG_CFLAGS="" +# Check whether to install icu-config +AC_ARG_ENABLE([icu-config], + AS_HELP_STRING([--enable-icu-config], [install icu-config]), + [case "${enableval}" in + yes) enable_icu_config=true ;; + no) enable_icu_config=false ;; + *) AC_MSG_ERROR([bad value '${enableval}' for --enable-icu-config]) ;; + esac], [enable_icu_config=true]) +AC_SUBST(INSTALL_ICU_CONFIG, [$enable_icu_config]) + # Check whether to build debug libraries AC_MSG_CHECKING([whether to build debug libraries]) enabled=no @@ -137,6 +152,10 @@ AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc]) # The g++ compiler is less likely to support C++11. AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC]) +# pkg-config is needed for harfbuzz support +PKG_PROG_PKG_CONFIG([0.20]) +PKG_CHECK_MODULES(ICULEHB, icu-le-hb, have_icu_le_hb=true, :) + # Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option # The release mode use is the default one for autoconf if test "$GCC" = yes; then @@ -180,6 +199,10 @@ fi #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) #AC_CHECK_PROG(STRIP, strip, strip, true) +# TODO(ICU-20301): Remove fallback to Python 2. +AC_CHECK_PROGS(PYTHON, python3 "py -3" python "py") +AC_SUBST(PYTHON) + # Check for the platform make AC_PATH_PROGS(U_MAKE, gmake gnumake, make) AC_SUBST(U_MAKE) @@ -330,7 +353,7 @@ AC_SUBST(UCLN_NO_AUTO_CLEANUP) MSVC_RELEASE_FLAG="" if test $enabled = yes then - if test $icu_cv_host_frag = mh-cygwin-msvc + if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if defined _MSC_VER && _MSC_VER >= 1400 @@ -360,12 +383,15 @@ AC_ARG_ENABLE(draft, AC_MSG_RESULT($enabled) # Make sure that we can use draft API in ICU. if test "$U_DEFAULT_SHOW_DRAFT" = 0; then - CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API" + CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API -DU_SHOW_INTERNAL_API" fi AC_SUBST(U_DEFAULT_SHOW_DRAFT) AC_PROG_RANLIB +# need sed +AC_PROG_SED + # look for 'ar' the proper way AC_CHECK_TOOL(AR, ar, false) @@ -407,9 +433,25 @@ if test "x$ac_cv_header_elf_h" = "xyes"; then CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_HAVE_ELF_H=1"; fi +# Enable/disable plugins +AC_ARG_ENABLE(plugins, + [ --enable-plugins enable plugins [default=no]], + [case "${enableval}" in + yes) plugins=true ;; + no) plugins=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugins) ;; + esac], + plugins=false) +ICU_CONDITIONAL(PLUGINS, test "$plugins" = true) + +if test "x$plugins" = "xtrue"; then + UCONFIG_CPPFLAGS="$UCONFIG_CPPFLAGS -DUCONFIG_ENABLE_PLUGINS=1" +fi + + U_ENABLE_DYLOAD=1 enable=yes -AC_MSG_CHECKING([whether to enable dynamic loading of plugins]) +AC_MSG_CHECKING([whether to enable dynamic loading of plugins. Ignored if plugins disabled.]) AC_ARG_ENABLE(dyload, [ --disable-dyload disable dynamic loading [default=no]], [ case "${enableval}" in @@ -471,121 +513,96 @@ else fi if [[ "$GXX" = yes ]]; then - # if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x, + # if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++11, # and check that the compiler still works. if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then OLD_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="$CXXFLAGS --std=c++0x" + CXXFLAGS="$CXXFLAGS -std=c++11" AC_MSG_CHECKING([[if we have a C++11 compiler]]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no]) AC_MSG_RESULT($cxx11_okay) if [[ $cxx11_okay = yes ]]; then - AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x]) - UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x" + AC_MSG_NOTICE([Adding CXXFLAGS option -std=c++11]) + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -std=c++11" else CXXFLAGS="$OLD_CXXFLAGS" fi + case "${host}" in + *-*-solaris*) + CXXFLAGS="$OLD_CXXFLAGS" + ;; + esac fi fi -AC_MSG_CHECKING([[if #include works]]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no]) -AC_MSG_RESULT($ac_cv_header_stdstring) -if test $ac_cv_header_stdstring = yes -then - U_HAVE_STD_STRING=1 -else - U_HAVE_STD_STRING=0 - CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0" -fi -AC_SUBST(U_HAVE_STD_STRING) - - -AC_MSG_CHECKING([[if #include works]]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no]) -AC_MSG_RESULT($ac_cv_header_atomic) -if test $ac_cv_header_atomic = yes -then - U_HAVE_ATOMIC=1 -else - U_HAVE_ATOMIC=0 -fi -# Make this available via CPPFLAGS -CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}" -AC_SUBST(U_HAVE_ATOMIC) - AC_LANG_POP([C++]) # Always build ICU with multi-threading support. -threads=true -ICU_USE_THREADS=1 OLD_LIBS=${LIBS} -if test $threads = true; then - # For Compaq Tru64 (OSF1), we must look for pthread_attr_init - # and must do this before seaching for pthread_mutex_destroy, or - # we will pick up libpthreads.so not libpthread.so - # If this fails, then we must test for HPUX specials, before - # moving on to a more generic test +# For Compaq Tru64 (OSF1), we must look for pthread_attr_init +# and must do this before seaching for pthread_mutex_destroy, or +# we will pick up libpthreads.so not libpthread.so +# If this fails, then we must test for HPUX specials, before +# moving on to a more generic test - AC_CHECK_LIB(pthread, pthread_attr_init) - if test $ac_cv_lib_pthread_pthread_attr_init = yes; then - ICU_USE_THREADS=1 - else - # Locate the right library for POSIX threads. We look for the - # symbols in the libraries first, because on Solaris libc provides - # pthread_create but libpthread has the real code :( - # AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread - # FreeBSD users may need libpthread if they do not have libc_r. +AC_CHECK_LIB(pthread, pthread_attr_init) +if test $ac_cv_lib_pthread_pthread_attr_init = yes; then + : +else + # Locate the right library for POSIX threads. We look for the + # symbols in the libraries first, because on Solaris libc provides + # pthread_create but libpthread has the real code :( + # AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread + # FreeBSD users may need libpthread if they do not have libc_r. - AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r ) + AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r ) - if test "$ac_cv_search_pthread_mutex_destroy" != no; then - ICU_USE_THREADS=1 - else - # For HP 11 - AC_CHECK_LIB(pthread, pthread_mutex_init) - if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then - ICU_USE_THREADS=1 - fi + if test "$ac_cv_search_pthread_mutex_destroy" != no; then + : + else + # For HP 11 + AC_CHECK_LIB(pthread, pthread_mutex_init) + if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + : fi + fi - AC_CHECK_FUNC(pthread_mutex_lock) + AC_CHECK_FUNC(pthread_mutex_lock) - if test $ac_cv_func_pthread_mutex_lock = yes; then - ICU_USE_THREADS=1 - fi + if test $ac_cv_func_pthread_mutex_lock = yes; then + : fi - # Check to see if we are using CygWin with MSVC - case "${host}" in - *-pc-cygwin*|*-pc-mingw*) - # For gcc, the thread options are set by mh-mingw/mh-cygwin - # For msvc, the thread options are set by runConfigureICU - ICU_USE_THREADS=1 - ;; - *-*-hpux*) - # Add -mt because it does several nice things on newer compilers. - case "${icu_cv_host_frag}" in - mh-hpux-acc) - OLD_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${CXXFLAGS} -mt" - if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then - CXXFLAGS="${OLD_CXXFLAGS}" - else - UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" - fi - ;; - esac +fi +# Check to see if we are using CygWin with MSVC +case "${host}" in +*-pc-cygwin*|*-pc-mingw*) + # For gcc, the thread options are set by mh-mingw/mh-cygwin + # For msvc, the thread options are set by runConfigureICU + : + ;; +*-*-hpux*) + # Add -mt because it does several nice things on newer compilers. + case "${icu_cv_host_frag}" in + mh-hpux-acc) + OLD_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXXFLAGS} -mt" + if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then + CXXFLAGS="${OLD_CXXFLAGS}" + else + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" + fi ;; - *-*-solaris*) - case "${icu_cv_host_frag}" in - mh-solaris) - LIBS="${LIBS} -mt" - ;; - esac + esac + ;; +*-*-solaris*) + case "${icu_cv_host_frag}" in + mh-solaris) + LIBS="${LIBS} -mt" ;; esac -fi + ;; +esac AC_ARG_ENABLE(weak-threads, [ --enable-weak-threads weakly reference the threading library [default=no]], @@ -647,7 +664,10 @@ sparc-*-solaris*) GENCCODE_ASSEMBLY="-a sun" ;; ia64-*-hpux*) - GENCCODE_ASSEMBLY="-a aCC-ia64" +# There has been some issues with building ICU data on HPUX ia64 aCC +# when using the assemble code setting below. For now, build without +# assemble code for this platform. This will increase the build time. +# GENCCODE_ASSEMBLY="-a aCC-ia64" ;; esac AC_SUBST(GENCCODE_ASSEMBLY) @@ -809,8 +829,8 @@ AC_SUBST(U_TZSET) U_HAVE_TZNAME=0 AC_CACHE_CHECK(for tzname,ac_cv_var_tzname, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef __USE_POSIX -#define __USE_POSIX +[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE #endif #include #include @@ -836,11 +856,8 @@ AC_SUBST(U_HAVE_TZNAME) AC_SUBST(U_TZNAME) AC_CACHE_CHECK(for timezone,ac_cv_var_timezone, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifndef __USE_POSIX -#define __USE_POSIX -#endif -#ifndef __USE_XOPEN -#define __USE_XOPEN +[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE #endif #include ], [[timezone = 1;]])],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no])]) @@ -868,6 +885,24 @@ fi AC_SUBST(U_HAVE_TIMEZONE) AC_SUBST(U_TIMEZONE) +AC_CHECK_FUNC(strtod_l) +if test x$ac_cv_func_strtod_l = xyes +then + U_HAVE_STRTOD_L=1 + AC_CHECK_HEADER(xlocale.h) + if test "$ac_cv_header_xlocale_h" = yes; then + U_HAVE_XLOCALE_H=1 + CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=1" + else + U_HAVE_XLOCALE_H=0 + CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=0" + fi +else + CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0" + U_HAVE_STRTOD_L=0 +fi +AC_SUBST(U_HAVE_STRTOD_L) + # Checks for typedefs AC_CHECK_TYPE(int8_t,signed char) AC_CHECK_TYPE(uint8_t,unsigned char) @@ -1008,19 +1043,14 @@ case "${host}" in ;; esac -# GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future. +# GCC >= 4.4 supports UTF16 string literals. As of ICU 62, both C and C++ files require them. if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then if test "$GCC" = yes; then - OLD_CFLAGS="${CFLAGS}" - CFLAGS="${CFLAGS} -std=gnu99" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -static const char16_t test[] = u"This is a UTF16 literal string."; +static const unsigned short test[] = u"This is a UTF16 literal string."; ]], [[]])],[CC_UTF16_STRING=1],[CC_UTF16_STRING=0]) if test "$CC_UTF16_STRING" = 1; then - UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -std=gnu99" CHECK_UTF16_STRING_RESULT="C only"; - else - CFLAGS="${OLD_CFLAGS}" fi fi if test "$GXX" = yes; then @@ -1061,16 +1091,27 @@ AC_ARG_ENABLE(icuio, icuio=true) ICU_CONDITIONAL(ICUIO, test "$icuio" = true) +# Enable/disable layoutex +AC_ARG_ENABLE(layoutex, + [ --enable-layoutex build ICU's Paragraph Layout library [default=yes]. + icu-le-hb must be installed via pkg-config. See http://harfbuzz.org], + [case "${enableval}" in + yes) layoutex=$have_icu_le_hb ;; + no) layoutex=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-layoutex) ;; + esac], + layoutex=$have_icu_le_hb) +ICU_CONDITIONAL(LAYOUTEX, test "$layoutex" = true) + # Enable/disable layout AC_ARG_ENABLE(layout, - [ --enable-layout build ICU's layout library [default=yes]], + [], [case "${enableval}" in - yes) layout=true ;; - no) layout=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;; + yes) AC_MSG_ERROR(The ICU Layout Engine has been removed.) ;; + no) ;; + *) ;; esac], - layout=true) -ICU_CONDITIONAL(LAYOUT, test "$layout" = true) + ) # Enable/disable tools AC_ARG_ENABLE(tools, @@ -1084,7 +1125,13 @@ AC_ARG_ENABLE(tools, ICU_CONDITIONAL(TOOLS, test "$tools" = true) AC_ARG_WITH(data-packaging, - [ --with-data-packaging=type specify how to package ICU data (files, archive, library, static, auto) [default=auto]], + [ --with-data-packaging specify how to package ICU data. Possible values: + files raw files (.res, etc) + archive build a single icudtXX.dat file + library shared library (.dll/.so/etc.) + static static library (.a/.lib/etc.) + auto build shared if possible (default) + See http://userguide.icu-project.org/icudata for more info.], [case "${withval}" in files|archive|library) datapackaging=$withval ;; auto) datapackaging=$withval ;; @@ -1249,13 +1296,13 @@ fi # Now that we're done using CPPFLAGS etc. for tests, we can change it # for build. -if test "${CC}" == "clang"; then +if test "${CC}" = "clang"; then CLANGCFLAGS="-Qunused-arguments -Wno-parentheses-equality" else CLANGCFLAGS="" fi -if test "${CXX}" == "clang++"; then +if test "${CXX}" = "clang++"; then CLANGCXXFLAGS="-Qunused-arguments -Wno-parentheses-equality" else CLANGCXXFLAGS="" @@ -1287,7 +1334,6 @@ AC_CONFIG_FILES([icudefs.mk \ stubdata/Makefile \ common/Makefile \ i18n/Makefile \ - layout/Makefile \ layoutex/Makefile \ io/Makefile \ extra/Makefile \ @@ -1313,6 +1359,7 @@ AC_CONFIG_FILES([icudefs.mk \ tools/pkgdata/Makefile \ tools/tzcode/Makefile \ tools/gencfu/Makefile \ + tools/escapesrc/Makefile \ test/Makefile \ test/compat/Makefile \ test/testdata/Makefile \ @@ -1344,6 +1391,39 @@ AC_CONFIG_FILES([icudefs.mk \ samples/cal/Makefile samples/layout/Makefile]) AC_OUTPUT +if test -z "$PYTHON"; +then + echo "" > data/rules.mk + echo "" > test/testdata/rules.mk +else + if test -f "$srcdir/data/locales/root.txt"; + then + echo "Spawning Python to generate data/rules.mk..." + PYTHONPATH="$srcdir/data" $PYTHON -m buildtool \ + --mode gnumake \ + --seqmode parallel \ + --src_dir "$srcdir/data" \ + --filter_file "$ICU_DATA_FILTER_FILE" \ + $ICU_DATA_BUILDTOOL_OPTS \ + > data/rules.mk + if test "$?" != "0"; then + AC_MSG_ERROR(Python failed to run; see above error.) + fi + else + echo "Not rebuilding data/rules.mk, assuming prebuilt data in data/in" + touch data/rules.mk + fi + echo "Spawning Python to generate test/testdata/rules.mk..." + PYTHONPATH="$srcdir/test/testdata:$srcdir/data" $PYTHON -m buildtool \ + --mode gnumake \ + --seqmode parallel \ + --src_dir "$srcdir/test/testdata" \ + > test/testdata/rules.mk + if test "$?" != "0"; then + AC_MSG_ERROR(Python failed to run; see above error.) + fi +fi + echo echo "ICU for C/C++ $VERSION is ready to be built." echo "=== Important Notes: ===" @@ -1423,4 +1503,9 @@ then echo "## Expect build failures in the 'data', 'test', and other directories." fi +if test -z "$PYTHON"; +then + echo "** Note: Python not found. You will not be able to build data from source or run tests." +fi + $as_unset _CXX_CXXSUFFIX