From a15fa42697c540acc697ac4d1b2529f2d5983ee6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 25 Feb 2013 15:08:44 +0000 Subject: [PATCH 1/2] Use AS_IF, AS_CASE rather than if/fi, case/esac Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54112 --- configure.ac | 73 +++++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/configure.ac b/configure.ac index 75c1c48..3adb363 100644 --- a/configure.ac +++ b/configure.ac @@ -75,18 +75,15 @@ dnl debugging stuff AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile without debug code]), [ - case "${enableval}" in - yes|no) enable_debug="${enableval}" ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; - esac + AS_CASE(["${enableval}"], + [yes|no], [enable_debug="${enableval}"], + [*], [AC_MSG_ERROR(bad value ${enableval} for --enable-debug)]) ], [enable_debug=yes]) -if test "$enable_debug" = yes; then - AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code]) -else - enable_debug=no -fi +AS_IF([test "$enable_debug" = yes], + [AC_DEFINE([ENABLE_DEBUG], [], [Enable debug code])], + [enable_debug=no]) AC_ARG_WITH(installed-headers, AC_HELP_STRING([--with-installed-headers=DIR], @@ -165,18 +162,19 @@ AC_ARG_ENABLE([prefer-stream-ciphers], [prefer stream ciphers over block ciphers to save bandwidth (at the possible expense of security)]), [prefer_stream_ciphers=$enableval], [prefer_stream_ciphers=no]) -if test x$prefer_stream_ciphers = xyes; then +AS_IF([test x$prefer_stream_ciphers = xyes], + [ AC_DEFINE(ENABLE_PREFER_STREAM_CIPHERS, [], [Prefer stream ciphers over block ones to save bandwidth]) - if test $with_tls = gnutls; then + AS_IF([test $with_tls = gnutls], + [ # The *-ALL priority strings require gnutls 2.12.0. # We do this check here and not earlier to avoid accidentally falling # back to openssl because of the use of --enable-prefer-stream-ciphers. PKG_CHECK_MODULES(GNUTLS_FOR_STREAM_CIPHERS, [gnutls >= 2.12.0],[], AC_MSG_ERROR([gnutls 2.12.0 is needed to use --enable-prefer-stream-cihpers])) - fi -fi - + ]) + ]) # ----------------------------------------------------------- # Make CA certificates path configurable @@ -186,31 +184,26 @@ AC_MSG_CHECKING([location of system Certificate Authority list]) AC_ARG_WITH(ca-certificates, [AC_HELP_STRING([--with-ca-certificates=@<:@path@:>@], [path to system Certificate Authority list])]) -if test "$with_ca_certificates" = "no"; then - AC_MSG_RESULT([disabled]) -else - if test -z "$with_ca_certificates"; then +AS_IF([test "$with_ca_certificates" = "no"], + [AC_MSG_RESULT([disabled])], + [ + AS_IF([test -z "$with_ca_certificates"], + [ for f in /etc/pki/tls/certs/ca-bundle.crt \ /etc/ssl/certs/ca-certificates.crt; do - if test -f "$f"; then - with_ca_certificates="$f" - fi + AS_IF([test -f "$f"], [with_ca_certificates="$f"]) done - if test -z "$with_ca_certificates"; then - AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or --without-ca-certificates to disable]) - fi - fi + AS_IF([test -z "$with_ca_certificates"], + [AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or --without-ca-certificates to disable])]) + ]) AC_MSG_RESULT($with_ca_certificates) AC_DEFINE_UNQUOTED([GTLS_SYSTEM_CA_CERTIFICATES], ["$with_ca_certificates"], [path to system Certificate Authority list]) -fi - -if test -n "$with_ca_certificates"; then - if ! test -f "$with_ca_certificates"; then - AC_MSG_WARN([Specified certificate authority file '$with_ca_certificates' does not exist]) - fi -fi + ]) +AS_IF([test -n "$with_ca_certificates"], + [AS_IF([! test -f "$with_ca_certificates"], + [AC_MSG_WARN([Specified certificate authority file '$with_ca_certificates' does not exist])])]) GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` AC_SUBST(GLIB_GENMARSHAL) @@ -255,30 +248,28 @@ AC_ARG_ENABLE(google-relay, [disable Google Jingle relay support]), [enable_google_relay=$enableval], [enable_google_relay=yes]) -if test x$enable_google_relay = xyes; then +AS_IF([test "x$enable_google_relay" = xyes], + [ AC_DEFINE(ENABLE_GOOGLE_RELAY, [], [Enable Google Jingle relay support]) dnl Check for libsoup PKG_CHECK_MODULES(SOUP, libsoup-2.4) -fi + ]) AM_CONDITIONAL([ENABLE_GOOGLE_RELAY], [test "x$enable_google_relay" = xyes]) AC_ARG_ENABLE(coverage, AC_HELP_STRING([--enable-coverage], [compile with coverage profiling instrumentation (gcc only)]), [ - case "${enableval}" in - "yes"|"no") enable_coverage="${enableval}" ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-coverage) ;; - esac + AS_CASE(["${enableval}"], + ["yes"|"no"], [enable_coverage="${enableval}"], + [*], [AC_MSG_ERROR(bad value ${enableval} for --enable-coverage)]) ] ) WOCKY_GCOV(${enable_coverage}) WOCKY_LCOV(${enable_coverage}) -if test "x$enable_coverage" = "x"; then - enable_coverage=no -fi +AS_IF([test "x$enable_coverage" = "x"], [enable_coverage=no]) AC_SUBST(PACKAGE_STRING) -- 1.7.10.4