From: Ken Raeburn Date: Wed, 31 Oct 2007 11:37:57 +0000 (+0000) Subject: Set GNU warning options in CFLAGS and CXXFLAGS separately, avoiding options X-Git-Tag: krb5-1.7-alpha1~782 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=99e64ffc0b849eab304e0424994c144c26833841;p=krb5.git Set GNU warning options in CFLAGS and CXXFLAGS separately, avoiding options in CXXFLAGS that G++ doesn't support. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20159 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 7d7d2120f..10803cc54 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -588,12 +588,15 @@ dnl dnl AC_DEFUN(KRB5_AC_CHECK_FOR_CFLAGS,[ AC_BEFORE([$0],[AC_PROG_CC]) +AC_BEFORE([$0],[AC_PROG_CXX]) krb5_ac_cflags_set=${CFLAGS+set} +krb5_ac_cxxflags_set=${CXXFLAGS+set} ]) dnl AC_DEFUN(WITH_CC,[dnl AC_REQUIRE([KRB5_AC_CHECK_FOR_CFLAGS])dnl AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CXX])dnl if test $ac_cv_c_compiler_gnu = yes ; then HAVE_GCC=yes else HAVE_GCC= @@ -609,14 +612,14 @@ if test "$GCC" = yes; then fi]) # maybe add -Waggregate-return, or can we assume that actually works by now? # -Wno-long-long, if needed, for k5-platform.h without inttypes.h etc. -extra_gcc_warn_opts="-Wall -Wmissing-prototypes -Wcast-qual \ - -Wcast-align -Wconversion -Wshadow" +extra_gcc_warn_opts="-Wall -Wcast-qual -Wcast-align -Wconversion -Wshadow" +# -Wmissing-prototypes if test "$GCC" = yes ; then if test "x$krb5_ac_cflags_set" = xset ; then AC_MSG_NOTICE(not adding extra gcc warning flags because CFLAGS was set) else AC_MSG_NOTICE(adding extra warning flags for gcc) - CFLAGS="$CFLAGS $extra_gcc_warn_opts" + CFLAGS="$CFLAGS $extra_gcc_warn_opts -Wmissing-prototypes" if test "`uname -s`" = Darwin ; then AC_MSG_NOTICE(skipping pedantic warnings on Darwin) elif test "`uname -s`" = Linux ; then @@ -624,6 +627,16 @@ if test "$GCC" = yes ; then else CFLAGS="$CFLAGS -pedantic" fi + if test "$ac_cv_cxx_compiler_gnu" = yes; then + if test "x$krb5_ac_cxxflags_set" = xset ; then + AC_MSG_NOTICE(not adding extra g++ warnings because CXXFLAGS was sent) + else + AC_MSG_NOTICE(adding extra warning flags for g++) + CXXFLAGS="$CXXFLAGS $extra_gcc_warn_opts" + fi + fi + # Currently, G++ does not support -Wno-format-zero-length. + # So only add it to CFLAGS. AC_CACHE_CHECK([if GCC supports -Wno-format-zero-length], krb5_cv_gcc_Wno_format_zero_length, [# first try without, then with diff --git a/src/configure.in b/src/configure.in index f1f415e20..d010d0388 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1057,8 +1057,6 @@ AC_SUBST(ldap_plugin_dir) AC_CHECK_HEADERS(Python.h python2.3/Python.h) -AC_PROG_CXX - dnl dnl Kludge for simple server --- FIXME is this the best way to do this? dnl