summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917>2008-12-02 21:44:21 +0000
committerfergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917>2008-12-02 21:44:21 +0000
commit369fda0a4d5ca955dddc79dd0f61568f8ca72aa0 (patch)
tree70bf47df1d7bacf3e900f4e67e70e815999e1032
parentb357e22c72cc1a8fd075fb76bb01217f24d89bee (diff)
downloaddistcc-369fda0a4d5ca955dddc79dd0f61568f8ca72aa0.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 git-svn-id: http://distcc.googlecode.com/svn/trunk@627 01de4be4-8c4a-0410-9132-4925637da917
-rw-r--r--Makefile.in6
-rw-r--r--NEWS5
-rw-r--r--configure.ac40
-rwxr-xr-xinclude_server/setup.py24
4 files changed, 49 insertions, 26 deletions
diff --git a/Makefile.in b/Makefile.in
index 2813ec6..073482e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -17,6 +17,7 @@ SHELL = @SHELL@
CFLAGS = @CFLAGS@
WERROR_CFLAGS = @WERROR_CFLAGS@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
POPT_CFLAGS = @POPT_CFLAGS@
POPT_INCLUDES = @POPT_INCLUDES@
@@ -561,7 +562,7 @@ include-server:
mkdir -p "$(include_server_builddir)" && \
DISTCC_VERSION="$(VERSION)" \
SRCDIR="$(srcdir)" \
- CFLAGS="$(CFLAGS)" \
+ CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
$(INCLUDESERVER_PYTHON) "$(srcdir)/include_server/setup.py" \
build \
@@ -920,7 +921,7 @@ clean-include-server:
if test -n "$(INCLUDESERVER_PYTHON)"; then \
DISTCC_VERSION="$(VERSION)" \
SRCDIR="$(srcdir)" \
- CFLAGS="$(CFLAGS)" \
+ CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
$(INCLUDESERVER_PYTHON) "$(srcdir)/include_server/setup.py" \
clean \
@@ -1041,6 +1042,7 @@ install-include-server: include-server pump
DESTDIR=`cd "$(DESTDIR)/" && pwd` && \
DISTCC_VERSION="$(VERSION)" \
SRCDIR="$(srcdir)" \
+ CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
$(INCLUDESERVER_PYTHON) "$(srcdir)/include_server/setup.py" \
build \
diff --git a/NEWS b/NEWS
index 5e895c5..a3a71e7 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,11 @@ distcc-3.1 "Humming along" 2008-11-21
without actually compiling anything. This provides a simple
interface to the include server.
+ * New "--disable-Werror" option to configure.
+ This disables the use of gcc's -Werror option when building
+ distcc, allowing compilation of distcc to succeed even if
+ gcc issues warnings.
+
DOCUMENTATION:
* Document all of the exit codes in the man page
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
diff --git a/include_server/setup.py b/include_server/setup.py
index ff172f6..6d2dd7e 100755
--- a/include_server/setup.py
+++ b/include_server/setup.py
@@ -109,6 +109,11 @@ if not cpp_flags_env:
# in order to identify the include directory options.
cpp_flags_includes = GetIncludes(cpp_flags_env)
+python_cflags_env = os.getenv('PYTHON_CFLAGS', '')
+if not python_cflags_env:
+ # Don't quit; perhaps the user is asking for help using '--help'.
+ print >> sys.stderr, 'setup.py: PYTHON_CFLAGS must be defined.'
+
# SRCDIR checking.
if not os.getenv('SRCDIR'):
# Don't quit; perhaps the user is asking for help using '--help'.
@@ -160,24 +165,7 @@ ext = distutils.extension.Extension(
libraries=[],
runtime_library_dirs=[],
extra_objects=[],
- # This is the same list as is in configure.ac, except we leave out
- # -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.
- extra_compile_args=(('-W -Wall -Wimplicit -Wuninitialized '
- '-Wshadow -Wpointer-arith -Wcast-align '
- '-Waggregate-return -Wstrict-prototypes '
- '-Wnested-externs -Werror').split()
- # -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.
- + ['-Wp,-U_FORTIFY_SOURCE'])
+ extra_compile_args=python_cflags_env.split()
)
args = {