michael@0: # -*-autoconf-*- michael@0: AC_COPYRIGHT([ Copyright (c) 1999-2013, International Business Machines Corporation and others. All Rights Reserved. ]) michael@0: # configure.in for ICU michael@0: # Stephen F. Booth, heavily modified by Yves and others michael@0: michael@0: # Check for autoconf version michael@0: AC_PREREQ(2.68) michael@0: michael@0: # Process this file with autoconf to produce a configure script michael@0: AC_INIT([ICU]) michael@0: michael@0: #TODO: IcuBug:8502 michael@0: #AC_INIT([ICU], michael@0: # m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"), michael@0: # [http://icu-project.org/bugs], michael@0: # [International Components for Unicode], michael@0: # [http://icu-project.org]) michael@0: michael@0: AC_CONFIG_SRCDIR([common/unicode/utypes.h]) michael@0: michael@0: PACKAGE="icu" michael@0: AC_SUBST(PACKAGE) michael@0: michael@0: # Use custom echo test for newline option michael@0: # Current autoconf (2.65) gives incorrect echo newline option michael@0: # for icu-config michael@0: # This may be removed later - mow (June 17, 2010) michael@0: ICU_ECHO_C= ICU_ECHO_N= ICU_ECHO_T= michael@0: case `/bin/sh -c "echo -n x"` in michael@0: -n*) michael@0: case `/bin/sh -c "echo 'x\c'"` in michael@0: *c*) ICU_ECHO_T=' ';; # ECHO_T is single tab character. michael@0: *) ICU_ECHO_C='\c';; michael@0: esac;; michael@0: *) michael@0: ICU_ECHO_N='-n';; michael@0: esac michael@0: AC_SUBST(ICU_ECHO_N) michael@0: AC_SUBST(ICU_ECHO_C) michael@0: AC_SUBST(ICU_ECHO_T) michael@0: michael@0: AC_MSG_CHECKING(for ICU version numbers) michael@0: michael@0: # Get the ICU version from uversion.h or other headers michael@0: geticuversion() { michael@0: [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"] michael@0: } michael@0: getuversion() { michael@0: [sed -n 's/^[ ]*#[ ]*define[ ]*U_UNICODE_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"] michael@0: } michael@0: VERSION=`geticuversion $srcdir/common/unicode/uvernum.h` michael@0: if test x"$VERSION" = x; then michael@0: as_fn_error $? "Cannot determine ICU version number from uvernum.h header file" "$LINENO" 5 michael@0: fi michael@0: michael@0: #TODO: IcuBug:8502 michael@0: #if test "$VERSION" != "$PACKAGE_VERSION"; then michael@0: # AC_MSG_ERROR([configure was generated for $PACKAGE_VERSION but uvernum.h has $VERSION - please rerun autoconf]) michael@0: #fi michael@0: michael@0: UNICODE_VERSION=`getuversion $srcdir/common/unicode/uchar.h` michael@0: if test x"$UNICODE_VERSION" = x; then michael@0: AC_MSG_ERROR([Cannot determine Unicode version number from uchar.h header file]) michael@0: fi michael@0: # Compute a reasonable library version from the release version. This is michael@0: # very bad, but that's wanted... We want to make sure that the LIB_VERSION michael@0: # has at least a dot in it, so we'll add a .0 if needed. michael@0: #[LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`] michael@0: LIB_VERSION=$VERSION michael@0: LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'` michael@0: AC_SUBST(VERSION) michael@0: AC_SUBST(LIB_VERSION) michael@0: AC_SUBST(LIB_VERSION_MAJOR) michael@0: AC_MSG_RESULT([release $VERSION, library $LIB_VERSION, unicode version $UNICODE_VERSION]) michael@0: michael@0: AC_SUBST(UNICODE_VERSION) michael@0: michael@0: # Determine the host system michael@0: AC_CANONICAL_HOST michael@0: michael@0: AC_SUBST(CPPFLAGS) michael@0: michael@0: # This variable is needed on z/OS because the C++ compiler only recognizes .C michael@0: _CXX_CXXSUFFIX=cpp michael@0: export _CXX_CXXSUFFIX michael@0: michael@0: # Accumulate #defines michael@0: michael@0: # CONFIG_CPPFLAGS: These are defines that are set for ICU Build time only. michael@0: # They are only needed for building ICU itself. Example: platform stuff michael@0: CONFIG_CPPFLAGS="" michael@0: # UCONFIG_CPPFLAGS: These are defines which are set for ICU build time, michael@0: # and also a notice is output that they need to be set michael@0: # for end-users of ICU also. uconfig.h.prepend is generated michael@0: # with, for example, "#define U_DISABLE_RENAMING 1" michael@0: # Example: ICU configuration stuff michael@0: UCONFIG_CPPFLAGS="" michael@0: # UCONFIG_CFLAGS: contains a copy of anything that needs to be set by end users michael@0: # such as -std michael@0: UCONFIG_CFLAGS="" michael@0: michael@0: # Check whether to build debug libraries michael@0: AC_MSG_CHECKING([whether to build debug libraries]) michael@0: enabled=no michael@0: ENABLE_DEBUG=0 michael@0: AC_ARG_ENABLE(debug, michael@0: [ --enable-debug build debug libraries and enable the U_DEBUG define [default=no]], michael@0: [ case "${enableval}" in michael@0: yes|"") enabled=yes; ENABLE_DEBUG=1; CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEBUG=1" ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(ENABLE_DEBUG) michael@0: michael@0: # Check whether to build release libraries michael@0: AC_MSG_CHECKING([whether to build release libraries]) michael@0: enabled=yes michael@0: ENABLE_RELEASE=1 michael@0: AC_ARG_ENABLE(release, michael@0: [ --enable-release build release libraries [default=yes]], michael@0: [ case "${enableval}" in michael@0: no) enabled=no; ENABLE_RELEASE=0 ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(ENABLE_RELEASE) michael@0: michael@0: # Don't use the default C/CXXFLags michael@0: : ${CFLAGS=""} michael@0: : ${CXXFLAGS=""} michael@0: michael@0: # Checks for compilers michael@0: AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc]) michael@0: # Make sure that we try clang++ first, which provides C++11 support. michael@0: # The g++ compiler is less likely to support C++11. michael@0: AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC]) michael@0: michael@0: # Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option michael@0: # The release mode use is the default one for autoconf michael@0: if test "$GCC" = yes; then michael@0: if test "$CFLAGS" = ""; then michael@0: if test "$ENABLE_DEBUG" = 1; then michael@0: CFLAGS=-g michael@0: fi michael@0: if test "$ENABLE_RELEASE" = 1; then michael@0: CFLAGS="$CFLAGS -O2" michael@0: fi michael@0: fi michael@0: if test "$CXXFLAGS" = ""; then michael@0: if test "$ENABLE_DEBUG" = 1; then michael@0: CXXFLAGS=-g michael@0: fi michael@0: if test "$ENABLE_RELEASE" = 1; then michael@0: CXXFLAGS="$CXXFLAGS -O2" michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: AC_PROG_CPP michael@0: michael@0: AC_PROG_INSTALL michael@0: michael@0: AC_SUBST(cross_compiling) michael@0: michael@0: dnl use the pld hack to get ac_fn_cxx_try_link defined globally and not local michael@0: AC_LANG_PUSH([C++]) michael@0: AC_LINK_IFELSE([AC_LANG_PROGRAM()]) michael@0: AC_LANG_POP([C++]) michael@0: michael@0: # make sure install is relative to srcdir - if a script michael@0: if test "$srcdir" = "."; then michael@0: # If srcdir isn't just ., then (srcdir) is already prepended. michael@0: if test "${ac_install_sh}" = "${INSTALL}"; then michael@0: INSTALL="\\\$(top_srcdir)/${ac_install_sh}" michael@0: fi michael@0: fi michael@0: michael@0: #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) michael@0: #AC_CHECK_PROG(STRIP, strip, strip, true) michael@0: michael@0: # Check for the platform make michael@0: AC_PATH_PROGS(U_MAKE, gmake gnumake, make) michael@0: AC_SUBST(U_MAKE) michael@0: michael@0: michael@0: AC_ARG_WITH(cross-build, michael@0: [ --with-cross-build=dir specify an absolute path to the build directory of an ICU built for the current platform [default=no cross dir]], michael@0: [cross_buildroot="${withval}"], michael@0: [cross_buildroot=""]) michael@0: michael@0: if test "X$cross_buildroot" = "X"; then michael@0: if test "$cross_compiling" = "yes"; then michael@0: AC_MSG_ERROR([Error! Cross compiling but no --with-cross-build option specified - please supply the path to an executable ICU's build root]) michael@0: dnl ' michael@0: fi michael@0: else michael@0: if test -f "${cross_buildroot}/config/icucross.mk"; then michael@0: AC_MSG_RESULT([Using cross buildroot: $cross_buildroot]) michael@0: else michael@0: if test -d "${cross_buildroot}"; then michael@0: AC_MSG_ERROR([${cross_buildroot}/config/icucross.mk not found. Please build ICU in ${cross_buildroot} first.]) michael@0: else michael@0: AC_MSG_ERROR([No such directory ${cross_buildroot} supplied as the argument to --with-cross-build. Use an absolute path.]) michael@0: fi michael@0: fi michael@0: fi michael@0: AC_SUBST(cross_buildroot) michael@0: michael@0: # Check for doxygen to generate documentation michael@0: AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin) michael@0: michael@0: # Check that the linker is usable michael@0: ICU_PROG_LINK michael@0: michael@0: # Determine the executable suffix michael@0: # We don't use AC_EXEEXT because some compilers output separate debugging michael@0: # files, which confuses the AC_EXEEXT macro. michael@0: AC_MSG_CHECKING(checking for executable suffix) michael@0: case "${host}" in michael@0: *-*-cygwin*|*-*-mingw*) EXEEXT=.exe ;; michael@0: *) EXEEXT="" ;; michael@0: esac michael@0: ac_exeext=$EXEEXT michael@0: AC_MSG_RESULT($EXEEXT) michael@0: AC_SUBST(EXEEXT) michael@0: michael@0: # Determine how strict we want to be when compiling michael@0: AC_CHECK_STRICT_COMPILE michael@0: michael@0: # Check if we can build and use 64-bit libraries michael@0: AC_CHECK_64BIT_LIBS michael@0: AC_SUBST(ARFLAGS) michael@0: AC_SUBST(COMPILE_LINK_ENVVAR) michael@0: michael@0: # Determine the Makefile fragment michael@0: ICU_CHECK_MH_FRAG michael@0: michael@0: # Checks for libraries and other host specific stuff michael@0: # On HP/UX, don't link to -lm from a shared lib because it isn't michael@0: # PIC (at least on 10.2) michael@0: case "${host}" in michael@0: *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; michael@0: michael@0: *) AC_CHECK_LIB(m, floor) michael@0: LIB_M="" ;; michael@0: esac michael@0: AC_SUBST(LIB_M) michael@0: michael@0: # Check whether to build shared libraries michael@0: AC_MSG_CHECKING([whether to build shared libraries]) michael@0: enabled=no michael@0: AC_ARG_ENABLE(shared, michael@0: [ --enable-shared build shared libraries [default=yes]], michael@0: [ case "${enableval}" in michael@0: yes|"") enabled=yes; ENABLE_SHARED=YES ;; michael@0: no);; michael@0: *) ;; michael@0: esac], michael@0: [enabled=yes; ENABLE_SHARED=YES] michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(ENABLE_SHARED) michael@0: michael@0: # Check whether to build static libraries michael@0: AC_MSG_CHECKING([whether to build static libraries]) michael@0: enabled=no michael@0: AC_ARG_ENABLE(static, michael@0: [ --enable-static build static libraries [default=no]], michael@0: [ case "${enableval}" in michael@0: yes|"") enabled=yes; ENABLE_STATIC=YES ;; michael@0: no) ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(ENABLE_STATIC) michael@0: michael@0: # When building release static library, there might be some optimization flags we can use michael@0: if test "$ENABLE_STATIC" = "YES"; then michael@0: if test "$ENABLE_SHARED" != "YES"; then michael@0: if test "$ENABLE_RELEASE" = 1; then michael@0: AC_MSG_CHECKING([whether we can use static library optimization option]) michael@0: CHECK_STATIC_OPT_FLAG=no michael@0: michael@0: OLD_CPPFLAGS="${CPPFLAGS}" michael@0: OLD_LDFLAGS="${LDFLAGS}" michael@0: michael@0: case "${host}" in michael@0: *-linux*|i*86-*-*bsd*|i*86-pc-gnu) michael@0: if test "$GCC" = yes; then michael@0: CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections" michael@0: LDFLAGS="${LDFLAGS} -Wl,--gc-sections" michael@0: fi michael@0: ;; michael@0: *) michael@0: ;; michael@0: esac michael@0: michael@0: AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [CHECK_STATIC_OPT_FLAG=yes], [CHECK_STATIC_OPT_FLAG=no]) michael@0: AC_MSG_RESULT($CHECK_STATIC_OPT_FLAG) michael@0: if test "$CHECK_STATIC_OPT_FLAG" = no; then michael@0: CPPFLAGS="${OLD_CPPFLAGS}" michael@0: LDFLAGS="${OLD_LDFLAGS}" michael@0: fi michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: michael@0: # Check whether to enable auto cleanup of libraries michael@0: AC_MSG_CHECKING([whether to enable auto cleanup of libraries]) michael@0: enabled=no michael@0: UCLN_NO_AUTO_CLEANUP=1 michael@0: AC_ARG_ENABLE(auto-cleanup, michael@0: [ --enable-auto-cleanup enable auto cleanup of libraries [default=no]], michael@0: [ case "${enableval}" in michael@0: yes) enabled=yes; michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DUCLN_NO_AUTO_CLEANUP=0"; michael@0: UCLN_NO_AUTO_CLEANUP=0 michael@0: ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(UCLN_NO_AUTO_CLEANUP) michael@0: michael@0: # MSVC floating-point option michael@0: MSVC_RELEASE_FLAG="" michael@0: if test $enabled = yes michael@0: then michael@0: if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc michael@0: then michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ michael@0: #if defined _MSC_VER && _MSC_VER >= 1400 michael@0: #else michael@0: Microsoft Visual C++ < 2005 michael@0: #endif michael@0: ]], [[]])],[MSVC_RELEASE_FLAG="/fp:precise"],[MSVC_RELEASE_FLAG="/Op"]) michael@0: michael@0: CFLAGS="${CFLAGS} ${MSVC_RELEASE_FLAG}" michael@0: CXXFLAGS="${CXXFLAGS} ${MSVC_RELEASE_FLAG}" michael@0: fi michael@0: fi michael@0: michael@0: # Check whether to enabled draft APIs michael@0: AC_MSG_CHECKING([whether to enable draft APIs]) michael@0: enabled=yes michael@0: U_DEFAULT_SHOW_DRAFT=1 michael@0: AC_ARG_ENABLE(draft, michael@0: [ --enable-draft enable draft APIs (and internal APIs) [default=yes]], michael@0: [ case "${enableval}" in michael@0: no) enabled=no; U_DEFAULT_SHOW_DRAFT=0; michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEFAULT_SHOW_DRAFT=0" michael@0: ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: # Make sure that we can use draft API in ICU. michael@0: if test "$U_DEFAULT_SHOW_DRAFT" = 0; then michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API" michael@0: fi michael@0: AC_SUBST(U_DEFAULT_SHOW_DRAFT) michael@0: michael@0: AC_PROG_RANLIB michael@0: michael@0: # look for 'ar' the proper way michael@0: AC_CHECK_TOOL(AR, ar, false) michael@0: michael@0: AC_MSG_CHECKING([whether to enable renaming of symbols]) michael@0: enabled=yes michael@0: U_DISABLE_RENAMING=0 michael@0: AC_ARG_ENABLE(renaming, michael@0: [ --enable-renaming add a version suffix to symbols [default=yes]], michael@0: [ case "${enableval}" in michael@0: yes|"") enabled=yes ;; michael@0: no) enabled=no; U_DISABLE_RENAMING=1; michael@0: UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_DISABLE_RENAMING=1" michael@0: ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(U_DISABLE_RENAMING) michael@0: michael@0: AC_MSG_CHECKING([whether to enable function and data tracing]) michael@0: enabled=no michael@0: U_ENABLE_TRACING=0 michael@0: AC_ARG_ENABLE(tracing, michael@0: [ --enable-tracing enable function and data tracing [default=no]], michael@0: [ case "${enableval}" in michael@0: yes|"") enabled=yes; michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_TRACING=1"; michael@0: U_ENABLE_TRACING=1 ;; michael@0: no) enabled=no; U_ENABLE_TRACING=0 ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enabled) michael@0: AC_SUBST(U_ENABLE_TRACING) michael@0: michael@0: # check if elf.h is present. michael@0: AC_CHECK_HEADERS([elf.h]) michael@0: if test "x$ac_cv_header_elf_h" = "xyes"; then michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_HAVE_ELF_H=1"; michael@0: fi michael@0: michael@0: U_ENABLE_DYLOAD=1 michael@0: enable=yes michael@0: AC_MSG_CHECKING([whether to enable dynamic loading of plugins]) michael@0: AC_ARG_ENABLE(dyload, michael@0: [ --disable-dyload disable dynamic loading [default=no]], michael@0: [ case "${enableval}" in michael@0: yes|"") michael@0: U_ENABLE_DYLOAD=1 michael@0: enable=yes michael@0: ;; michael@0: no) michael@0: U_ENABLE_DYLOAD=0; michael@0: enable=no; michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_DYLOAD=0"; michael@0: ;; michael@0: *) ;; michael@0: esac], michael@0: ) michael@0: AC_MSG_RESULT($enable) michael@0: AC_SUBST(U_ENABLE_DYLOAD) michael@0: michael@0: if test "$enable" = "yes"; then michael@0: AC_CHECK_HEADERS([dlfcn.h]) michael@0: #AC_MSG_RESULT($enabled) michael@0: AC_SEARCH_LIBS([dlopen], [dl]) michael@0: AC_CHECK_FUNCS([dlopen]) michael@0: michael@0: if test "x$ac_cv_func_dlopen" != xyes; then michael@0: CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DHAVE_DLOPEN=0" michael@0: fi michael@0: fi michael@0: michael@0: # Check for miscellanous functions. michael@0: # So, use for putil / tools only. michael@0: # Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY michael@0: AC_CHECK_FUNCS([gettimeofday]) michael@0: michael@0: michael@0: # Check whether to use the evil rpath or not michael@0: AC_ARG_ENABLE(rpath, michael@0: [ --enable-rpath use rpath when linking [default is only if necessary]], michael@0: [ case "${enableval}" in michael@0: yes|"") ENABLE_RPATH=YES ;; michael@0: no) ;; michael@0: *) ;; michael@0: esac], michael@0: [ENABLE_RPATH=NO] michael@0: ) michael@0: AC_SUBST(ENABLE_RPATH) michael@0: michael@0: michael@0: michael@0: AC_LANG_PUSH([C++]) michael@0: AC_MSG_CHECKING([[if we have a C++ compiler]]) michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx_okay=yes],[cxx_okay=no]) michael@0: if test $cxx_okay = yes michael@0: then michael@0: AC_MSG_RESULT([[Good]]) michael@0: else michael@0: AC_MSG_RESULT([[no]]) michael@0: AC_MSG_ERROR([[C++ compiler $CXX does not work or no compiler found]]) michael@0: fi michael@0: michael@0: if [[ "$GXX" = yes ]]; then michael@0: # if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x, michael@0: # and check that the compiler still works. michael@0: if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then michael@0: OLD_CXXFLAGS="${CXXFLAGS}" michael@0: CXXFLAGS="$CXXFLAGS --std=c++0x" michael@0: AC_MSG_CHECKING([[if we have a C++11 compiler]]) michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no]) michael@0: AC_MSG_RESULT($cxx11_okay) michael@0: if [[ $cxx11_okay = yes ]]; then michael@0: AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x]) michael@0: UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x" michael@0: else michael@0: CXXFLAGS="$OLD_CXXFLAGS" michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: AC_MSG_CHECKING([[if #include works]]) michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no]) michael@0: AC_MSG_RESULT($ac_cv_header_stdstring) michael@0: if test $ac_cv_header_stdstring = yes michael@0: then michael@0: U_HAVE_STD_STRING=1 michael@0: else michael@0: U_HAVE_STD_STRING=0 michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0" michael@0: fi michael@0: AC_SUBST(U_HAVE_STD_STRING) michael@0: michael@0: michael@0: AC_MSG_CHECKING([[if #include works]]) michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no]) michael@0: AC_MSG_RESULT($ac_cv_header_atomic) michael@0: if test $ac_cv_header_atomic = yes michael@0: then michael@0: U_HAVE_ATOMIC=1 michael@0: else michael@0: U_HAVE_ATOMIC=0 michael@0: fi michael@0: # Make this available via CPPFLAGS michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}" michael@0: AC_SUBST(U_HAVE_ATOMIC) michael@0: michael@0: AC_LANG_POP([C++]) michael@0: michael@0: # Always build ICU with multi-threading support. michael@0: threads=true michael@0: ICU_USE_THREADS=1 michael@0: OLD_LIBS=${LIBS} michael@0: michael@0: if test $threads = true; then michael@0: # For Compaq Tru64 (OSF1), we must look for pthread_attr_init michael@0: # and must do this before seaching for pthread_mutex_destroy, or michael@0: # we will pick up libpthreads.so not libpthread.so michael@0: # If this fails, then we must test for HPUX specials, before michael@0: # moving on to a more generic test michael@0: michael@0: AC_CHECK_LIB(pthread, pthread_attr_init) michael@0: if test $ac_cv_lib_pthread_pthread_attr_init = yes; then michael@0: ICU_USE_THREADS=1 michael@0: else michael@0: # Locate the right library for POSIX threads. We look for the michael@0: # symbols in the libraries first, because on Solaris libc provides michael@0: # pthread_create but libpthread has the real code :( michael@0: # AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread michael@0: # FreeBSD users may need libpthread if they do not have libc_r. michael@0: michael@0: AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r ) michael@0: michael@0: if test "$ac_cv_search_pthread_mutex_destroy" != no; then michael@0: ICU_USE_THREADS=1 michael@0: else michael@0: # For HP 11 michael@0: AC_CHECK_LIB(pthread, pthread_mutex_init) michael@0: if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then michael@0: ICU_USE_THREADS=1 michael@0: fi michael@0: fi michael@0: michael@0: AC_CHECK_FUNC(pthread_mutex_lock) michael@0: michael@0: if test $ac_cv_func_pthread_mutex_lock = yes; then michael@0: ICU_USE_THREADS=1 michael@0: fi michael@0: fi michael@0: # Check to see if we are using CygWin with MSVC michael@0: case "${host}" in michael@0: *-pc-cygwin*|*-pc-mingw*) michael@0: # For gcc, the thread options are set by mh-mingw/mh-cygwin michael@0: # For msvc, the thread options are set by runConfigureICU michael@0: ICU_USE_THREADS=1 michael@0: ;; michael@0: *-*-hpux*) michael@0: # Add -mt because it does several nice things on newer compilers. michael@0: case "${icu_cv_host_frag}" in michael@0: mh-hpux-acc) michael@0: OLD_CXXFLAGS="${CXXFLAGS}" michael@0: CXXFLAGS="${CXXFLAGS} -mt" michael@0: if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then michael@0: CXXFLAGS="${OLD_CXXFLAGS}" michael@0: else michael@0: UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" michael@0: fi michael@0: ;; michael@0: esac michael@0: ;; michael@0: *-*-solaris*) michael@0: case "${icu_cv_host_frag}" in michael@0: mh-solaris) michael@0: LIBS="${LIBS} -mt" michael@0: ;; michael@0: esac michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_ARG_ENABLE(weak-threads, michael@0: [ --enable-weak-threads weakly reference the threading library [default=no]], michael@0: [case "${enableval}" in michael@0: yes) michael@0: LIB_THREAD="${LIBS%${OLD_LIBS}}" michael@0: LIBS=${OLD_LIBS} michael@0: ;; michael@0: no) ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-weak-threads) ;; michael@0: esac]) michael@0: AC_SUBST(LIB_THREAD) michael@0: michael@0: # Check for mmap() michael@0: michael@0: # The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific. michael@0: # Do this check instead. michael@0: HAVE_MMAP=0 michael@0: AC_MSG_CHECKING([for mmap]) michael@0: AC_CACHE_VAL(ac_cv_func_mmap_ok, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include michael@0: #include michael@0: #include michael@0: #include ], [mmap((void *)0, 0, PROT_READ, 0, 0, 0);])],[ac_cv_func_mmap_ok=yes],[ac_cv_func_mmap_ok=no])] ) michael@0: AC_MSG_RESULT($ac_cv_func_mmap_ok) michael@0: if test $ac_cv_func_mmap_ok = yes michael@0: then michael@0: HAVE_MMAP=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_MMAP=0" michael@0: fi michael@0: AC_SUBST(HAVE_MMAP) michael@0: michael@0: AC_MSG_CHECKING([for genccode assembly]) michael@0: michael@0: # Check to see if genccode can generate simple assembly. michael@0: GENCCODE_ASSEMBLY= michael@0: case "${host}" in michael@0: *-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu) michael@0: if test "$GCC" = yes; then michael@0: # We're using gcc, and the simple -a gcc command line works for genccode michael@0: GENCCODE_ASSEMBLY="-a gcc" michael@0: fi ;; michael@0: i*86-*-solaris*) michael@0: if test "$GCC" = yes; then michael@0: # When using gcc, look if we're also using GNU as. michael@0: # When using GNU as, the simple -a gcc command line works for genccode. michael@0: asv=`"${CC}" -print-prog-name=as 2>/dev/null` michael@0: asv=`"${asv}" --version 2>/dev/null` michael@0: case "X${asv}" in michael@0: X*GNU*) GENCCODE_ASSEMBLY="-a gcc" ;; michael@0: X*) GENCCODE_ASSEMBLY="-a sun-x86" ;; michael@0: esac michael@0: unset asv michael@0: else michael@0: GENCCODE_ASSEMBLY="-a sun-x86" michael@0: fi ;; michael@0: sparc-*-solaris*) michael@0: GENCCODE_ASSEMBLY="-a sun" michael@0: ;; michael@0: ia64-*-hpux*) michael@0: GENCCODE_ASSEMBLY="-a aCC-ia64" michael@0: ;; michael@0: esac michael@0: AC_SUBST(GENCCODE_ASSEMBLY) michael@0: michael@0: AC_MSG_RESULT($GENCCODE_ASSEMBLY) michael@0: michael@0: # Checks for header files michael@0: AC_CHECK_HEADERS(inttypes.h) michael@0: if test $ac_cv_header_inttypes_h = no; then michael@0: U_HAVE_INTTYPES_H=0 michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0" michael@0: else michael@0: U_HAVE_INTTYPES_H=1 michael@0: fi michael@0: if test "$CC" = ccc; then michael@0: AC_MSG_RESULT("C compiler set to CCC ${CC}" ) michael@0: case "${host}" in michael@0: alpha*-*-*) U_HAVE_INTTYPES_H=0; michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0" michael@0: esac michael@0: fi michael@0: michael@0: AC_SUBST(U_HAVE_INTTYPES_H) michael@0: michael@0: AC_CHECK_HEADERS(dirent.h) michael@0: if test $ac_cv_header_dirent_h = no; then michael@0: U_HAVE_DIRENT_H=0 michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_DIRENT_H=0" michael@0: else michael@0: U_HAVE_DIRENT_H=1 michael@0: fi michael@0: michael@0: AC_SUBST(U_HAVE_DIRENT_H) michael@0: michael@0: # Check for endianness michael@0: AC_C_BIGENDIAN() michael@0: if test $ac_cv_c_bigendian = no; then michael@0: U_IS_BIG_ENDIAN=0 michael@0: U_ENDIAN_CHAR="l" michael@0: else michael@0: U_IS_BIG_ENDIAN=1 michael@0: U_ENDIAN_CHAR="b" michael@0: fi michael@0: AC_SUBST(U_IS_BIG_ENDIAN) michael@0: michael@0: # Do various POSIX related checks michael@0: U_HAVE_NL_LANGINFO_CODESET=0 michael@0: U_NL_LANGINFO_CODESET=-1 michael@0: AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0]) michael@0: dnl AC_SUBST(U_HAVE_NL_LANGINFO) michael@0: if test $U_HAVE_NL_LANGINFO -eq 1; then michael@0: AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset], michael@0: ac_cv_nl_langinfo_codeset, michael@0: [ac_cv_nl_langinfo_codeset="unknown" michael@0: for a in CODESET _NL_CTYPE_CODESET_NAME; do michael@0: AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[nl_langinfo($a);]])],[ac_cv_nl_langinfo_codeset="$a"; break],[])] michael@0: done) michael@0: if test x$ac_cv_nl_langinfo_codeset != xunknown michael@0: then michael@0: U_HAVE_NL_LANGINFO_CODESET=1 michael@0: U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset michael@0: if test "x${ac_cv_nl_langinfo_codeset}" != "xCODESET" michael@0: then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DNL_LANGINFO_CODESET=${ac_cv_nl_langinfo_codeset}" michael@0: fi michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_NL_LANGINFO_CODESET=0" michael@0: fi michael@0: fi michael@0: AC_SUBST(U_HAVE_NL_LANGINFO_CODESET) michael@0: AC_SUBST(U_NL_LANGINFO_CODESET) michael@0: michael@0: # Namespace support checks michael@0: AC_LANG(C++) michael@0: AC_MSG_CHECKING([for namespace support]) michael@0: AC_CACHE_VAL(ac_cv_namespace_ok, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace x_version {void f(){}} michael@0: namespace x = x_version; michael@0: using namespace x_version; michael@0: ], [f();])],[ac_cv_namespace_ok=yes],[ac_cv_namespace_ok=no])] ) michael@0: AC_MSG_RESULT($ac_cv_namespace_ok) michael@0: if test $ac_cv_namespace_ok = no michael@0: then michael@0: AC_MSG_ERROR(Namespace support is required to build ICU.) michael@0: fi michael@0: michael@0: AC_MSG_CHECKING([for properly overriding new and delete]) michael@0: U_OVERRIDE_CXX_ALLOCATION=0 michael@0: U_HAVE_PLACEMENT_NEW=0 michael@0: AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include michael@0: class UMemory { michael@0: public: michael@0: void *operator new(size_t size) {return malloc(size);} michael@0: void *operator new[](size_t size) {return malloc(size);} michael@0: void operator delete(void *p) {free(p);} michael@0: void operator delete[](void *p) {free(p);} michael@0: }; michael@0: ]], [])],[ac_cv_override_cxx_allocation_ok=yes],[ac_cv_override_cxx_allocation_ok=no])] ) michael@0: AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok) michael@0: if test $ac_cv_override_cxx_allocation_ok = yes michael@0: then michael@0: U_OVERRIDE_CXX_ALLOCATION=1 michael@0: AC_MSG_CHECKING([for placement new and delete]) michael@0: AC_CACHE_VAL(ac_cv_override_placement_new_ok, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include michael@0: class UMemory { michael@0: public: michael@0: void *operator new(size_t size) {return malloc(size);} michael@0: void *operator new[](size_t size) {return malloc(size);} michael@0: void operator delete(void *p) {free(p);} michael@0: void operator delete[](void *p) {free(p);} michael@0: void * operator new(size_t, void *ptr) { return ptr; } michael@0: void operator delete(void *, void *) {} michael@0: }; michael@0: ]], [])],[ac_cv_override_placement_new_ok=yes],[ac_cv_override_placement_new_ok=no])] ) michael@0: AC_MSG_RESULT($ac_cv_override_placement_new_ok) michael@0: if test $ac_cv_override_placement_new_ok = yes michael@0: then michael@0: U_HAVE_PLACEMENT_NEW=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_PLACEMENT_NEW=0" michael@0: fi michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_OVERRIDE_CXX_ALLOCATION=0" michael@0: fi michael@0: AC_SUBST(U_OVERRIDE_CXX_ALLOCATION) michael@0: AC_SUBST(U_HAVE_PLACEMENT_NEW) michael@0: michael@0: AC_LANG(C) michael@0: AC_CHECK_FUNC(popen) michael@0: if test x$ac_cv_func_popen = xyes michael@0: then michael@0: U_HAVE_POPEN=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_POPEN=0" michael@0: U_HAVE_POPEN=0 michael@0: fi michael@0: AC_SUBST(U_HAVE_POPEN) michael@0: michael@0: AC_CHECK_FUNC(tzset) michael@0: U_HAVE_TZSET=0 michael@0: if test x$ac_cv_func_tzset = xyes michael@0: then michael@0: U_TZSET=tzset michael@0: U_HAVE_TZSET=1 michael@0: else michael@0: AC_CHECK_FUNC(_tzset) michael@0: if test x$ac_cv_func__tzset = xyes michael@0: then michael@0: U_TZSET=_tzset michael@0: U_HAVE_TZSET=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0" michael@0: fi michael@0: fi michael@0: AC_SUBST(U_HAVE_TZSET) michael@0: AC_SUBST(U_TZSET) michael@0: michael@0: U_HAVE_TZNAME=0 michael@0: AC_CACHE_CHECK(for tzname,ac_cv_var_tzname, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef __USE_POSIX michael@0: #define __USE_POSIX michael@0: #endif michael@0: #include michael@0: #include michael@0: #ifndef tzname /* For SGI. */ michael@0: extern char *tzname[]; /* RS6000 and others reject char **tzname. */ michael@0: #endif]], [atoi(*tzname);])],[ac_cv_var_tzname=yes],[ac_cv_var_tzname=no])]) michael@0: if test $ac_cv_var_tzname = yes; then michael@0: U_TZNAME=tzname michael@0: U_HAVE_TZNAME=1 michael@0: else michael@0: AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include michael@0: #include michael@0: extern char *_tzname[];]], [atoi(*_tzname);])],[ac_cv_var__tzname=yes],[ac_cv_var__tzname=no])]) michael@0: if test $ac_cv_var__tzname = yes; then michael@0: U_TZNAME=_tzname michael@0: U_HAVE_TZNAME=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0" michael@0: fi michael@0: fi michael@0: AC_SUBST(U_HAVE_TZNAME) michael@0: AC_SUBST(U_TZNAME) michael@0: michael@0: AC_CACHE_CHECK(for timezone,ac_cv_var_timezone, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifndef __USE_POSIX michael@0: #define __USE_POSIX michael@0: #endif michael@0: #ifndef __USE_XOPEN michael@0: #define __USE_XOPEN michael@0: #endif michael@0: #include michael@0: ], [[timezone = 1;]])],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no])]) michael@0: U_HAVE_TIMEZONE=0 michael@0: if test $ac_cv_var_timezone = yes; then michael@0: U_TIMEZONE=timezone michael@0: U_HAVE_TIMEZONE=1 michael@0: else michael@0: AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[__timezone = 1;]])],[ac_cv_var___timezone=yes],[ac_cv_var___timezone=no])]) michael@0: if test $ac_cv_var___timezone = yes; then michael@0: U_TIMEZONE=__timezone michael@0: U_HAVE_TIMEZONE=1 michael@0: else michael@0: AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone, michael@0: [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[_timezone = 1;]])],[ac_cv_var__timezone=yes],[ac_cv_var__timezone=no])]) michael@0: if test $ac_cv_var__timezone = yes; then michael@0: U_TIMEZONE=_timezone michael@0: U_HAVE_TIMEZONE=1 michael@0: else michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TIMEZONE=0" michael@0: fi michael@0: fi michael@0: fi michael@0: AC_SUBST(U_HAVE_TIMEZONE) michael@0: AC_SUBST(U_TIMEZONE) michael@0: michael@0: # Checks for typedefs michael@0: AC_CHECK_TYPE(int8_t,signed char) michael@0: AC_CHECK_TYPE(uint8_t,unsigned char) michael@0: AC_CHECK_TYPE(int16_t,signed short) michael@0: AC_CHECK_TYPE(uint16_t,unsigned short) michael@0: AC_CHECK_TYPE(int32_t,signed long) michael@0: AC_CHECK_TYPE(uint32_t,unsigned long) michael@0: AC_CHECK_TYPE(int64_t,signed long long) michael@0: AC_CHECK_TYPE(uint64_t,unsigned long long) michael@0: michael@0: if test $ac_cv_type_int8_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT8_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_uint8_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT8_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_int16_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT16_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_uint16_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT16_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_int32_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT32_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_uint32_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT32_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_int64_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT64_T=0" michael@0: fi michael@0: michael@0: if test $ac_cv_type_uint64_t = no; then michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT64_T=0" michael@0: fi michael@0: michael@0: # Do various wchar_t related checks michael@0: AC_CHECK_HEADER(wchar.h) michael@0: if test "$ac_cv_header_wchar_h" = no michael@0: then michael@0: U_HAVE_WCHAR_H=0 michael@0: U_HAVE_WCSCPY=0 michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCHAR_H=0 -DU_HAVE_WCSCPY=0" michael@0: else michael@0: AC_DEFINE([HAVE_WCHAR_H], [1], [wchar.h was found.]) michael@0: U_HAVE_WCHAR_H=1 michael@0: # Some broken systems have wchar.h but not some of its functions... michael@0: AC_SEARCH_LIBS(wcscpy, wcs w) michael@0: if test "$ac_cv_search_wcscpy" != no; then michael@0: U_HAVE_WCSCPY=1 michael@0: else michael@0: U_HAVE_WCSCPY=0 michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCSCPY=0" michael@0: fi michael@0: fi michael@0: AC_SUBST(U_HAVE_WCHAR_H) michael@0: AC_SUBST(U_HAVE_WCSCPY) michael@0: michael@0: AC_CHECK_SIZEOF([wchar_t], 0, [ michael@0: #if STDC_HEADERS michael@0: #include michael@0: #endif michael@0: #include michael@0: #if HAVE_WCHAR_H michael@0: #include michael@0: #include michael@0: #endif]) michael@0: U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t michael@0: # We do this check to verify that everything is okay. michael@0: if test $U_SIZEOF_WCHAR_T = 0; then michael@0: if test $U_HAVE_WCHAR_H=1; then michael@0: AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0) michael@0: fi michael@0: fi michael@0: michael@0: AC_MSG_CHECKING([for UTF-16 string literal support]) michael@0: U_CHECK_UTF16_STRING=1 michael@0: CHECK_UTF16_STRING_RESULT="unknown" michael@0: michael@0: case "${host}" in michael@0: *-*-aix*|powerpc64-*-linux*) michael@0: if test "$GCC" = no; then michael@0: OLD_CFLAGS="${CFLAGS}" michael@0: OLD_CXXFLAGS="${CXXFLAGS}" michael@0: CFLAGS="${CFLAGS} -qutf" michael@0: CXXFLAGS="${CXXFLAGS} -qutf" michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = u"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0]) michael@0: if test "$U_CHECK_UTF16_STRING" = 0; then michael@0: CFLAGS="${OLD_CFLAGS}" michael@0: CXXFLAGS="${OLD_CXXFLAGS}" michael@0: else michael@0: UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -qutf" michael@0: CHECK_UTF16_STRING_RESULT="-qutf" michael@0: fi michael@0: fi michael@0: ;; michael@0: *-*-solaris*) michael@0: if test "$GCC" = no; then michael@0: OLD_CFLAGS="${CFLAGS}" michael@0: OLD_CXXFLAGS="${CXXFLAGS}" michael@0: CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort" michael@0: CXXFLAGS="${CXXFLAGS} -xustr=ascii_utf16_ushort" michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = U"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0]) michael@0: if test "$U_CHECK_UTF16_STRING" = 0; then michael@0: CFLAGS="${OLD_CFLAGS}" michael@0: CXXFLAGS="${OLD_CXXFLAGS}" michael@0: else michael@0: CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort" michael@0: UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -xustr=ascii_utf16_ushort" michael@0: UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -xustr=ascii_utf16_ushort" michael@0: # Since we can't detect the availability of this UTF-16 syntax at compile time, michael@0: # we depend on configure telling us that we can use it. michael@0: # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort, michael@0: # we only use this macro within ICU. michael@0: # If an ICU user uses icu-config, this feature will be enabled. michael@0: CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_CHECK_UTF16_STRING=1" michael@0: U_CHECK_UTF16_STRING=0 michael@0: fi michael@0: fi michael@0: ;; michael@0: *-*-hpux*) michael@0: if test "$GCC" = no; then michael@0: # The option will be detected at compile time without additional compiler options. michael@0: CHECK_UTF16_STRING_RESULT="available" michael@0: fi michael@0: ;; michael@0: *-*-cygwin) michael@0: # wchar_t can be used michael@0: CHECK_UTF16_STRING_RESULT="available" michael@0: ;; michael@0: *) michael@0: ;; michael@0: esac michael@0: michael@0: # GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future. michael@0: if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then michael@0: if test "$GCC" = yes; then michael@0: OLD_CFLAGS="${CFLAGS}" michael@0: CFLAGS="${CFLAGS} -std=gnu99" michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ michael@0: static const char16_t test[] = u"This is a UTF16 literal string."; michael@0: ]], [[]])],[CC_UTF16_STRING=1],[CC_UTF16_STRING=0]) michael@0: if test "$CC_UTF16_STRING" = 1; then michael@0: UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -std=gnu99" michael@0: CHECK_UTF16_STRING_RESULT="C only"; michael@0: else michael@0: CFLAGS="${OLD_CFLAGS}" michael@0: fi michael@0: fi michael@0: if test "$GXX" = yes; then michael@0: # -Wno-return-type-c-linkage is desired so that stable ICU API is not warned about. michael@0: AC_LANG_PUSH([C++]) michael@0: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ michael@0: static const char16_t test[] = u"This is a UTF16 literal string."; michael@0: ]], [[]])],[CXX_UTF16_STRING=1],[CXX_UTF16_STRING=0]) michael@0: AC_LANG_POP([C++]) michael@0: if test "$CXX_UTF16_STRING" = 1; then michael@0: if test "$CC_UTF16_STRING" = 1; then michael@0: CHECK_UTF16_STRING_RESULT="available"; michael@0: else michael@0: CHECK_UTF16_STRING_RESULT="C++ only"; michael@0: fi michael@0: fi michael@0: fi michael@0: fi michael@0: AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT) michael@0: michael@0: # Enable/disable extras michael@0: AC_ARG_ENABLE(extras, michael@0: [ --enable-extras build ICU extras [default=yes]], michael@0: [case "${enableval}" in michael@0: yes) extras=true ;; michael@0: no) extras=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;; michael@0: esac], michael@0: extras=true) michael@0: ICU_CONDITIONAL(EXTRAS, test "$extras" = true) michael@0: AC_ARG_ENABLE(icuio, michael@0: [ --enable-icuio build ICU's icuio library [default=yes]], michael@0: [case "${enableval}" in michael@0: yes) icuio=true ;; michael@0: no) icuio=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;; michael@0: esac], michael@0: icuio=true) michael@0: ICU_CONDITIONAL(ICUIO, test "$icuio" = true) michael@0: michael@0: # Enable/disable layout michael@0: AC_ARG_ENABLE(layout, michael@0: [ --enable-layout build ICU's layout library [default=yes]], michael@0: [case "${enableval}" in michael@0: yes) layout=true ;; michael@0: no) layout=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;; michael@0: esac], michael@0: layout=true) michael@0: ICU_CONDITIONAL(LAYOUT, test "$layout" = true) michael@0: michael@0: # Enable/disable tools michael@0: AC_ARG_ENABLE(tools, michael@0: [ --enable-tools build ICU's tools [default=yes]], michael@0: [case "${enableval}" in michael@0: yes) tools=true ;; michael@0: no) tools=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;; michael@0: esac], michael@0: tools=true) michael@0: ICU_CONDITIONAL(TOOLS, test "$tools" = true) michael@0: michael@0: AC_ARG_WITH(data-packaging, michael@0: [ --with-data-packaging=type specify how to package ICU data (files, archive, library, static, auto) [default=auto]], michael@0: [case "${withval}" in michael@0: files|archive|library) datapackaging=$withval ;; michael@0: auto) datapackaging=$withval ;; michael@0: common) datapackaging=archive ;; michael@0: dll) datapackaging=library ;; michael@0: static) datapackaging=static ;; michael@0: *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;; michael@0: esac], michael@0: [datapackaging=]) michael@0: michael@0: # Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc.. michael@0: # thesysconfdir=`eval echo $sysconfdir` michael@0: dnl# AC_SUBST(thesysconfdir) michael@0: dnl# thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir` michael@0: dnl# AC_SUBST(thelibdir) michael@0: thedatadir=`eval echo $datadir` michael@0: dnl# AC_SUBST(thedatadir) michael@0: # 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}. michael@0: pkgicudatadir=$datadir michael@0: thepkgicudatadir=$thedatadir michael@0: AC_SUBST(pkgicudatadir) michael@0: AC_SUBST(thepkgicudatadir) michael@0: michael@0: dnl# Shouldn't need the AC_SUBST michael@0: michael@0: if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then michael@0: # default to library michael@0: datapackaging=library michael@0: if test "$ENABLE_STATIC" = "YES"; then michael@0: if test "$ENABLE_SHARED" != "YES"; then michael@0: datapackaging=static michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: datapackaging_dir=`eval echo $thedatadir`"/icu/${VERSION}" michael@0: michael@0: datapackaging_msg="(No explaination for mode $datapackaging.)" michael@0: michael@0: 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." michael@0: 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." michael@0: datapackaging_howfound="(unknown)" michael@0: michael@0: case "$datapackaging" in michael@0: files) michael@0: DATA_PACKAGING_MODE=files michael@0: datapackaging_msg="ICU data will be stored in individual files." michael@0: datapackaging_howfound="$datapackaging_msg_path" michael@0: ;; michael@0: archive) michael@0: DATA_PACKAGING_MODE=common michael@0: datapackaging_msg="ICU data will be stored in a single .dat file." michael@0: datapackaging_howfound="$datapackaging_msg_path" michael@0: ;; michael@0: library) michael@0: DATA_PACKAGING_MODE=dll michael@0: datapackaging_msg="ICU data will be linked with ICU." michael@0: if test "$ENABLE_STATIC" = "YES"; then michael@0: datapackaging_msg="$datapackaging_msg A static data library will be built. " michael@0: fi michael@0: if test "$ENABLE_SHARED" = "YES"; then michael@0: datapackaging_msg="$datapackaging_msg A shared data library will be built. " michael@0: fi michael@0: datapackaging_howfound="$datapackaging_msg_set" michael@0: ;; michael@0: static) michael@0: DATA_PACKAGING_MODE=static michael@0: datapackaging_msg="ICU data will be stored in a static library." michael@0: datapackaging_howfound="$datapackaging_msg_set" michael@0: ;; michael@0: esac michael@0: AC_SUBST(DATA_PACKAGING_MODE) michael@0: michael@0: # Sets a library suffix michael@0: AC_MSG_CHECKING([for a library suffix to use]) michael@0: AC_ARG_WITH(library-suffix, michael@0: [ --with-library-suffix=suffix tag a suffix to the library names [default=]], michael@0: [ICULIBSUFFIX="${withval}"], michael@0: [ICULIBSUFFIX=]) michael@0: msg=$ICULIBSUFFIX michael@0: if test "$msg" = ""; then michael@0: msg=none michael@0: fi michael@0: AC_MSG_RESULT($msg) michael@0: AC_SUBST(ICULIBSUFFIX) michael@0: if test "$ICULIBSUFFIX" != "" michael@0: then michael@0: U_HAVE_LIB_SUFFIX=1 michael@0: ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'` michael@0: UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} " michael@0: else michael@0: U_HAVE_LIB_SUFFIX=0 michael@0: fi michael@0: AC_SUBST(U_HAVE_LIB_SUFFIX) michael@0: AC_SUBST(ICULIBSUFFIXCNAME) michael@0: michael@0: # Enable/disable tests michael@0: AC_ARG_ENABLE(tests, michael@0: [ --enable-tests build ICU tests [default=yes]], michael@0: [case "${enableval}" in michael@0: yes) tests=true ;; michael@0: no) tests=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; michael@0: esac], michael@0: tests=true) michael@0: ICU_CONDITIONAL(TESTS, test "$tests" = true) michael@0: michael@0: # Enable/disable samples michael@0: AC_ARG_ENABLE(samples, michael@0: [ --enable-samples build ICU samples [default=yes] michael@0: michael@0: Additionally, the variable FORCE_LIBS may be set before calling configure. michael@0: If set, it will REPLACE any automatic list of libraries.], michael@0: [case "${enableval}" in michael@0: yes) samples=true ;; michael@0: no) samples=false ;; michael@0: *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;; michael@0: esac], michael@0: samples=true) michael@0: ICU_CONDITIONAL(SAMPLES, test "$samples" = true) michael@0: michael@0: ICUDATA_CHAR=$U_ENDIAN_CHAR michael@0: michael@0: # Platform-specific Makefile setup michael@0: # set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform. michael@0: case "${host}" in michael@0: *-*-solaris*) platform=U_SOLARIS ;; michael@0: *-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) platform=U_LINUX ;; michael@0: *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;; michael@0: *-*-aix*) platform=U_AIX ;; michael@0: *-*-hpux*) platform=U_HPUX ;; michael@0: *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; michael@0: *-*-cygwin*) platform=U_CYGWIN ;; michael@0: *-*-mingw*) platform=U_MINGW ;; michael@0: *-*ibm-openedition*|*-*-os390*) platform=OS390 michael@0: if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then michael@0: ICUDATA_CHAR="e" michael@0: fi ;; michael@0: *-*-os400*) platform=OS400 michael@0: if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then michael@0: ICUDATA_CHAR="e" michael@0: fi ;; michael@0: *-*-nto*) platform=U_QNX ;; michael@0: *-dec-osf*) platform=U_OSF ;; michael@0: *-*-beos) platform=U_BEOS ;; michael@0: *-*-irix*) platform=U_IRIX ;; michael@0: *-ncr-*) platform=U_MPRAS ;; michael@0: *) platform=U_UNKNOWN_PLATFORM ;; michael@0: esac michael@0: AC_SUBST(ICUDATA_CHAR) michael@0: AC_SUBST(platform) michael@0: platform_make_fragment_name="$icu_cv_host_frag" michael@0: platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name" michael@0: AC_SUBST(platform_make_fragment_name) michael@0: AC_SUBST(platform_make_fragment) michael@0: michael@0: if test "${FORCE_LIBS}" != ""; then michael@0: echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6 michael@0: LIBS=${FORCE_LIBS} michael@0: fi michael@0: michael@0: # Now that we're done using CPPFLAGS etc. for tests, we can change it michael@0: # for build. michael@0: michael@0: if test "${CC}" == "clang"; then michael@0: CLANGCFLAGS="-Qunused-arguments -Wno-parentheses-equality" michael@0: else michael@0: CLANGCFLAGS="" michael@0: fi michael@0: michael@0: if test "${CXX}" == "clang++"; then michael@0: CLANGCXXFLAGS="-Qunused-arguments -Wno-parentheses-equality" michael@0: else michael@0: CLANGCXXFLAGS="" michael@0: fi michael@0: michael@0: CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)" michael@0: CFLAGS="$CFLAGS \$(THREADSCFLAGS) $CLANGCFLAGS" michael@0: CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS) $CLANGCXXFLAGS" michael@0: michael@0: AC_SUBST(LIBCFLAGS) michael@0: AC_SUBST(LIBCXXFLAGS) michael@0: michael@0: # append all config cppflags michael@0: CPPFLAGS="$CPPFLAGS $CONFIG_CPPFLAGS $UCONFIG_CPPFLAGS" michael@0: michael@0: echo "CPPFLAGS=$CPPFLAGS" michael@0: echo "CFLAGS=$CFLAGS" michael@0: echo "CXXFLAGS=$CXXFLAGS" michael@0: michael@0: michael@0: # output the Makefiles michael@0: AC_CONFIG_FILES([icudefs.mk \ michael@0: Makefile \ michael@0: data/pkgdataMakefile \ michael@0: config/Makefile.inc \ michael@0: config/icu.pc \ michael@0: config/pkgdataMakefile \ michael@0: data/Makefile \ michael@0: stubdata/Makefile \ michael@0: common/Makefile \ michael@0: i18n/Makefile \ michael@0: layout/Makefile \ michael@0: layoutex/Makefile \ michael@0: io/Makefile \ michael@0: extra/Makefile \ michael@0: extra/uconv/Makefile \ michael@0: extra/uconv/pkgdataMakefile \ michael@0: extra/scrptrun/Makefile \ michael@0: tools/Makefile \ michael@0: tools/ctestfw/Makefile \ michael@0: tools/toolutil/Makefile \ michael@0: tools/makeconv/Makefile \ michael@0: tools/genrb/Makefile \ michael@0: tools/genccode/Makefile \ michael@0: tools/gencmn/Makefile \ michael@0: tools/gencnval/Makefile \ michael@0: tools/gendict/Makefile \ michael@0: tools/gentest/Makefile \ michael@0: tools/gennorm2/Makefile \ michael@0: tools/genbrk/Makefile \ michael@0: tools/gensprep/Makefile \ michael@0: tools/icuinfo/Makefile \ michael@0: tools/icupkg/Makefile \ michael@0: tools/icuswap/Makefile \ michael@0: tools/pkgdata/Makefile \ michael@0: tools/tzcode/Makefile \ michael@0: tools/gencfu/Makefile \ michael@0: test/Makefile \ michael@0: test/compat/Makefile \ michael@0: test/testdata/Makefile \ michael@0: test/testdata/pkgdataMakefile \ michael@0: test/hdrtst/Makefile \ michael@0: test/intltest/Makefile \ michael@0: test/cintltst/Makefile \ michael@0: test/iotest/Makefile \ michael@0: test/letest/Makefile \ michael@0: test/perf/Makefile \ michael@0: test/perf/collationperf/Makefile \ michael@0: test/perf/collperf/Makefile \ michael@0: test/perf/dicttrieperf/Makefile \ michael@0: test/perf/ubrkperf/Makefile \ michael@0: test/perf/charperf/Makefile \ michael@0: test/perf/convperf/Makefile \ michael@0: test/perf/normperf/Makefile \ michael@0: test/perf/DateFmtPerf/Makefile \ michael@0: test/perf/howExpensiveIs/Makefile \ michael@0: test/perf/strsrchperf/Makefile \ michael@0: test/perf/unisetperf/Makefile \ michael@0: test/perf/usetperf/Makefile \ michael@0: test/perf/ustrperf/Makefile \ michael@0: test/perf/utfperf/Makefile \ michael@0: test/perf/utrie2perf/Makefile \ michael@0: test/perf/leperf/Makefile \ michael@0: samples/Makefile samples/date/Makefile \ michael@0: samples/cal/Makefile samples/layout/Makefile]) michael@0: AC_OUTPUT michael@0: michael@0: echo michael@0: echo "ICU for C/C++ $VERSION is ready to be built." michael@0: echo "=== Important Notes: ===" michael@0: michael@0: echo "Data Packaging: $datapackaging" michael@0: echo " This means: $datapackaging_msg" michael@0: echo " To locate data: $datapackaging_howfound" michael@0: michael@0: if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then michael@0: echo "Building ICU: Use a GNU make such as $U_MAKE to build ICU." michael@0: else michael@0: echo "** WARNING: $U_MAKE may not be GNU make." michael@0: echo "This may cause ICU to fail to build. Please make sure that GNU make" michael@0: echo "is in your PATH so that the configure script can detect its location." michael@0: fi michael@0: if test "x$AR" = "xfalse"; then michael@0: echo "*** WARNING: Archiver ar not found. Set AR= or fix PATH. Some builds (such as static) may fail." michael@0: fi michael@0: michael@0: AC_MSG_CHECKING([the version of "$U_MAKE"]) michael@0: if "$U_MAKE" -f "$srcdir/config/gmakever.mk" PLATFORM="$platform"; then michael@0: AC_MSG_RESULT([ok]) michael@0: else michael@0: AC_MSG_RESULT([too old or test failed - try upgrading GNU Make]) michael@0: fi michael@0: michael@0: AC_SUBST(UCONFIG_CPPFLAGS) michael@0: if test -n "$UCONFIG_CPPFLAGS"; then michael@0: HDRFILE="uconfig.h.prepend" michael@0: echo "*** WARNING: You must set the following flags before code compiled against this ICU will function properly:" michael@0: echo michael@0: echo " ${UCONFIG_CPPFLAGS}" michael@0: echo michael@0: 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.' michael@0: echo "Creating the file ${HDRFILE}" michael@0: echo michael@0: echo '--------------- ' "${HDRFILE}" michael@0: echo > "${HDRFILE}" michael@0: echo '/* ICU customizations: put these lines at the top of uconfig.h */' >> "${HDRFILE}" michael@0: echo >> "${HDRFILE}" michael@0: for flag in ${UCONFIG_CPPFLAGS}; michael@0: do michael@0: echo " /* $flag */" >> "${HDRFILE}" michael@0: case "${flag}" in michael@0: -D*=*) michael@0: [ \echo "${flag}" | sed -n 's%-D\([^=]*\)=%#define \1 %p' >> "${HDRFILE}" ] michael@0: \echo >> "${HDRFILE}" michael@0: ;; michael@0: -D*) michael@0: [ \echo "${flag}" | sed -n 's%-D\([^=]*\)%#define \1 %p' >> "${HDRFILE}" ] michael@0: \echo >> "${HDRFILE}" michael@0: ;; michael@0: *) michael@0: \echo "/* Not sure how to handle this argument: ${flag} */" >> "${HDRFILE}" michael@0: \echo >> "${HDRFILE}" michael@0: ;; michael@0: esac michael@0: done michael@0: cat "${HDRFILE}" michael@0: \echo "/* End of ${HDRFILE} ------------ */" >> "${HDRFILE}" michael@0: echo >> "${HDRFILE}" michael@0: echo '--------------- end ' "${HDRFILE}" michael@0: fi michael@0: michael@0: AC_SUBST(UCONFIG_CFLAGS) michael@0: if test -n "$UCONFIG_CFLAGS"; then michael@0: echo "C apps may want to build with CFLAGS = ${UCONFIG_CFLAGS}" michael@0: fi michael@0: AC_SUBST(UCONFIG_CXXFLAGS) michael@0: if test -n "$UCONFIG_CXXFLAGS"; then michael@0: echo "C++ apps may want to build with CXXFLAGS = ${UCONFIG_CXXFLAGS}" michael@0: fi michael@0: michael@0: if test "$tools" = false; michael@0: then michael@0: echo "## Note: you have disabled ICU's tools. This ICU cannot build its own data or tests." michael@0: echo "## Expect build failures in the 'data', 'test', and other directories." michael@0: fi michael@0: michael@0: $as_unset _CXX_CXXSUFFIX