]> git.ipfire.org Git - pakfire.git/commitdiff
configure: Replace CFLAGS
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Dec 2021 12:39:30 +0000 (12:39 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Dec 2021 12:39:30 +0000 (12:39 +0000)
All flags that are default or a decision by the operating system have
been removed and we only enable a bunch of warnings that will help us to
write better code.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
configure.ac

index 7649c9d52996a2986b825628b9196f05b455b613..8de0153264d71dd33324e3a48839cfe5767004b4 100644 (file)
@@ -100,19 +100,18 @@ m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-conf
 AC_PROG_CC_STDC
 
 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-       -pipe \
        -Wall \
-       -Wextra \
-       -Wno-inline \
-       -Wundef \
-       "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
-       -Wno-unused-parameter \
-       -Wno-unused-result \
-       -fno-strict-aliasing \
-       -ffunction-sections \
-       -fdata-sections \
-       -fstack-protector-all \
-       --param=ssp-buffer-size=4])
+       -Wchar-subscripts \
+       -Wformat-security \
+       -Wmissing-declarations \
+       -Wmissing-prototypes \
+       -Wnested-externs \
+       -Wpointer-arith \
+       -Wshadow \
+       -Wsign-compare \
+       -Wstrict-prototypes \
+       -Wtype-limits \
+])
 
 # Enable -fanalyzer if requested
 AC_ARG_ENABLE([analyzer],
@@ -122,18 +121,6 @@ AS_IF([test "x$enable_analyzer" = "xyes"],
        CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fanalyzer])
 )
 
-AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
-       [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-               -Wp,-D_FORTIFY_SOURCE=2])],
-       [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
-
-CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-       -Wl,--as-needed \
-       -Wl,--no-undefined \
-       -Wl,--gc-sections \
-       -Wl,-z,relro \
-       -Wl,-z,now])
-
 # Enable -fno-semantic-interposition (if available)
 CC_CHECK_FLAGS_APPEND([with_CFLAGS], [CFLAGS], [-fno-semantic-interposition])
 CC_CHECK_FLAGS_APPEND([with_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition])