summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-01-04 12:44:25 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-01-04 12:44:25 +0000
commit231545d638f4b19a9e181944e798710660e22466 (patch)
treeb5c64fa75cffb6a5c6e53e0a9591953ff1c9de53
parent454061d0119057584a30e8f1c997d9524758520e (diff)
Use AS_IF, AS_CASE instead of if/fi and case/esac
It only rarely matters, but when it does, it's really confusing. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54119
-rw-r--r--configure.ac123
1 files changed, 55 insertions, 68 deletions
diff --git a/configure.ac b/configure.ac
index 047b2705..0696a304 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,14 +41,11 @@ SALUT_ARG_COVERAGE
dnl Detect Windows Verion
AC_MSG_CHECKING([for operating system])
-case "$host" in
- *-*-*mingw*|*-*-*cygwin*)
- platform=win32
- ;;
- *)
- platform=generic
- ;;
-esac
+AS_CASE([$host],
+ [*-*-*mingw*|*-*-*cygwin*],
+ [platform=win32],
+ [*],
+ [platform=generic])
AC_MSG_RESULT($platform)
@@ -92,26 +89,22 @@ TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$enable_fatal_warnings" = xyes],
unused-parameter])
AC_SUBST([ERROR_CFLAGS])
-if test x$enable_debug = xyes; then
- AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code])
-fi
+AS_IF([test x$enable_debug = xyes],
+ [AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code])])
dnl Check for code generation tools
XSLTPROC=
AC_CHECK_PROGS([XSLTPROC], [xsltproc])
-if test -z "$XSLTPROC"; then
- AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])
-fi
+AS_IF([test -z "$XSLTPROC"],
+ [AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])])
AM_PATH_PYTHON([2.5])
# Check for a python >= 2.5 with twisted to run python tests
AC_MSG_CHECKING([for Python with Avahi, Twisted and XMPP protocol support])
-if $PYTHON -c "import twisted.words.xish.domish, twisted.words.protocols.jabber, twisted.internet.reactor, avahi" >/dev/null 2>&1; then
- TEST_PYTHON="$PYTHON"
-else
- TEST_PYTHON=false
-fi
+AS_IF([$PYTHON -c "import twisted.words.xish.domish, twisted.words.protocols.jabber, twisted.internet.reactor, avahi" >/dev/null 2>&1],
+ [TEST_PYTHON="$PYTHON"],
+ [TEST_PYTHON=false])
AC_MSG_RESULT([$TEST_PYTHON])
AC_SUBST(TEST_PYTHON)
AM_CONDITIONAL([WANT_TWISTED_TESTS], test false != "$TEST_PYTHON")
@@ -122,12 +115,10 @@ AC_ARG_ENABLE(avahi-tests,
[Enable tests that use the system avahi to hit the network ]),
enable_avahi_tests=$enableval, enable_avahi_tests=yes)
-if test x$enable_avahi_tests = xyes; then
- if test false = "$TEST_PYTHON"; then
- AC_MSG_ERROR(
- [Python with twisted support is needed for avahi twisted tests])
- fi
-fi
+AS_IF([test x$enable_avahi_tests = xyes],
+ [AS_IF([test false = "$TEST_PYTHON"],
+ [AC_MSG_ERROR(
+ [Python with twisted support is needed for avahi twisted tests])])])
AM_CONDITIONAL(WANT_TWISTED_AVAHI_TESTS, test "x$enable_avahi_tests" = "xyes")
dnl olpc specific code switch
@@ -135,10 +126,8 @@ AC_ARG_ENABLE(olpc,
AC_HELP_STRING([--enable-olpc],[compile with olpc specific code]),
enable_olpc=$enableval, enable_olpc=no )
-if test x$enable_olpc = xyes; then
- AC_DEFINE(ENABLE_OLPC, [], [Enable olpc code])
-fi
-
+AS_IF([test x$enable_olpc = xyes],
+ [AC_DEFINE(ENABLE_OLPC, [], [Enable olpc code])])
AM_CONDITIONAL(ENABLE_OLPC, test "x$enable_olpc" = "xyes")
AC_SUBST(ENABLE_OLPC)
@@ -180,17 +169,19 @@ AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-if test "$platform" = "win32"; then
+AS_IF([test "$platform" = "win32"],
+[
PKG_CHECK_MODULES(GIO_WINDOWS,
[gio-windows-2.0])
AC_SUBST(GIO_WINDOWS_CFLAGS)
AC_SUBST(GIO_WINDOWS_LIBS)
-else
+],
+[
PKG_CHECK_MODULES(GIO_UNIX,
[gio-unix-2.0])
AC_SUBST(GIO_UNIX_CFLAGS)
AC_SUBST(GIO_UNIX_LIBS)
-fi
+])
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
@@ -214,44 +205,49 @@ AC_SUBST(TELEPATHY_GLIB_CFLAGS)
AC_SUBST(TELEPATHY_GLIB_LIBS)
dnl check the backend to use
-if test "$platform" = "win32"; then
+AS_IF([test "$platform" = "win32"],
+[
AC_ARG_WITH(backend,
AC_HELP_STRING([--with-backend=[bonjour/no]],
[Zeroconf backend to use]),
[], [with_backend=bonjour])
-else
+],
+[
AC_ARG_WITH(backend,
AC_HELP_STRING([--with-backend=[avahi/bonjour/no]],
[Zeroconf backend to use]),
[], [with_backend=avahi])
-fi
+])
AM_CONDITIONAL(USE_BACKEND_AVAHI, [test "x$with_backend" = "xavahi"])
AM_CONDITIONAL(USE_BACKEND_BONJOUR, [test "x$with_backend" = "xbonjour"])
AM_CONDITIONAL(USE_BACKEND_DUMMY, [test "x$with_backend" = "xno"])
dnl Check for Avahi
-if test x$with_backend = xavahi; then
+AS_IF([test x$with_backend = xavahi],
+[
PKG_CHECK_MODULES(AVAHI, [avahi-gobject, avahi-client])
AC_DEFINE(USE_BACKEND_AVAHI, [], [Use Avahi backend])
AC_SUBST(AVAHI_CFLAGS)
AC_SUBST(AVAHI_LIBS)
AC_SUBST(USE_BACKEND_AVAHI)
-fi
+])
dnl Check for Bonjour Client Library libdns_sd
-if test x$with_backend = xbonjour; then
+AS_IF([test x$with_backend = xbonjour],
+[
PKG_CHECK_MODULES(BONJOUR, [libdns_sd])
AC_DEFINE(USE_BACKEND_BONJOUR, [], [Use Bonjour backend])
AC_SUBST(BONJOUR_CFLAGS)
AC_SUBST(BONJOUR_LIBS)
AC_SUBST(USE_BACKEND_BONJOUR)
-fi
+])
-if test x$with_backend = xno; then
+AS_IF([test x$with_backend = xno],
+[
AC_DEFINE(USE_BACKEND_DUMMY, [], [Use dummy backend])
AC_SUBST(USE_BACKEND_DUMMY)
-fi
+])
dnl Check for libsoup
PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4])
@@ -262,11 +258,9 @@ dnl check for libuuid
PKG_CHECK_MODULES([UUID], [uuid], [HAVE_UUID=yes], [HAVE_UUID=no])
AC_SUBST([UUID_CFLAGS])
AC_SUBST([UUID_LIBS])
-if test x"$HAVE_UUID" = xyes; then
- AC_DEFINE([HAVE_UUID], [1], [Define if libuuid is available])
-else
- AC_MSG_WARN([libuuid not found, falling back to generating random IDs])
-fi
+AS_IF([test x"$HAVE_UUID" = xyes],
+ [AC_DEFINE([HAVE_UUID], [1], [Define if libuuid is available])],
+ [AC_MSG_WARN([libuuid not found, falling back to generating random IDs])])
AC_ARG_ENABLE(submodules,
AS_HELP_STRING([--disable-submodules],
@@ -278,14 +272,12 @@ AC_ARG_ENABLE(submodules,
# not install-data).
#
# Private directory for Wocky and the salut-plugins library
-if test "x$pluginexeclibdir" = x; then
- pluginexeclibdir='${libdir}/telepathy/salut-0/lib'
-fi
+AS_IF([test "x$pluginexeclibdir" = x],
+ [pluginexeclibdir='${libdir}/telepathy/salut-0/lib'])
AC_ARG_VAR([pluginexeclibdir])
# The actual plugins
-if test "x$pluginexecdir" = x; then
- pluginexecdir='${libdir}/telepathy/salut-0/plugins'
-fi
+AS_IF([test "x$pluginexecdir" = x],
+ [pluginexecdir='${libdir}/telepathy/salut-0/plugins'])
AC_ARG_VAR([pluginexecdir])
dnl plugins
@@ -294,7 +286,8 @@ AC_ARG_ENABLE(plugins,
[disable plugin loader]),
[enable_plugins=$enableval], [enable_plugins=yes])
-if test x$enable_plugins = xyes; then
+AS_IF([test x$enable_plugins = xyes],
+[
AC_DEFINE(ENABLE_PLUGINS, [], [Enable plugins])
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
@@ -306,7 +299,7 @@ if test x$enable_plugins = xyes; then
wocky_install_headers_dir="${includedir}/telepathy-salut-0"
],
[enable_plugin_api=no])
-fi
+])
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
@@ -322,9 +315,7 @@ AM_CONDITIONAL(ENABLE_PLUGIN_API, test x$enable_plugin_api = xyes)
# If you don't specify --prefix, it starts off as NONE. Autoconf
# would normally do this defaulting for us later, but that's too
# late to help Wocky.
-if test "x${prefix}" = "xNONE"; then
- prefix=/usr/local
-fi
+AS_IF([test "x${prefix}" = "xNONE"], [prefix=/usr/local])
# We tell Wocky to install its headers alongside gabble's so that an actual
# separate Wocky installation won't clash with them. This is a bit of a hack.
@@ -334,17 +325,13 @@ fi
prev_ac_configure_args=$ac_configure_args
ac_configure_args="$ac_configure_args --with-installed-headers=${wocky_install_headers_dir} --enable-shared-suffix=${PACKAGE}-${VERSION} --libdir=${pluginexeclibdir}"
-if test "x$enable_fatal_warnings" = xyes ; then
- ac_configure_args="$ac_configure_args --enable-coding-style-checks"
-else
- ac_configure_args="$ac_configure_args --disable-coding-style-checks"
-fi
-
-if test "x$tp_werror" = xyes && test "x$enable_fatal_warnings" = xyes; then
- ac_configure_args="$ac_configure_args --enable-Werror"
-else
- ac_configure_args="$ac_configure_args --disable-Werror"
-fi
+AS_IF([test "x$enable_fatal_warnings" = xyes],
+ [ac_configure_args="$ac_configure_args --enable-coding-style-checks"],
+ [ac_configure_args="$ac_configure_args --disable-coding-style-checks"])
+
+AS_IF([test "x$tp_werror" = xyes && test "x$enable_fatal_warnings" = xyes],
+ [ac_configure_args="$ac_configure_args --enable-Werror"],
+ [ac_configure_args="$ac_configure_args --disable-Werror"])
prev_top_build_prefix=$ac_top_build_prefix
AX_CONFIG_DIR([lib/ext/wocky])