mirror of https://github.com/xzeldon/htop.git
Add some default compiler warnings
Compatible with gcc and clang.
This commit is contained in:
parent
dd6500c7c7
commit
f4602f7b4e
|
@ -10,7 +10,7 @@ applications_DATA = htop.desktop
|
||||||
pixmapdir = $(datadir)/pixmaps
|
pixmapdir = $(datadir)/pixmaps
|
||||||
pixmap_DATA = htop.png
|
pixmap_DATA = htop.png
|
||||||
|
|
||||||
AM_CFLAGS += -pedantic -Wall $(wextra_flag) -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" -I"$(top_srcdir)/$(my_htop_platform)"
|
AM_CFLAGS += -pedantic -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" -I"$(top_srcdir)/$(my_htop_platform)"
|
||||||
AM_LDFLAGS =
|
AM_LDFLAGS =
|
||||||
AM_CPPFLAGS = -DNDEBUG
|
AM_CPPFLAGS = -DNDEBUG
|
||||||
|
|
||||||
|
|
30
configure.ac
30
configure.ac
|
@ -85,26 +85,13 @@ AC_CHECK_FUNCS([memmove strncasecmp strstr strdup])
|
||||||
|
|
||||||
save_cflags="${CFLAGS}"
|
save_cflags="${CFLAGS}"
|
||||||
CFLAGS="${CFLAGS} -std=c99"
|
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_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||||
[AC_INCLUDES_DEFAULT], [[char *a; a = strdup("foo"); int i = 0; i++; // C99]])],
|
[AC_INCLUDES_DEFAULT], [[char *a; a = strdup("foo"); int i = 0; i++; // C99]])],
|
||||||
[AC_MSG_RESULT([yes])],
|
[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"
|
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.
|
# Checks for features and flags.
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
PROCDIR=/proc
|
PROCDIR=/proc
|
||||||
|
@ -279,6 +266,19 @@ then
|
||||||
])
|
])
|
||||||
fi
|
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])
|
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"])
|
AS_IF([test "x$enable_werror" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -Werror"])
|
||||||
AC_SUBST([AM_CFLAGS])
|
AC_SUBST([AM_CFLAGS])
|
||||||
|
|
Loading…
Reference in New Issue