dnl -*-m4-*- dnl configure.in for ICU dnl Copyright (c) 1999-2000, International Business Machines Corporation and dnl others. All Rights Reserved. dnl Stephen F. Booth, heavily modified by Yves and others dnl $Id: configure.in,v 1.93 2000/11/14 21:45:26 emader Exp $ dnl Process this file with autoconf to produce a configure script AC_INIT(common/unicode/utypes.h) AC_CONFIG_HEADER(common/icucfg.h) PACKAGE="icu" AC_SUBST(PACKAGE) AC_MSG_CHECKING(for ICU version numbers) dnl Get the ICU version from utypes.h changequote(<<, >>)dnl VERSION=`sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' $srcdir/common/unicode/utypes.h` dnl Compute a reasonable library version from the release version. This is dnl very bad, but that's wanted... We want to make sure that the LIB_VERSION dnl has at least a dot in it, so we'll add a .0 if needed. LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'` LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'` changequote([, ])dnl AC_SUBST(VERSION) AC_SUBST(LIB_VERSION) AC_SUBST(LIB_VERSION_MAJOR) AC_MSG_RESULT([release $VERSION, library $LIB_VERSION]) UNICODE_VERSION="3.0.0" AC_SUBST(UNICODE_VERSION) thedatadir=`eval echo $datadir` AC_SUBST(thedatadir) thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir` AC_SUBST(thelibdir) dnl Shouldn't need the AC_SUBST CPPFLAGS="${CPPFLAGS} -I." AC_SUBST(CPPFLAGS) dnl Checks for programs AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL # make sure install is relative to srcdir - if a script if test "$srcdir" = "."; then # If srcdir isn't just ., then (srcdir) is already prepended. if test "${ac_install_sh}" = "${INSTALL}"; then INSTALL="\\\$(top_srcdir)/${ac_install_sh}" fi fi AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) AC_CHECK_PROG(STRIP, strip, strip, true) dnl Check for the platform make AC_PATH_PROGS(U_MAKE, gmake, make) AC_SUBST(U_MAKE) dnl Determine how strict we want to be when compiling AC_CHECK_STRICT_COMPILE dnl Determine the host system and Makefile fragment AC_CANONICAL_HOST SOL64=no case "${host}" in *-*-solaris*) if test "$ac_cv_prog_gcc" = no; then AC_MSG_CHECKING([if we have a 64-bit (sparcv9) compiler]) SOL64=`$CXX -xarch=v9 && $CC -xarch=v9 2>&1 |grep -v usage:` if test -z "$SOL64"; then AC_MSG_RESULT(yes) SOL64=yes else AC_MSG_RESULT(no) SOL64=no fi fi ;; alpha*-*-linux-gnu) CFLAGS="${CFLAGS} -mieee -O2" CXXFLAGS="${CXXFLAGS} -mieee -O2" ;; esac ICU_CHECK_MH_FRAG hpuxcma=false dnl Checks for libraries and other host specific stuff dnl On HP/UX, don't link to -lm from a shared lib because it isn't dnl PIC (at least on 10.2) case "${host}" in *-*-hpux10*) hpuxcma=true AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; *) AC_CHECK_LIB(m, floor) LIB_M="" ;; esac AC_SUBST(LIB_M) dnl Enable/disable hpuxcma if test $hpuxcma = false; then AC_ARG_ENABLE(hpuxcma, [ --enable-hpuxcma build ICU with HPUX CMA threads (only ver>=11) [default=no]], [case "${enableval}" in yes) hpuxcma=true;; no) hpuxcma=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-hpuxcma) ;; esac], ) fi dnl Note, we set the conditional outside of IF for non hpux plats ICU_CONDITIONAL(HPUX_CMA, test "$hpuxcma" = true) dnl Should this be a nested CASE? if test $hpuxcma = true; then case "${host}" in *-*-hpux*) hpuxcma=true ;; *) AC_MSG_ERROR(--enable-hpuxcma is not valid on this platform ${host}) ;; esac fi dnl Check whether to build shared libraries AC_MSG_CHECKING([whether to build shared libraries]) enabled=no AC_ARG_ENABLE(shared, [ --enable-shared=[PKGS] build shared libraries [default=yes]], [ case "${enableval}" in yes|"") enabled=yes; ENABLE_SHARED=YES ;; no) ;; *) ;; esac], [ENABLE_SHARED=YES] ) AC_MSG_RESULT($enabled) AC_SUBST(ENABLE_SHARED) dnl Check whether to build static libraries AC_MSG_CHECKING([whether to build static libraries]) enabled=no AC_ARG_ENABLE(static, [ --enable-static[=PKGS] build static libraries [default=no]], [ case "${enableval}" in yes|"") enabled=yes; ENABLE_STATIC=YES ;; no) ;; *) ;; esac], ) AC_MSG_RESULT($enabled) AC_SUBST(ENABLE_STATIC) AC_PROG_RANLIB dnl Check whether to use the evil rpath or not AC_ARG_ENABLE(rpath, [ --enable-rpath use rpath when linking [default is only if necessary]], [ case "${enableval}" in yes|"") ENABLE_RPATH=YES ;; no) ;; *) ;; esac], [ENABLE_RPATH=NO] ) AC_SUBST(ENABLE_RPATH) threads=true dnl Enable/disable threads AC_ARG_ENABLE(threads, [ --enable-threads build ICU with threads [default=yes]], [case "${enableval}" in yes) threads=true ;; no) threads=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;; esac], threads=true) ICU_CONDITIONAL(THREADS, test "$threads" = true) ICU_USE_THREADS=0 dnl Test for HPUX cma threads first.. if test $hpuxcma = true; then dnl HPUX cma case if test $threads = true; then AC_CHECK_LIB(cma, pthread_create) if test $ac_cv_lib_cma_pthread_create = yes; then ICU_USE_THREADS=1 fi fi else if test $threads = true; then dnl Locate the right library for POSIX threads. We look for the dnl symbols in the libraries first, because on Solaris libc provides dnl pthread_create but libpthread has the real code :( dnl AIX uses libpthreads instead of libpthread, and HP/UX uses libcma dnl (but that was checked above). dnl FreeBSD users may need libpthread if they do not have libc_r. AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r cma) if test "$ac_cv_search_pthread_mutex_destroy" != no; then ICU_USE_THREADS=1 else dnl For HP 11 AC_CHECK_LIB(pthread, pthread_mutex_init) if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then ICU_USE_THREADS=1 fi fi AC_CHECK_FUNC(pthread_mutex_lock) if test $ac_cv_func_pthread_mutex_lock = yes; then ICU_USE_THREADS=1 fi fi fi AC_SUBST(ICU_USE_THREADS) # check for dlopen() HAVE_DLOPEN=0 #add more libs here.. AC_SEARCH_LIBS(dlopen, c dl) if test "$ac_cv_search_dlopen" != no; then HAVE_DLOPEN=1 fi if test $HAVE_DLOPEN = 0; then AC_CHECK_LIB(dld, shl_load) if test $ac_cv_lib_dld_shl_load = yes; then HAVE_DLOPEN=1 fi fi dnl added for s/390 DLL loading detection if test $HAVE_DLOPEN = 0; then AC_CHECK_FUNC(dllload) if test $ac_cv_func_dllload = yes; then HAVE_DLOPEN=1 fi fi AC_SUBST(HAVE_DLOPEN) dnl Check for mmap() AC_FUNC_MMAP if test $ac_cv_func_mmap_fixed_mapped = yes; then HAVE_MMAP=1 fi AC_SUBST(HAVE_MMAP) dnl Checks for header files AC_CHECK_HEADERS(inttypes.h) if test $ac_cv_header_inttypes_h = no; then U_HAVE_INTTYPES_H=0 else U_HAVE_INTTYPES_H=1 fi AC_SUBST(U_HAVE_INTTYPES_H) AC_ARG_WITH(iostream, [ --with-iostream=version specify the version of iostream to use (old, std, auto) [default=auto]], [case "${withval}" in none) streams=none ;; old) streams=198506 ;; std) streams=199711 ;; auto) streams= ;; *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;; esac], [streams=]) if test x$streams != xnone then AC_LANG_SAVE AC_LANG_CPLUSPLUS U_IOSTREAM_SOURCE=0 AC_CHECK_HEADER(iostream) if test $ac_cv_header_iostream = yes then U_IOSTREAM_SOURCE=199711 else AC_CHECK_HEADER(iostream.h) if test $ac_cv_header_iostream_h = yes; then AC_MSG_CHECKING([whether ostream is really defined]) AC_CACHE_VAL(ac_cv_iostream_ok, AC_TRY_LINK([#include ],[ostream &testout = cout; testout << "test" << endl;],ac_cv_iostream_ok=yes,ac_cv_iostream_ok=no)) AC_MSG_RESULT($ac_cv_iostream_ok) if test $ac_cv_iostream_ok = yes then U_IOSTREAM_SOURCE=198506 fi fi fi if test x$streams != x then if test $U_IOSTREAM_SOURCE -ge $streams then U_IOSTREAM_SOURCE=$streams else AC_MSG_ERROR(${withval} iostream is not available) fi fi fi AC_SUBST(U_IOSTREAM_SOURCE) AC_LANG_RESTORE dnl Check for endianness AC_C_BIGENDIAN(unknown) if test $ac_cv_c_bigendian = no; then U_IS_BIG_ENDIAN=0 else U_IS_BIG_ENDIAN=1 fi AC_SUBST(U_IS_BIG_ENDIAN) dnl Do various wchar_t related checks AC_CHECK_HEADER(wchar.h) if test "$ac_cv_header_wchar_h" = no then U_HAVE_WCHAR_H=0 U_HAVE_WCSCPY=0 else AC_DEFINE(HAVE_WCHAR_H) U_HAVE_WCHAR_H=1 dnl Some broken systems have wchar.h but not some of its functions... AC_SEARCH_LIBS(wcscpy, wcs) if test "$ac_cv_search_wcscpy" != no; then U_HAVE_WCSCPY=1 else U_HAVE_WCSCPY=0 fi fi AC_SUBST(U_HAVE_WCHAR_H) AC_SUBST(U_HAVE_WCSCPY) dnl Do various POSIX related checks U_HAVE_NL_LANGINFO_CODESET=0 U_NL_LANGINFO_CODESET=-1 AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0]) AC_SUBST(U_HAVE_NL_LANGINFO) if test $U_HAVE_NL_LANGINFO -eq 1; then AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset], ac_cv_nl_langinfo_codeset, [ac_cv_nl_langinfo_codeset="unknown" for a in CODESET _NL_CTYPE_CODESET_NAME; do AC_TRY_LINK([#include ],[nl_langinfo($a);],[ac_cv_nl_langinfo_codeset="$a"; break])] done) if test x$ac_cv_nl_langinfo_codeset != xunknown then U_HAVE_NL_LANGINFO_CODESET=1 U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset fi fi AC_SUBST(U_HAVE_NL_LANGINFO_CODESET) AC_SUBST(U_NL_LANGINFO_CODESET) AC_CHECK_FUNC(tzset) if test x$ac_cv_func_tzset = xyes then U_TZSET=tzset else AC_CHECK_FUNC(_tzset) if test x$ac_cv_func__tzset = xyes then U_TZSET=_tzset fi fi AC_SUBST(U_TZSET) AC_CACHE_CHECK(for tzname,ac_cv_var_tzname, [AC_TRY_LINK( changequote(<<, >>)dnl <<#ifndef __USE_POSIX #define __USE_POSIX #endif #include #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others reject char **tzname. */ #endif>>, changequote([, ])dnl [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) if test $ac_cv_var_tzname = yes; then U_TZNAME=tzname else AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname, [AC_TRY_LINK( changequote(<<, >>)dnl <<#include extern char *_tzname[]; >>, changequote([, ])dnl [atoi(*_tzname);], ac_cv_var__tzname=yes, ac_cv_var__tzname=no)]) if test $ac_cv_var__tzname = yes; then U_TZNAME=_tzname fi fi AC_SUBST(U_TZNAME) AC_CACHE_CHECK(for timezone,ac_cv_var_timezone, [AC_TRY_LINK( changequote(<<, >>)dnl <<#ifndef __USE_POSIX #define __USE_POSIX #endif #ifndef __USE_XOPEN #define __USE_XOPEN #endif #include >>, changequote([, ])dnl [timezone = 1;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)]) if test $ac_cv_var_timezone = yes; then U_TIMEZONE=timezone else AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone, [AC_TRY_LINK( changequote(<<, >>)dnl <<#include >>, changequote([, ])dnl [__timezone = 1;], ac_cv_var___timezone=yes, ac_cv_var___timezone=no)]) if test $ac_cv_var___timezone = yes; then U_TIMEZONE=__timezone else AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone, [AC_TRY_LINK( changequote(<<, >>)dnl <<#include >>, changequote([, ])dnl [_timezone = 1;], ac_cv_var__timezone=yes, ac_cv_var__timezone=no)]) if test $ac_cv_var__timezone = yes; then U_TIMEZONE=_timezone fi fi fi AC_SUBST(U_TIMEZONE) ac_default_sizeof_wchar_t=4 AC_DO_CHECK_SIZEOF(wchar_t,$ac_default_sizeof_wchar_t,[ #if STDC_HEADERS #include #endif #if HAVE_WCHAR_H #include #endif]) dnl We could set ac_cv_sizeof_wchar_t to the default if the check returned dnl 0 (unknown) but we'd rather do it in the headers, so we know we had no dnl clue at configure time. U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t AC_SUBST(U_SIZEOF_WCHAR_T) dnl Checks for typedefs AC_CHECK_TYPE(int8_t,signed char) AC_CHECK_TYPE(uint8_t,unsigned char) AC_CHECK_TYPE(int16_t,signed short) AC_CHECK_TYPE(uint16_t,unsigned short) AC_CHECK_TYPE(int32_t,signed long) AC_CHECK_TYPE(uint32_t,unsigned long) AC_CHECK_TYPE(bool_t,signed char) if test $ac_cv_type_int8_t = no; then HAVE_INT8_T=0 else HAVE_INT8_T=1 fi AC_SUBST(HAVE_INT8_T) if test $ac_cv_type_uint8_t = no; then HAVE_UINT8_T=0 else HAVE_UINT8_T=1 fi AC_SUBST(HAVE_UINT8_T) if test $ac_cv_type_int16_t = no; then HAVE_INT16_T=0 else HAVE_INT16_T=1 fi AC_SUBST(HAVE_INT16_T) if test $ac_cv_type_uint16_t = no; then HAVE_UINT16_T=0 else HAVE_UINT16_T=1 fi AC_SUBST(HAVE_UINT16_T) if test $ac_cv_type_int32_t = no; then HAVE_INT32_T=0 else HAVE_INT32_T=1 fi AC_SUBST(HAVE_INT32_T) if test $ac_cv_type_uint32_t = no; then HAVE_UINT32_T=0 else HAVE_UINT32_T=1 fi AC_SUBST(HAVE_UINT32_T) if test $ac_cv_type_bool_t = no; then HAVE_BOOL_T=0 else HAVE_BOOL_T=1 fi AC_SUBST(HAVE_BOOL_T) dnl Echo ECHO_N=$ac_n ECHO_C=$ac_c AC_SUBST(ECHO_N) AC_SUBST(ECHO_C) dnl Enable/disable extras AC_ARG_ENABLE(extras, [ --enable-extras build ICU extras [default=yes]], [case "${enableval}" in yes) extras=true ;; no) extras=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;; esac], extras=true) ICU_CONDITIONAL(EXTRAS, test "$extras" = true) AC_ARG_WITH(data-packaging, [ --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) [default=auto]], [case "${withval}" in files|archive|library) datapackaging=$withval ;; auto) datapackaging=$withval ;; *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;; esac], [datapackaging=]) dnl Deprecated support for --enable-mapped AC_ARG_ENABLE(mapped,, [case "${enableval}" in yes) mapped=archive ;; no) mapped=library ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-mapped; use --with-data-packaging now) ;; esac], [mapped=]) if test x"$mapped" != x; then case $mapped in archive) AC_MSG_WARN(use --with-data-packaging=archive instead of --enable-mapped) ;; library) AC_MSG_WARN(use --with-data-packaging=library instead of --disable-mapped) ;; esac if test x"$datapackaging" != x -a x"$mapped" != x"$datapackaging"; then AC_MSG_ERROR(conflicting values used for --with-data-packaging and deprecated --enable-mapped) fi datapackaging=$mapped fi if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then if test "$HAVE_DLOPEN" -eq 1; then datapackaging=library else datapackaging=archive fi fi case "$datapackaging" in files) DATA_PACKAGING_MODE=files ;; archive) DATA_PACKAGING_CPPFLAGS=-DUDATA_MAP DATA_PACKAGING_MODE=common ;; library) DATA_PACKAGING_CPPFLAGS=-DUDATA_DLL DATA_PACKAGING_MODE=dll ;; esac AC_SUBST(DATA_PACKAGING_CPPFLAGS) AC_SUBST(DATA_PACKAGING_MODE) dnl Enable/disable tests AC_ARG_ENABLE(tests, [ --enable-tests build ICU tests [default=yes]], [case "${enableval}" in yes) tests=true ;; no) tests=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; esac], tests=true) ICU_CONDITIONAL(TESTS, test "$tests" = true) dnl Enable/disable samples AC_ARG_ENABLE(samples, [ --enable-samples build ICU samples [default=yes] Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries.], [case "${enableval}" in yes) samples=true ;; no) samples=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;; esac], samples=true) ICU_CONDITIONAL(SAMPLES, test "$samples" = true) dnl Platform-specific Makefile setup case "${host}" in *-*-solaris*) platform=U_SOLARIS ;; *-*-linux*) platform=U_LINUX ;; *-*-freebsd*) platform=U_LINUX ;; *-*-aix*) platform=AIX ;; *-sequent-*) platform=PTX ;; *-*-hpux*) platform=HPUX ;; *-*-irix*) platform=IRIX ;; *-*-os390*) platform=OS390 ;; *-*-os400*) platform=OS400 ;; *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; *) platform=U_UNKNOWN_PLATFORM ;; esac AC_SUBST(platform) platform_make_fragment_name="$icu_cv_host_frag" platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name" AC_SUBST(platform_make_fragment_name) AC_SUBST(platform_make_fragment) dnl Handle -rpath options for shared library paths case "${host}" in *-*-solaris*) ld_rpath_suf=":" ;; *-*-linux*) ld_rpath_suf=" " ;; *-*-freebsd*) ld_rpath_suf=" " ;; *-*-aix*) ld_rpath_suf="" ;; *-sequent-*) ld_rpath_suf="" ;; *-*-hpux*) ld_rpath_suf=":" ;; *-*-irix*) ld_rpath_suf=" " ;; *-*-os390*) ld_rpath_suf="" ;; *-*-os400*) ld_rpath_suf=" " ;; *) ld_rpath_suf="" ;; esac AC_SUBST(ld_rpath_suf) dnl On HP/UX, main() functions compiled in C don't invoke dnl static constructors in C++ libs. Hack around that here dnl by renaming some .c files to .cpp case "${host}" in *-*-hpux*) for file in samples/date/date \ samples/cal/cal test/cintltst/cintltst \ tools/makeconv/makeconv tools/genrb/genrb \ tools/rbdump/read tools/genccode/genccode \ tools/gencmn/gencmn tools/gencnval/gencnval \ tools/gennames/gennames tools/gentest/gentest \ tools/pkgdata/pkgdata tools/genprops/genprops do if test -f $file.c; then mv $file.c $file.cpp else echo "# $file.c does not exist or is already renamed [warning]" fi done ;; esac if test "${FORCE_LIBS}" != ""; then echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6 LIBS=${FORCE_LIBS} fi dnl SPECIAL handling for HPUX 10 and also '11 & --enable-hpuxcma=true' if test $hpuxcma = true; then CPPFLAGS="${CPPFLAGS} -D_PTHREADS_DRAFT_4 -DHPUX_CMA" fi dnl END special dnl Now that we're done using CPPFLAGS etc. for tests, we can change it dnl for build. if test $ICU_USE_THREADS -ne 0 then CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)" CFLAGS="$CFLAGS \$(THREADSCFLAGS)" CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)" fi if test "$ac_cv_lib_dld_shl_load" = "yes"; then CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD" fi dnl added for s/390 DLL loading detection if test "$ac_cv_func_dllload" = "yes"; then CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD" fi dnl output the Makefiles AC_OUTPUT([README icudefs.mk \ Makefile \ data/Makefile \ common/Makefile config/Makefile.inc i18n/Makefile \ layout/Makefile layout/aat/Makefile layout/opentype/Makefile \ extra/Makefile extra/ustdio/Makefile \ tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \ tools/genrb/Makefile \ tools/pkgdata/Makefile tools/pkgdata/icupkg.inc \ tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \ tools/gennames/Makefile tools/toolutil/Makefile tools/gentest/Makefile tools/genprops/Makefile \ test/Makefile test/testdata/Makefile test/intltest/Makefile test/cintltst/Makefile \ test/ieeetest/Makefile \ samples/Makefile samples/date/Makefile samples/cal/Makefile \ samples/XMLConverter/Makefile \ common/unicode/platform.h]) if test $ICU_USE_THREADS = 0; then echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages [above] to see why we couldn't find pthread_create()" 1>&6 fi