changeset 948:ac488ad4ef1d

Don't fail if we don't have ALSA available
author Sam Lantinga <slouken@libsdl.org>
date Tue, 24 Aug 2004 06:32:50 +0000
parents 3bb035750537
children e0d96eb0af19
files acinclude.m4 configure.in
diffstat 2 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Sat Aug 21 20:35:50 2004 +0000
+++ b/acinclude.m4	Tue Aug 24 06:32:50 2004 +0000
@@ -19,24 +19,22 @@
   cat >>$new <$old
 ])
 
-#
-# --- alsa.m4 ---
-#
+##############################################################################
 dnl Configure Paths for Alsa
 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
 dnl Jaroslav Kysela <perex@suse.cz>
-dnl Last modification: alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp
+dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp
 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
 dnl enables arguments --with-alsa-prefix=
 dnl                   --with-alsa-enc-prefix=
-dnl                   --disable-alsatest  (this has no effect, as yet)
+dnl                   --disable-alsatest
 dnl
 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
 dnl
-AC_DEFUN(AM_PATH_ALSA,
+AC_DEFUN([AM_PATH_ALSA],
 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
 alsa_save_CFLAGS="$CFLAGS"
 alsa_save_LDFLAGS="$LDFLAGS"
@@ -57,7 +55,7 @@
 dnl FIXME: this is not yet implemented
 AC_ARG_ENABLE(alsatest,
 [  --disable-alsatest      Do not try to compile and run a test Alsa program],
-[enable_alsatest=no],
+[enable_alsatest="$enableval"],
 [enable_alsatest=yes])
 
 dnl Add any special include directories
@@ -140,17 +138,20 @@
 AC_LANG_RESTORE
 
 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
+if test "x$enable_alsatest" = "xyes"; then
 AC_CHECK_LIB([asound], [snd_ctl_open],,
 	[ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
 	 alsa_found=no]
 )
-
-CFLAGS="$alsa_save_CFLAGS"
-LDFLAGS="$alsa_save_LDFLAGS"
-LIBS="$alsa_save_LIBS"
+fi
+
 if test "x$alsa_found" = "xyes" ; then
    ifelse([$2], , :, [$2])
-else
+   LIBS=`echo $LIBS | sed 's/-lasound//g'`
+   LIBS=`echo $LIBS | sed 's/  //'`
+   LIBS="-lasound $LIBS"
+fi
+if test "x$alsa_found" = "xno" ; then
    ifelse([$3], , :, [$3])
    CFLAGS="$alsa_save_CFLAGS"
    LDFLAGS="$alsa_save_LDFLAGS"
@@ -164,8 +165,7 @@
 AC_SUBST(ALSA_LIBS)
 ])
 
-
-
+##############################################################################
 #
 # --- esd.m4 ---
 #
@@ -334,6 +334,7 @@
   rm -f conf.esdtest
 ])
 
+##############################################################################
 # Based on libtool-1.5.8
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
--- a/configure.in	Sat Aug 21 20:35:50 2004 +0000
+++ b/configure.in	Tue Aug 24 06:32:50 2004 +0000
@@ -282,8 +282,7 @@
 [  --enable-alsa           support the ALSA audio API [default=yes]],
                   , enable_alsa=yes)
     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
-        have_alsa=no
-        AM_PATH_ALSA(0.9.0, have_alsa=yes)
+        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
         if test x$have_alsa = xyes; then
             AC_ARG_ENABLE(alsa-shared,
 [  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
@@ -364,9 +363,8 @@
 [  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
                   , enable_esd=yes)
     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
-        use_esd=no
-        AM_PATH_ESD(0.2.8, use_esd=yes)
-        if test x$use_esd = xyes; then
+        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
+        if test x$have_esd = xyes; then
             AC_ARG_ENABLE(esd-shared,
 [  --enable-esd-shared     dynamically load ESD audio support [default=yes]],
                           , enable_esd_shared=yes)