2
AC_INIT(esound, 0.2.41)
7
ESD_VERSION=$ESD_MAJOR_VERSION.$ESD_MINOR_VERSION.$ESD_MICRO_VERSION
9
AC_CANONICAL_TARGET([])
13
AM_CONFIG_HEADER(config.h)
15
ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
17
AC_CONFIG_SRCDIR([esd.h])
19
dnl set version info for libesd.so to package rev - $MAJOR + $MINOR : $MICRO : $MINOR
20
ESD_VERSION_INFO=`expr $ESD_MINOR_VERSION + $ESD_MAJOR_VERSION`:$ESD_MICRO_VERSION:$ESD_MINOR_VERSION
22
AC_SUBST(ESD_MAJOR_VERSION)
23
AC_SUBST(ESD_MINOR_VERSION)
24
AC_SUBST(ESD_MICRO_VERSION)
26
AC_SUBST(ESD_VERSION_INFO)
41
dnl Check for compiler environment
47
dnl Check for system libs needed
50
AC_CHECK_FUNCS(setenv putenv fchown fchmod gethostbyname2)
51
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
52
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
53
AC_CHECK_FUNC(hstrerror,,[AC_CHECK_LIB(resolv,hstrerror)])
54
AC_CHECK_FUNC(nanosleep,,[
55
AC_CHECK_LIB(rt,nanosleep,,[AC_CHECK_LIB(posix4,nanosleep)])])
56
AC_CHECK_FUNCS(usleep)
57
AC_CHECK_FUNCS(strtok_r)
60
AC_CHECK_FUNC(inet_pton,use_inet_pton=yes,[AC_CHECK_LIB(resolv,inet_pton)])
61
if test "x$use_inet_pton" = "xyes"; then
62
case $ac_cv_func_inet_pton/$ac_cv_lib_resolv_inet_pton in
64
*) AC_DEFINE(HAVE_INET_PTON, 1, [Defined if inet_pton() works])
67
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
68
case $ac_cv_func_inet_aton/$ac_cv_lib_resolv_inet_aton in
70
*) AC_DEFINE(HAVE_INET_ATON, 1, [Defined if inet_aton() works])
74
case $ac_cv_func_nanosleep/$ac_cv_lib_rt_nanosleep/$ac_cv_lib_posix4_nanosleep in
76
*) AC_DEFINE(HAVE_NANOSLEEP, 1, [Defined if nanosleep() works])
79
dnl Check if INADDR_LOOPBACK exists
83
#include<netinet/in.h>],
84
[unsigned long ul = INADDR_LOOPBACK;],,
85
[AC_DEFINE(INADDR_LOOPBACK, (u_int32_t)0x7f000001, [Defined as the address of the loopback interface])])
88
dnl ========================================================================
90
dnl ========================================================================
91
AC_MSG_CHECKING([whether to enable ipv6])
92
AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
94
if test $enable_ipv6 = yes; then
96
#include <sys/types.h>
97
#include <sys/socket.h>], [
98
socket(AF_INET6, SOCK_STREAM, 0)
103
AC_MSG_RESULT($have_ipv6)
105
if test $have_ipv6=yes; then
107
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
108
if test $have_getaddrinfo = no; then
109
for lib in bsd socket inet; do
110
AC_CHECK_LIB($lib,getaddrinfo,[LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
114
if test $have_getaddrinfo = yes; then
115
AC_DEFINE(ENABLE_IPV6, 1, [Defined if ipv6 is enabled])
119
dnl Check for inet_ntop. We need it only for debugging
120
AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Defined if inet_ntop() works]))
126
dnl ========================================================================
127
dnl End of IPv6 checks
128
dnl ========================================================================
130
dnl Check if SUN_LEN exists
133
#include<sys/types.h>
135
[struct sockaddr_un su; int i = SUN_LEN(&su);],
136
[AC_DEFINE(HAVE_SUN_LEN, 1, [Defined if SUN_LEN() exists])], )
138
dnl check for getopt_long, substitute the distributed versions if not
140
AC_CHECK_FUNC(getopt_long,[have_getopt_long=yes],[have_getopt_long=no])
141
AM_CONDITIONAL(NEED_GETOPT, test "x$have_getopt_long" = xno)
143
dnl Needed for FIONBIO on Solaris at least
145
AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h)
147
dnl see if we want to enable insanely verbose debugging
149
AC_ARG_ENABLE(debugging,
150
AC_HELP_STRING([--enable-debugging],[enable verbose diagnostic info [default=no]]),
151
[enable_debuggin=${enableval}],
152
[enable_debugging=no])
154
if test "x$enable_debugging" = "xyes"; then
155
AC_DEFINE(ESDBG, 1, [Defined if debugging is enabled])
158
dnl see if we intentionally want to disable local sound
160
AC_ARG_ENABLE(local_sound,
161
AC_HELP_STRING([--enable-local-sound],[turn on local sound playing [default=yes]]),
162
[enable_local_sound=${enableval}],
163
[enable_local_sound=yes])
165
AC_HELP_STRING([--enable-oss],[use OSS if available [default=yes]]),
166
[enable_oss=${enableval}],
169
AC_HELP_STRING([--enable-alsa],[use ALSA if available [default=yes]]),
170
[enable_alsa=${enableval}],
173
AC_HELP_STRING([--enable-arts],[use arts if available [default=no]]),
174
[enable_arts=${enableval}],
177
dnl build the esddsp wrapper for systems,
178
dnl that support LD_PRELOAD and RTLD_NEXT only
181
AC_MSG_CHECKING([if your platform supports esddsp])
183
linux* | freebsd* | kfreebsd*-gnu | bsdi4* )
187
AC_MSG_RESULT($dsp_ok)
189
if test "x$dsp_ok" = xyes; then
190
AC_CHECK_FUNC(dlopen, DL_LIB=,
191
AC_CHECK_LIB(dl, dlopen, DL_LIB=-ldl))
193
LIBESDDSP=libesddsp.la
195
AM_CONDITIONAL(BUILD_ESDDSP, test "x$dsp_ok" = xyes)
197
if test "x$enable_local_sound" = "xyes"; then
200
dnl Check for audio header files needed
202
echo "---------------------------------------------------------------------"
203
echo "--- Checking to see which audio header files your system uses.";
204
echo "--- Most of these checks should fail. Do not be alarmed.";
205
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
206
AC_CHECK_HEADERS(sys/audioio.h sys/audio.io.h sun/audioio.h)
207
AC_CHECK_HEADERS(dmedia/audio.h sys/soundlib.h sys/asoundlib.h alsa/asoundlib.h)
208
AC_CHECK_HEADERS(CoreAudio/CoreAudio.h)
209
# mme_api.h directly includes other files from the mme subdir
210
xCPPFLAGS="$CPPFLAGS"
211
CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
212
AC_CHECK_HEADERS(mme/mme_api.h)
213
CPPFLAGS="$xCPPFLAGS"
214
AM_PATH_ARTS(, HAVE_ARTS=yes, HAVE_ARTS=no)
216
dnl Define the driver needed based on the first header file found
218
if test x"$enable_oss" = xyes ; then
219
if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
220
test "${ac_cv_header_soundcard_h}" = "yes" || \
221
test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
223
dnl Platform mklinux/powerpc needs special care and feeding
225
AC_DEFINE(DRIVER_OSS, 1, [Defined if OSS backend is enabled])
229
if test "${ac_cv_header_sys_audio_h}" = "yes"; then
233
AC_DEFINE(DRIVER_HPUX, 1, [Defined if HPUX backend is enabled])
237
AC_DEFINE(DRIVER_AIX, 1, [Defined if AIX backend is enabled])
241
if test "${ac_cv_header_sys_audioio_h}" = "yes" || \
242
test "${ac_cv_header_sys_audio_io_h}" = "yes" || \
243
test "${ac_cv_header_sun_audioio_h}" = "yes"; then
247
AC_DEFINE(DRIVER_SOLARIS, 1, [Defined if Solaris backend is enabled])
255
AC_DEFINE(DRIVER_DART, 1, [Defined if OS/2 backend is enabled])
259
if test "${ac_cv_header_dmedia_audio_h}" = "yes"; then
263
AC_DEFINE(DRIVER_IRIX, 1, [Defined if IRIX backend is enabled])
267
if test "${ac_cv_header_mme_mme_api_h}" = "yes"; then
271
AC_DEFINE(DRIVER_OSF, 1, [Defined if OSF backend is enabled])
272
CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
277
if test "x$enable_alsa" = "xyes"; then
278
if test "${ac_cv_header_sys_soundlib_h}" = "yes"; then
280
AC_DEFINE(DRIVER_ALSA, 1, [Defined if ALSA backend is enabled (deprecated)])
282
if test "${ac_cv_header_alsa_asoundlib_h}" = "yes"; then
284
AC_DEFINE(DRIVER_ALSA_09, 1, [Defined if ALSA-1.0 backend is enabled])
286
if test "${ac_cv_header_sys_asoundlib_h}" = "yes"; then
288
AC_DEFINE(DRIVER_NEWALSA, 1, [Defined if old ALSA backend is enabled (deprecated)])
292
if test "${ac_cv_header_CoreAudio_CoreAudio_h}" = "yes"; then
294
AC_DEFINE(DRIVER_COREAUDIO, 1, [Defined if CoreAudio backend is enabled])
295
SOUND_LIBS="-Wl,-framework,CoreAudio"
298
if test "x$enable_arts" = "xyes" ; then
299
if test "x$HAVE_ARTS" = "xyes"; then
301
CFLAGS="$CFLAGS $ARTSC_CFLAGS"
302
LIBS="$LIBS $ARTS_LIBS"
303
AC_DEFINE(DRIVER_ARTS, 1, [Defined if Arts backend is enabled])
307
if test "$found_sound" = "no"; then
308
AC_MSG_ERROR([Could not find a support sound driver])
311
dnl Check for additional audio libs needed
313
echo "---------------------------------------------------------------------"
314
echo "--- Checking to see which audio libraries are required for linking.";
315
echo "--- Most of these checks should also fail. Do not be alarmed.";
316
AC_CHECK_FUNC(_oss_ioctl,,[AC_CHECK_LIB(ossaudio,_oss_ioctl)])
317
AC_CHECK_FUNC(ALnewconfig,,[AC_CHECK_LIB(audio,ALnewconfig)])
318
if test "x$enable_alsa" = "xyes"; then
319
AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(sound,snd_cards)])
320
AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(asound,snd_cards)])
321
AC_CHECK_FUNC(snd_pcm_pause,,[AC_CHECK_LIB(asound,snd_pcm_pause)])
323
dnl Check if ALSA uses new API
324
saved_cflags="$CFLAGS"
325
CFLAGS="$CFLAGS -Werror"
326
echo -n "checking for alsa new PCM API... "
328
#include <alsa/asoundlib.h>
331
snd_pcm_hw_params_t *params;
334
/* intentionally not uses pointers, trying to replicate bug 129709 */
335
snd_pcm_hw_params_set_rate_near(pcm, params, val, &dir);
336
],[ echo "no" ], AC_DEFINE(DRIVER_ALSA_09_NEW_PCM_API, 1, [Defined if alsa-0.9 new pcm api is detected]) [ echo "yes" ],
339
CFLAGS="$saved_cflags"
344
AC_DEFINE(DRIVER_NONE, 1, [Defined if no backend is enabled])
347
dnl offer daemon in serverdir
349
AC_ARG_WITH(esd-dir, [ --with-esd-dir=PATH specify location of esound daemon ])
351
if test "x$with_esd_dir" = "x" ; then
352
ESD_DIR='$(prefix)/bin'
353
ESD_PC_DIR='${prefix}/bin'
355
ESD_DIR=$with_esd_dir
356
ESD_PC_DIR=$with_esd_dir
361
dnl make sure we have the library, -laudiofile
365
PKG_CHECK_MODULES(AUDIOFILE, [audiofile >= 0.2.3])
367
CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
368
LIBS="$LIBS $AUDIOFILE_LIBS"
372
AM_CONDITIONAL(BUILD_ESDPLAY, $build_esdplay)
374
echo "---------------------------------------------------------------------"
375
echo "--- Checking for the documentation generation tools. NOTE: These "
376
echo "--- are NOT required for proper compilation of the esound package."
378
AC_CHECK_PROG(JW, jw, jw, false)
379
AM_CONDITIONAL(HAVE_JW, test "x$JW" != xfalse)
381
echo "---------------------------------------------------------------------"
383
AC_ARG_WITH(libwrap,[ --with-libwrap use tcp wrappers [default=no]], , wrap_ok=no)
386
if test "x$with_libwrap" = "xyes"; then
387
esound_save_LIBS="$LIBS"
390
AC_MSG_CHECKING([for tcp_wrapper library and headers])
396
int allow_severity = LOG_INFO;
397
int deny_severity = LOG_WARNING;],
398
[struct request_info *request; return hosts_access (request);],
399
[AC_DEFINE(USE_LIBWRAP, 1, [Defined if libwrap is used])
406
int allow_severity = LOG_INFO;
407
int deny_severity = LOG_WARNING;],
408
[struct request_info *request; return hosts_access (request);],
410
[AC_DEFINE(USE_LIBWRAP, 1, [Defined if libwrap is used])
411
WRAP_LIB="-lwrap -lnsl"
414
AC_MSG_RESULT($wrap_ok)
416
LIBS="$esound_save_LIBS"
419
AS_COMPILER_FLAG(-Wall, CFLAGS="$CFLAGS -Wall")
421
# set | sort; # just for double checking the script...
425
AC_SUBST(AUDIOFILE_LIBS)
450
dnl , [case "$CONFIG_FILES" in *esd-config*) chmod +x esd-config;; esac])
453
echo "Esound Configure Settings:"
455
echo "Debugging support: $enable_debugging"
456
echo "libwrap support: $wrap_ok"