1999-09-03 22:08:47 +00:00
dnl -*-m4-*-
1999-08-16 21:50:52 +00:00
dnl configure.in for ICU
2000-01-17 19:48:20 +00:00
dnl Copyright (c) 1999-2000, International Business Machines Corporation and
dnl others. All Rights Reserved.
1999-08-16 21:50:52 +00:00
dnl Stephen F. Booth
dnl Process this file with autoconf to produce a configure script
2000-02-16 22:38:38 +00:00
AC_INIT(common/unicode/utypes.h)
1999-12-09 23:11:48 +00:00
1999-08-16 21:50:52 +00:00
AC_CONFIG_HEADER(common/icucfg.h)
PACKAGE="icu"
AC_SUBST(PACKAGE)
2000-07-13 16:46:25 +00:00
VERSION="1.6"
1999-08-16 21:50:52 +00:00
AC_SUBST(VERSION)
1999-11-23 04:49:35 +00:00
UNICODE_VERSION="3.0.0"
AC_SUBST(UNICODE_VERSION)
1999-08-16 21:50:52 +00:00
2000-01-06 20:14:26 +00:00
dnl Shouldn't need the AC_SUBST
CPPFLAGS="${CPPFLAGS} -I."
AC_SUBST(CPPFLAGS)
1999-08-16 21:50:52 +00:00
dnl Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
1999-11-23 04:49:35 +00:00
AC_CHECK_PROG(STRIP, strip, strip, true)
1999-08-16 21:50:52 +00:00
2000-07-11 22:25:51 +00:00
dnl Check for the platform make
AC_PATH_PROGS(U_MAKE, gmake, make)
AC_SUBST(U_MAKE)
2000-04-10 21:54:53 +00:00
dnl Determine how strict we want to be when compiling
AC_CHECK_STRICT_COMPILE
1999-08-16 21:50:52 +00:00
dnl Determine the host system and Makefile fragment
AC_CANONICAL_HOST
2000-05-23 21:06:02 +00:00
case "${host}" in
*-*-solaris*)
if test "$ac_cv_prog_gcc" = no; then
AC_MSG_CHECKING([if we have a 64-bit (sparcv9) compiler])
2000-08-01 00:39:55 +00:00
SOL64=`$CXX -xarch=v9 && $CC -xarch=v9 2>&1 |grep -v usage:`
2000-05-23 21:06:02 +00:00
if test -z "$SOL64"; then
AC_MSG_RESULT(yes)
SOL64=yes
else
AC_MSG_RESULT(no)
SOL64=no
fi
fi ;;
*) SOL64=no ;;
esac
1999-08-16 21:50:52 +00:00
ICU_CHECK_MH_FRAG
2000-01-17 22:22:29 +00:00
hpuxcma=false
2000-05-23 21:06:02 +00:00
dnl Checks for libraries and other host specific stuff
1999-08-16 21:50:52 +00:00
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
2000-01-17 22:22:29 +00:00
*-*-hpux10*) hpuxcma=true
AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
1999-08-16 21:50:52 +00:00
*-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
2000-05-23 21:06:02 +00:00
1999-08-16 21:50:52 +00:00
*) AC_CHECK_LIB(m, floor)
LIB_M="" ;;
esac
AC_SUBST(LIB_M)
2000-01-17 22:22:29 +00:00
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
1999-12-09 23:11:48 +00:00
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
2000-01-17 22:22:29 +00:00
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
1999-12-09 23:47:30 +00:00
if test $threads = true; then
2000-01-17 22:22:29 +00:00
1999-12-09 23:11:48 +00:00
dnl special pthread handling
dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
1999-12-29 01:09:27 +00:00
dnl FreeBSD users -pthread
1999-12-09 23:11:48 +00:00
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = yes; then
ICU_USE_THREADS=1
2000-01-17 22:22:29 +00:00
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
1999-12-09 23:11:48 +00:00
fi
2000-01-17 22:22:29 +00:00
if test $ICU_USE_THREADS = 0; then
AC_CHECK_LIB(pthreads, pthread_create)
1999-12-09 23:11:48 +00:00
if test $ac_cv_lib_pthreads_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
2000-01-17 22:22:29 +00:00
if test $ICU_USE_THREADS = 0; then
1999-12-09 23:11:48 +00:00
AC_CHECK_LIB(cma, pthread_create)
if test $ac_cv_lib_cma_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
2000-01-08 01:34:45 +00:00
dnl If all other thread tests fail, try BSD's -pthread
if test $ICU_USE_THREADS = 0; then
AC_PTHREAD_FREEBSD
1999-12-29 01:09:27 +00:00
fi
2000-01-20 21:31:01 +00:00
AC_CHECK_FUNC(pthread_mutex_lock)
if test $ac_cv_func_pthread_mutex_lock = yes; then
ICU_USE_THREADS=1
fi
1999-08-16 21:50:52 +00:00
fi
2000-01-17 22:22:29 +00:00
fi
1999-08-16 21:50:52 +00:00
1999-12-09 23:11:48 +00:00
AC_SUBST(ICU_USE_THREADS)
2000-01-08 01:34:45 +00:00
dnl FreeBSD needs a WCS library.
AC_CHECK_LIB(wcs, wcscpy)
1999-12-04 02:31:40 +00:00
# check for dlopen()
HAVE_DLOPEN=0
#add more libs here..
1999-11-23 04:49:35 +00:00
AC_CHECK_LIB(dl, dlopen)
1999-12-04 02:31:40 +00:00
if test $ac_cv_lib_dl_dlopen = yes; then
HAVE_DLOPEN=1
fi
2000-01-19 07:23:50 +00:00
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
2000-03-20 23:29:45 +00:00
dnl added for s/390 DLL loading detection
2000-01-19 07:23:50 +00:00
2000-03-20 23:29:45 +00:00
if test $HAVE_DLOPEN = 0; then
AC_CHECK_FUNC(dllload)
if test $ac_cv_func_dllload = yes; then
HAVE_DLOPEN=1
fi
fi
1999-12-04 02:31:40 +00:00
AC_SUBST(HAVE_DLOPEN)
1999-08-16 21:50:52 +00:00
dnl Checks for header files
AC_CHECK_HEADERS(inttypes.h)
if test $ac_cv_header_inttypes_h = no; then
2000-06-30 21:35:03 +00:00
U_HAVE_INTTYPES_H=0
1999-08-16 21:50:52 +00:00
else
2000-06-30 21:35:03 +00:00
U_HAVE_INTTYPES_H=1
1999-08-16 21:50:52 +00:00
fi
2000-06-30 21:35:03 +00:00
AC_SUBST(U_HAVE_INTTYPES_H)
1999-08-16 21:50:52 +00:00
2000-04-25 21:18:35 +00:00
if test x$U_IOSTREAM_SOURCE = x
then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
2000-04-27 21:20:16 +00:00
U_IOSTREAM_SOURCE=0
2000-04-25 21:18:35 +00:00
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 <iostream.h>],[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
fi
AC_SUBST(U_IOSTREAM_SOURCE)
AC_LANG_RESTORE
1999-10-09 01:19:08 +00:00
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)
2000-04-06 23:36:17 +00:00
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
else
AC_DEFINE(HAVE_WCHAR_H)
U_HAVE_WCHAR_H=1
fi
AC_SUBST(U_HAVE_WCHAR_H)
ac_default_sizeof_wchar_t=4
AC_DO_CHECK_SIZEOF(wchar_t,$ac_default_sizeof_wchar_t,[
#if STDC_HEADERS
#include <stddef.h>
#endif
#if HAVE_WCHAR_H
#include <wchar.h>
#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)
1999-10-09 01:19:08 +00:00
1999-08-16 21:50:52 +00:00
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 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)
1999-11-23 04:49:35 +00:00
dnl Enable/disable mapped files [default DLL]
AC_ARG_ENABLE(mapped,
[ --enable-mapped try to use memory-mapped files (instead of DLLs) when possible [default=no]],
[case "${enableval}" in
yes) mapped=true ;;
no) mapped=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mapped) ;;
esac],
mapped=false)
1999-12-04 02:31:40 +00:00
ICU_CONDITIONAL(USE_MAPPED, test "$mapped" = true -o "$HAVE_DLOPEN" = 0)
1999-11-23 04:49:35 +00:00
1999-08-16 21:50:52 +00:00
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,
1999-12-09 23:11:48 +00:00
[ --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.],
1999-08-16 21:50:52 +00:00
[case "${enableval}" in
yes) samples=true ;;
no) samples=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;;
esac],
samples=true)
ICU_CONDITIONAL(SAMPLES, test "$samples" = true)
dnl Platform-specific Makefile setup
case "${host}" in
2000-06-30 21:35:03 +00:00
*-*-solaris*) platform=U_SOLARIS ;;
*-*-linux*) platform=U_LINUX ;;
*-*-freebsd*) platform=U_LINUX ;;
1999-08-16 21:50:52 +00:00
*-*-aix*) platform=AIX ;;
2000-06-28 22:18:27 +00:00
*-sequent-*) platform=PTX ;;
1999-08-16 21:50:52 +00:00
*-*-hpux*) platform=HPUX ;;
1999-12-30 06:55:24 +00:00
*-*-irix*) platform=IRIX ;;
1999-09-03 22:08:47 +00:00
*-*-os390*) platform=OS390 ;;
2000-03-07 01:28:09 +00:00
*-*-os400*) platform=OS400 ;;
2000-07-19 04:29:20 +00:00
*-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;;
2000-06-30 21:35:03 +00:00
*) platform=U_UNKNOWN_PLATFORM ;;
1999-08-16 21:50:52 +00:00
esac
AC_SUBST(platform)
host_frag=$icu_cv_host_frag
AC_SUBST_FILE(host_frag)
dnl Handle -rpath options for shared library paths
case "${host}" in
*-*-solaris*) ld_rpath_suf=":" ;;
*-*-linux*) ld_rpath_suf=" " ;;
1999-12-29 01:09:27 +00:00
*-*-freebsd*) ld_rpath_suf=" " ;;
1999-08-16 21:50:52 +00:00
*-*-aix*) ld_rpath_suf="" ;;
2000-06-28 22:18:27 +00:00
*-sequent-*) ld_rpath_suf="" ;;
1999-08-16 21:50:52 +00:00
*-*-hpux*) ld_rpath_suf=":" ;;
1999-12-30 06:55:24 +00:00
*-*-irix*) ld_rpath_suf=" " ;;
2000-01-21 07:30:58 +00:00
*-*-os390*) ld_rpath_suf="" ;;
2000-03-07 01:28:09 +00:00
*-*-os400*) ld_rpath_suf=" " ;;
1999-08-16 21:50:52 +00:00
*) 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
2000-08-16 17:02:34 +00:00
*-*-hpux*)
2000-07-07 23:39:54 +00:00
for file in samples/date/date \
1999-12-15 21:48:22 +00:00
samples/cal/cal test/cintltst/cintltst \
tools/makeconv/makeconv tools/genrb/genrb \
tools/rbdump/read tools/genccode/genccode \
tools/gencmn/gencmn tools/gencnval/gencnval \
2000-08-15 02:41:58 +00:00
tools/gennames/gennames tools/gentest/gentest \
tools/pkgdata/pkgdata
1999-08-16 21:50:52 +00:00
do
if test -f $file.c; then
mv $file.c $file.cpp
1999-12-15 21:48:22 +00:00
else
echo "# $file.c does not exist or is already renamed [warning]"
1999-08-16 21:50:52 +00:00
fi
done
;;
esac
1999-12-09 23:11:48 +00:00
if test "${FORCE_LIBS}" != ""; then
echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
LIBS=${FORCE_LIBS}
fi
1999-08-16 21:50:52 +00:00
2000-01-17 22:22:29 +00:00
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
2000-01-19 07:23:50 +00:00
2000-01-22 01:41:16 +00:00
if test "$ac_cv_lib_dld_shl_load" = "yes"; then
2000-01-19 07:23:50 +00:00
CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD"
fi
2000-02-16 22:38:38 +00:00
if test -f ./configure.in
then
# they are normal. Build is in .. (note this is mostly for the top level script)
DATABUILDDIR=`pwd`/../data/
RELATIVEDATADIR=../data/
else
DATABUILDDIR=`pwd`/data/
RELATIVEDATADIR=data/
fi
AC_SUBST(DATABUILDDIR)
AC_SUBST(RELATIVEDATADIR)
2000-01-19 07:23:50 +00:00
2000-03-20 23:29:45 +00:00
dnl added for s/390 DLL loading detection
if test "$ac_cv_func_dllload" = "yes"; then
2000-03-20 23:34:54 +00:00
CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD"
2000-03-20 23:29:45 +00:00
fi
1999-08-16 21:50:52 +00:00
dnl output the Makefiles
AC_OUTPUT([Makefile \
2000-06-13 19:44:38 +00:00
common/Makefile config/Makefile.inc i18n/Makefile \
1999-08-16 21:50:52 +00:00
extra/Makefile extra/ustdio/Makefile \
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
2000-07-07 23:39:54 +00:00
tools/genrb/Makefile \
2000-08-15 02:41:58 +00:00
tools/pkgdata/Makefile tools/pkgdata/icupkg.inc \
1999-12-04 02:31:40 +00:00
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \
2000-04-22 17:00:28 +00:00
tools/gennames/Makefile tools/toolutil/Makefile tools/gentest/Makefile tools/genprops/Makefile \
1999-08-16 21:50:52 +00:00
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
2000-04-06 23:36:17 +00:00
samples/XMLConverter/Makefile \
common/unicode/platform.h])
1999-12-09 23:11:48 +00:00
2000-02-16 22:38:38 +00:00
2000-02-07 21:00:53 +00:00
dnl create the data directory
2000-02-16 22:38:38 +00:00
if test -d $DATABUILDDIR
2000-02-07 21:00:53 +00:00
then
:
else
2000-02-16 22:38:38 +00:00
echo creating $DATABUILDDIR
mkdir -p $DATABUILDDIR
2000-02-07 21:00:53 +00:00
fi
2000-02-16 22:38:38 +00:00
if test -d $DATABUILDDIR/../source/test/testdata
then
:
else
echo creating $DATABUILDDIR/../source/test/testdata
mkdir -p $DATABUILDDIR/../source/test/testdata
2000-02-07 21:00:53 +00:00
fi
1999-12-09 23:11:48 +00:00
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