From af14eca77a3f2c037b1aca4d3f6945ffa2b985db Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 19 Feb 2016 12:04:44 +0000 Subject: configure.ac: use AS_CASE, AS_IF Signed-off-by: Simon McVittie --- configure.ac | 70 +++++++++++++++++++----------------------- m4/dbus-py-add-rst2htmlflag.m4 | 26 ++++++++-------- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/configure.ac b/configure.ac index 2dddd3e..2b1b4c1 100644 --- a/configure.ac +++ b/configure.ac @@ -42,14 +42,11 @@ AC_CANONICAL_HOST # mingw32, mingw-w64 are native Windows; for our purposes, Cygwin isn't AC_MSG_CHECKING([for native Windows host]) -case "$host" in - (*-*-mingw*) - windows=yes - ;; - (*) - windows=no - ;; -esac +AS_CASE(["$host"], + [*-*-mingw*], + [windows=yes], + [*], + [windows=no]) AC_MSG_RESULT([$windows]) AM_CONDITIONAL([WINDOWS], [test "x$windows" = xyes]) @@ -110,20 +107,17 @@ AC_HELP_STRING([--enable-api-docs], [Enable API documentation building (requires AC_MSG_RESULT([$enable_api_docs]) -if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then +AS_IF([test "$enable_api_docs" != no || test "$enable_html_docs" != no], + [ AX_PYTHON_MODULE([docutils]) - if test "$HAVE_PYMOD_DOCUTILS" = no; then - if test "$enable_api_docs" = "if possible"; then - enable_api_docs=no - fi - if test "$enable_html_docs" = "if possible"; then - enable_html_docs=no - fi - if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then - AC_MSG_ERROR([cannot compile HTML documentation or API documentation without python-docutils installed]) - fi - fi -fi + AS_IF([test "$HAVE_PYMOD_DOCUTILS" = no], + [ + AS_IF([test "$enable_api_docs" = "if possible"], [enable_api_docs=no]) + AS_IF([test "$enable_html_docs" = "if possible"], [enable_html_docs=no]) + AS_IF([test "$enable_api_docs" != no || test "$enable_html_docs" != no], + [AC_MSG_ERROR([cannot compile HTML documentation or API documentation without python-docutils installed])]) + ]) + ]) AS_IF([test "${enable_api_docs}" != no], [ @@ -142,8 +136,7 @@ AS_IF([test "${enable_api_docs}" != no], [ AC_MSG_RESULT([no, $EPYDOC_VERSION]) EPYDOC= - ], - ) + ]) ], [ EPYDOC= @@ -154,10 +147,9 @@ AS_IF([test "${enable_api_docs}" != no], [if*possible], [enable_api_docs=no], [*], - [AC_MSG_ERROR([cannot compile API documentation without epydoc 3.0beta1 or newer installed])], - ) + [AC_MSG_ERROR([cannot compile API documentation without epydoc 3.0beta1 or newer installed])]) ]) -]) + ]) AC_ARG_VAR([DBUS_RUN_SESSION], [The dbus-run-session tool from dbus 1.8 or later]) @@ -165,18 +157,19 @@ AC_PATH_PROG([DBUS_RUN_SESSION], [dbus-run-session], [false]) AM_CONDITIONAL([HAVE_DBUS_RUN_SESSION], [test "$DBUS_RUN_SESSION" != false]) RST2HTMLFLAGS= -if test "${enable_html_docs}" != no; then +AS_IF([test "${enable_html_docs}" != no], + [ AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py], []) - if test -z "$RST2HTML"; then - case "$enable_html_docs" in - if*possible) - enable_html_docs=no - ;; - *) - AC_MSG_ERROR([cannot compile HTML documentation without rst2html installed]) - ;; - esac - else + AS_IF([test -z "$RST2HTML"], + [ + AS_CASE(["$enable_html_docs"], + [if*possible], + [enable_html_docs=no], + [*], + [AC_MSG_ERROR([cannot compile HTML documentation without rst2html installed])]) + ]) + ], + [ DBUS_PY_ADD_RST2HTMLFLAG([--generator]) DBUS_PY_ADD_RST2HTMLFLAG([--date]) DBUS_PY_ADD_RST2HTMLFLAG([--time]) @@ -185,8 +178,7 @@ if test "${enable_html_docs}" != no; then DBUS_PY_ADD_RST2HTMLFLAG([--no-file-insertion]) DBUS_PY_ADD_RST2HTMLFLAG([--cloak-email-addresses]) DBUS_PY_ADD_RST2HTMLFLAG([--input-encoding=UTF-8]) - fi -fi + ]) AC_SUBST([RST2HTML]) AC_SUBST([RST2HTMLFLAGS]) diff --git a/m4/dbus-py-add-rst2htmlflag.m4 b/m4/dbus-py-add-rst2htmlflag.m4 index 88b4de0..59e37ec 100644 --- a/m4/dbus-py-add-rst2htmlflag.m4 +++ b/m4/dbus-py-add-rst2htmlflag.m4 @@ -3,21 +3,19 @@ dnl checks whether rst2html supports the given flag, and if so, adds dnl it to $RST2HTMLFLAGS. Same as JH_ADD_CFLAG, really. AC_DEFUN([DBUS_PY_ADD_RST2HTMLFLAG], [ -case " $RST2HTMLFLAGS " in -*@<:@\ \ @:>@$1@<:@\ \ @:>@*) - ;; -*) +AS_CASE([" $RST2HTMLFLAGS "], +[*@<:@\ \ @:>@$1@<:@\ \ @:>@*], + [], +[*], + [ save_RST2HTMLFLAGS="$RST2HTMLFLAGS" RST2HTMLFLAGS="$RST2HTMLFLAGS $1" AC_MSG_CHECKING([whether [$]RST2HTML understands $1]) - if $RST2HTML --strict $RST2HTMLFLAGS /dev/null > /dev/null 2>/dev/null; then - dbuspy_has_option=yes - else - dbuspy_has_option=no - fi + AS_IF([$RST2HTML --strict $RST2HTMLFLAGS /dev/null > /dev/null 2>/dev/null], + [dbuspy_has_option=yes], + [dbuspy_has_option=no]) AC_MSG_RESULT($dbuspy_has_option) - if test $dbuspy_has_option = no; then - RST2HTMLFLAGS="$save_RST2HTMLFLAGS" - fi - ;; -esac]) + AS_IF([test $dbuspy_has_option = no], + [RST2HTMLFLAGS="$save_RST2HTMLFLAGS"]) + ]) +]) -- cgit v1.2.1