Add C++ compiler flags with --enable-werror, remove -Wall from CPPFLAGS
This commit is contained in:
parent
cf06c3fbc5
commit
2f80c453bb
15
configure.ac
15
configure.ac
|
@ -643,9 +643,13 @@ AM_CONDITIONAL([ENABLE_TINY_NGHTTPD],
|
||||||
test "x${have_timerfd_create}" = "xyes"])
|
test "x${have_timerfd_create}" = "xyes"])
|
||||||
|
|
||||||
ac_save_CFLAGS=$CFLAGS
|
ac_save_CFLAGS=$CFLAGS
|
||||||
|
ac_save_CXXFLAGS=$CXXFLAGS
|
||||||
|
|
||||||
CFLAGS=
|
CFLAGS=
|
||||||
|
CXXFLAGS=
|
||||||
|
|
||||||
if test "x$werror" != "xno"; then
|
if test "x$werror" != "xno"; then
|
||||||
|
# For C compiler
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
|
AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
|
AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
|
||||||
|
@ -691,12 +695,23 @@ if test "x$werror" != "xno"; then
|
||||||
AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"])
|
AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"])
|
||||||
# Only work with Clang for the moment
|
# Only work with Clang for the moment
|
||||||
AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
|
AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
|
||||||
|
|
||||||
|
# For C++ compiler
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"])
|
||||||
|
AC_LANG_POP()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
WARNCFLAGS=$CFLAGS
|
WARNCFLAGS=$CFLAGS
|
||||||
|
WARNCXXFLAGS=$CXXFLAGS
|
||||||
|
|
||||||
CFLAGS=$ac_save_CFLAGS
|
CFLAGS=$ac_save_CFLAGS
|
||||||
|
CXXFLAGS=$ac_save_CXXFLAGS
|
||||||
|
|
||||||
AC_SUBST([WARNCFLAGS])
|
AC_SUBST([WARNCFLAGS])
|
||||||
|
AC_SUBST([WARNCXXFLAGS])
|
||||||
|
|
||||||
EXTRACFLAG=
|
EXTRACFLAG=
|
||||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"])
|
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"])
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
if ENABLE_EXAMPLES
|
if ENABLE_EXAMPLES
|
||||||
|
|
||||||
AM_CFLAGS = $(WARNCFLAGS)
|
AM_CFLAGS = $(WARNCFLAGS)
|
||||||
|
AM_CXXFLAGS = $(WARNCXXFLAGS)
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-Wall \
|
|
||||||
-I$(top_srcdir)/lib/includes \
|
-I$(top_srcdir)/lib/includes \
|
||||||
-I$(top_builddir)/lib/includes \
|
-I$(top_builddir)/lib/includes \
|
||||||
-I$(top_srcdir)/src/includes \
|
-I$(top_srcdir)/src/includes \
|
||||||
|
|
|
@ -27,9 +27,9 @@ check_PROGRAMS =
|
||||||
TESTS =
|
TESTS =
|
||||||
|
|
||||||
AM_CFLAGS = $(WARNCFLAGS)
|
AM_CFLAGS = $(WARNCFLAGS)
|
||||||
|
AM_CXXFLAGS = $(WARNCXXFLAGS)
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-DPKGDATADIR='"$(pkgdatadir)"' \
|
-DPKGDATADIR='"$(pkgdatadir)"' \
|
||||||
-Wall \
|
|
||||||
-I$(top_srcdir)/lib/includes \
|
-I$(top_srcdir)/lib/includes \
|
||||||
-I$(top_builddir)/lib/includes \
|
-I$(top_builddir)/lib/includes \
|
||||||
-I$(top_srcdir)/lib \
|
-I$(top_srcdir)/lib \
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
AM_CPPFLAGS = -Wall @DEFS@
|
AM_CPPFLAGS = @DEFS@
|
||||||
|
|
||||||
if ENABLE_THIRD_PARTY
|
if ENABLE_THIRD_PARTY
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue