changeset 4657:52d8b00cfe13

Simplify AUD_ARG_* even more.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 16 Jun 2008 19:19:09 +0300
parents 60910362ecf2
children 763b20a53874
files acinclude.m4 configure.ac
diffstat 2 files changed, 91 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Mon Jun 16 14:50:16 2008 +0300
+++ b/acinclude.m4	Mon Jun 16 19:19:09 2008 +0300
@@ -48,9 +48,8 @@
 dnl ** Simple wrapper for AC_ARG_ENABLE
 dnl ** AUD_ARG_ENABLE([name], [default value], [help string], [if enabled], [if disabled])
 AC_DEFUN([AUD_ARG_ENABLE], [dnl
-# _A_ARG_ENABLE($1, $2, $3, $4, $5)
     define([Name], [translit([$1], [./-], [___])])dnl
-    define([cBasce], [$3 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
+    define([cBasce], [ifelse([$2],[yes],[Disable],[Enable]) $3 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
     AC_ARG_ENABLE([$1], [AS_HELP_STRING([ifelse([$2],[yes],[--disable-$1],[--enable-$1])], cBasce)],, [enable_[]Name=$2])
     if test "x${enable_[]Name}" = "xyes"; then
         m4_ifvaln([$4], [$4], [:])dnl
@@ -60,9 +59,8 @@
 
 
 AC_DEFUN([AUD_ARG_SIMPLE], [dnl
-# _A_ARG_SIMPLE($1, $2, $3, $4, $5, $6)
     define([Name], [translit([$1], [./-], [___])])dnl
-    define([cBasce], [$3 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
+    define([cBasce], [ifelse([$2],[yes],[Disable],[Enable]) $3 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
     AC_ARG_ENABLE([$1], [AS_HELP_STRING([ifelse([$2],[yes],[--disable-$1],[--enable-$1])], cBasce)],, [enable_[]Name=$2])
     if test "x${enable_[]Name}" = "xyes"; then
         AC_DEFINE([$4], [$5], [$6])
@@ -191,8 +189,7 @@
 
 dnl SSE2 support
 dnl ============
-AUD_ARG_ENABLE([sse2], [yes],
-[Disable SSE2 support],
+AUD_ARG_ENABLE([sse2], [yes], [SSE2 support],
 [
     AC_MSG_CHECKING([SSE2 support])
     aud_my_save_CFLAGS="$CFLAGS"
@@ -218,8 +215,7 @@
 
 dnl AltiVec support 
 dnl ===============
-AUD_ARG_ENABLE([altivec], [yes],
-[Disable AltiVec support],
+AUD_ARG_ENABLE([altivec], [yes], [AltiVec support],
 [
     AC_CHECK_HEADERS([altivec.h],
     [
@@ -234,3 +230,84 @@
 ])    
 
 ])
+
+
+dnl Plugin helper macros
+dnl ====================
+AC_DEFUN([AUD_PLUGIN_ADD], [dnl
+define([Name], [translit([$1], [A-Z./-], [a-z___])])dnl
+have_[]Name="yes"; res_short_[]Name="$1"
+res_desc_[]Name="$3"; ifdef([aud_def_plugin_$2], [$2[]_PLUGINS="${$2[]_PLUGINS} $1"], [$2[]_PLUGINS="$1"])dnl
+define([aud_def_plugin_$2],[1])dnl
+])
+
+AC_DEFUN([AUD_PLUGIN_CHK], [dnl
+define([cBasce], [$5 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
+AC_ARG_ENABLE([$1], [AS_HELP_STRING([ifelse([$2],[yes],[--disable-$1],[--enable-$1])], cBasce)],, [enable_$2="$3"])dnl
+    have_$2="no"
+    if test "x${enable_$2}" = "xyes"; then
+        m4_ifvaln([$6], [$6], [:])
+        if test "x${have_$2}" = "xyes"; then
+            m4_ifvaln([$7], [$7], [:])dnl
+        else
+            res_msg_$2="(not found)"
+            m4_ifvaln([$8], [$8], [:])dnl
+        fi
+    else
+        res_msg_$2="(disabled)"
+        m4_ifvaln([$9], [$9], [:])dnl
+    fi
+])
+
+AC_DEFUN([AUD_PLUGIN_CHECK_SIMPLE], [dnl
+define([cBasce], [$6 (def: ifelse([$2],[yes],[enabled],[disabled]))])dnl
+AC_ARG_ENABLE([$1], [AS_HELP_STRING([ifelse([$2],[yes],[--disable-$1],[--enable-$1])], cBasce)],, [enable_$2="$3"])dnl
+    have_$2="no"
+    if test "x${enable_$2}" = "xyes"; then
+        m4_ifvaln([$6], [$6], [:])
+    else
+        res_msg_$2="(disabled)"
+        m4_ifvaln([$7], [$7], [:])dnl
+    fi
+])
+
+
+dnl Check and enable a plugin with a pkg-config check
+AC_DEFUN([AUD_PLUGIN_CHECK_PKG], [dnl
+define([Name], [translit([$1], [A-Z./-], [a-z___])])dnl
+define([BigN], [translit([$1], [a-z./-], [A-Z___])])dnl
+    AUD_PLUGIN_CHK([$1], Name, [$2], [$4], [$6], [dnl
+        PKG_CHECK_MODULES([]BigN, [$7], [have_[]Name[]="yes"], [have_[]Name[]="no"])
+    ], [
+    AUD_PLUGIN_ADD([$5], [$3])
+    m4_ifvaln([$8], [$8])
+    ], [$9], [$10])
+])
+
+dnl Check and enable a plugin with a header files check
+AC_DEFUN([AUD_PLUGIN_CHECK_HEADERS], [
+define([Name], [translit([$1], [A-Z./-], [a-z___])])dnl
+    AUD_PLUGIN_CHK([$1], Name, [$2], [$4], [$6], [
+        AC_CHECK_HEADERS([$7], [have_[]Name[]="yes"], [have_[]Name[]="no"])
+    ], [
+    AUD_PLUGIN_ADD([$5], [$3])
+    m4_ifvaln([$8], [$8])
+    ], [$9], [$10])
+])
+
+dnl Check and enable a plugin with complex checks
+AC_DEFUN([AUD_PLUGIN_CHECK_COMPLEX], [
+# CHECK_COMPLEX #1 : $1
+define([Name], [translit([$1], [A-Z./-], [a-z___])])dnl
+    AUD_PLUGIN_CHK([$1], Name, [$2], [$4], [$6], [
+# CHECK_COMPLEX #2 BEGIN
+        $7
+# CHECK_COMPLEX #2 END
+    ], [
+# CHECK_COMPLEX #3 BEGIN
+    AUD_PLUGIN_ADD([$5], [$3])
+    m4_ifvaln([$8], [$8])
+# CHECK_COMPLEX #3 END
+    ], [$9], [$10])
+])
+
--- a/configure.ac	Mon Jun 16 14:50:16 2008 +0300
+++ b/configure.ac	Mon Jun 16 19:19:09 2008 +0300
@@ -76,7 +76,7 @@
 AC_PATH_PROG([AUDACIOUS_PATH], [audacious], [no])
 
 AUD_ARG_ENABLE([user-plugin-dir], [yes],
-[Disable per-user plugin dir])
+[per-user plugin dir])
 
 if test "x$enable_user_plugin_dir" = "xno"; then
     AC_DEFINE([DISABLE_USER_PLUGIN_DIR], 1, [Define to disable per user plugin directory])
@@ -87,7 +87,7 @@
 dnl Chardet support
 dnl ===============
 AUD_ARG_ENABLE([chardet], [yes],
-[Disable charset detection support],
+[charset detection support],
 [
     AC_DEFINE([USE_CHARDET], 1, [Define if character set detection enabled])
     AC_CHECK_LIB([udet_c], [detectCharset], [
@@ -103,7 +103,7 @@
 dnl D-Bus support
 dnl =============
 AUD_ARG_ENABLE([dbus], [yes],
-[Enable D-Bus support],
+[D-Bus support],
 [
     PKG_CHECK_MODULES([DBUS], [dbus-1 >= 0.60 dbus-glib-1 >= 0.60 gthread-2.0],
         [enable_dbus=yes],
@@ -134,7 +134,7 @@
 dnl libsamplerate support
 dnl =====================
 AUD_ARG_ENABLE([samplerate], [no],
-[Enable libsamplerate support],
+[libsamplerate support],
 [
     AUD_CHECK_MODULE([SAMPLERATE], [samplerate],, [libsamplerate])
     aud_save_LIBS="$LIBS"
@@ -155,7 +155,7 @@
 dnl xspf playlist support
 dnl =====================
 AUD_ARG_ENABLE([xspf], [yes],
-[Disable XSPF support],
+[XSPF support],
 [
     AM_PATH_XML2([2.0.0],, [
        AC_MSG_WARN([*** libxml2 is not installed. XSPF playlist support will not be built. ***])
@@ -209,7 +209,7 @@
 AC_DEFINE_UNQUOTED([AUDACIOUS_DESKTOP_FILE], "${desktop_file}", [Location of the desktop file])
 
 AUD_ARG_ENABLE([sm], [yes],
-[Disable session management],
+[session management],
 [
     PKG_CHECK_MODULES([SM], [sm >= 1.0], [
         AC_DEFINE([USE_EGGSM], 1, [Define if session management should be used.])