acinclude/alsa.m4
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 3342 3da232c5980a
permissions -rw-r--r--
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3342
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
##############################################################################
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
dnl Configure Paths for Alsa
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     3
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
dnl Jaroslav Kysela <perex@suse.cz>
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     9
dnl enables arguments --with-alsa-prefix=
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
dnl                   --with-alsa-enc-prefix=
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    11
dnl                   --disable-alsatest
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
dnl
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    13
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
dnl
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
AC_DEFUN([AM_PATH_ALSA],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
alsa_save_CFLAGS="$CFLAGS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
alsa_save_LDFLAGS="$LDFLAGS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
alsa_save_LIBS="$LIBS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
alsa_found=yes
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
dnl
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
dnl Get the cflags and libraries for alsa
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
dnl
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
AC_ARG_WITH(alsa-prefix,
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
[  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
[alsa_prefix="$withval"], [alsa_prefix=""])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
AC_ARG_WITH(alsa-inc-prefix,
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
[  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
dnl FIXME: this is not yet implemented
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
AC_ARG_ENABLE(alsatest,
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
[  --disable-alsatest      Do not try to compile and run a test Alsa program],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
[enable_alsatest="$enableval"],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
[enable_alsatest=yes])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
dnl Add any special include directories
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
AC_MSG_CHECKING(for ALSA CFLAGS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
if test "$alsa_inc_prefix" != "" ; then
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
	ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
	CFLAGS="$CFLAGS -I$alsa_inc_prefix"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
fi
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
AC_MSG_RESULT($ALSA_CFLAGS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
dnl add any special lib dirs
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
AC_MSG_CHECKING(for ALSA LDFLAGS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
if test "$alsa_prefix" != "" ; then
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
	ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
	LDFLAGS="$LDFLAGS $ALSA_LIBS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
fi
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
dnl add the alsa library
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
LIBS=`echo $LIBS | sed 's/-lm//'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
LIBS=`echo $LIBS | sed 's/-ldl//'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
LIBS=`echo $LIBS | sed 's/-lpthread//'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
LIBS=`echo $LIBS | sed 's/  //'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
LIBS="$ALSA_LIBS $LIBS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
AC_MSG_RESULT($ALSA_LIBS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
dnl Check for a working version of libasound that is of the right version.
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
min_alsa_version=ifelse([$1], ,0.1.1,$1)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
no_alsa=""
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
    alsa_min_major_version=`echo $min_alsa_version | \
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
    alsa_min_minor_version=`echo $min_alsa_version | \
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
    alsa_min_micro_version=`echo $min_alsa_version | \
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    75
AC_LANG_SAVE
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
AC_LANG_C
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
AC_TRY_COMPILE([
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
#include <alsa/asoundlib.h>
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
], [
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
/* ensure backward compatibility */
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
#endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    86
#endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    88
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
#endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
#  if(SND_LIB_MAJOR > $alsa_min_major_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
  exit(0);
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
#  else
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
#    if(SND_LIB_MAJOR < $alsa_min_major_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
#       error not present
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
#    endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
#   if(SND_LIB_MINOR > $alsa_min_minor_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
  exit(0);
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
#   else
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
#     if(SND_LIB_MINOR < $alsa_min_minor_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
#          error not present
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
#      endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
#      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
#        error not present
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
#      endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
#    endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
#  endif
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
exit(0);
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
  [AC_MSG_RESULT(found.)],
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
  [AC_MSG_RESULT(not present.)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
   ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
   alsa_found=no]
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
AC_LANG_RESTORE
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
if test "x$enable_alsatest" = "xyes"; then
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
AC_CHECK_LIB([asound], [snd_ctl_open],,
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
	[ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
	 alsa_found=no]
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
fi
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
if test "x$alsa_found" = "xyes" ; then
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
   ifelse([$2], , :, [$2])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
   LIBS=`echo $LIBS | sed 's/-lasound//g'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   130
   LIBS=`echo $LIBS | sed 's/  //'`
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
   LIBS="-lasound $LIBS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
fi
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   133
if test "x$alsa_found" = "xno" ; then
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
   ifelse([$3], , :, [$3])
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
   CFLAGS="$alsa_save_CFLAGS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   136
   LDFLAGS="$alsa_save_LDFLAGS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
   LIBS="$alsa_save_LIBS"
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
   ALSA_CFLAGS=""
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
   ALSA_LIBS=""
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
fi
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   141
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   142
dnl That should be it.  Now just export out symbols:
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
AC_SUBST(ALSA_CFLAGS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
AC_SUBST(ALSA_LIBS)
3da232c5980a Split acinclude.m4 into its constituent parts for easy upgrading
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
])