2016-06-15 18:58:17 +00:00
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
2016-05-31 21:45:07 +00:00
# Copyright (c) 1999-2016, International Business Machines Corporation and
# others. All Rights Reserved.
2013-09-04 17:31:08 +00:00
# acinclude.m4 for ICU
# Don't edit aclocal.m4, do edit acinclude.m4
2008-10-03 08:08:02 +00:00
# Stephen F. Booth
1999-08-16 21:50:52 +00:00
2008-10-03 08:08:02 +00:00
# @TOP@
1999-08-16 21:50:52 +00:00
2008-10-03 08:08:02 +00:00
# ICU_CHECK_MH_FRAG
2013-09-04 05:14:27 +00:00
AC_DEFUN([ICU_CHECK_MH_FRAG], [
1999-08-16 21:50:52 +00:00
AC_CACHE_CHECK(
2009-04-01 01:54:14 +00:00
[which Makefile fragment to use for ${host}],
1999-08-16 21:50:52 +00:00
[icu_cv_host_frag],
[
case "${host}" in
2000-05-23 21:06:02 +00:00
*-*-solaris*)
2004-05-12 16:40:18 +00:00
if test "$GCC" = yes; then
2007-07-12 04:21:34 +00:00
icu_cv_host_frag=mh-solaris-gcc
1999-08-16 21:50:52 +00:00
else
2001-11-28 04:10:53 +00:00
icu_cv_host_frag=mh-solaris
1999-08-16 21:50:52 +00:00
fi ;;
2001-05-25 18:00:38 +00:00
alpha*-*-linux-gnu)
2004-05-12 16:40:18 +00:00
if test "$GCC" = yes; then
2001-05-25 18:00:38 +00:00
icu_cv_host_frag=mh-alpha-linux-gcc
2007-07-12 04:21:34 +00:00
else
2001-05-25 18:00:38 +00:00
icu_cv_host_frag=mh-alpha-linux-cc
fi ;;
2004-09-30 18:51:03 +00:00
powerpc*-*-linux*)
if test "$GCC" = yes; then
2007-07-26 06:42:56 +00:00
icu_cv_host_frag=mh-linux
2004-09-30 18:51:03 +00:00
else
2007-07-26 06:42:56 +00:00
icu_cv_host_frag=mh-linux-va
2004-09-30 18:51:03 +00:00
fi ;;
2010-08-25 22:24:53 +00:00
*-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;;
2014-08-27 21:49:22 +00:00
i[[34567]]86-*-cygwin)
if test "$GCC" = yes; then
icu_cv_host_frag=mh-cygwin
else
icu_cv_host_frag=mh-cygwin-msvc
fi ;;
x86_64-*-cygwin)
if test "$GCC" = yes; then
icu_cv_host_frag=mh-cygwin64
else
icu_cv_host_frag=mh-cygwin-msvc
fi ;;
2014-08-25 22:07:21 +00:00
*-*-mingw*)
2004-09-30 18:51:03 +00:00
if test "$GCC" = yes; then
2014-04-30 21:08:54 +00:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2012-11-29 18:20:09 +00:00
#ifndef __MINGW64__
#error This is not MinGW64
2014-04-30 21:08:54 +00:00
#endif]])], [icu_cv_host_frag=mh-mingw64],
2014-04-30 21:17:52 +00:00
[icu_cv_host_frag=mh-mingw])
2003-02-11 00:13:48 +00:00
else
2014-08-27 22:42:28 +00:00
case "${host}" in
*-*-mingw*) icu_cv_host_frag=mh-msys-msvc ;;
*-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;;
esac
2004-11-01 23:22:40 +00:00
fi ;;
2015-09-11 02:01:12 +00:00
*-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;;
2002-07-19 22:21:21 +00:00
*-*-aix*)
2004-05-12 16:40:18 +00:00
if test "$GCC" = yes; then
icu_cv_host_frag=mh-aix-gcc
2002-07-19 22:21:21 +00:00
else
2007-04-05 07:29:13 +00:00
icu_cv_host_frag=mh-aix-va
2002-07-19 22:21:21 +00:00
fi ;;
1999-08-16 21:50:52 +00:00
*-*-hpux*)
2004-05-12 16:40:18 +00:00
if test "$GCC" = yes; then
2002-11-01 19:12:24 +00:00
icu_cv_host_frag=mh-hpux-gcc
else
case "$CXX" in
*aCC) icu_cv_host_frag=mh-hpux-acc ;;
esac
fi ;;
2001-11-05 22:28:09 +00:00
*-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;;
2000-10-24 19:50:20 +00:00
*-*-os400*) icu_cv_host_frag=mh-os400 ;;
*-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;;
*-apple-darwin*) icu_cv_host_frag=mh-darwin ;;
2010-08-25 22:29:44 +00:00
*-*-beos) icu_cv_host_frag=mh-beos ;;
*-*-haiku) icu_cv_host_frag=mh-haiku ;;
2003-03-15 02:22:07 +00:00
*-*-irix*) icu_cv_host_frag=mh-irix ;;
*-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
*-*-nto*) icu_cv_host_frag=mh-qnx ;;
2003-06-23 23:16:10 +00:00
*-ncr-*) icu_cv_host_frag=mh-mpras ;;
2000-10-24 19:50:20 +00:00
*) icu_cv_host_frag=mh-unknown ;;
1999-08-16 21:50:52 +00:00
esac
]
)
])
2008-10-03 08:08:02 +00:00
# ICU_PROG_LINK - Make sure that the linker is usable
2013-09-04 05:14:27 +00:00
AC_DEFUN([ICU_PROG_LINK],
2005-10-05 07:38:03 +00:00
[
case "${host}" in
*-*-cygwin*|*-*-mingw*)
if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then
AC_MSG_ERROR([link.exe is not a valid linker. Your PATH is incorrect.
Please follow the directions in ICU's readme.])
fi;;
*);;
esac])
2008-10-03 08:08:02 +00:00
# AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
# [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
# Search for a library defining FUNC, then see if it's not already available.
2007-07-12 04:21:34 +00:00
2013-09-04 05:14:27 +00:00
AC_DEFUN([AC_SEARCH_LIBS_FIRST],
2000-10-18 20:35:21 +00:00
[AC_PREREQ([2.13])
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
[ac_func_search_save_LIBS="$LIBS"
ac_cv_search_$1="no"
for i in $2; do
LIBS="-l$i $5 $ac_func_search_save_LIBS"
AC_TRY_LINK_FUNC([$1],
[ac_cv_search_$1="-l$i"
break])
done
if test "$ac_cv_search_$1" = "no"; then
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
fi
LIBS="$ac_func_search_save_LIBS"])
if test "$ac_cv_search_$1" != "no"; then
test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"
$3
else :
$4
fi])
2008-10-14 22:55:22 +00:00
2008-10-03 08:08:02 +00:00
# Check if we can build and use 64-bit libraries
2013-09-04 05:14:27 +00:00
AC_DEFUN([AC_CHECK_64BIT_LIBS],
2002-03-22 22:46:46 +00:00
[
2008-10-14 22:55:22 +00:00
BITS_REQ=nochange
ENABLE_64BIT_LIBS=unknown
## revisit this for cross-compile.
2002-03-22 22:46:46 +00:00
AC_ARG_ENABLE(64bit-libs,
2008-10-14 22:55:22 +00:00
[ --enable-64bit-libs (deprecated, use --with-library-bits) build 64-bit libraries [default= platform default]],
[echo "note, use --with-library-bits instead of --*-64bit-libs"
2009-04-06 23:27:57 +00:00
case "${enableval}" in
no|false|32) with_library_bits=32; ;;
yes|true|64) with_library_bits=64else32 ;;
nochange) with_library_bits=nochange; ;;
*) AC_MSG_ERROR(bad value ${enableval} for '--*-64bit-libs') ;;
2008-10-14 22:55:22 +00:00
esac] )
AC_ARG_WITH(library-bits,
[ --with-library-bits=bits specify how many bits to use for the library (32, 64, 64else32, nochange) [default=nochange]],
[case "${withval}" in
2009-04-06 23:27:57 +00:00
""|nochange) BITS_REQ=$withval ;;
2008-10-14 22:55:22 +00:00
32|64|64else32) BITS_REQ=$withval ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-library-bits) ;;
esac])
2009-04-06 23:27:57 +00:00
# don't use these for cross compiling
if test "$cross_compiling" = "yes" -a "${BITS_REQ}" != "nochange"; then
AC_MSG_ERROR([Don't specify bitness when cross compiling. See readme.html for help with cross compilation., and set compiler options manually.])
fi
2010-01-07 22:32:53 +00:00
AC_CHECK_SIZEOF([void *])
2009-04-06 23:27:57 +00:00
AC_MSG_CHECKING([whether runnable 64 bit binaries are built by default])
2010-01-07 22:32:53 +00:00
case $ac_cv_sizeof_void_p in
8) DEFAULT_64BIT=yes ;;
4) DEFAULT_64BIT=no ;;
*) DEFAULT_64BIT=unknown
esac
2008-10-14 22:55:22 +00:00
BITS_GOT=unknown
2009-04-06 23:27:57 +00:00
# 'OK' here means, we can exit any further checking, everything's copa
2008-10-14 22:55:22 +00:00
BITS_OK=yes
2009-04-06 23:27:57 +00:00
# do we need to check for buildable/runnable 32 or 64 bit?
BITS_CHECK_32=no
BITS_CHECK_64=no
# later, can we run the 32/64 bit binaries so made?
BITS_RUN_32=no
BITS_RUN_64=no
2008-10-14 22:55:22 +00:00
if test "$DEFAULT_64BIT" = "yes"; then
2009-04-06 23:27:57 +00:00
# we get 64 bits by default.
2008-10-14 22:55:22 +00:00
BITS_GOT=64
case "$BITS_REQ" in
2009-04-06 23:27:57 +00:00
32)
# need to look for 32 bit support.
BITS_CHECK_32=yes
# not copa.
BITS_OK=no;;
# everyone else is happy.
2008-10-14 22:55:22 +00:00
nochange) ;;
*) ;;
esac
elif test "$DEFAULT_64BIT" = "no"; then
2009-04-06 23:27:57 +00:00
# not 64 bit by default.
2008-10-14 22:55:22 +00:00
BITS_GOT=32
case "$BITS_REQ" in
2009-04-06 23:27:57 +00:00
64|64else32)
BITS_CHECK_64=yes
#BITS_CHECK_32=yes
BITS_OK=no;;
2008-10-14 22:55:22 +00:00
nochange) ;;
*) ;;
esac
elif test "$DEFAULT_64BIT" = "unknown"; then
2009-10-05 21:42:20 +00:00
# cross compiling.
BITS_GOT=unknown
case "$BITS_REQ" in
64|64else32) BITS_OK=no
BITS_CHECK_32=yes
BITS_CHECK_64=yes ;;
32) BITS_OK=no;;
nochange) ;;
*) ;;
esac
2008-10-14 22:55:22 +00:00
fi
AC_MSG_RESULT($DEFAULT_64BIT);
2009-04-06 23:27:57 +00:00
2008-10-14 22:55:22 +00:00
if test "$BITS_OK" != "yes"; then
2009-04-06 23:27:57 +00:00
# not copa. back these up.
CFLAGS_OLD="${CFLAGS}"
CXXFLAGS_OLD="${CXXFLAGS}"
LDFLAGS_OLD="${LDFLAGS}"
ARFLAGS_OLD="${ARFLAGS}"
CFLAGS_32="${CFLAGS}"
CXXFLAGS_32="${CXXFLAGS}"
LDFLAGS_32="${LDFLAGS}"
ARFLAGS_32="${ARFLAGS}"
CFLAGS_64="${CFLAGS}"
CXXFLAGS_64="${CXXFLAGS}"
LDFLAGS_64="${LDFLAGS}"
ARFLAGS_64="${ARFLAGS}"
CAN_BUILD_64=unknown
CAN_BUILD_32=unknown
2008-10-14 22:55:22 +00:00
# These results can't be cached because is sets compiler flags.
2009-04-06 23:27:57 +00:00
if test "$BITS_CHECK_64" = "yes"; then
2008-10-14 22:55:22 +00:00
AC_MSG_CHECKING([how to build 64-bit executables])
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=no
####
# Find out if we think we can *build* for 64 bit. Doesn't check whether we can run it.
# Note, we don't have to actually check if the options work- we'll try them before using them.
# So, only try actually testing the options, if you are trying to decide between multiple options.
# On exit from the following clauses:
# if CAN_BUILD_64=yes:
# *FLAGS are assumed to contain the right settings for 64bit
# else if CAN_BUILD_64=no: (default)
# *FLAGS are assumed to be trashed, and will be reset from *FLAGS_OLD
2008-10-14 22:55:22 +00:00
if test "$GCC" = yes; then
2007-08-03 20:44:41 +00:00
CFLAGS="${CFLAGS} -m64"
CXXFLAGS="${CXXFLAGS} -m64"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes, CAN_BUILD_64=no)
2008-10-14 22:55:22 +00:00
else
case "${host}" in
sparc*-*-solaris*)
# 1. try -m64
CFLAGS="${CFLAGS} -m64"
CXXFLAGS="${CXXFLAGS} -m64"
2011-04-29 18:58:48 +00:00
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
2009-04-06 23:27:57 +00:00
if test "$CAN_BUILD_64" != yes; then
2008-10-14 22:55:22 +00:00
# Nope. back out changes.
2009-04-06 23:27:57 +00:00
CFLAGS="${CFLAGS_OLD}"
2014-08-12 02:11:22 +00:00
CXXFLAGS="${CXXFLAGS_OLD}"
2008-10-14 22:55:22 +00:00
# 2. try xarch=v9 [deprecated]
## TODO: cross compile: the following won't work.
SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
# "Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs"
if test -z "$SOL64" && test -n "$SPARCV9"; then
CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9"
LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9"
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes
2008-10-14 22:55:22 +00:00
fi
2008-10-03 08:08:02 +00:00
fi
2008-10-14 22:55:22 +00:00
;;
i386-*-solaris*)
# 1. try -m64
2007-08-03 20:44:41 +00:00
CFLAGS="${CFLAGS} -m64"
CXXFLAGS="${CXXFLAGS} -m64"
2011-04-29 18:58:48 +00:00
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
2009-04-06 23:27:57 +00:00
if test "$CAN_BUILD_64" != yes; then
2008-10-14 22:55:22 +00:00
# Nope. back out changes.
2009-04-06 23:27:57 +00:00
CFLAGS="${CFLAGS_OLD}"
CXXFLAGS="${CXXFLAGS_OLD}"
2008-10-14 22:55:22 +00:00
# 2. try the older compiler option
## TODO: cross compile problem
2011-04-29 18:58:48 +00:00
AMD64=`isainfo -n 2>&1 | grep amd64`
2008-10-14 22:55:22 +00:00
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"
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes
2008-10-14 22:55:22 +00:00
fi
fi
;;
ia64-*-linux*)
# check for ecc/ecpc compiler support
## TODO: cross compiler problem
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
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes
2008-10-14 22:55:22 +00:00
fi
2007-08-03 20:44:41 +00:00
fi
2008-10-14 22:55:22 +00:00
;;
*-*-cygwin)
# vcvarsamd64.bat should have been used to enable 64-bit builds.
# We only do this check to display the correct answer.
## TODO: cross compiler problem
if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes
2004-05-12 16:40:18 +00:00
fi
2008-10-14 22:55:22 +00:00
;;
*-*-aix*|powerpc64-*-linux*)
CFLAGS="${CFLAGS} -q64"
CXXFLAGS="${CXXFLAGS} -q64"
LDFLAGS="${LDFLAGS} -q64"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes, CAN_BUILD_64=no)
if test "$CAN_BUILD_64" = yes; then
# worked- set other options.
2008-10-14 22:55:22 +00:00
case "${host}" in
*-*-aix*)
2009-04-06 23:27:57 +00:00
# tell AIX what executable mode to use.
2008-10-14 22:55:22 +00:00
ARFLAGS="${ARFLAGS} -X64"
esac
fi
;;
*-*-hpux*)
# First we try the newer +DD64, if that doesn't work,
# try other options.
2004-04-01 23:47:10 +00:00
2008-10-14 22:55:22 +00:00
CFLAGS="${CFLAGS} +DD64"
CXXFLAGS="${CXXFLAGS} +DD64"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes, CAN_BUILD_64=no)
if test "$CAN_BUILD_64" != yes; then
# reset
CFLAGS="${CFLAGS_OLD}"
CXXFLAGS="${CXXFLAGS_OLD}"
# append
2008-10-14 22:55:22 +00:00
CFLAGS="${CFLAGS} +DA2.0W"
CXXFLAGS="${CXXFLAGS} +DA2.0W"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes, CAN_BUILD_64=no)
2007-08-03 20:44:41 +00:00
fi
2008-10-14 22:55:22 +00:00
;;
*-*ibm-openedition*|*-*-os390*)
CFLAGS="${CFLAGS} -Wc,lp64"
CXXFLAGS="${CXXFLAGS} -Wc,lp64"
LDFLAGS="${LDFLAGS} -Wl,lp64"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_64=yes, CAN_BUILD_64=no)
2008-10-14 22:55:22 +00:00
;;
*)
2009-04-06 23:27:57 +00:00
# unknown platform.
2008-10-14 22:55:22 +00:00
;;
esac
fi
2009-04-06 23:27:57 +00:00
AC_MSG_RESULT($CAN_BUILD_64)
if test "$CAN_BUILD_64" = yes; then
AC_MSG_CHECKING([whether runnable 64-bit binaries are being built ])
2011-04-29 18:58:48 +00:00
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
2009-04-06 23:27:57 +00:00
BITS_RUN_64=yes, BITS_RUN_64=no, BITS_RUN_64=unknown)
AC_MSG_RESULT($BITS_RUN_64);
CFLAGS_64="${CFLAGS}"
CXXFLAGS_64="${CXXFLAGS}"
LDFLAGS_64="${LDFLAGS}"
ARFLAGS_64="${ARFLAGS}"
fi
# put it back.
CFLAGS="${CFLAGS_OLD}"
CXXFLAGS="${CXXFLAGS_OLD}"
LDFLAGS="${LDFLAGS_OLD}"
ARFLAGS="${ARFLAGS_OLD}"
fi
if test "$BITS_CHECK_32" = "yes"; then
# see comment under 'if BITS_CHECK_64', above.
2008-10-14 22:55:22 +00:00
AC_MSG_CHECKING([how to build 32-bit executables])
if test "$GCC" = yes; then
CFLAGS="${CFLAGS} -m32"
CXXFLAGS="${CXXFLAGS} -m32"
2011-04-28 21:25:40 +00:00
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])],
2009-04-06 23:27:57 +00:00
CAN_BUILD_32=yes, CAN_BUILD_32=no)
fi
AC_MSG_RESULT($CAN_BUILD_32)
if test "$CAN_BUILD_32" = yes; then
AC_MSG_CHECKING([whether runnable 32-bit binaries are being built ])
2011-04-29 18:58:48 +00:00
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])],
2009-04-06 23:27:57 +00:00
BITS_RUN_32=yes, BITS_RUN_32=no, BITS_RUN_32=unknown)
AC_MSG_RESULT($BITS_RUN_32);
CFLAGS_32="${CFLAGS}"
CXXFLAGS_32="${CXXFLAGS}"
LDFLAGS_32="${LDFLAGS}"
ARFLAGS_32="${ARFLAGS}"
2008-10-14 22:55:22 +00:00
fi
2009-04-06 23:27:57 +00:00
# put it back.
CFLAGS="${CFLAGS_OLD}"
CXXFLAGS="${CXXFLAGS_OLD}"
LDFLAGS="${LDFLAGS_OLD}"
ARFLAGS="${ARFLAGS_OLD}"
fi
##
# OK. Now, we've tested for 32 and 64 bitness. Let's see what we'll do.
#
# First, implement 64else32
if test "$BITS_REQ" = "64else32"; then
if test "$BITS_RUN_64" = "yes"; then
BITS_REQ=64
2008-10-14 22:55:22 +00:00
else
2009-04-06 23:27:57 +00:00
# no changes.
BITS_OK=yes
2006-06-09 01:33:53 +00:00
fi
fi
2008-10-14 22:55:22 +00:00
2009-04-06 23:27:57 +00:00
# implement.
if test "$BITS_REQ" = "32" -a "$BITS_RUN_32" = "yes"; then
CFLAGS="${CFLAGS_32}"
CXXFLAGS="${CXXFLAGS_32}"
LDFLAGS="${LDFLAGS_32}"
ARFLAGS="${ARFLAGS_32}"
BITS_OK=yes
elif test "$BITS_REQ" = "64" -a "$BITS_RUN_64" = "yes"; then
CFLAGS="${CFLAGS_64}"
CXXFLAGS="${CXXFLAGS_64}"
LDFLAGS="${LDFLAGS_64}"
ARFLAGS="${ARFLAGS_64}"
BITS_OK=yes
elif test "$BITS_OK" != "yes"; then
AC_MSG_ERROR([Requested $BITS_REQ bit binaries but could not compile and execute them. See readme.html for help with cross compilation., and set compiler options manually.])
2008-10-14 22:55:22 +00:00
fi
2009-04-06 23:27:57 +00:00
fi
2002-03-22 22:46:46 +00:00
])
2008-10-03 08:08:02 +00:00
# Strict compilation options.
2013-09-04 05:14:27 +00:00
AC_DEFUN([AC_CHECK_STRICT_COMPILE],
2000-04-10 21:54:53 +00:00
[
AC_MSG_CHECKING([whether strict compiling is on])
2008-10-01 05:43:35 +00:00
AC_ARG_ENABLE(strict,[ --enable-strict compile with strict compiler options [default=yes]], [
2004-04-07 05:32:19 +00:00
if test "$enableval" = no
then
ac_use_strict_options=no
2000-04-10 21:54:53 +00:00
else
2004-04-07 05:32:19 +00:00
ac_use_strict_options=yes
2000-04-10 21:54:53 +00:00
fi
2008-10-01 05:43:35 +00:00
], [ac_use_strict_options=yes])
2000-04-10 22:38:53 +00:00
AC_MSG_RESULT($ac_use_strict_options)
2000-04-10 21:54:53 +00:00
2000-04-10 22:38:53 +00:00
if test "$ac_use_strict_options" = yes
2000-04-10 21:54:53 +00:00
then
if test "$GCC" = yes
then
2013-09-13 21:36:38 +00:00
case "${host}" in
2016-04-19 21:00:50 +00:00
*-*-solaris*)
2018-04-23 21:16:52 +00:00
# Don't use -std=c11 on Solaris because of timezone check fails
2016-04-19 21:00:50 +00:00
;;
2013-09-13 21:36:38 +00:00
*)
# Do not use -ansi. It limits us to C90, and it breaks some platforms.
2018-04-23 21:16:52 +00:00
# We use -std=c11 to disable the gnu99 defaults and its associated warnings
CFLAGS="$CFLAGS -std=c11"
2013-09-13 21:36:38 +00:00
;;
esac
CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
2004-05-30 07:18:39 +00:00
else
case "${host}" in
*-*-cygwin)
if test "`$CC /help 2>&1 | head -c9`" = "Microsoft"
then
CFLAGS="$CFLAGS /W4"
2014-08-27 22:42:28 +00:00
fi ;;
*-*-mingw*)
CFLAGS="$CFLAGS -W4" ;;
2004-05-30 07:18:39 +00:00
esac
2000-04-10 21:54:53 +00:00
fi
if test "$GXX" = yes
then
2012-08-15 17:46:17 +00:00
CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
2004-05-30 07:18:39 +00:00
else
case "${host}" in
*-*-cygwin)
if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft"
then
CXXFLAGS="$CXXFLAGS /W4"
2014-08-27 22:42:28 +00:00
fi ;;
*-*-mingw*)
CFLAGS="$CFLAGS -W4" ;;
2004-05-30 07:18:39 +00:00
esac
2000-04-10 21:54:53 +00:00
fi
fi
])
2004-05-12 16:40:18 +00:00