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