scuffed-code/icu4c/source/configure.in
2000-03-20 23:34:54 +00:00

428 lines
10 KiB
Plaintext

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
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)
VERSION="1.4.0"
AC_SUBST(VERSION)
UNICODE_VERSION="3.0.0"
AC_SUBST(UNICODE_VERSION)
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
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
AC_CHECK_PROG(STRIP, strip, strip, true)
dnl Determine the host system and Makefile fragment
AC_CANONICAL_HOST
ICU_CHECK_MH_FRAG
hpuxcma=false
dnl Checks for libraries
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
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 special pthread handling
dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
dnl FreeBSD users -pthread
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = yes; 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
if test $ICU_USE_THREADS = 0; then
AC_CHECK_LIB(pthreads, pthread_create)
if test $ac_cv_lib_pthreads_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
if test $ICU_USE_THREADS = 0; then
AC_CHECK_LIB(cma, pthread_create)
if test $ac_cv_lib_cma_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
dnl If all other thread tests fail, try BSD's -pthread
if test $ICU_USE_THREADS = 0; then
AC_PTHREAD_FREEBSD
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)
dnl FreeBSD needs a WCS library.
AC_CHECK_LIB(wcs, wcscpy)
# check for dlopen()
HAVE_DLOPEN=0
#add more libs here..
AC_CHECK_LIB(dl, dlopen)
if test $ac_cv_lib_dl_dlopen = yes; 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 Checks for header files
AC_CHECK_HEADERS(inttypes.h)
if test $ac_cv_header_inttypes_h = no; then
HAVE_INTTYPES_H=0
else
HAVE_INTTYPES_H=1
fi
AC_SUBST(HAVE_INTTYPES_H)
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 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)
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)
ICU_CONDITIONAL(USE_MAPPED, test "$mapped" = true -o "$HAVE_DLOPEN" = 0)
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=SOLARIS ;;
*-*-linux*) platform=LINUX ;;
*-*-freebsd*) platform=LINUX ;;
*-*-aix*) platform=AIX ;;
*-*-hpux*) platform=HPUX ;;
*-*-irix*) platform=IRIX ;;
*-*-os390*) platform=OS390 ;;
*-*-os400*) platform=OS400 ;;
*) platform=UNKNOWN ;;
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=" " ;;
*-*-freebsd*) ld_rpath_suf=" " ;;
*-*-aix*) 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 tools/gencol/gencol 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
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
if test "$ac_cv_lib_dld_shl_load" = "yes"; then
CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD"
fi
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)
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([Makefile \
common/Makefile common/unicode/platform.h config/Makefile i18n/Makefile \
extra/Makefile extra/ustdio/Makefile \
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
tools/genrb/Makefile tools/gencol/Makefile \
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \
tools/gennames/Makefile tools/toolutil/Makefile tools/gentest/Makefile \
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
samples/XMLConverter/Makefile])
dnl create the data directory
if test -d $DATABUILDDIR
then
:
else
echo creating $DATABUILDDIR
mkdir -p $DATABUILDDIR
fi
if test -d $DATABUILDDIR/translit
then
:
else
echo creating $DATABUILDDIR/translit
mkdir $DATABUILDDIR/translit
fi
if test -d $DATABUILDDIR/../source/test/testdata
then
:
else
echo creating $DATABUILDDIR/../source/test/testdata
mkdir -p $DATABUILDDIR/../source/test/testdata
fi
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