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