summaryrefslogtreecommitdiff
path: root/m4/audio_out.m4
blob: 4288c32d5f7e6a01d62e11e95ef873c2226e18e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
dnl -----------------
dnl Audio out plugins
dnl -----------------
AC_DEFUN([XINE_AUDIO_OUT_PLUGINS], [
    dnl Setup defaults for the target operating system.  For example, alsa is
    dnl only ever available on Linux, so don't bother checking for it unless
    dnl explicitly requested to do so on other operating systems.
    dnl Notes:
    dnl - Alsa is Linux only
    dnl - CoreAudio is Mac OS X only
    dnl - EsounD is reported to be available on most platforms
    dnl - FusionSound is Linux only, but don't enable it by default
    dnl - Jack is Linux and Mac OS X primarily
    dnl - OSS is most unix variants
    dnl - PulseAudio has been tested on Linux, Solaris, FreeBSD, Windows
    dnl - SunAudio is NetBSD, OpenBSD, Solaris (anything else?)

    default_enable_coreaudio=disable
    default_enable_irixal=disable
    default_enable_oss=enable
    default_enable_sunaudio=disable

    default_with_alsa=without
    default_with_esound=with
    default_with_fusionsound=without
    default_with_jack=without
    default_with_pulseaudio=without

    case "$host_os" in
        cygwin* | mingw*)
            default_enable_oss=disable
            default_with_pulseaudio=with
            ;;
        darwin*)
            default_enable_coreaudio=enable
            default_with_jack=with
            default_enable_oss=disable
            ;;
        freebsd*)
            default_with_pulseaudio=with
            ;;
        irix*)
            default_enable_irixal=enable
            default_enable_oss=disable
            ;;
        linux*)
            default_with_alsa=with
            default_with_jack=with
            default_with_pulseaudio=with
            ;;
        netbsd*)
            default_enable_sunaudio=enable
            ;;
        openbsd*)
            default_enable_sunaudio=enable
            ;;
        solaris*)
            default_with_pulseaudio=with
            default_enable_sunaudio=enable
            ;;
    esac


    dnl Alsa support
    AC_ARG_WITH([alsa],
                [AS_HELP_STRING([--with-alsa], [Build with ALSA audio output support])],
                [test x"$withval" != x"no" && with_alsa="yes"],
                [test $default_with_alsa = without && with_alsa="no"])
    if test x"$with_alsa" != x"no"; then
        PKG_CHECK_MODULES([ALSA], [alsa >= 0.9.0], [have_alsa=yes], [have_alsa=no])
        if test x"$with_alsa" = x"yes" && test x"$have_alsa" != x"yes"; then
            AC_MSG_ERROR([ALSA support requested but not found.])
        elif test x"$have_alsa" = x"yes"; then
            dnl This is needed by src/input/input_v4l.c
            AC_DEFINE([HAVE_ALSA], 1, [Define this if you have ALSA installed])
        fi
    fi
    AM_CONDITIONAL([ENABLE_ALSA], [test x"$have_alsa" = x"yes"])


    dnl CoreAudio for Mac OS X
    AC_ARG_ENABLE([coreaudio],
                  [AS_HELP_STRING([--enable-coreaudio], [Enable support for Mac OS X CoreAudio])],
                  [test x"$enableval" != x"no" && enable_coreaudio="yes"],
                  [test $default_enable_coreaudio = disable && enable_coreaudio="no"])
    if test x"$enable_coreaudio" != x"no"; then
        AC_MSG_CHECKING([for CoreAudio frameworks])
        ac_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreAudio -framework AudioUnit"
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0]])], [have_coreaudio=yes], [have_coreaudio=no])
        LIBS="$ac_save_LIBS"
        AC_MSG_RESULT([$have_coreaudio])
        if test x"$enable_coreaudio" = x"yes" && test x"$have_coreaudio" != x"yes"; then
            AC_MSG_ERROR([CoreAudio support requested, but CoreAudio not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_COREAUDIO], [test x"$have_coreaudio" = x"yes"])


    dnl EsounD support
    AC_ARG_WITH([esound],
                [AS_HELP_STRING([--with-esound], [Build with EsounD audio output support])],
                [test x"$withval" != x"no" && with_esound="yes"],
                [test $default_with_esound = without && with_esound="no"])
    if test x"$with_esound" != x"no"; then
        PKG_CHECK_MODULES([ESD], [esound], [have_esound=yes], [have_esound=no])
        if test x"$with_esound" = x"yes" && test x"$have_esound" != x"yes"; then
            AC_MSG_ERROR([EsounD support requested, but EsounD not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_ESD], [test x"$have_esound" = x"yes"])


    dnl FusionSound support
    AC_ARG_WITH([fusionsound],
                [AS_HELP_STRING([--with-fusionsound], [Build with FunsionSound audio output support])],
                [test x"$withval" != x"no" && with_fusionsound="yes"],
                [test $default_with_fusionsound = without && with_fusionsound="no"])
    if test x"$with_fusionsound" != x"no"; then
        PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 0.9.23], [have_fusionsound=yes], [have_fusionsound=no])
        if test x"$with_fusionsound" = x"yes" && test x"$have_fusionsound" != x"yes"; then
            AC_MSG_ERROR([FusionSound support requested, but FusionSound not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_FUSIONSOUND], [test x"$have_fusionsound" = x"yes"])


    dnl IRIX style audio interface
    AC_ARG_ENABLE([irixal],
                  [AS_HELP_STRING([--enable-irixal], [Enable support for IRIX libaudio])],
                  [test x"$enableval" != x"no" && enable_irixal="yes"],
                  [test $default_enable_irixal = disable && enable_irixal="no"])
    if test x"$enable_irixal" != x"no"; then
        AC_CACHE_CHECK([for IRIX libaudio support], [am_cv_have_irixal],
                       [AC_CHECK_HEADER([dmedia/audio.h],
                       [am_cv_have_irixal=yes], [am_cv_have_irixal=no])])
        if test x"$am_cv_have_irixal" = x"yes"; then
            AC_DEFINE([HAVE_IRIXAL], 1, [Define this if you have a usable IRIX al interface available])
            IRIXAL_LIBS="-laudio"
            IRIXAL_STATIC_LIB="/usr/lib/libaudio.a"
            AC_SUBST(IRIXAL_LIBS)
            AC_SUBST(IRIXAL_STATIC_LIB)
        fi
    fi
    AM_CONDITIONAL([ENABLE_IRIXAL], [test x"$am_cv_have_irixal" = x"yes"])


    dnl JACK support
    AC_ARG_WITH([jack],
                [AS_HELP_STRING([--with-jack], [Build with Jack support])],
                [test x"$withval" != x"no" && with_jack="yes"],
                [test $default_with_jack = without && with_jack="no"])
    if test x"$with_jack" != x"no"; then
        PKG_CHECK_MODULES([JACK], [jack >= 0.100], [have_jack=yes], [have_jack=no])
        if test x"$with_jack" = x"yes" && test x"$have_jack" != x"yes"; then
            AC_MSG_ERROR([Jack support requested, but Jack not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_JACK], [test x"$have_jack" = x"yes"])


    dnl OSS (Open Sound System)
    AC_ARG_ENABLE([oss],
                  [AS_HELP_STRING([--enable-oss], [Enable OSS (Open Sound System) support])],
                  [test x"$enableval" != x"no" && enable_oss="yes"],
                  [test $default_enable_oss = disable && enable_oss="no"])
    if test x"$enable_oss" != x"no"; then
        AC_CHECK_HEADERS([sys/soundcard.h machine/soundcard.h soundcard.h], [break])
        AC_CHECK_DECL([SNDCTL_DSP_SETFRAGMENT], [have_oss=yes], [have_oss=no],
                      [#ifdef HAVE_SYS_SOUNDCARD_H
                       # include <sys/soundcard.h>
                       #endif
                       #ifdef HAVE_MACHINE_SOUNDCARD_H
                       # include <sys/soundcard.h>
                       #endif
                       #ifdef HAVE_SOUNDCARD_H
                       # include <soundcard.h>
                       #endif])
        if test x"$enable_oss" = x"yes" && test x"$have_oss" != x"yes"; then
            AC_MSG_ERROR([OSS support requested, but OSS not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_OSS], [test x"$have_oss" = x"yes"])


    dnl PulseAudio
    AC_ARG_WITH([pulseaudio],
                [AS_HELP_STRING([--with-pulseaudio], [Build with PulseAudio support])],
                [test x"$withval" != x"no" && with_pulseaudio="yes"],
                [test $default_with_pulseaudio = without && with_pulseaudio="no"])
    if test x"$with_pulseaudio" != x"no"; then
        PKG_CHECK_MODULES([PULSEAUDIO], [libpulse], [have_pulseaudio="yes"], [have_pulseaudio="no"])
        if test x"$with_pulseaudio" = x"yes" && test x"$have_pulseaudio" != x"yes"; then
            AC_MSG_ERROR([PulseAudio support requested, but PulseAudio not found])
        fi
    fi
    AM_CONDITIONAL([ENABLE_PULSEAUDIO], [test x"$have_pulseaudio" = x"yes"])


    dnl SUN style audio interface
    AC_ARG_ENABLE([sunaudio],
                  [AS_HELP_STRING([--enable-sunaudio], [Enable Sun audio support])],
                  [test x"$enableval" != x"no" && enable_sunaudio="yes"],
                  [test $default_enable_sunaudio = disable && enable_sunaudio="no"])
    if test x"$enable_sunaudio" != x"no"; then
        AC_MSG_CHECKING([for Sun audio support])
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
                                             #include <sys/audioio.h>]],
                                           [[audio_info_t audio_info; AUDIO_INITINFO(&audio_info)]])],
                          [have_sunaudio=yes], [have_sunaudio=no])
        AC_MSG_RESULT([$have_sunaudio])
        if test x"$enable_sunaudio" = x"yes" && test x"$have_sunaudio" != x"yes"; then
            AC_MSG_ERROR([Sun audio support requested, but Sun audio not found])
        elif test x"$have_sunaudio" = x"yes"; then
           dnl NetBSD and OpenBSD don't have this, but check for it
           dnl rather than assuming that it doesn't happen elsewhere.
           AC_CHECK_MEMBERS([audio_info_t.output_muted])
        fi
    fi
    AM_CONDITIONAL([ENABLE_SUNAUDIO], [test x"$have_sunaudio" = x"yes"])
])dnl XINE_AUDIO_OUT_PLUGINS