diff options
author | Carl Worth <cworth@cworth.org> | 2010-10-30 12:36:06 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-10-30 13:11:56 -0700 |
commit | b802c18d3b9b0a2f5909e4c92ef7d6e7db234825 (patch) | |
tree | 12a27d8c234a2cdb67235285d91516785670bf69 /configure | |
parent | 3fe90a955e21bc6825e3d9b7ffaba31e1c3d0c8b (diff) |
configure: Test for each compiler warning before enabling it.
This should allow the build to be much more automatically portable
to compilers with different sets of warning options.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -391,6 +391,30 @@ else fi rm -f compat/have_strcasestr +printf "int main(void){return 0;}\n" > minimal.c + +WARN_CXXFLAGS="" +printf "Checking for available C++ compiler warning flags... " +for flag in -Wall -Wextra -Wwrite-strings -Wswitch-enum; do + if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1 + then + WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}" + fi +done +printf "\n\t${WARN_CXXFLAGS}\n" + +WARN_CFLAGS="${WARN_CXXFLAGS}" +printf "Checking for available C compiler warning flags... " +for flag in -Wmissing-declarations; do + if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1 + then + WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}" + fi +done +printf "\n\t${WARN_CFLAGS}\n" + +rm -f minimal minimal.c + cat <<EOF All required packages were found. You may now run the following @@ -429,10 +453,10 @@ CXXFLAGS = ${CXXFLAGS} LDFLAGS = ${LDFLAGS} # Flags to enable warnings when using the C++ compiler -WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum +WARN_CXXFLAGS=${WARN_CXXFLAGS} # Flags to enable warnings when using the C compiler -WARN_CFLAGS=\$(WARN_CXXFLAGS) -Wmissing-declarations +WARN_CFLAGS=${WARN_CFLAGS} # The prefix to which notmuch should be installed # Note: If you change this value here, be sure to ensure that the |