summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorfergus.henderson <fergushenderson@users.noreply.github.com>2008-12-02 21:44:21 +0000
committerfergus.henderson <fergushenderson@users.noreply.github.com>2008-12-02 21:44:21 +0000
commite690460d7abf332aa62c472604e64296941e06f7 (patch)
tree70bf47df1d7bacf3e900f4e67e70e815999e1032 /configure.ac
parent2683e9432597fd255a4cb3addc5016a66fb99db1 (diff)
downloaddistcc-git-e690460d7abf332aa62c472604e64296941e06f7.tar.gz
1. Fix some compilation errors arising from the use of
-Wwrite-strings when compiling the python extension module, due to lack of const correctness in the Python 2.2 "Python.h" header file. This problem was introduced by the fix for distcc issue 26 <http://code.google.com/p/distcc/issues/detail?id=26>. The solution was to explicitly disable these warnings with -Wno-write-strings. 2. Centralize the use of gcc-specific compilation options in conditional code in configure.ac that is only executed if we're using gcc. Previously include_server/setup.py was hard-coding gcc-specific options, regardless of whether we're using gcc. 3. Don't use -Wuninitialized if CFLAGS doesn't contain "-O*", because -Wuninitialized only works if optimization is enabled. This avoids a gcc warning (and hence an error with -Werror) about -Wuninitialized not having any effect when distcc is configured with "CFLAGS=-g ./configure". 4. Add a new configure option "--disable-Werror". For the 3.0 release of distcc, some people porting distcc resorted to patching distcc to remove the -Werror option. -Werror is useful, so I want to keep it enabled by default, but I'd prefer that people are able to port distcc easily, hence the configure option. This addresses distcc issue 20 <http://code.google.com/p/distcc/issues/detail?id=20>. Reviewers: Craig Silverstein
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac40
1 files changed, 34 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 07f83f4..757dbe3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,8 @@ then
CFLAGS="$CFLAGS -pg -g"
fi
+AC_ARG_ENABLE(Werror,
+ AC_HELP_STRING([--disable-Werror], [don't use gcc's -Werror option when building]))
# Now get the package configuration information for whatever packages
# we need. It's faster to just do it once during configuration.
@@ -160,31 +162,57 @@ AC_SUBST(UNINSTALL_GNOME)
dnl Checks for programs
AC_PROG_CC
-POPT_CFLAGS=""
WERROR_CFLAGS=""
-if test x"$GCC" = xyes
+POPT_CFLAGS=""
+PYTHON_CFLAGS=""
+if test x"$GCC" = xyes
then
CFLAGS="$CFLAGS -MD \
--W -Wall -Wimplicit -Wuninitialized \
+-W -Wall -Wimplicit \
-Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings \
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes \
-Wnested-externs -Wmissing-declarations"
+
+ # -Wuninitialized requires -O
+ case "$CFLAGS" in "-O"*|*" -O"*)
+ CFLAGS="$CFLAGS -Wuninitialized"
+ ;;
+ esac
# Would like -Wunreachable-code here, but it generates too many false
# positives.
- # We want warnings to be treated as errors.
+ # We want warnings to be treated as errors,
+ # unless the --disable-Werror configure option was used.
# Note that we can't include this in CFLAGS,
# because that would affect the configure tests,
# causing some of the tests to fail when they should succeed.
- WERROR_CFLAGS="-Werror"
+ if test x"$enable_Werror" != xno
+ then
+ WERROR_CFLAGS="-Werror"
+ fi
+
+ # Additional flags for compiling Python extension modules.
+ # We disable -Wmissing-prototypes and -Wmissing-declarations,
+ # which don't apply to python extensions (it exports global fns via a
+ # pointer), and -Wwrite-strings, which just had too many false
+ # positives (for Python 2.2, anyway; looks like these may be fixed
+ # in Python 2.5).
+ # -Wp,-U_FORTIFY_SOURCE is to turn off _FORTIFY_SOURCE on systems where
+ # it's in the Python Makefile (and hence inherited by us).
+ # _FORTIFY_SOURCE gives compiler errors for some distcc routines that
+ # ignore the return value from libc functions (like getcwd).
+ # That would cause this code to not compile, which is no good.
+ PYTHON_CFLAGS="-Wno-missing-prototypes -Wno-missing-declarations \
+-Wno-write-strings -Wp,-U_FORTIFY_SOURCE"
# For popt/*.c, we disable unused variable warnings.
POPT_CFLAGS="-Wno-unused"
AC_MSG_NOTICE([Adding gcc options: $CFLAGS])
fi
-AC_SUBST(POPT_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
+AC_SUBST(POPT_CFLAGS)
+AC_SUBST(PYTHON_CFLAGS)
AC_ISC_POSIX