1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-13 12:25:53 +01:00

Configure: Place the argument checks at the beginning of execution

The autotool provides a simple mechanism which allows us to move ("divert")
the checks we do on the user arguments to the beginning of the script, yet
without needing to scatter the code.

This is good because we can raise errors very fast, user do not have to
wait until many other checks have passed before knowing he has to correct
his argument list; yet on our side we can keep related things together.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2021-09-04 19:05:23 +02:00
committed by Carlos R. Mafra
parent ca4ae5068b
commit 1d1c904126
3 changed files with 69 additions and 3 deletions

View File

@@ -30,7 +30,9 @@ m4_pattern_allow([^WM_OSDEP(_[A-Z]*)?$])
# execute ACTION-IF-GIVEN which is supposed to call AC_MSG_ERROR to
# stop any further processing and tell the user its arguments are bad
AC_DEFUN([WM_DENY_ARG_WITH],
[AS_IF([test "${[with_]m4_translit([$1], [-+.], [___])+set}" = set], [$2])])
[m4_divert_push([INIT_PREPARE])dnl
AS_IF([test "${[with_]m4_translit([$1], [-+.], [___])+set}" = set], [$2])
m4_divert_pop([INIT_PREPARE])])
# WM_CHECK_XFT_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])

View File

@@ -147,7 +147,8 @@ AM_CONDITIONAL([HAVE_XGETTEXT], [test "x$XGETTEXT" != "x"])dnl
# wish to customize the menus, and thus can make them translatable
# with their own po/mo files without having to touch WMaker's stuff.
AC_DEFUN_ONCE([WM_I18N_MENUTEXTDOMAIN],
[AC_ARG_WITH([menu-textdomain],
[m4_divert_push([INIT_PREPARE])dnl
AC_ARG_WITH([menu-textdomain],
[AS_HELP_STRING([--with-menu-textdomain=DOMAIN],
[specify gettext domain used for menu translations])],
[AS_CASE([$withval],
@@ -155,6 +156,7 @@ AC_DEFUN_ONCE([WM_I18N_MENUTEXTDOMAIN],
[no], [menutextdomain=""],
[menutextdomain="$withval"])],
[menutextdomain=""])
m4_divert_pop([INIT_PREPARE])dnl
AS_IF([test "x$menutextdomain" != "x"],
[AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$menutextdomain"],
[gettext domain to be used for menu translations]) ])
@@ -167,13 +169,15 @@ dnl
dnl X11 needs to redefine the function 'setlocale' to properly initialize itself,
dnl we check if user wants to disable this behaviour or if it is not supported
AC_DEFUN_ONCE([WM_I18N_XLOCALE],
[AC_ARG_ENABLE([xlocale],
[m4_divert_push([INIT_PREPARE])dnl
AC_ARG_ENABLE([xlocale],
[AS_HELP_STRING([--disable-xlocale],
[disable initialization of locale for X])],
[AS_CASE([$enableval],
[yes|no], [],
[AC_MSG_ERROR([bad value '$enableval' for --disable-xlocale])])],
[enable_xlocale=auto])
m4_divert_pop([INIT_PREPARE])dnl
AS_IF([test "x$enable_xlocale" != "xno"],
[AC_CHECK_LIB([X11], [_Xsetlocale],
[AC_DEFINE([X_LOCALE], [1],