1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([libao],[1.2.2],[monty@xiph.org])
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 ====================================
38 dnl ====================================
40 dnl ====================================
42 dnl Currently use this to disable plugin support dlfcn.h
43 AC_CHECK_HEADERS([dlfcn.h],
44 [AC_SEARCH_LIBS([dlopen],[dl],
45 [AC_DEFINE([HAVE_DLOPEN],[1],
46 [support dynamic linking loader])])])
48 dnl ====================================
49 dnl Set some general compile options
50 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"
89 CFLAGS="-D__NO_MATH_INLINES -fsigned-char"
90 PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
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 -DAO_BUILDING_LIBAO"
99 DEBUG="$DEBUG $cflags_save -DAO_BUILDING_LIBAO"
100 PROFILE="$PROFILE $cflags_save -DAO_BUILDING_LIBAO"
105 dnl =========================================
106 dnl Need -no-undefined for building win32 dll
107 dnl =========================================
108 dnl Should we do that for cygwin too ???
109 dnl I guess so but it needs to be tested.
112 LIBAO_LA_LDFLAGS="-no-undefined"
118 AC_SUBST(LIBAO_LA_LDFLAGS)
120 dnl ===================================
121 dnl Check for symbol versioning support
122 dnl ===================================
124 AC_MSG_CHECKING([if libraries can be versioned])
125 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
127 have_ld_version_script=yes
130 have_ld_version_script=no
133 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
135 dnl ==============================
136 dnl Check for libraries
137 dnl ==============================
139 # we link to libpthread just in case one of our plugins does
140 # in which case this is required to avoid problems on dlclose()
141 AC_CHECK_LIB(pthread, pthread_kill)
143 dnl ==============================
144 dnl Checks for header files
145 dnl ==============================
147 dnl ==============================
148 dnl Select proper plugin options
149 dnl ==============================
152 DLOPEN_FLAG='(RTLD_LAZY)'
155 *openbsd* | *netbsd* | *solaris2.7 | *darwin*)
156 DLOPEN_FLAG='(RTLD_LAZY)'
160 DLOPEN_FLAG='(RTLD_NOW | RTLD_GLOBAL)'
164 AC_DEFINE_UNQUOTED(DLOPEN_FLAG, $DLOPEN_FLAG)
165 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "$SHARED_LIB_EXT")
167 dnl ==============================
169 dnl ==============================
171 AC_CHECK_SIZEOF(short)
173 AC_CHECK_SIZEOF(long)
176 $ac_cv_sizeof_short) SIZE16="short";;
177 $ac_cv_sizeof_int) SIZE16="int";;
181 $ac_cv_sizeof_short) SIZE32="short";;
182 $ac_cv_sizeof_int) SIZE32="int";;
183 $ac_cv_sizeof_long) SIZE32="long";;
186 if test -z "$SIZE16"; then
187 AC_MSG_ERROR(No 16 bit type found on this platform!)
189 if test -z "$SIZE32"; then
190 AC_MSG_ERROR(No 32 bit type found on this platform!)
196 dnl ======================================
197 dnl Disable default use of SLP in roar
198 dnl until such time as SLP doesn't block
200 dnl ======================================
203 AC_ARG_ENABLE([roar-default-slp],
205 [--enable-roar-default-slp],
206 [allow Roar driver to use SLP in default search])],
207 [use_slp="$enableval"],[use_slp="no"]
209 if test "x$use_slp" != "xyes"; then
210 SLP_DEF="-DROAR_LIBROAR_CONFIG_WAS_NO_SLP"
214 dnl ======================================
215 dnl Detect possible output devices
216 dnl ======================================
224 [include WMM output plugin @<:@default=check@:>@])],
225 [],[enable_wmm="check"]
227 AS_IF([AC_LANG_SOURCE([test "x$enable_wmm" != "xno"],
228 [AC_CHECK_HEADERS([mmsystem.h],
230 AC_MSG_CHECKING([waveOut family functions])
231 waveout_old_LIBS="$LIBS"; LIBS="$LIBS -lwinmm"
232 dnl Can't use AC_SEARCH_LIBS because symbols are decorated
235 #include <mmsystem.h>
236 int main(int na, char ** a) {
237 return waveOutOpen(0,0,0,0,0,0);
242 AC_DEFINE([HAVE_WMM],[1],[Support Windows MultiMedia])
245 LIBS="$waveout_old_LIBS"
247 ],[],[#include <windows.h>])])
248 AM_CONDITIONAL([HAVE_WMM],[test "x$have_wmm" = "xyes"])
249 AS_IF([test "x${have_wmm}" = "xyes"],[WMM_LIBS="-lwinmm"],[WMM_LIBS=""])
255 AC_ARG_ENABLE(esd, [ --enable-esd include ESD output plugin ],
256 [ BUILD_ESD="$enableval" ],[ BUILD_ESD="yes" ])
258 if test "$BUILD_ESD" = "yes"; then
259 AM_PATH_ESD(0.2.8, have_esd=yes)
261 AM_CONDITIONAL(HAVE_ESD,test "x$have_esd" = xyes)
267 AC_CHECK_HEADERS(sys/soundcard.h, have_oss=yes)
268 AC_CHECK_HEADERS(machine/soundcard.h, have_oss=yes)
269 AM_CONDITIONAL(HAVE_OSS,test "${have_oss}" = "yes")
272 dnl Check for ALSA 0.9/1.0
274 AC_ARG_ENABLE(alsa, [ --enable-alsa include alsa 0.9/1.0 output plugin ],
275 [ BUILD_ALSA="$enableval" ],[ BUILD_ALSA="yes" ])
276 AC_ARG_ENABLE(alsa-mmap,
277 [ --enable-alsa-mmap use mmio with alsa ],
278 [ BUILD_ALSAMMIO="$enableval" ],[ BUILD_ALSAMMIO="no" ])
280 if test "$BUILD_ALSA" = "yes"; then
281 AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
282 AC_CHECK_HEADER(alsa/asoundlib.h, , have_alsa=no)
283 if test "$BUILD_ALSAMMIO" = "yes" ; then
284 AC_CHECK_HEADER(sys/mman.h, have_alsammio=yes, have_alsammio=no)
289 if test "x$have_alsa" = xyes; then
291 if test "x$have_alsammio" = xyes; then
292 AC_DEFINE(USE_ALSA_MMIO)
297 AM_CONDITIONAL(HAVE_ALSA,test "x$have_alsa" = xyes)
300 dnl Decide whether we need to enable the workaround for broken OSS APIs
301 dnl such as the OSS emulation in ALSA.
303 AC_ARG_ENABLE(broken-oss, [ --enable-broken-oss workaround for some OSS drivers (see README for details)],,
304 if test "x$have_alsa" = "xyes" -o "x$have_alsa" = "xyes"; then
305 enable_broken_oss="yes"
308 if test "x$enable_broken_oss" = "xyes"; then
309 AC_DEFINE(BROKEN_OSS)
310 AC_MSG_WARN(Broken OSS API workaround enabled. See README for details.)
313 dnl Check for Sun audio
316 AC_CHECK_HEADERS(sys/audioio.h, have_sun=yes)
317 AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${have_sun}" = yes)
319 dnl Check for libsndio audio
322 AC_CHECK_HEADERS(sndio.h, have_sndio=yes)
323 AM_CONDITIONAL(HAVE_SNDIO_AUDIO,test "${have_sndio}" = yes)
325 dnl Check for roaraudio
328 AC_CHECK_HEADERS(libroar/config.h, have_roar=yes)
329 if test "x$have_roar" = "xyes"; then
330 AC_MSG_CHECKING([if SLP lookup can be disabled in libroar])
331 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
332 #include <libroar/config.h>
333 int main(int a, char **b) {
334 #ifdef ROAR_LIBROAR_CONFIG_WAS_NO_SLP
337 ROAR_LIBROAR_CONFIG_WAS_NO_SLP required
341 [AC_MSG_RESULT([yes])],
344 AC_MSG_RESULT([RoarAudio 0.4beta2 or later required to build Roar support])
347 AM_CONDITIONAL(HAVE_ROAR_AUDIO,test "${have_roar}" = yes)
349 dnl Check for AIX audio
354 AC_CHECK_HEADERS(sys/audio.h, have_aix=yes)
357 AM_CONDITIONAL(HAVE_AIX_AUDIO,test "x$have_aix" = xyes)
361 AC_ARG_ENABLE(arts, [ --enable-arts include aRts output plugin ],
362 [ BUILD_ARTS="$enableval" ],[ BUILD_ARTS="maybe" ])
364 dnl aRts support is whacked on OS X, so don't build it by default
365 if test "$BUILD_ARTS" = "maybe"; then
375 if test "$BUILD_ARTS" = "yes"; then
376 AC_PATH_PROG(ARTSC_CONFIG, artsc-config)
378 if test "x$ac_cv_path_ARTSC_CONFIG" != x
380 PKG_CHECK_MODULES(ARTSGLIB, glib-2.0 gthread-2.0)
381 ARTS_CFLAGS="`$ac_cv_path_ARTSC_CONFIG --cflags` $ARTSGLIB_CFLAGS"
382 ARTS_LIBS="`$ac_cv_path_ARTSC_CONFIG --libs` $ARTSGLIB_LIBS"
384 LIBS="$LIBS $ARTS_LIBS"
385 AC_CHECK_FUNCS(arts_suspended)
390 AM_CONDITIONAL(HAVE_ARTS,test "x${have_arts}" = xyes)
392 AC_SUBST(ARTS_CFLAGS)
401 AC_CHECK_LIB(audio, ALwritesamps, have_irix=yes, have_irix=no)
404 AM_CONDITIONAL(HAVE_IRIX,test "x$have_irix" = xyes)
407 dnl Check for MacOS X
414 AM_CONDITIONAL(HAVE_MACOSX,test "x$have_macosx" = xyes)
419 AC_ARG_ENABLE(nas, [ --enable-nas include NAS output plugin ],
420 [ BUILD_NAS="$enableval" ],[ BUILD_NAS="yes" ])
423 if test "$BUILD_NAS" = "yes"; then
425 AC_CHECK_LIB(Xau, XauFileName, have_nas=yes, have_nas=no, $X_LIBS)
426 AC_CHECK_LIB(audio, AuOpenServer, dummy="no-op", have_nas=no, -lXau $X_LIBS)
428 ac_save_CPPFLAGS="$CPPFLAGS"
429 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
430 AC_CHECK_HEADER(audio/audiolib.h, dummy="no-op", have_nas=no)
431 CPPFLAGS="$ac_save_CPPFLAGS"
434 AM_CONDITIONAL(HAVE_NAS,test "x$have_nas" = xyes)
436 if test "x$have_nas" = xyes; then
437 NAS_CFLAGS="$X_CFLAGS"
438 NAS_LIBS="-laudio -lXau $X_LIBS"
448 AC_ARG_ENABLE(pulse, [ --enable-pulse include PulseAudio output plugin ],
449 [ BUILD_PULSE="$enableval" ],[ BUILD_PULSE="yes" ])
452 if test "x$BUILD_PULSE" = "xyes" ; then
453 PKG_CHECK_MODULES(PULSE, [ libpulse-simple >= 0.9 ],
454 [have_pulse=yes],[have_pulse=no])
458 AM_CONDITIONAL(HAVE_PULSE,test "x$have_pulse" = xyes)
460 dnl Orphaned driver. We'll probably dump it soon.
461 AM_CONDITIONAL(HAVE_SOLARIS,test "x$have_solaris" = xyes)
463 dnl Plugins get special LDFLAGS
464 AC_SUBST(PLUGIN_LDFLAGS)
467 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/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile src/plugins/sndio/Makefile src/plugins/roar/Makefile ao.pc])
469 AS_AC_EXPAND(LIBDIR, ${libdir})
470 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
471 AS_AC_EXPAND(BINDIR, ${bindir})
472 AS_AC_EXPAND(DOCDIR, ${docdir})
475 ------------------------------------------------------------------------
476 $PACKAGE $VERSION: Automatic configuration OK.
478 Backends to be built:
480 AU file output: .............. yes
481 RAW file output: ............. yes
482 WAV file output: ............. yes
484 AIX live output: ............. ${have_aix}
485 ALSA live output: ............ ${have_alsa}
486 ARTS live output: ............ ${have_arts}
487 ESD live output: ............. ${have_esd}
488 IRIX live output: ............ ${have_irix}
489 MACOSX live output: .......... ${have_macosx}
490 NAS live output: ............. ${have_nas}
491 NULL live output: ............ yes
492 OSS live output: ............. ${have_oss}
493 PULSE live output: ........... ${have_pulse}
494 ROAR live output: ............ ${have_roar}
495 SNDIO live output: ........... ${have_sndio}
496 SUN live output: ............. ${have_sun}
497 Windows WMM live output: ..... ${have_wmm}
501 libao: ....................... ${LIBDIR}
502 C header files: .............. ${INCLUDEDIR}/ao
503 Documentation: ............... ${DOCDIR}
507 Type 'make' to compile $PACKAGE.
509 Type 'make install' to install $PACKAGE.
511 ------------------------------------------------------------------------