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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
|
AC_PREREQ([2.58])
AC_INIT(esound, 0.2.41)
ESD_MAJOR_VERSION=0
ESD_MINOR_VERSION=2
ESD_MICRO_VERSION=39
ESD_VERSION=$ESD_MAJOR_VERSION.$ESD_MINOR_VERSION.$ESD_MICRO_VERSION
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE(1.6)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
AC_CONFIG_SRCDIR([esd.h])
dnl set version info for libesd.so to package rev - $MAJOR + $MINOR : $MICRO : $MINOR
ESD_VERSION_INFO=`expr $ESD_MINOR_VERSION + $ESD_MAJOR_VERSION`:$ESD_MICRO_VERSION:$ESD_MINOR_VERSION
AC_SUBST(ESD_MAJOR_VERSION)
AC_SUBST(ESD_MINOR_VERSION)
AC_SUBST(ESD_MICRO_VERSION)
AC_SUBST(ESD_VERSION)
AC_SUBST(ESD_VERSION_INFO)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
dnl Check for tools
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl Check for compiler environment
AC_C_CONST
AC_C_BIGENDIAN
AC_C_INLINE
dnl Check for system libs needed
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(setenv putenv fchown fchmod gethostbyname2)
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
AC_CHECK_FUNC(hstrerror,,[AC_CHECK_LIB(resolv,hstrerror)])
AC_CHECK_FUNC(nanosleep,,[
AC_CHECK_LIB(rt,nanosleep,,[AC_CHECK_LIB(posix4,nanosleep)])])
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(strtok_r)
use_inet_pton=no
AC_CHECK_FUNC(inet_pton,use_inet_pton=yes,[AC_CHECK_LIB(resolv,inet_pton)])
if test "x$use_inet_pton" = "xyes"; then
case $ac_cv_func_inet_pton/$ac_cv_lib_resolv_inet_pton in
no/no) ;;
*) AC_DEFINE(HAVE_INET_PTON, 1, [Defined if inet_pton() works])
esac
else
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
case $ac_cv_func_inet_aton/$ac_cv_lib_resolv_inet_aton in
no/no) ;;
*) AC_DEFINE(HAVE_INET_ATON, 1, [Defined if inet_aton() works])
esac
fi
case $ac_cv_func_nanosleep/$ac_cv_lib_rt_nanosleep/$ac_cv_lib_posix4_nanosleep in
no/no/no) ;;
*) AC_DEFINE(HAVE_NANOSLEEP, 1, [Defined if nanosleep() works])
esac
dnl Check if INADDR_LOOPBACK exists
AC_TRY_COMPILE([
#include<sys/types.h>
#include<netinet/in.h>],
[unsigned long ul = INADDR_LOOPBACK;],,
[AC_DEFINE(INADDR_LOOPBACK, (u_int32_t)0x7f000001, [Defined as the address of the loopback interface])])
dnl ========================================================================
dnl Begin IPv6 checks
dnl ========================================================================
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
if test $enable_ipv6 = yes; then
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>], [
socket(AF_INET6, SOCK_STREAM, 0)
],
have_ipv6=yes,
have_ipv6=no
)
AC_MSG_RESULT($have_ipv6)
if test $have_ipv6=yes; then
have_getaddrinfo=no
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
if test $have_getaddrinfo = no; then
for lib in bsd socket inet; do
AC_CHECK_LIB($lib,getaddrinfo,[LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
done
fi
if test $have_getaddrinfo = yes; then
AC_DEFINE(ENABLE_IPV6, 1, [Defined if ipv6 is enabled])
fi
dnl Check for inet_ntop. We need it only for debugging
AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Defined if inet_ntop() works]))
fi
else
AC_MSG_RESULT(no)
fi
dnl ========================================================================
dnl End of IPv6 checks
dnl ========================================================================
dnl Check if SUN_LEN exists
AC_TRY_LINK([
#include<sys/types.h>
#include<sys/un.h>],
[struct sockaddr_un su; int i = SUN_LEN(&su);],
[AC_DEFINE(HAVE_SUN_LEN, 1, [Defined if SUN_LEN() exists])], )
dnl check for getopt_long, substitute the distributed versions if not
AC_CHECK_FUNC(getopt_long,[have_getopt_long=yes],[have_getopt_long=no])
AM_CONDITIONAL(NEED_GETOPT, test "x$have_getopt_long" = xno)
dnl Needed for FIONBIO on Solaris at least
AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h)
dnl see if we want to enable insanely verbose debugging
AC_ARG_ENABLE(debugging,
AC_HELP_STRING([--enable-debugging],[enable verbose diagnostic info [default=no]]),
[enable_debuggin=${enableval}],
[enable_debugging=no])
if test "x$enable_debugging" = "xyes"; then
AC_DEFINE(ESDBG, 1, [Defined if debugging is enabled])
fi
dnl see if we intentionally want to disable local sound
AC_ARG_ENABLE(local_sound,
AC_HELP_STRING([--enable-local-sound],[turn on local sound playing [default=yes]]),
[enable_local_sound=${enableval}],
[enable_local_sound=yes])
AC_ARG_ENABLE(oss,
AC_HELP_STRING([--enable-oss],[use OSS if available [default=yes]]),
[enable_oss=${enableval}],
[enable_oss=yes])
AC_ARG_ENABLE(alsa,
AC_HELP_STRING([--enable-alsa],[use ALSA if available [default=yes]]),
[enable_alsa=${enableval}],
[enable_alsa=yes])
AC_ARG_ENABLE(arts,
AC_HELP_STRING([--enable-arts],[use arts if available [default=no]]),
[enable_arts=${enableval}],
[enable_arts=no])
dnl build the esddsp wrapper for systems,
dnl that support LD_PRELOAD and RTLD_NEXT only
dsp_ok=no DL_LIB=
AC_MSG_CHECKING([if your platform supports esddsp])
case "$host_os" in
linux* | freebsd* | kfreebsd*-gnu | bsdi4* )
dsp_ok=yes
;;
esac
AC_MSG_RESULT($dsp_ok)
if test "x$dsp_ok" = xyes; then
AC_CHECK_FUNC(dlopen, DL_LIB=,
AC_CHECK_LIB(dl, dlopen, DL_LIB=-ldl))
ESDDSP=esddsp
LIBESDDSP=libesddsp.la
fi
AM_CONDITIONAL(BUILD_ESDDSP, test "x$dsp_ok" = xyes)
if test "x$enable_local_sound" = "xyes"; then
found_sound=no
dnl Check for audio header files needed
echo "---------------------------------------------------------------------"
echo "--- Checking to see which audio header files your system uses.";
echo "--- Most of these checks should fail. Do not be alarmed.";
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
AC_CHECK_HEADERS(sys/audioio.h sys/audio.io.h sun/audioio.h)
AC_CHECK_HEADERS(dmedia/audio.h sys/soundlib.h sys/asoundlib.h alsa/asoundlib.h)
AC_CHECK_HEADERS(CoreAudio/CoreAudio.h)
# mme_api.h directly includes other files from the mme subdir
xCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
AC_CHECK_HEADERS(mme/mme_api.h)
CPPFLAGS="$xCPPFLAGS"
AM_PATH_ARTS(, HAVE_ARTS=yes, HAVE_ARTS=no)
dnl Define the driver needed based on the first header file found
if test x"$enable_oss" = xyes ; then
if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
test "${ac_cv_header_soundcard_h}" = "yes" || \
test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
dnl Platform mklinux/powerpc needs special care and feeding
found_sound=yes
AC_DEFINE(DRIVER_OSS, 1, [Defined if OSS backend is enabled])
fi
fi
if test "${ac_cv_header_sys_audio_h}" = "yes"; then
case ${host_os} in
hpux*)
found_sound=yes
AC_DEFINE(DRIVER_HPUX, 1, [Defined if HPUX backend is enabled])
;;
aix*)
found_sound=yes
AC_DEFINE(DRIVER_AIX, 1, [Defined if AIX backend is enabled])
esac
fi
if test "${ac_cv_header_sys_audioio_h}" = "yes" || \
test "${ac_cv_header_sys_audio_io_h}" = "yes" || \
test "${ac_cv_header_sun_audioio_h}" = "yes"; then
case ${host_os} in
solaris*)
found_sound=yes
AC_DEFINE(DRIVER_SOLARIS, 1, [Defined if Solaris backend is enabled])
;;
esac
fi
case ${host_os} in
os2*)
found_sound=yes
AC_DEFINE(DRIVER_DART, 1, [Defined if OS/2 backend is enabled])
;;
esac
if test "${ac_cv_header_dmedia_audio_h}" = "yes"; then
case ${host_os} in
irix*)
found_sound=yes
AC_DEFINE(DRIVER_IRIX, 1, [Defined if IRIX backend is enabled])
esac
fi
if test "${ac_cv_header_mme_mme_api_h}" = "yes"; then
case ${host_os} in
osf*)
found_sound=yes
AC_DEFINE(DRIVER_OSF, 1, [Defined if OSF backend is enabled])
CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
SOUND_LIBS=-lmme
esac
fi
if test "x$enable_alsa" = "xyes"; then
if test "${ac_cv_header_sys_soundlib_h}" = "yes"; then
found_sound=yes
AC_DEFINE(DRIVER_ALSA, 1, [Defined if ALSA backend is enabled (deprecated)])
fi
if test "${ac_cv_header_alsa_asoundlib_h}" = "yes"; then
found_sound=yes
AC_DEFINE(DRIVER_ALSA_09, 1, [Defined if ALSA-1.0 backend is enabled])
fi
if test "${ac_cv_header_sys_asoundlib_h}" = "yes"; then
found_sound=yes
AC_DEFINE(DRIVER_NEWALSA, 1, [Defined if old ALSA backend is enabled (deprecated)])
fi
fi
if test "${ac_cv_header_CoreAudio_CoreAudio_h}" = "yes"; then
found_sound=yes
AC_DEFINE(DRIVER_COREAUDIO, 1, [Defined if CoreAudio backend is enabled])
SOUND_LIBS="-Wl,-framework,CoreAudio"
fi
if test "x$enable_arts" = "xyes" ; then
if test "x$HAVE_ARTS" = "xyes"; then
found_sound=yes
CFLAGS="$CFLAGS $ARTSC_CFLAGS"
LIBS="$LIBS $ARTS_LIBS"
AC_DEFINE(DRIVER_ARTS, 1, [Defined if Arts backend is enabled])
fi
fi
if test "$found_sound" = "no"; then
AC_MSG_ERROR([Could not find a support sound driver])
fi
dnl Check for additional audio libs needed
echo "---------------------------------------------------------------------"
echo "--- Checking to see which audio libraries are required for linking.";
echo "--- Most of these checks should also fail. Do not be alarmed.";
AC_CHECK_FUNC(_oss_ioctl,,[AC_CHECK_LIB(ossaudio,_oss_ioctl)])
AC_CHECK_FUNC(ALnewconfig,,[AC_CHECK_LIB(audio,ALnewconfig)])
if test "x$enable_alsa" = "xyes"; then
AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(sound,snd_cards)])
AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(asound,snd_cards)])
AC_CHECK_FUNC(snd_pcm_pause,,[AC_CHECK_LIB(asound,snd_pcm_pause)])
dnl Check if ALSA uses new API
saved_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
echo -n "checking for alsa new PCM API... "
AC_TRY_LINK([
#include <alsa/asoundlib.h>
], [
snd_pcm_t *pcm;
snd_pcm_hw_params_t *params;
unsigned int val;
int dir;
/* intentionally not uses pointers, trying to replicate bug 129709 */
snd_pcm_hw_params_set_rate_near(pcm, params, val, &dir);
],[ echo "no" ], AC_DEFINE(DRIVER_ALSA_09_NEW_PCM_API, 1, [Defined if alsa-0.9 new pcm api is detected]) [ echo "yes" ],
])
CFLAGS="$saved_cflags"
fi
else
AC_DEFINE(DRIVER_NONE, 1, [Defined if no backend is enabled])
fi
dnl offer daemon in serverdir
AC_ARG_WITH(esd-dir, [ --with-esd-dir=PATH specify location of esound daemon ])
if test "x$with_esd_dir" = "x" ; then
ESD_DIR='$(prefix)/bin'
ESD_PC_DIR='${prefix}/bin'
else
ESD_DIR=$with_esd_dir
ESD_PC_DIR=$with_esd_dir
fi
AC_SUBST(ESD_DIR)
AC_SUBST(ESD_PC_DIR)
dnl make sure we have the library, -laudiofile
build_esdplay=false
PKG_CHECK_MODULES(AUDIOFILE, [audiofile >= 0.2.3])
CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
LIBS="$LIBS $AUDIOFILE_LIBS"
build_esdplay=true
AM_CONDITIONAL(BUILD_ESDPLAY, $build_esdplay)
echo "---------------------------------------------------------------------"
echo "--- Checking for the documentation generation tools. NOTE: These "
echo "--- are NOT required for proper compilation of the esound package."
AC_CHECK_PROG(JW, jw, jw, false)
AM_CONDITIONAL(HAVE_JW, test "x$JW" != xfalse)
echo "---------------------------------------------------------------------"
AC_ARG_WITH(libwrap,[ --with-libwrap use tcp wrappers [default=no]], , wrap_ok=no)
WRAP_LIB=
if test "x$with_libwrap" = "xyes"; then
esound_save_LIBS="$LIBS"
LIBS="$LIBS -lwrap"
AC_MSG_CHECKING([for tcp_wrapper library and headers])
wrap_ok=no
AC_TRY_LINK(
[#include <tcpd.h>
#include <syslog.h>
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;],
[struct request_info *request; return hosts_access (request);],
[AC_DEFINE(USE_LIBWRAP, 1, [Defined if libwrap is used])
WRAP_LIB="-lwrap"
wrap_ok=yes],
[LIBS="$LIBS -lnsl"
AC_TRY_LINK(
[#include <tcpd.h>
#include <syslog.h>
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;],
[struct request_info *request; return hosts_access (request);],
[AC_DEFINE(USE_LIBWRAP, 1, [Defined if libwrap is used])
WRAP_LIB="-lwrap -lnsl"
wrap_ok=yes])])
AC_MSG_RESULT($wrap_ok)
LIBS="$esound_save_LIBS"
fi
AS_COMPILER_FLAG(-Wall, CFLAGS="$CFLAGS -Wall")
# set | sort; # just for double checking the script...
AC_SUBST(WRAP_LIB)
AC_SUBST(SOUND_LIBS)
AC_SUBST(AUDIOFILE_LIBS)
AC_SUBST(DL_LIB)
AC_SUBST(DOCS)
AC_SUBST(DISTDOCS)
AC_SUBST(JW)
AC_OUTPUT([
Makefile
esd-config
esound.spec
esound.pc
esddsp
docs/Makefile
docs/esd.1
docs/esdcat.1
docs/esd-config.1
docs/esdctl.1
docs/esddsp.1
docs/esdfilt.1
docs/esdloop.1
docs/esdmon.1
docs/esdplay.1
docs/esdrec.1
docs/esdsample.1
])
dnl , [case "$CONFIG_FILES" in *esd-config*) chmod +x esd-config;; esac])
echo ""
echo "Esound Configure Settings:"
echo ""
echo "Debugging support: $enable_debugging"
echo "libwrap support: $wrap_ok"
echo ""
echo "LIBS=$LIBS"
echo ""
|