summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-08 14:25:46 +0200
committercgzones <cgzones@googlemail.com>2020-09-18 12:28:40 +0200
commitf4602f7b4e7fdcf4b3a5d2c0c353b50fef98aa7e (patch)
tree78f171144f6159137b63da0aeeee3d600f8df7ba /configure.ac
parentdd6500c7c7920f142474373a90bd7d07e037c141 (diff)
Add some default compiler warnings
Compatible with gcc and clang.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac30
1 files changed, 15 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 12676fa3..f22490f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,26 +85,13 @@ AC_CHECK_FUNCS([memmove strncasecmp strstr strdup])
save_cflags="${CFLAGS}"
CFLAGS="${CFLAGS} -std=c99"
-AC_MSG_CHECKING([whether gcc -std=c99 option works])
+AC_MSG_CHECKING([whether cc -std=c99 option works])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT], [[char *a; a = strdup("foo"); int i = 0; i++; // C99]])],
[AC_MSG_RESULT([yes])],
- [AC_MSG_ERROR([htop is written in C99. A newer version of gcc is required.])])
+ [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])])
CFLAGS="$save_cflags"
-save_cflags="${CFLAGS}"
-CFLAGS="$CFLAGS -Wextra"
-AC_MSG_CHECKING([if compiler supports -Wextra])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],[
- wextra_flag=-Wextra
- AC_MSG_RESULT([yes])
-],[
- wextra_flag=
- AC_MSG_RESULT([no])
-])
-CFLAGS="$save_cflags"
-AC_SUBST(wextra_flag)
-
# Checks for features and flags.
# ----------------------------------------------------------------------
PROCDIR=/proc
@@ -279,6 +266,19 @@ then
])
fi
+AM_CFLAGS="\
+ -Wall\
+ -Wcast-align\
+ -Wextra\
+ -Wmissing-format-attribute\
+ -Wmissing-noreturn\
+ -Wpointer-arith\
+ -Wshadow\
+ -Wstrict-prototypes\
+ -Wundef\
+ -Wunused\
+ -Wwrite-strings"
+
AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors (default: warnings are not errors)])], [enable_werror="$enableval"], [enable_werror=no])
AS_IF([test "x$enable_werror" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -Werror"])
AC_SUBST([AM_CFLAGS])

© 2014-2024 Faster IT GmbH | imprint | privacy policy