[build] Set default CFLAGS for SunPro, rationalise CFLAGS defaults.

2005-11-26 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: Collect together CFLAGS based on compiler
	  detected a bit. Recognise and set default CFLAGS for SunPro /
	  SOS10.
This commit is contained in:
paul 2005-11-26 08:28:00 +00:00
parent 0ed3192835
commit 6a4b883229
2 changed files with 55 additions and 26 deletions

View file

@ -1,3 +1,9 @@
2005-11-26 Paul Jakma <paul.jakma@sun.com>
* configure.ac: Collect together CFLAGS based on compiler
detected a bit. Recognise and set default CFLAGS for SunPro /
SOS10.
2005-11-14 Paul Jakma <paul.jakma@sun.com>
* configure.ac: Tell gcc we like C99.

View file

@ -5,7 +5,7 @@
## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
##
## $Id: configure.ac,v 1.115 2005/11/14 14:05:36 paul Exp $
## $Id: configure.ac,v 1.116 2005/11/26 08:28:00 paul Exp $
AC_PREREQ(2.53)
AC_INIT(Quagga, 0.99.2, [http://bugzilla.quagga.net])
@ -68,13 +68,22 @@ dnl Intel compiler check. Although Intel tries really hard to make icc
dnl look like gcc, there are some differences. It's very verbose with
dnl -Wall and it doesn't support the individual -W options.
dnl ------------------------------------------------------------------
AC_MSG_CHECKING([whether we are using the Intel compiler])
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
ICC="no"
AC_MSG_RESULT([no]),
ICC="yes"
AC_MSG_RESULT([yes])
)
if test "x${GCC}" = "xyes" ; then
COMPILER="GCC"
AC_MSG_CHECKING([whether we are using the Intel compiler])
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
[AC_MSG_RESULT([no])],
[COMPILER="ICC"
AC_MSG_RESULT([yes])]
)
else
AC_MSG_CHECKING([whether we are using SunPro compiler])
AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
[AC_MSG_RESULT([no])],
[COMPILER="SUNPRO"
AC_MSG_RESULT([yes])]
)
fi
dnl ---------------------------------------------
dnl If CLFAGS doesn\'t exist set default value
@ -82,32 +91,46 @@ dnl AC_PROG_CC will have set minimal default
dnl already, eg "-O2 -g" for gcc, "-g" for others
dnl (Wall is gcc specific... have to make sure
dnl gcc is being used before setting it)
dnl Intel icc 8.0 also sets __GNUC__, but
dnl doesn't support all these fancy -W options.
dnl ---------------------------------------------
dnl
if test "x$cflags_specified" = "x" ; then
if test "x${GCC}" = "xyes" && test "x${ICC}" = "xno"; then
CFLAGS="-Os -fno-omit-frame-pointer -g -std=c99 -Wall"
CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
fi
# TODO: conditionally addd -Wpacked if handled
fi
dnl ---------------------------------------------------------------------
dnl Intel icc 8.0 also sets __GNUC__,
dnl but doesn't support all these fancy -W options.
dnl Intel compiler warnings we ignore:
dnl 279: controlling expression is constant.
dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
dnl macro.
dnl 981: operands are evaluated in unspecified order.
dnl ---------------------------------------------------------------------
dnl
dnl Sun Studio 10 / SunPro 5.7 is also supported,
dnl so lets set some sane CFLAGS for it.
dnl ---------------------------------------------
if test "$ICC" = "yes"; then
CFLAGS="-Os -g -Wall -wd 279,869,981"
AC_MSG_CHECKING([whether to set a default CFLAGS])
if test "x${cflags_specified}" = "x" ; then
case ${COMPILER} in
"ICC")
CFLAGS="-Os -g -Wall -wd 279,869,981"
AC_MSG_RESULT([Intel default])
;;
"GCC")
CFLAGS="-Os -fno-omit-frame-pointer -g -std=c99 -Wall"
CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
# TODO: conditionally addd -Wpacked if handled
AC_MSG_RESULT([gcc default])
;;
"SUNPRO")
CFLAGS="-xO4 -xspace -xcode=pic32 -xstrconst -Xt -xc99"
AC_MSG_RESULT([SunPro default])
;;
*)
AC_MSG_RESULT([unknown compiler])
;;
esac
else
AC_MSG_RESULT([CFLAGS supplied by user])
fi
dnl --------------