dnl aclocal.m4 for ICU
-dnl Copyright (c) 1999-2006, International Business Machines Corporation and
+dnl Copyright (c) 1999-2007, International Business Machines Corporation and
dnl others. All Rights Reserved.
dnl Stephen F. Booth
case "${host}" in
*-*-solaris*)
if test "$GCC" = yes; then
- icu_cv_host_frag=mh-solaris-gcc
+ icu_cv_host_frag=mh-solaris-gcc
else
icu_cv_host_frag=mh-solaris
fi ;;
alpha*-*-linux-gnu)
if test "$GCC" = yes; then
icu_cv_host_frag=mh-alpha-linux-gcc
- else
+ else
icu_cv_host_frag=mh-alpha-linux-cc
fi ;;
powerpc*-*-linux*)
if test "$GCC" = yes; then
- icu_cv_host_frag=mh-linux
+ icu_cv_host_frag=mh-linux
else
- icu_cv_host_frag=mh-linux-va
+ icu_cv_host_frag=mh-linux-va
fi ;;
-*-*-linux*) icu_cv_host_frag=mh-linux ;;
-*-*-cygwin)
+*-*-linux*|*-pc-gnu) icu_cv_host_frag=mh-linux ;;
+*-*-cygwin|*-*-mingw32)
if test "$GCC" = yes; then
- icu_cv_host_frag=mh-cygwin
+ AC_TRY_COMPILE([
+#ifndef __MINGW32__
+#error This is not MinGW
+#endif], [], icu_cv_host_frag=mh-mingw, icu_cv_host_frag=mh-cygwin)
else
- icu_cv_host_frag=mh-cygwin-msvc
- fi ;;
-*-*-mingw32)
- if test "$GCC" = yes; then
- icu_cv_host_frag=mh-mingw
- else
- icu_cv_host_frag=mh-cygwin-msvc
+ icu_cv_host_frag=mh-cygwin-msvc
fi ;;
*-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;;
*-*-aix*)
if test "$GCC" = yes; then
icu_cv_host_frag=mh-aix-gcc
else
- if test -n "`$CXX --help 2>&1 | grep 'IBM C and C++ Compilers$'`"; then
- icu_cv_host_frag=mh-aix
- else
- icu_cv_host_frag=mh-aix-va
- fi
+ icu_cv_host_frag=mh-aix-va
fi ;;
*-*-hpux*)
if test "$GCC" = yes; then
else
case "$CXX" in
*aCC) icu_cv_host_frag=mh-hpux-acc ;;
- *CC) icu_cv_host_frag=mh-hpux-cc ;;
esac
fi ;;
*-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;;
dnl AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl Search for a library defining FUNC, then see if it's not already available.
-
+
AC_DEFUN(AC_SEARCH_LIBS_FIRST,
[AC_PREREQ([2.13])
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
dnl These results can't be cached because is sets compiler flags.
AC_MSG_CHECKING([for 64-bit executable support])
if test "$ENABLE_64BIT_LIBS" != no; then
- case "${host}" in
- *-*-solaris*)
- SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
- if test "$GCC" = yes; then
- # We could add a check for -m64 depending on the gcc version.
- ENABLE_64BIT_LIBS=no
+ if test "$GCC" = yes; then
+ dnl First we check that gcc already compiles as 64-bit
+ if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
+ ENABLE_64BIT_LIBS=yes
else
+ dnl Now we check a little more forcefully.
+ dnl Maybe the compiler builds as 32-bit on a 64-bit machine.
+ OLD_CFLAGS="${CFLAGS}"
+ OLD_CXXFLAGS="${CXXFLAGS}"
+ CFLAGS="${CFLAGS} -m64"
+ CXXFLAGS="${CXXFLAGS} -m64"
+ AC_TRY_RUN(int main(void) {return 0;},
+ ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
+ if test "$ENABLE_64BIT_LIBS" = no; then
+ # Nope. We're on a 32-bit machine with a 32-bit compiler.
+ CFLAGS="${OLD_CFLAGS}"
+ CXXFLAGS="${OLD_CXXFLAGS}"
+ fi
+ fi
+ else
+ case "${host}" in
+ sparc*-*-solaris*)
+ SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
if test -z "$SOL64" && test -n "$SPARCV9"; then
CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
else
ENABLE_64BIT_LIBS=no
fi
- fi
- ;;
- ia64-*-linux*)
- if test "$GCC" = yes; then
- # gcc compiler support
- if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
+ ;;
+ i386-*-solaris*)
+ AMD64=`isainfo -n 2>&1 | grep amd64`
+ # The new compiler option
+ SOL64=`$CXX -m64 2>&1 && $CC -m64 2>&1 | grep -v usage:`
+ if test -z "$SOL64" && test -n "$AMD64"; then
+ CFLAGS="${CFLAGS} -m64"
+ CXXFLAGS="${CXXFLAGS} -m64"
ENABLE_64BIT_LIBS=yes
else
- ENABLE_64BIT_LIBS=no
+ # The older compiler option
+ SOL64=`$CXX -xtarget=generic64 2>&1 && $CC -xtarget=generic64 2>&1 | grep -v usage:`
+ if test -z "$SOL64" && test -n "$AMD64"; then
+ CFLAGS="${CFLAGS} -xtarget=generic64"
+ CXXFLAGS="${CXXFLAGS} -xtarget=generic64"
+ ENABLE_64BIT_LIBS=yes
+ else
+ ENABLE_64BIT_LIBS=no
+ fi
fi
- else
+ ;;
+ ia64-*-linux*)
# check for ecc/ecpc compiler support
if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then
if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then
# unknown
ENABLE_64BIT_LIBS=no
fi
- fi
- ;;
- x86_64-*-linux*)
- if test "$GCC" = yes; then
- if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
- ENABLE_64BIT_LIBS=yes
- else
- ENABLE_64BIT_LIBS=no
- fi
- else
- # unknown
- ENABLE_64BIT_LIBS=no
- fi
- ;;
- x86_64-*-cygwin)
- if test "$GCC" = yes; then
- if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
+ ;;
+ *-*-cygwin)
+ dnl vcvarsamd64.bat should have been used to enable 64-bit builds.
+ dnl We only do this check to display the correct answer.
+ if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then
ENABLE_64BIT_LIBS=yes
else
+ # unknown
ENABLE_64BIT_LIBS=no
fi
- else
- ENABLE_64BIT_LIBS=no
- OLD_CPPFLAGS="${CPPFLAGS}"
- OLD_LDFLAGS="${LDFLAGS}"
- CPPFLAGS="${CPPFLAGS} /DWIN64"
- LDFLAGS="${LDFLAGS} /MACHINE:AMD64"
- AC_TRY_RUN(int main(void) {return 0;},
- ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
- if test "$ENABLE_64BIT_LIBS" = no; then
- CPPFLAGS="${OLD_CPPFLAGS}"
- LDFLAGS="${OLD_LDFLAGS}"
- fi
- fi
- ;;
- *-*-aix*|powerpc64-*-linux*)
- if test "$ac_cv_prog_gcc" = no; then
- # Note: Have not tested 64-bitness with gcc.
- # Maybe the flag "-maix64" could be used with gcc?
+ ;;
+ *-*-aix*|powerpc64-*-linux*)
OLD_CFLAGS="${CFLAGS}"
OLD_CXXFLAGS="${CXXFLAGS}"
OLD_LDFLAGS="${LDFLAGS}"
ARFLAGS="${ARFLAGS} -X64"
esac
fi
- fi
- ;;
- *-*-hpux*)
- dnl First we try the newer +DD64, if that doesn't work,
- dnl try other options.
+ ;;
+ *-*-hpux*)
+ dnl First we try the newer +DD64, if that doesn't work,
+ dnl try other options.
- OLD_CFLAGS="${CFLAGS}"
- OLD_CXXFLAGS="${CXXFLAGS}"
- CFLAGS="${CFLAGS} +DD64"
- CXXFLAGS="${CXXFLAGS} +DD64"
- AC_TRY_RUN(int main(void) {return 0;},
- ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
- if test "$ENABLE_64BIT_LIBS" = no; then
- CFLAGS="${OLD_CFLAGS}"
- CXXFLAGS="${OLD_CXXFLAGS}"
- CFLAGS="${CFLAGS} +DA2.0W"
- CXXFLAGS="${CXXFLAGS} +DA2.0W"
+ OLD_CFLAGS="${CFLAGS}"
+ OLD_CXXFLAGS="${CXXFLAGS}"
+ CFLAGS="${CFLAGS} +DD64"
+ CXXFLAGS="${CXXFLAGS} +DD64"
AC_TRY_RUN(int main(void) {return 0;},
ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
if test "$ENABLE_64BIT_LIBS" = no; then
CFLAGS="${OLD_CFLAGS}"
CXXFLAGS="${OLD_CXXFLAGS}"
+ CFLAGS="${CFLAGS} +DA2.0W"
+ CXXFLAGS="${CXXFLAGS} +DA2.0W"
+ AC_TRY_RUN(int main(void) {return 0;},
+ ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
+ if test "$ENABLE_64BIT_LIBS" = no; then
+ CFLAGS="${OLD_CFLAGS}"
+ CXXFLAGS="${OLD_CXXFLAGS}"
+ fi
fi
- fi
- ;;
- *-*ibm-openedition*|*-*-os390*)
- OLD_CFLAGS="${CFLAGS}"
- OLD_CXXFLAGS="${CXXFLAGS}"
- OLD_LDFLAGS="${LDFLAGS}"
- CFLAGS="${CFLAGS} -Wc,lp64"
- CXXFLAGS="${CXXFLAGS} -Wc,lp64"
- LDFLAGS="${LDFLAGS} -Wl,lp64"
- AC_TRY_RUN(int main(void) {return 0;},
- ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
- if test "$ENABLE_64BIT_LIBS" = no; then
- CFLAGS="${OLD_CFLAGS}"
- CXXFLAGS="${OLD_CXXFLAGS}"
- LDFLAGS="${OLD_LDFLAGS}"
- fi
- ;;
- *)
- ENABLE_64BIT_LIBS=no
- ;;
- esac
+ ;;
+ *-*ibm-openedition*|*-*-os390*)
+ OLD_CFLAGS="${CFLAGS}"
+ OLD_CXXFLAGS="${CXXFLAGS}"
+ OLD_LDFLAGS="${LDFLAGS}"
+ CFLAGS="${CFLAGS} -Wc,lp64"
+ CXXFLAGS="${CXXFLAGS} -Wc,lp64"
+ LDFLAGS="${LDFLAGS} -Wl,lp64"
+ AC_TRY_RUN(int main(void) {return 0;},
+ ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
+ if test "$ENABLE_64BIT_LIBS" = no; then
+ CFLAGS="${OLD_CFLAGS}"
+ CXXFLAGS="${OLD_CXXFLAGS}"
+ LDFLAGS="${OLD_LDFLAGS}"
+ fi
+ ;;
+ *)
+ ENABLE_64BIT_LIBS=no
+ ;;
+ esac
+ fi
else
if test "$GCC" = yes; then
OLD_CFLAGS="${CFLAGS}"
fi
])
-dnl Define a sizeof checking macro that is a bit better than autoconf's
-dnl builtin (and heavily based on it, of course). The new macro is
-dnl AC_DO_CHECK_SIZEOF(TYPE [, CROSS_SIZE [, INCLUDES])
-AC_DEFUN(AC_DO_CHECK_SIZEOF,
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $1)
-AC_CACHE_VAL(AC_CV_NAME,
-[AC_TRY_RUN($3
-[#include <stdio.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof($1));
- exit(0);
-}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])