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