1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([libao],[0.8.8],[benjihan@users.sourceforge.net])
4 AM_INIT_AUTOMAKE([gnu 1.6])
8 dnl $$$ben: Is that neccessary ? And why ?
11 dnl Library versioning
16 AC_SUBST(LIB_REVISION)
19 dnl Plugin versioning. We use an integer version number much like LIB_CURRENT.
25 plugindir=$libdir/ao/plugins-$PLUGIN_VERSION
28 dnl ====================================
29 dnl Check for programs
30 dnl ====================================
37 dnl ====================================
39 dnl ====================================
41 dnl Currently use this to disable plugin support dlfcn.h
42 AC_CHECK_HEADERS([dlfcn.h],
43 [AC_SEARCH_LIBS([dlopen],[dl],
44 [AC_DEFINE([HAVE_DLOPEN],[1],
45 [support dynamic linking loader])])])
47 dnl ====================================
48 dnl Set some general compile options
49 dnl ====================================
52 if test -z "$GCC"; then
55 if test -z "$CC"; then
58 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
60 CFLAGS="-O2 -w -signed"
61 PROFILE="-p -g3 -O2 -signed" ;;
63 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
65 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
66 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
68 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
77 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
78 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
79 CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
80 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
82 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
83 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
84 CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char"
85 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char" ;;
87 PLUGIN_LDFLAGS="-module -avoid-version"
88 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore"
89 CFLAGS="-D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore"
90 PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;;
92 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
93 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
94 CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
95 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
98 CFLAGS="$CFLAGS $cflags_save"
99 DEBUG="$DEBUG $cflags_save"
100 PROFILE="$PROFILE $cflags_save"
106 dnl =========================================
107 dnl Need -no-undefined for building win32 dll
108 dnl =========================================
109 dnl Should we do that for cygwin too ???
110 dnl I guess so but it needs to be tested.
113 LIBAO_LA_LDFLAGS="-no-undefined"
119 AC_SUBST(LIBAO_LA_LDFLAGS)
121 dnl ==============================
122 dnl Check for libraries
123 dnl ==============================
125 # we link to libpthread just in case one of our plugins does
126 # in which case this is required to avoid problems on dlclose()
127 AC_CHECK_LIB(pthread, pthread_kill)
129 dnl ==============================
130 dnl Checks for header files
131 dnl ==============================
133 dnl ==============================
134 dnl Select proper plugin options
135 dnl ==============================
138 DLOPEN_FLAG='(RTLD_LAZY)'
141 *openbsd* | *netbsd* | *solaris2.7)
142 DLOPEN_FLAG='(RTLD_LAZY)'
146 DLOPEN_FLAG='(RTLD_NOW | RTLD_GLOBAL)'
150 AC_DEFINE_UNQUOTED(DLOPEN_FLAG, $DLOPEN_FLAG)
151 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "$SHARED_LIB_EXT")
153 dnl ==============================
155 dnl ==============================
157 AC_CHECK_SIZEOF(short)
159 AC_CHECK_SIZEOF(long)
162 $ac_cv_sizeof_short) SIZE16="short";;
163 $ac_cv_sizeof_int) SIZE16="int";;
167 $ac_cv_sizeof_short) SIZE32="short";;
168 $ac_cv_sizeof_int) SIZE32="int";;
169 $ac_cv_sizeof_long) SIZE32="long";;
172 if test -z "$SIZE16"; then
173 AC_MSG_ERROR(No 16 bit type found on this platform!)
175 if test -z "$SIZE32"; then
176 AC_MSG_ERROR(No 32 bit type found on this platform!)
182 dnl ======================================
183 dnl Detect possible output devices
184 dnl ======================================
192 [include WMM output plugin @<:@default=check@:>@])],
193 [],[enable_wmm="check"]
195 AS_IF([test "x$enable_wmm" != "xno"],
196 [AC_CHECK_HEADERS([mmsystem.h],
198 AC_MSG_CHECKING([waveOut family functions])
199 waveout_old_LIBS="$LIBS"; LIBS="$LIBS -lwinmm"
200 dnl Can't use AC_SEARCH_LIBS because symbols are decorated
203 #include <mmsystem.h>
204 int main(int na, char ** a) {
205 return waveOutOpen(0,0,0,0,0,0);
210 AC_DEFINE([HAVE_WMM],[1],[Support Windows MultiMedia])
213 LIBS="$waveout_old_LIBS"
215 ],[],[#include <windows.h>])])
216 AM_CONDITIONAL([HAVE_WMM],[test "x$has_wmm" = "xyes"])
217 AS_IF([test "x${has_wmm}" = "xyes"],[WMM_LIBS="-lwinmm"],[WMM_LIBS=""])
222 AC_ARG_ENABLE(esd, [ --enable-esd include ESD output plugin ],
223 [ BUILD_ESD="$enableval" ],[ BUILD_ESD="yes" ])
225 if test "$BUILD_ESD" = "yes"; then
226 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
228 AM_CONDITIONAL(HAVE_ESD,test "x$have_esd" = xyes)
233 AC_CHECK_HEADERS(sys/soundcard.h)
234 AC_CHECK_HEADERS(machine/soundcard.h)
235 AM_CONDITIONAL(HAVE_OSS,test "${ac_cv_header_sys_soundcard_h}" = "yes" || test "${ac_cv_header_machine_soundcard_h}" = "yes")
238 dnl Check for ALSA 0.5.x
240 AC_ARG_ENABLE(alsa, [ --enable-alsa include alsa 0.5 output plugin ],
241 [ BUILD_ALSA="$enableval" ],[ BUILD_ALSA="yes" ])
243 if test "$BUILD_ALSA" = "yes"; then
244 AC_CHECK_LIB(asound, snd_pcm_channel_params, have_alsa=yes, have_alsa=no)
245 AC_CHECK_HEADER(sys/asoundlib.h, , have_alsa=no)
248 if test "x$have_alsa" = xyes; then
253 AM_CONDITIONAL(HAVE_ALSA,test "x$have_alsa" = xyes)
257 dnl Check for ALSA 0.9.x
259 AC_ARG_ENABLE(alsa09, [ --enable-alsa09 include alsa 0.9 output plugin ],
260 [ BUILD_ALSA09="$enableval" ],[ BUILD_ALSA09="yes" ])
261 AC_ARG_ENABLE(alsa09-mmap,
262 [ --enable-alsa09-mmap use mmio with alsa 0.9 (experimental!) ],
263 [ BUILD_ALSA09MMIO="$enableval" ],[ BUILD_ALSA09MMIO="no" ])
265 if test "$BUILD_ALSA09" = "yes"; then
266 AC_CHECK_LIB(asound, snd_pcm_open, have_alsa09=yes, have_alsa09=no)
267 AC_CHECK_HEADER(alsa/asoundlib.h, , have_alsa09=no)
268 if test "$BUILD_ALSA09MMIO" = "yes" ; then
269 AC_CHECK_HEADER(sys/mman.h, have_alsa09mmio=yes, have_alsa09mmio=no)
274 if test "x$have_alsa09" = xyes; then
275 ALSA09_LIBS="-lasound"
276 if test "x$have_alsa09mmio" = xyes; then
277 AC_DEFINE(USE_ALSA_MMIO)
282 AM_CONDITIONAL(HAVE_ALSA09,test "x$have_alsa09" = xyes)
283 AC_SUBST(ALSA09_LIBS)
285 dnl Decide whether we need to enable the workaround for broken OSS APIs
286 dnl such as the OSS emulation in ALSA.
288 AC_ARG_ENABLE(broken-oss, [ --enable-broken-oss workaround for some OSS drivers (see README for details)],,
289 if test "x$have_alsa" = "xyes" -o "x$have_alsa09" = "xyes"; then
290 enable_broken_oss="yes"
293 if test "x$enable_broken_oss" = "xyes"; then
294 AC_DEFINE(BROKEN_OSS)
295 AC_MSG_WARN(Broken OSS API workaround enabled. See README for details.)
298 dnl Check for Sun audio
300 AC_CHECK_HEADERS(sys/audioio.h)
301 AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${ac_cv_header_sys_audioio_h}" = yes)
303 dnl Check for AIX audio
307 AC_CHECK_HEADERS(sys/audio.h)
310 AM_CONDITIONAL(HAVE_AIX_AUDIO,test "x${ac_cv_header_sys_audio_h}" = xyes)
314 AC_ARG_ENABLE(arts, [ --enable-arts include aRts output plugin ],
315 [ BUILD_ARTS="$enableval" ],[ BUILD_ARTS="maybe" ])
317 dnl aRts support is whacked on OS X, so don't build it by default
318 if test "$BUILD_ARTS" = "maybe"; then
328 if test "$BUILD_ARTS" = "yes"; then
329 AC_PATH_PROG(ARTSC_CONFIG, artsc-config)
331 if test "x$ac_cv_path_ARTSC_CONFIG" != x
333 ARTS_CFLAGS=`$ac_cv_path_ARTSC_CONFIG --cflags`
334 ARTS_LIBS=`$ac_cv_path_ARTSC_CONFIG --libs`
336 LIBS="$LIBS $ARTS_LIBS"
337 AC_CHECK_FUNCS(arts_suspended)
341 AM_CONDITIONAL(HAVE_ARTS,test "x$ac_cv_path_ARTSC_CONFIG" != x)
343 AC_SUBST(ARTS_CFLAGS)
351 AC_CHECK_LIB(audio, ALwritesamps, have_irix=yes, have_irix=no)
354 AM_CONDITIONAL(HAVE_IRIX,test "x$have_irix" = xyes)
357 dnl Check for MacOS X
364 AM_CONDITIONAL(HAVE_MACOSX,test "x$have_macosx" = xyes)
369 AC_ARG_ENABLE(nas, [ --enable-nas include NAS output plugin ],
370 [ BUILD_NAS="$enableval" ],[ BUILD_NAS="yes" ])
373 if test "$BUILD_NAS" = "yes"; then
375 AC_CHECK_LIB(Xau, XauFileName, have_nas=yes, have_nas=no, $X_LIBS)
376 AC_CHECK_LIB(audio, AuOpenServer, dummy="no-op", have_nas=no, -lXau $X_LIBS)
378 ac_save_CPPFLAGS="$CPPFLAGS"
379 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
380 AC_CHECK_HEADER(audio/audiolib.h, dummy="no-op", have_nas=no)
381 CPPFLAGS="$ac_save_CPPFLAGS"
384 AM_CONDITIONAL(HAVE_NAS,test "x$have_nas" = xyes)
386 if test "x$have_nas" = xyes; then
387 NAS_CFLAGS="$X_CFLAGS"
388 NAS_LIBS="-laudio -lXau $X_LIBS"
398 AC_ARG_ENABLE(pulse, [ --enable-pulse include PulseAudio output plugin ],
399 [ BUILD_PULSE="$enableval" ],[ BUILD_PULSE="yes" ])
402 if test "x$BUILD_PULSE" = "xyes" ; then
403 PKG_CHECK_MODULES(PULSE, [ libpulse-simple >= 0.9 ],
404 [have_pulse=yes],[have_pulse=no])
406 AC_SUBST(PULSE_CFLAGS)
409 AM_CONDITIONAL(HAVE_PULSE,test "x$have_pulse" = xyes)
411 dnl Orphaned driver. We'll probably dump it soon.
412 AM_CONDITIONAL(HAVE_SOLARIS,test "x$have_solaris" = xyes)
414 dnl Plugins get special LDFLAGS
415 AC_SUBST(PLUGIN_LDFLAGS)
418 AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/alsa09/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile ao.pc)