build-sys: cleanup AC_ARG_ENABLE() usage

* don't duplicate default behavior with [enable_foo=$enableval]
 * don't introduce things like disable_* variables
 * use everywhere the same coding style

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2013-08-13 15:21:31 +02:00 committed by Jaromir Capik
parent dec37e484c
commit 616e167f81

View File

@ -104,17 +104,17 @@ AC_TRY_COMPILE([#include <errno.h>],
dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
AC_SUBST([WITH_WATCH8BIT]) AC_SUBST([WITH_WATCH8BIT])
AC_ARG_ENABLE([watch8bit], AC_ARG_ENABLE([watch8bit],
AS_HELP_STRING([--enable-watch8bit], [enable watch to be 8bit clean (requires ncursesw)]), AS_HELP_STRING([--enable-watch8bit], [enable watch to be 8bit clean (requires ncursesw)]),
[enable_watch8bit=$enableval], [], [enable_watch8bit=no]
[enable_watch8bit="no"]) )
if test "$enable_watch8bit" = "yes"; then if test "$enable_watch8bit" = "yes"; then
AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch]) AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
fi fi
AC_ARG_ENABLE([libselinux], AC_ARG_ENABLE([libselinux],
AS_HELP_STRING([--enable-libselinux], [enable libselinux]), AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
[enable_libselinux=$enableval], [], [enable_libselinux=no]
[enable_libselinux="no"]) )
if test "$enable_libselinux" = "yes"; then if test "$enable_libselinux" = "yes"; then
AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux]) AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
fi fi
@ -122,9 +122,8 @@ fi
# Optional packages - AC_ARG_WITH # Optional packages - AC_ARG_WITH
AC_ARG_WITH([ncurses], AC_ARG_WITH([ncurses],
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]), AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
[with_ncurses=$withval], [with_ncurses=yes] [], [with_ncurses=yes]
) )
if test "x$with_ncurses" = xno; then if test "x$with_ncurses" = xno; then
AM_CONDITIONAL(WITH_NCURSES, false) AM_CONDITIONAL(WITH_NCURSES, false)
else else
@ -151,8 +150,8 @@ AC_SUBST([WATCH_NCURSES_LIBS])
AC_ARG_WITH([systemd], AC_ARG_WITH([systemd],
[AS_HELP_STRING([--with-systemd], [enable systemd support])], [AS_HELP_STRING([--with-systemd], [enable systemd support])],
[], [with_systemd=no]) [], [with_systemd=no]
)
if test "x$with_systemd" != xno; then if test "x$with_systemd" != xno; then
PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 202], [], [ PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 202], [], [
AC_CHECK_LIB(systemd-login, sd_pid_get_machine_name, [have_systemd=yes], [have_systemd=no]) AC_CHECK_LIB(systemd-login, sd_pid_get_machine_name, [have_systemd=yes], [have_systemd=no])
@ -170,26 +169,26 @@ fi
# AC_ARG_ENABLEs # AC_ARG_ENABLEs
AC_ARG_ENABLE([kill], AC_ARG_ENABLE([kill],
AS_HELP_STRING([--disable-kill], [do not build kill]), AS_HELP_STRING([--disable-kill], [do not build kill]),
[], enable_kill=yes [], [enable_kill=yes]
) )
AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes) AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu) AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu)
AC_ARG_ENABLE([skill], AC_ARG_ENABLE([skill],
AS_HELP_STRING([--enable-skill], [build skill and snice]), AS_HELP_STRING([--enable-skill], [build skill and snice]),
[], enable_skill=no [], [enable_skill=no]
) )
AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes) AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
AC_ARG_ENABLE([examples], AC_ARG_ENABLE([examples],
AS_HELP_STRING([--enable-examples], [add example files to installation]), AS_HELP_STRING([--enable-examples], [add example files to installation]),
[], enable_examples=no [], [enable_examples=no]
) )
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes) AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
AC_ARG_ENABLE([oomem], AC_ARG_ENABLE([oomem],
AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]), AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]),
[], enable_oomem=no [], [enable_oomem=no]
) )
if test "x$enable_oomem" = xyes; then if test "x$enable_oomem" = xyes; then
AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top]) AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top])
@ -197,7 +196,7 @@ fi
AC_ARG_ENABLE([sigwinch], AC_ARG_ENABLE([sigwinch],
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]), AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
[], enable_sigwinch=no [], [enable_sigwinch=no]
) )
if test "x$enable_sigwinch" = xyes; then if test "x$enable_sigwinch" = xyes; then
AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top]) AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
@ -205,7 +204,7 @@ fi
AC_ARG_ENABLE([wide-percent], AC_ARG_ENABLE([wide-percent],
AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]), AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]),
[enable_wide_percent=yes], [] [], [enable_wide_percent=no]
) )
if test "x$enable_wide_percent" = xyes; then if test "x$enable_wide_percent" = xyes; then
AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top]) AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
@ -213,17 +212,18 @@ fi
AC_ARG_ENABLE([wide-memory], AC_ARG_ENABLE([wide-memory],
AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]), AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]),
[disable_wide_memory=yes], [] [], [enable_wide_memory=yes]
) )
if test "x$disable_wide_memory" = xyes; then if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top]) AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
fi fi
DL_LIB= DL_LIB=
AC_ARG_ENABLE([numa], AC_ARG_ENABLE([numa],
AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]), AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
[disable_numa=yes], []) [], [enable_numa=yes]
if test "x$disable_numa" = x"yes"; then )
if test "x$enable_numa" = xno; then
AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top]) AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
else else
AC_SEARCH_LIBS([dlopen], [dl], [], AC_SEARCH_LIBS([dlopen], [dl], [],
@ -234,7 +234,7 @@ AC_SUBST([DL_LIB])
AC_ARG_ENABLE([w-from], AC_ARG_ENABLE([w-from],
AS_HELP_STRING([--enable-w-from], [enable w from field by default]), AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
[], enable_w_from=no [], [enable_w_from=no]
) )
if test "x$enable_w_from" = xyes; then if test "x$enable_w_from" = xyes; then
AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default]) AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
@ -242,7 +242,7 @@ fi
AC_ARG_ENABLE([whining], AC_ARG_ENABLE([whining],
AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]), AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
[], enable_whining=yes [], [enable_whining=yes]
) )
if test "x$enable_whining" = xyes; then if test "x$enable_whining" = xyes; then
AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)]) AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])