source: trunk/third/esound/configure.in @ 21330

Revision 21330, 12.9 KB checked in by ghudson, 19 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21329, which included commits to RCS files with non-trunk default branches.
Line 
1dnl Initialize the autoconf settings
2
3AC_INIT(esd.h)
4
5AM_CONFIG_HEADER(config.h)
6
7ESD_MAJOR_VERSION=0
8ESD_MINOR_VERSION=2
9ESD_MICRO_VERSION=35
10ESD_VERSION=$ESD_MAJOR_VERSION.$ESD_MINOR_VERSION.$ESD_MICRO_VERSION
11
12dnl set version info for libesd.so to package rev - $MAJOR + $MINOR : $MICRO : $MINOR
13ESD_VERSION_INFO=`expr $ESD_MINOR_VERSION + $ESD_MAJOR_VERSION`:$ESD_MICRO_VERSION:$ESD_MINOR_VERSION
14
15AC_SUBST(ESD_MAJOR_VERSION)
16AC_SUBST(ESD_MINOR_VERSION)
17AC_SUBST(ESD_MICRO_VERSION)
18AC_SUBST(ESD_VERSION)
19AC_SUBST(ESD_VERSION_INFO)
20
21AM_INIT_AUTOMAKE(esound, $ESD_VERSION)
22
23AM_MAINTAINER_MODE
24
25AC_PROG_CC
26AC_PROG_CPP
27AC_LIBTOOL_WIN32_DLL
28AM_PROG_LIBTOOL
29
30
31dnl Check for tools
32
33AC_CANONICAL_HOST
34AC_PROG_MAKE_SET
35
36AC_PROG_INSTALL
37
38dnl Check for compiler environment
39
40AC_C_CONST
41AC_C_BIGENDIAN
42AC_C_INLINE
43
44dnl Check for system libs needed
45
46AC_FUNC_ALLOCA
47AC_CHECK_FUNCS(setenv putenv fchown fchmod gethostbyname2)
48AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
49AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
50AC_CHECK_FUNC(hstrerror,,[AC_CHECK_LIB(resolv,hstrerror)])
51AC_CHECK_FUNC(nanosleep,,[
52  AC_CHECK_LIB(rt,nanosleep,,[AC_CHECK_LIB(posix4,nanosleep)])])
53AC_CHECK_FUNCS(usleep)
54AC_CHECK_FUNCS(strtok_r)
55
56use_inet_pton=no
57AC_CHECK_FUNC(inet_pton,use_inet_pton=yes,[AC_CHECK_LIB(resolv,inet_pton)])
58       if test "x$use_inet_pton" = "xyes"; then
59               case $ac_cv_func_inet_pton/$ac_cv_lib_resolv_inet_pton in
60               no/no) ;;
61               *) AC_DEFINE(HAVE_INET_PTON)
62               esac
63       else
64               AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
65               case $ac_cv_func_inet_aton/$ac_cv_lib_resolv_inet_aton in
66               no/no) ;;
67               *) AC_DEFINE(HAVE_INET_ATON)
68               esac
69       fi
70
71case $ac_cv_func_nanosleep/$ac_cv_lib_rt_nanosleep/$ac_cv_lib_posix4_nanosleep in
72no/no/no) ;;
73*) AC_DEFINE(HAVE_NANOSLEEP)
74esac
75
76dnl Check if INADDR_LOOPBACK exists
77 
78AC_TRY_COMPILE([
79    #include<sys/types.h>
80    #include<netinet/in.h>],
81    [unsigned long ul = INADDR_LOOPBACK;],,
82    [AC_DEFINE(INADDR_LOOPBACK, (u_int32_t)0x7f000001)])
83   
84
85dnl ========================================================================
86dnl Begin IPv6 checks
87dnl ========================================================================
88AC_MSG_CHECKING([whether to enable ipv6])
89AC_ARG_ENABLE(ipv6, [  --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
90
91if test $enable_ipv6 = yes; then
92  AC_TRY_COMPILE([
93    #include <sys/types.h>
94    #include <sys/socket.h>], [
95    socket(AF_INET6, SOCK_STREAM, 0)
96    ],
97    have_ipv6=yes,
98    have_ipv6=no
99  )
100  AC_MSG_RESULT($have_ipv6)
101
102  if test $have_ipv6=yes; then
103    have_getaddrinfo=no
104    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
105    if test $have_getaddrinfo = no; then
106      for lib in bsd socket inet; do
107        AC_CHECK_LIB($lib,getaddrinfo,[LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
108      done
109    fi
110
111    if test $have_getaddrinfo = yes; then
112      AC_DEFINE(ENABLE_IPV6)
113    fi
114
115
116    dnl Check for inet_ntop. We need it only for debugging
117    AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
118  fi
119else
120  AC_MSG_RESULT(no)
121fi
122
123dnl ========================================================================
124dnl End of IPv6 checks
125dnl ========================================================================
126
127dnl Check if SUN_LEN exists
128
129AC_TRY_LINK([
130    #include<sys/types.h>
131    #include<sys/un.h>],
132    [struct sockaddr_un su; int i = SUN_LEN(&su);],
133    [AC_DEFINE(HAVE_SUN_LEN)], )
134
135dnl check for getopt_long, substitute the distributed versions if not
136
137AC_CHECK_FUNC(getopt_long,[have_getopt_long=yes],[have_getopt_long=no])
138AM_CONDITIONAL(NEED_GETOPT, test "x$have_getopt_long" = xno)
139
140dnl Needed for FIONBIO on Solaris at least
141
142AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h)
143
144dnl see if we want to enable insanely verbose debugging
145
146AC_ARG_ENABLE(debugging,[  --enable-debugging      enable verbose diagnostic info [default=no]], , enable_debugging=no )
147
148if test "x$enable_debugging" = "xyes"; then
149  AC_DEFINE(ESDBG)
150fi
151
152dnl see if we intentionally want to disable local sound
153
154AC_ARG_ENABLE(local_sound,[  --enable-local-sound    turn on local sound playing [default=yes]], , enable_local_sound=yes)
155
156if test "x$enable_local_sound" = "xyes"; then
157   found_sound=no
158
159   dnl Check for audio header files needed
160
161   echo "---------------------------------------------------------------------"
162   echo "--- Checking to see which audio header files your system uses.";
163   echo "--- Most of these checks should fail. Do not be alarmed.";
164   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
165   AC_CHECK_HEADERS(sys/audioio.h sys/audio.io.h sun/audioio.h)
166   AC_CHECK_HEADERS(dmedia/audio.h sys/soundlib.h sys/asoundlib.h alsa/asoundlib.h)
167   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h)
168   # mme_api.h directly includes other files from the mme subdir
169   xCPPFLAGS="$CPPFLAGS"
170   CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
171   AC_CHECK_HEADERS(mme/mme_api.h)
172   CPPFLAGS="$xCPPFLAGS"
173
174   dnl Define the driver needed based on the first header file found
175
176   if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
177      test "${ac_cv_header_soundcard_h}" = "yes" || \
178      test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
179
180      dnl Platform mklinux/powerpc needs special care and feeding
181      found_sound=yes
182      AC_DEFINE(DRIVER_OSS)
183   fi
184
185   if test "${ac_cv_header_sys_audio_h}" = "yes"; then
186      case ${host_os} in
187      hpux*)
188          found_sound=yes
189          AC_DEFINE(DRIVER_HPUX)
190      ;;
191      aix*)
192          found_sound=yes
193          AC_DEFINE(DRIVER_AIX)
194      esac
195   fi
196
197   if test "${ac_cv_header_sys_audioio_h}" = "yes" || \
198      test "${ac_cv_header_sys_audio_io_h}" = "yes" || \
199      test "${ac_cv_header_sun_audioio_h}" = "yes"; then
200      case ${host_os} in
201      solaris*)
202         found_sound=yes
203         AC_DEFINE(DRIVER_SOLARIS)
204         ;;
205      esac
206   fi
207
208   case ${host_os} in
209   os2*)
210      found_sound=yes
211      AC_DEFINE(DRIVER_DART)
212      ;;
213   esac
214
215   if test "${ac_cv_header_dmedia_audio_h}" = "yes"; then
216      case ${host_os} in
217      irix*)
218         found_sound=yes
219         AC_DEFINE(DRIVER_IRIX)
220      esac
221   fi
222
223   if test "${ac_cv_header_mme_mme_api_h}" = "yes"; then
224      case ${host_os} in
225      osf*)
226        found_sound=yes
227        AC_DEFINE(DRIVER_OSF)
228        CPPFLAGS="$CPPFLAGS -I/usr/include/mme"
229        SOUND_LIBS=-lmme
230      esac
231   fi
232
233   AC_ARG_ENABLE(alsa,[  --enable-alsa           use alsa if available [default=yes]], , enable_alsa=yes)
234
235   
236   if test "x$enable_alsa" = "xyes"; then
237      if test "${ac_cv_header_sys_soundlib_h}" = "yes"; then
238         found_sound=yes
239         AC_DEFINE(DRIVER_ALSA)
240
241      elif test "${ac_cv_header_alsa_asoundlib_h}" = "yes"; then
242         found_sound=yes
243         AC_DEFINE(DRIVER_ALSA_09)
244
245      elif test "${ac_cv_header_sys_asoundlib_h}" = "yes"; then
246         found_sound=yes
247         AC_DEFINE(DRIVER_NEWALSA)
248      fi
249   fi
250
251   if test "${ac_cv_header_CoreAudio_CoreAudio_h}" = "yes"; then
252      found_sound=yes
253      AC_DEFINE(DRIVER_COREAUDIO)
254      SOUND_LIBS="-Wl,-framework -Wl,CoreAudio"
255   fi
256
257   if test "$found_sound" = "no"; then
258      AC_MSG_ERROR([Could not find a support sound driver])
259   fi
260
261   dnl Check for additional audio libs needed
262
263   echo "---------------------------------------------------------------------"
264   echo "--- Checking to see which audio libraries are required for linking.";
265   echo "--- Most of these checks should also fail. Do not be alarmed.";
266   AC_CHECK_FUNC(_oss_ioctl,,[AC_CHECK_LIB(ossaudio,_oss_ioctl)])
267   AC_CHECK_FUNC(ALnewconfig,,[AC_CHECK_LIB(audio,ALnewconfig)])
268   if test "x$enable_alsa" = "xyes"; then
269      AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(sound,snd_cards)])
270      AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(asound,snd_cards)])
271      AC_CHECK_FUNC(snd_pcm_pause,,[AC_CHECK_LIB(asound,snd_pcm_pause)])
272
273      dnl Check if ALSA uses new API
274      saved_cflags="$CFLAGS"
275      CFLAGS="$CFLAGS -Werror"
276      echo -n "checking for alsa new PCM API... "
277      AC_TRY_LINK([
278          #include <alsa/asoundlib.h>
279          ], [
280          snd_pcm_t *pcm;
281          snd_pcm_hw_params_t *params;
282          unsigned int val;
283          int dir;
284          /* intentionally not uses pointers, trying to replicate bug 129709 */
285          snd_pcm_hw_params_set_rate_near(pcm, params, val, &dir);
286          ],[ echo "no" ], AC_DEFINE(DRIVER_ALSA_09_NEW_PCM_API) [ echo "yes" ],
287          ])
288
289      CFLAGS="$saved_cflags"
290   fi
291else
292   AC_DEFINE(DRIVER_NONE)
293fi
294
295dnl offer daemon in serverdir
296
297AC_ARG_WITH(esd-dir, [  --with-esd-dir=PATH     specify location of esound daemon ])
298
299if test "x$with_esd_dir" = "x" ; then
300  ESD_DIR='$(prefix)/bin'
301  ESD_PC_DIR='${prefix}/bin'
302else
303  ESD_DIR=$with_esd_dir
304  ESD_PC_DIR=$with_esd_dir
305fi
306AC_SUBST(ESD_DIR)
307AC_SUBST(ESD_PC_DIR)
308
309dnl make sure we have the library, -laudiofile
310
311build_esdplay=false
312AC_ARG_WITH(audiofile,
313[  --with-audiofile        include support for audiofile related utilities and functions
314                              ARG = { yes | no | check } [default=check]])
315
316if test xno != x$with_audiofile ; then
317echo "---------------------------------------------------------------------"
318echo "--- Checking for the audiofile library.  NOTE: This library is now"
319echo "--- REQUIRED from proper compilation of the esound package."
320
321AM_PATH_AUDIOFILE(0.1.5, [
322
323build_esdplay=true
324echo "--- libaudiofile found. Building esound with audiofile support"
325],[
326
327echo "--- ERROR: The audiofile library was not found on your system."
328echo "--- The audiofile library may be obtained from your favourite"
329echo "--- gnome distribution center, or check the audiofile web page at:"
330echo "--- http://www.68k.org/~michael/audiofile/"
331echo "--- NOTE: The audiofile library is now REQUIRED for esound."
332
333])
334
335else
336
337   echo "---------------------------------------------------------------------"
338   echo "--- WARNING: Per configuration request, the audiofile library support"
339   echo "--- not be included.  This may result in errors using some programs"
340   echo "--- designed to operate with esd."
341   echo "--- The audiofile library may be obtained from your favourite"
342   echo "--- gnome distribution center, or check the audiofile web page at:"
343   echo "--- http://www.68k.org/~michael/audiofile/"
344   echo "--- NOTE: The audiofile library is now REQUIRED for esound."
345
346fi
347
348AM_CONDITIONAL(BUILD_ESDPLAY, $build_esdplay)
349
350echo "---------------------------------------------------------------------"
351echo "--- Checking for the documentation generation tools.  NOTE: These "
352echo "--- are NOT required for proper compilation of the esound package."
353
354DOCS=""
355DISTDOCS=""
356DB2HTML=true
357AC_CHECK_PROG(have_db2html, db2html, yes, no)
358if test "x$have_db2html" = "xyes"; then
359   DOCS=esound/index.html
360   DISTDOCS=docs/html
361   DB2HTML=db2html
362fi
363
364DB2PS=true
365AC_CHECK_PROG(have_db2ps, db2ps, yes, no)
366if test "x$have_db2ps" = "xyes"; then
367   DOCS="$DOCS esound.ps"
368   DISTDOCS="$DISTDOCS docs/esound.ps"
369   DB2PS=db2ps
370fi
371
372echo "---------------------------------------------------------------------"
373
374AC_ARG_WITH(libwrap,[  --with-libwrap          use tcp wrappers [default=no]], , wrap_ok=no)
375
376WRAP_LIB=
377if test "x$with_libwrap" = "xyes"; then
378   esound_save_LIBS="$LIBS"
379   LIBS="$LIBS -lwrap"
380
381   AC_MSG_CHECKING([for tcp_wrapper library and headers])
382
383   wrap_ok=no
384   AC_TRY_LINK(
385[#include <tcpd.h>
386#include <syslog.h>
387int allow_severity = LOG_INFO;
388int deny_severity = LOG_WARNING;],
389[struct request_info *request; return hosts_access (request);],
390      [AC_DEFINE(USE_LIBWRAP)
391       WRAP_LIB="-lwrap"
392       wrap_ok=yes],
393      [LIBS="$LIBS -lnsl"
394       AC_TRY_LINK(
395[#include <tcpd.h>
396#include <syslog.h>
397int allow_severity = LOG_INFO;
398int deny_severity = LOG_WARNING;],
399[struct request_info *request; return hosts_access (request);],
400
401         [AC_DEFINE(USE_LIBWRAP)
402          WRAP_LIB="-lwrap -lnsl"
403          wrap_ok=yes])])
404
405   AC_MSG_RESULT($wrap_ok)
406
407   LIBS="$esound_save_LIBS"
408fi
409
410dnl build the esddsp wrapper for systems,
411dnl that support LD_PRELOAD and RTLD_NEXT only
412dsp_ok=no DL_LIB=
413
414AC_MSG_CHECKING([if your platform supports esddsp])
415case "$host_os" in
416  linux* | freebsd* | kfreebsd*-gnu | bsdi4* )
417    dsp_ok=yes
418    ;;
419esac
420AC_MSG_RESULT($dsp_ok)
421
422if test "x$dsp_ok" = xyes; then
423   AC_CHECK_FUNC(dlopen, dsp_ok=yes,
424      AC_CHECK_LIB(dl, dlopen, dsp_ok=yes DL_LIB=-ldl))
425   ESDDSP=esddsp
426   LIBESDDSP=libesddsp.la
427fi
428AM_CONDITIONAL(BUILD_ESDDSP, test "x$dsp_ok" = xyes)
429
430# set | sort; # just for double checking the script...
431
432AC_SUBST(WRAP_LIB)
433AC_SUBST(SOUND_LIBS)
434AC_SUBST(AUDIOFILE_LIBS)
435AC_SUBST(DL_LIB)
436AC_SUBST(DOCS)
437AC_SUBST(DISTDOCS)
438AC_SUBST(DB2HTML)
439AC_SUBST(DB2PS)
440
441AC_OUTPUT([
442Makefile
443esd-config
444esound.spec
445esound.pc
446esddsp
447docs/Makefile
448docs/esd.1
449docs/esdcat.1
450docs/esd-config.1
451docs/esdctl.1
452docs/esddsp.1
453docs/esdfilt.1
454docs/esdloop.1
455docs/esdmon.1
456docs/esdplay.1
457docs/esdrec.1
458docs/esdsample.1
459])
460dnl , [case "$CONFIG_FILES" in *esd-config*) chmod +x esd-config;; esac])
461
462echo ""
463echo "Esound Configure Settings:"
464echo ""
465echo "Debugging support: $enable_debugging"
466echo "libwrap support:   $wrap_ok"
467echo ""
468echo "LIBS=$LIBS"
469echo ""
470
Note: See TracBrowser for help on using the repository browser.