diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-08-12 18:08:52 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-08-13 00:02:40 -0700 |
commit | 62d6112a7981ad7c34f3b43cffdf00d4662a4f25 (patch) | |
tree | aed93070f7e1be31868dce1d62a1de6ffc1360f9 /configure | |
parent | fb4e0599a5ddaef9eee726f786b9edef4943432b (diff) | |
download | zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.gz zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.bz2 zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.zip |
Clean up the usage of z_const and respect const usage within zlib.
This patch allows zlib to compile cleanly with the -Wcast-qual gcc
warning enabled, but only if ZLIB_CONST is defined, which adds
const to next_in and msg in z_stream and in the in_func prototype.
A --const option is added to ./configure which adds -DZLIB_CONST
to the compile flags, and adds -Wcast-qual to the compile flags
when ZLIBGCCWARN is set in the environment.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -70,6 +70,7 @@ shared=1 | |||
70 | solo=0 | 70 | solo=0 |
71 | cover=0 | 71 | cover=0 |
72 | zprefix=0 | 72 | zprefix=0 |
73 | zconst=0 | ||
73 | build64=0 | 74 | build64=0 |
74 | gcc=0 | 75 | gcc=0 |
75 | old_cc="$CC" | 76 | old_cc="$CC" |
@@ -96,7 +97,7 @@ do | |||
96 | case "$1" in | 97 | case "$1" in |
97 | -h* | --help) | 98 | -h* | --help) |
98 | echo 'usage:' | tee -a configure.log | 99 | echo 'usage:' | tee -a configure.log |
99 | echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log | 100 | echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log |
100 | echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log | 101 | echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log |
101 | echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log | 102 | echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log |
102 | exit 0 ;; | 103 | exit 0 ;; |
@@ -119,6 +120,7 @@ case "$1" in | |||
119 | -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; | 120 | -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; |
120 | --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; | 121 | --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; |
121 | --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; | 122 | --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; |
123 | -c* | --const) zconst=1; shift ;; | ||
122 | *) | 124 | *) |
123 | echo "unknown option: $1" | tee -a configure.log | 125 | echo "unknown option: $1" | tee -a configure.log |
124 | echo "$0 --help for help" | tee -a configure.log | 126 | echo "$0 --help for help" | tee -a configure.log |
@@ -171,7 +173,11 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then | |||
171 | SFLAGS="${SFLAGS} -m64" | 173 | SFLAGS="${SFLAGS} -m64" |
172 | fi | 174 | fi |
173 | if test "${ZLIBGCCWARN}" = "YES"; then | 175 | if test "${ZLIBGCCWARN}" = "YES"; then |
174 | CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" | 176 | if test "$zconst" -eq 1; then |
177 | CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" | ||
178 | else | ||
179 | CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" | ||
180 | fi | ||
175 | fi | 181 | fi |
176 | if test -z "$uname"; then | 182 | if test -z "$uname"; then |
177 | uname=`(uname -s || echo unknown) 2>/dev/null` | 183 | uname=`(uname -s || echo unknown) 2>/dev/null` |