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