AC_PREFIX_DEFAULT(/usr/local/cacao)
-dnl Set optimization and debugging for all architectures and systems.
-if test x"$CFLAGS" = "x"; then
- OPT_CFLAGS="-g -O0"
-else
- OPT_CFLAGS=$CFLAGS
-fi
-
-if test x"$CXXFLAGS" = "x"; then
- OPT_CXXFLAGS="-g -O0"
-else
- OPT_CXXFLAGS=$CXXFLAGS
-fi
-
-dnl system type
+dnl Host CPU type.
case "$host_cpu" in
alpha | alphaev56 | alphapca56 )
ARCH_DIR="alpha"
;;
* )
- AC_MSG_ERROR($host_cpu systems are not supported at this time)
+ AC_MSG_ERROR([$host_cpu systems are currently not supported.])
;;
esac
-dnl host type
+
+dnl Host operating system type.
case "$host_os" in
*cygwin* )
OS_DIR="cygwin"
OS_FLAGS="-D__WINDOWS__ -D__CYGWIN__"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*darwin* )
OS_DIR="darwin"
OS_FLAGS="-D__DARWIN__"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*kfreebsd*-gnu)
OS_DIR="freebsd"
OS_FLAGS="-D__FREEBSD__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*freebsd* )
OS_DIR="freebsd"
OS_FLAGS="-D__FREEBSD__ -D_XOPEN_SOURCE_EXTENDED"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*irix* )
OS_DIR="irix"
OS_FLAGS="-D__IRIX__"
- CC_FLAGS=""
- CXX_FLAGS=""
INTRP_CFLAGS="$ARCH_FLAGS $OS_FLAGS"
;;
*uclinux | *elf )
OS_DIR="uclinux"
OS_FLAGS="-D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*linux* | *Linux* )
OS_DIR="linux"
OS_FLAGS="-D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
*netbsd* )
OS_DIR="netbsd"
OS_FLAGS="-D__NETBSD__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
dnl not set when cpp is called with -std=c99, therefore we add them
dnl here.
OS_FLAGS="-D__SOLARIS__ -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_BSD_SOURCE"
- CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE=600"
- CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long"
+ CC_FLAGS="-D_XOPEN_SOURCE=600"
+ CXX_FLAGS="-D_XOPEN_SOURCE=500"
INTRP_CFLAGS="-Wall -Wno-long-long $ARCH_FLAGS $OS_FLAGS"
;;
* )
+ AC_MSG_ERROR([$host_os operating systems are currently not supported.])
;;
esac
-dnl temporary set the CFLAGS for configure tests (e.g. inline keyword)
-dnl we set it properly at the end of this file
+dnl Set optimization and debugging for all architectures and systems.
+dnl NOTE: Setting the CFLAGS/CXXFLAGS only works before calling AC_PROG_CC/AC_PROG_CXX.
+if test x"$CFLAGS" = "x"; then
+ OPT_CFLAGS="-g -O0"
+else
+ OPT_CFLAGS=$CFLAGS
+fi
+
+if test x"$CXXFLAGS" = "x"; then
+ OPT_CXXFLAGS="-g -O0"
+else
+ OPT_CXXFLAGS=$CXXFLAGS
+fi
+
+dnl Check for compiler.
+AC_PROG_CC
+AC_PROG_CXX
+
+dnl Check compiler vendor.
+AX_COMPILER_VENDOR
+
+dnl Set compiler flags depending on the compiler vendor.
+case "$ax_cv_c_compiler_vendor" in
+gnu )
+ CC_FLAGS="-std=c99 -pedantic -Wall -Wno-long-long $CC_FLAGS"
+ CXX_FLAGS="-std=c++98 -pedantic -Wall -Wno-long-long $CXX_FLAGS"
+ ;;
+
+sun )
+ CC_FLAGS="-xc99 $CC_FLAGS"
+ CXX_FLAGS="$CXX_FLAGS"
+ ;;
+
+* )
+ AC_MSG_ERROR([$ax_cv_c_compiler_vendor compilers are currently not supported.])
+ ;;
+esac
+
+dnl Temporary set the CFLAGS for configure tests (e.g. inline keyword)
+dnl we set it properly at the end of this file.
CFLAGS="$OPT_CFLAGS $ARCH_FLAGS $OS_FLAGS $CC_FLAGS"
CXXFLAGS="$OPT_CXXFLAGS $ARCH_FLAGS $OS_FLAGS $CXX_FLAGS"
AC_SUBST(OS_DIR)
AC_SUBST(USE_SCHEDULER)
-
dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
AM_PROG_AS
AC_PROG_LD
AC_PROG_LD_GNU
dnl Checks for libraries (NOTE: Should be done before function checks,
dnl as some functions may be in libraries we check for).
-
case "${OS_DIR}" in
solaris )
AC_CHECK_LIB([socket], [gethostname],, [AC_MSG_ERROR(cannot find libsocket)])
--- /dev/null
+dnl Taken from http://ac-archive.sourceforge.net/
+
+dnl @synopsis AX_COMPILER_VENDOR
+dnl
+dnl @summary find the vendor (gnu, intel, etc.) of the C/C++ compiler
+dnl
+dnl Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm,
+dnl sun, hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi,
+dnl microsoft, watcom, etc. The vendor is returned in the cache
+dnl variable $ax_cv_c_compiler_vendor for C and
+dnl $ax_cv_cxx_compiler_vendor for C++.
+dnl
+dnl @category C
+dnl @category Cxx
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu> with Matteo Frigo
+dnl @version 2005-05-30
+dnl @license GPLWithACException
+
+AC_DEFUN([AX_COMPILER_VENDOR],
+[
+AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
+ [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
+ # note: don't check for gcc first since some other compilers define __GNUC__
+ for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
+ vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
+#if !($vencpp)
+ thisisanerror;
+#endif
+])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
+ done
+ ])
+])