changeset 2546:a4c855226874

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 Apr 2008 13:29:56 +0300
parents 585f2fc4134e (current diff) 7591d7534eb8 (diff)
children d3432c34e817 6d17b2c838df
files m4/libmikmod.m4
diffstat 2 files changed, 119 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Wed Apr 30 05:01:37 2008 +0300
+++ b/acinclude.m4	Wed Apr 30 13:29:56 2008 +0300
@@ -1,9 +1,121 @@
-dnl ADD_PKG_REQUIRES([requirement])
+
+dnl ** ADD_PKG_REQUIRES([requirement])
+AC_DEFUN([ADD_PC_REQUIRES], [
+   if test "x$PC_REQUIRES" = "x"; then
+       PC_REQUIRES="$1"
+   else
+       PC_REQUIRES="$PC_REQUIRES, $1"
+   fi
+   AC_SUBST([PC_REQUIRES])
+])
+
+
+dnl ** Like PKG_CHECK_MODULES, but provides an informative error message.
+dnl ** AUD_CHECK_MODULE([define name], [module], [version required],
+dnl **     [informational name], [additional error message])
+dnl **
+dnl ** AUD_CHECK_MODULE([GLIB], [gtk+-2.0], [>= 2.10.0], [Gtk+2], [See http://www.gtk.org/])
+AC_DEFUN([AUD_CHECK_MODULE], [
+    PKG_CHECK_MODULES([$1], [$2 $3], [
+        ADD_PC_REQUIRES([$2 $3])
+    ],[
+        PKG_CHECK_EXISTS([$2], [
+            cv_pkg_version=`$PKG_CONFIG --modversion "$2" 2>/dev/null`
+            AC_MSG_ERROR([[
+$4 version $cv_pkg_version was found, but $2 $3 is required.
+$5]])
+        ],[
+            AC_MSG_ERROR([[
+Cannot find $4! If you are using binary packages based system, check that you
+have the corresponding -dev/devel packages installed.
+$5]])
+        ])
+    ])
+])
+
+
+dnl ** Simplifying wrapper
+AC_DEFUN([AUD_CONDITIONAL],
+dnl [AM_CONDITIONAL([$1],[test "x${$2}" = m4_ifval([$3], ["x$3"],["xyes"])])
+[if test "x${$2}" = m4_ifval([$3], ["x$3"],["xyes"]) ; then
+    $1="yes"
+else
+    $1="no"
+fi
+AC_SUBST([$1])dnl
+])
+
+
+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
+    define([Name], [translit([$1], [./-], [___])])
+    AC_ARG_ENABLE([$1], [$3],, [enable_[]Name=$2])
+    if test "x${enable_[]Name}" = "xyes"; then
+        m4_ifvaln([$4], [$4], [:])dnl
+        m4_ifvaln([$5], [else $5])dnl
+    fi
+])
+
 
-AC_DEFUN([ADD_PC_REQUIRES],
-[
-   test -z "$PC_REQUIRES" && PC_REQUIRES="$1" || PC_REQUIRES="$PC_REQUIRES, $1"
-   AC_SUBST(PC_REQUIRES)
-]
-)
+AC_DEFUN([AUD_ARG_SIMPLE], [dnl
+    define([Name], [translit([$1], [./-], [___])])
+    AC_ARG_ENABLE([$1], [$3],, [enable_[]Name=$2])
+    if test "x${enable_[]Name}" = "xyes"; then
+        AC_DEFINE([$4], [$5], [$6])
+    fi
+    AUD_CONDITIONAL([$4], [enable_$1])
+    AC_SUBST([$4])
+])
+
+
+dnl ** Wrapper for cached compilation check
+dnl ** AUD_TRY_COMPILE([message], [result variable], [includes], [body], [if ok], [if not ok])
+AC_DEFUN([AUD_TRY_COMPILE], [dnl
+    AC_CACHE_CHECK([$1], [$2],
+    [AC_TRY_COMPILE([$3], [$4], [$2="yes"], [$2="no"])])
+    if test "x${$2}" = "xyes"; then
+        m4_ifvaln([$5], [$5], [:])dnl
+        m4_ifvaln([$6], [else $6])dnl
+    fi
+])
+
 
+dnl ** Check for GNU make
+AC_DEFUN([AUD_CHECK_GNU_MAKE],[
+    AC_CACHE_CHECK([for GNU make],aud_gnu_make_command,[
+    aud_gnu_make_command=""
+    for a in "$MAKE" make gmake gnumake; do
+        test "x$a" = "x" && continue
+        if ( sh -c "$a --version" 2>/dev/null | grep "GNU Make" >/dev/null ) ; then
+            aud_gnu_make_command="$a"
+            break
+        fi
+    done
+    ])
+    if test "x$aud_gnu_make_command" != "x" ; then
+        MAKE="$aud_gnu_make_command"
+    else
+        AC_MSG_ERROR([** GNU make not found. If it is installed, try setting MAKE environment variable. **])
+    fi
+    AC_SUBST([MAKE])
+])
+
+
+dnl *** Define plugin directories
+AC_DEFUN([AUD_DEFINE_PLUGIN_DIR],[
+define([Name], [translit([$1], [a-z], [A-Z])])dnl
+if test "x$enable_one_plugin_dir" = "xyes"; then
+ifdef([aud_plugin_dirs_defined],[],
+[    pluginsubs="\\\"Plugins\\\""
+])dnl
+    Name[]_PLUGIN_DIR="Plugins"
+else
+    ifdef([aud_plugin_dirs_defined],
+    [pluginsubs="$pluginsubs,\\\"$1\\\""],
+    [pluginsubs="\\\"$1\\\""])
+    Name[]_PLUGIN_DIR="$1"
+fi
+AC_SUBST(Name[]_PLUGIN_DIR)dnl
+define([aud_plugin_dirs_defined],[1])dnl
+])dnl
--- a/m4/libmikmod.m4	Wed Apr 30 05:01:37 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-# Configure paths for libmikmod
-#
-# Derived from libmikmod.m4 (Owen Taylor 97-11-3)
-#
-
-dnl AM_PATH_LIBMIKMOD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
-dnl Test for libmikmod, and define LIBMIKMOD_CFLAGS, LIBMIKMOD_LIBS and
-dnl LIBMIKMOD_LDADD
-dnl
-AC_DEFUN([AM_PATH_LIBMIKMOD],
-[dnl 
-dnl Get the cflags and libraries from the libmikmod-config script
-dnl
-AC_ARG_WITH(libmikmod-prefix,[  --with-libmikmod-prefix=PFX   Prefix where libmikmod is installed (optional)],
-            libmikmod_config_prefix="$withval", libmikmod_config_prefix="")
-AC_ARG_WITH(libmikmod-exec-prefix,[  --with-libmikmod-exec-prefix=PFX Exec prefix where libmikmod is installed (optional)],
-            libmikmod_config_exec_prefix="$withval", libmikmod_config_exec_prefix="")
-
-  if test x$libmikmod_config_exec_prefix != x ; then
-     libmikmod_config_args="$libmikmod_config_args --exec-prefix=$libmikmod_config_exec_prefix"
-     if test x${LIBMIKMOD_CONFIG+set} != xset ; then
-        LIBMIKMOD_CONFIG=$libmikmod_config_exec_prefix/bin/libmikmod-config
-     fi
-  fi
-  if test x$libmikmod_config_prefix != x ; then
-     libmikmod_config_args="$libmikmod_config_args --prefix=$libmikmod_config_prefix"
-     if test x${LIBMIKMOD_CONFIG+set} != xset ; then
-        LIBMIKMOD_CONFIG=$libmikmod_config_prefix/bin/libmikmod-config
-     fi
-  fi
-
-  AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no)
-  min_libmikmod_version=ifelse([$1], ,3.1.5,$1)
-  AC_MSG_CHECKING(for libmikmod - version >= $min_libmikmod_version)
-  no_libmikmod=""
-  if test "$LIBMIKMOD_CONFIG" = "no" ; then
-    no_libmikmod=yes
-  else
-    LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --cflags`
-    LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --libs`
-    LIBMIKMOD_LDADD=`$LIBMIKMOD_CONFIG $libmikmod_config_args --ldadd`
-    libmikmod_config_major_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
-    libmikmod_config_minor_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
-    libmikmod_config_micro_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
-  fi
-  if test "x$no_libmikmod" = x ; then
-     AC_MSG_RESULT(yes)
-     ifelse([$2], , :, [$2])     
-  else
-     AC_MSG_RESULT(no)
-     if test "$LIBMIKMOD_CONFIG" = "no" ; then
-       echo "*** The libmikmod-config script installed by libmikmod could not be found"
-       echo "*** If libmikmod was installed in PREFIX, make sure PREFIX/bin is in"
-       echo "*** your path, or set the LIBMIKMOD_CONFIG environment variable to the"
-       echo "*** full path to libmikmod-config."
-     fi
-     LIBMIKMOD_CFLAGS=""
-     LIBMIKMOD_LIBS=""
-     LIBMIKMOD_LDADD=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(LIBMIKMOD_CFLAGS)
-  AC_SUBST(LIBMIKMOD_LIBS)
-  AC_SUBST(LIBMIKMOD_LDADD)
-  rm -f conf.mikmodtest
-])
-
-AC_DEFUN([AC_FIND_FILE],
-    [
-	$3=NO
-	for i in $2;
-	do
-	  for j in $1;
-	  do
-	    if test -r "$i/$j"; then
-		  $3=$i
-		  break 2
-		fi
-	  done
-	done
-    ]
-)
-