1dnl Process this file with autoconf to produce a configure script. 2 3AC_INIT([libao],[1.2.0],[monty@xiph.org]) 4AM_INIT_AUTOMAKE([gnu 1.6]) 5 6AM_MAINTAINER_MODE 7 8dnl $$$ben: Is that neccessary ? And why ? 9AM_DISABLE_STATIC 10 11dnl Library versioning 12LIB_CURRENT=5 13LIB_REVISION=0 14LIB_AGE=1 15AC_SUBST(LIB_CURRENT) 16AC_SUBST(LIB_REVISION) 17AC_SUBST(LIB_AGE) 18 19dnl Plugin versioning. We use an integer version number much like LIB_CURRENT. 20PLUGIN_VERSION=4 21 22AC_CANONICAL_BUILD 23AC_CANONICAL_HOST 24 25plugindir=$libdir/ao/plugins-$PLUGIN_VERSION 26AC_SUBST(plugindir) 27 28dnl ==================================== 29dnl Check for programs 30dnl ==================================== 31 32cflags_save="$CFLAGS" 33AC_PROG_CC 34AC_LIBTOOL_WIN32_DLL 35AC_LIBTOOL_DLOPEN 36AM_PROG_LIBTOOL 37 38dnl ==================================== 39dnl Check dlopen 40dnl ==================================== 41 42dnl Currently use this to disable plugin support dlfcn.h 43AC_CHECK_HEADERS([dlfcn.h], 44 [AC_SEARCH_LIBS([dlopen],[dl], 45 [AC_DEFINE([HAVE_DLOPEN],[1], 46 [support dynamic linking loader])])]) 47 48dnl ==================================== 49dnl Set some general compile options 50dnl ==================================== 51 52if test -z "$GCC"; then 53 case $host in 54 *-*-irix*) 55 if test -z "$CC"; then 56 CC=cc 57 fi 58 PLUGIN_LDFLAGS="-export-dynamic -avoid-version" 59 DEBUG="-g -signed" 60 CFLAGS="-O2 -w -signed" 61 PROFILE="-p -g3 -O2 -signed" ;; 62 sparc-sun-solaris*) 63 PLUGIN_LDFLAGS="-export-dynamic -avoid-version" 64 DEBUG="-v -g" 65 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" 66 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; 67 *) 68 PLUGIN_LDFLAGS="-export-dynamic -avoid-version" 69 DEBUG="-g" 70 CFLAGS="-O" 71 PROFILE="-g -p" ;; 72 esac 73else 74 75 case $host in 76 *-*-linux*) 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";; 81 sparc-sun-*) 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" ;; 86 *-darwin*) 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" ;; 91 *) 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" ;; 96 esac 97fi 98CFLAGS="$CFLAGS $cflags_save -DAO_BUILDING_LIBAO" 99DEBUG="$DEBUG $cflags_save -DAO_BUILDING_LIBAO" 100PROFILE="$PROFILE $cflags_save -DAO_BUILDING_LIBAO" 101 102AC_SUBST(DEBUG) 103AC_SUBST(PROFILE) 104 105dnl ========================================= 106dnl Need -no-undefined for building win32 dll 107dnl ========================================= 108dnl Should we do that for cygwin too ??? 109dnl I guess so but it needs to be tested. 110case $host in 111 *-mingw*|*-cygwin*) 112 LIBAO_LA_LDFLAGS="-no-undefined" 113 ;; 114 *) 115 LIBAO_LA_LDFLAGS="" 116 ;; 117esac 118AC_SUBST(LIBAO_LA_LDFLAGS) 119 120dnl =================================== 121dnl Check for symbol versioning support 122dnl =================================== 123 124AC_MSG_CHECKING([if libraries can be versioned]) 125GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` 126if test "$GLD"; then 127 have_ld_version_script=yes 128 AC_MSG_RESULT(yes) 129else 130 have_ld_version_script=no 131 AC_MSG_RESULT(no) 132fi 133AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") 134 135dnl ============================== 136dnl Check for libraries 137dnl ============================== 138 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() 141AC_CHECK_LIB(pthread, pthread_kill) 142 143dnl ============================== 144dnl Checks for header files 145dnl ============================== 146 147dnl ============================== 148dnl Select proper plugin options 149dnl ============================== 150case $host in 151 *hpux*) 152 DLOPEN_FLAG='(RTLD_LAZY)' 153 SHARED_LIB_EXT='.sl' 154 ;; 155 *openbsd* | *netbsd* | *solaris2.7 | *darwin*) 156 DLOPEN_FLAG='(RTLD_LAZY)' 157 SHARED_LIB_EXT='.so' 158 ;; 159 *) 160 DLOPEN_FLAG='(RTLD_NOW | RTLD_GLOBAL)' 161 SHARED_LIB_EXT='.so' 162 ;; 163esac 164AC_DEFINE_UNQUOTED(DLOPEN_FLAG, $DLOPEN_FLAG) 165AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "$SHARED_LIB_EXT") 166 167dnl ============================== 168dnl Checks for types 169dnl ============================== 170 171AC_CHECK_SIZEOF(short) 172AC_CHECK_SIZEOF(int) 173AC_CHECK_SIZEOF(long) 174 175case 2 in 176 $ac_cv_sizeof_short) SIZE16="short";; 177 $ac_cv_sizeof_int) SIZE16="int";; 178esac 179 180case 4 in 181 $ac_cv_sizeof_short) SIZE32="short";; 182 $ac_cv_sizeof_int) SIZE32="int";; 183 $ac_cv_sizeof_long) SIZE32="long";; 184esac 185 186if test -z "$SIZE16"; then 187 AC_MSG_ERROR(No 16 bit type found on this platform!) 188fi 189if test -z "$SIZE32"; then 190 AC_MSG_ERROR(No 32 bit type found on this platform!) 191fi 192 193AC_SUBST(SIZE16) 194AC_SUBST(SIZE32) 195 196dnl ====================================== 197dnl Disable default use of SLP in roar 198dnl until such time as SLP doesn't block 199dnl indefinitely 200dnl ====================================== 201 202use_slp="no" 203AC_ARG_ENABLE([roar-default-slp], 204 [AS_HELP_STRING( 205 [--enable-roar-default-slp], 206 [allow Roar driver to use SLP in default search])], 207 [use_slp="$enableval"],[use_slp="no"] 208) 209if test "x$use_slp" != "xyes"; then 210 SLP_DEF="-DROAR_LIBROAR_CONFIG_WAS_NO_SLP" 211fi 212AC_SUBST([SLP_DEF]) 213 214dnl ====================================== 215dnl Detect possible output devices 216dnl ====================================== 217 218dnl Check for WMM 219 220[have_wmm="no"] 221AC_ARG_ENABLE([wmm], 222 [AS_HELP_STRING( 223 [--enable-wmm], 224 [include WMM output plugin @<:@default=check@:>@])], 225 [],[enable_wmm="check"] 226) 227AS_IF([AC_LANG_SOURCE([test "x$enable_wmm" != "xno"], 228[AC_CHECK_HEADERS([mmsystem.h], 229 [ 230 AC_MSG_CHECKING([waveOut family functions]) 231 waveout_old_LIBS="$LIBS"; LIBS="$LIBS -lwinmm" 232dnl Can't use AC_SEARCH_LIBS because symbols are decorated 233 AC_LINK_IFELSE([ 234#include <windows.h> 235#include <mmsystem.h> 236int main(int na, char ** a) { 237 return waveOutOpen(0,0,0,0,0,0); 238} 239])],[ 240have_wmm="yes"; 241AC_MSG_RESULT([yes]) 242AC_DEFINE([HAVE_WMM],[1],[Support Windows MultiMedia]) 243],[ 244AC_MSG_RESULT([no]) 245LIBS="$waveout_old_LIBS" 246]) 247],[],[#include <windows.h>])]) 248AM_CONDITIONAL([HAVE_WMM],[test "x$have_wmm" = "xyes"]) 249AS_IF([test "x${have_wmm}" = "xyes"],[WMM_LIBS="-lwinmm"],[WMM_LIBS=""]) 250AC_SUBST([WMM_LIBS]) 251 252dnl Check for ESD 253 254have_esd="no"; 255AC_ARG_ENABLE(esd, [ --enable-esd include ESD output plugin ], 256[ BUILD_ESD="$enableval" ],[ BUILD_ESD="yes" ]) 257 258if test "$BUILD_ESD" = "yes"; then 259 AM_PATH_ESD(0.2.8, have_esd=yes) 260fi 261AM_CONDITIONAL(HAVE_ESD,test "x$have_esd" = xyes) 262 263 264dnl Check for OSS 265 266have_oss="no"; 267AC_CHECK_HEADERS(sys/soundcard.h, have_oss=yes) 268AC_CHECK_HEADERS(machine/soundcard.h, have_oss=yes) 269AM_CONDITIONAL(HAVE_OSS,test "${have_oss}" = "yes") 270 271 272dnl Check for ALSA 0.9/1.0 273have_alsa="no"; 274AC_ARG_ENABLE(alsa, [ --enable-alsa include alsa 0.9/1.0 output plugin ], 275[ BUILD_ALSA="$enableval" ],[ BUILD_ALSA="yes" ]) 276AC_ARG_ENABLE(alsa-mmap, 277 [ --enable-alsa-mmap use mmio with alsa ], 278 [ BUILD_ALSAMMIO="$enableval" ],[ BUILD_ALSAMMIO="no" ]) 279 280if 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) 285 fi 286 287fi 288 289if test "x$have_alsa" = xyes; then 290 ALSA_LIBS="-lasound" 291 if test "x$have_alsammio" = xyes; then 292 AC_DEFINE(USE_ALSA_MMIO) 293 fi 294else 295 ALSA_LIBS="" 296fi 297AM_CONDITIONAL(HAVE_ALSA,test "x$have_alsa" = xyes) 298AC_SUBST(ALSA_LIBS) 299 300dnl Decide whether we need to enable the workaround for broken OSS APIs 301dnl such as the OSS emulation in ALSA. 302 303AC_ARG_ENABLE(broken-oss, [ --enable-broken-oss workaround for some OSS drivers (see README for details)],, 304if test "x$have_alsa" = "xyes" -o "x$have_alsa" = "xyes"; then 305 enable_broken_oss="yes" 306fi) 307 308if 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.) 311fi 312 313dnl Check for Sun audio 314 315have_sun="no"; 316AC_CHECK_HEADERS(sys/audioio.h, have_sun=yes) 317AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${have_sun}" = yes) 318 319dnl Check for libsndio audio 320 321have_sndio="no"; 322AC_CHECK_HEADERS(sndio.h, have_sndio=yes) 323AM_CONDITIONAL(HAVE_SNDIO_AUDIO,test "${have_sndio}" = yes) 324 325dnl Check for roaraudio 326 327have_roar="no"; 328AC_CHECK_HEADERS(libroar/config.h, have_roar=yes) 329if 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> 333int main(int a, char **b) { 334#ifdef ROAR_LIBROAR_CONFIG_WAS_NO_SLP 335 return 0; 336#else 337 ROAR_LIBROAR_CONFIG_WAS_NO_SLP required 338#endif 339} 340 ], 341 [AC_MSG_RESULT([yes])], 342 [ 343 AC_MSG_RESULT([no]) 344 AC_MSG_RESULT([RoarAudio 0.4beta2 or later required to build Roar support]) 345 have_roar="no"])]) 346fi 347AM_CONDITIONAL(HAVE_ROAR_AUDIO,test "${have_roar}" = yes) 348 349dnl Check for AIX audio 350 351have_aix="no"; 352case $host in 353 *-aix*) 354 AC_CHECK_HEADERS(sys/audio.h, have_aix=yes) 355 ;; 356esac 357AM_CONDITIONAL(HAVE_AIX_AUDIO,test "x$have_aix" = xyes) 358 359dnl Check for aRts 360 361AC_ARG_ENABLE(arts, [ --enable-arts include aRts output plugin ], 362[ BUILD_ARTS="$enableval" ],[ BUILD_ARTS="maybe" ]) 363 364dnl aRts support is whacked on OS X, so don't build it by default 365if test "$BUILD_ARTS" = "maybe"; then 366 case $host in 367 *-darwin*) 368 BUILD_ARTS=no;; 369 *) 370 BUILD_ARTS=yes;; 371 esac 372fi 373 374have_arts="no"; 375if test "$BUILD_ARTS" = "yes"; then 376 AC_PATH_PROG(ARTSC_CONFIG, artsc-config) 377 378 if test "x$ac_cv_path_ARTSC_CONFIG" != x 379 then 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" 383 SAVELIBS=$LIBS 384 LIBS="$LIBS $ARTS_LIBS" 385 AC_CHECK_FUNCS(arts_suspended) 386 LIBS=$SAVELIBS 387 have_arts=yes 388 fi 389fi 390AM_CONDITIONAL(HAVE_ARTS,test "x${have_arts}" = xyes) 391 392AC_SUBST(ARTS_CFLAGS) 393AC_SUBST(ARTS_LIBS) 394 395 396dnl Check for IRIX 397 398have_irix="no"; 399case $host in 400 *-*-irix*) 401 AC_CHECK_LIB(audio, ALwritesamps, have_irix=yes, have_irix=no) 402 ;; 403esac 404AM_CONDITIONAL(HAVE_IRIX,test "x$have_irix" = xyes) 405 406 407dnl Check for MacOS X 408case $host in 409 *-darwin*) 410 have_macosx=yes;; 411 *) 412 have_macosx=no;; 413esac 414AM_CONDITIONAL(HAVE_MACOSX,test "x$have_macosx" = xyes) 415 416 417dnl Check for NAS 418 419AC_ARG_ENABLE(nas, [ --enable-nas include NAS output plugin ], 420[ BUILD_NAS="$enableval" ],[ BUILD_NAS="yes" ]) 421 422have_nas="no" 423if test "$BUILD_NAS" = "yes"; then 424 AC_PATH_XTRA 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) 427 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" 432fi 433 434AM_CONDITIONAL(HAVE_NAS,test "x$have_nas" = xyes) 435 436if test "x$have_nas" = xyes; then 437 NAS_CFLAGS="$X_CFLAGS" 438 NAS_LIBS="-laudio -lXau $X_LIBS" 439else 440 NAS_CFLAGS="" 441 NAS_LIBS="" 442fi 443AC_SUBST(NAS_CFLAGS) 444AC_SUBST(NAS_LIBS) 445 446dnl Check for pulse 447 448AC_ARG_ENABLE(pulse, [ --enable-pulse include PulseAudio output plugin ], 449[ BUILD_PULSE="$enableval" ],[ BUILD_PULSE="yes" ]) 450 451have_pulse="no"; 452if test "x$BUILD_PULSE" = "xyes" ; then 453 PKG_CHECK_MODULES(PULSE, [ libpulse-simple >= 0.9 ], 454 [have_pulse=yes],[have_pulse=no]) 455fi 456AC_SUBST(PULSE_LIBS) 457 458AM_CONDITIONAL(HAVE_PULSE,test "x$have_pulse" = xyes) 459 460dnl Orphaned driver. We'll probably dump it soon. 461AM_CONDITIONAL(HAVE_SOLARIS,test "x$have_solaris" = xyes) 462 463dnl Plugins get special LDFLAGS 464AC_SUBST(PLUGIN_LDFLAGS) 465 466 467AC_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]) 468 469AS_AC_EXPAND(LIBDIR, ${libdir}) 470AS_AC_EXPAND(INCLUDEDIR, ${includedir}) 471AS_AC_EXPAND(BINDIR, ${bindir}) 472AS_AC_EXPAND(DOCDIR, ${docdir}) 473 474AC_MSG_RESULT([ 475------------------------------------------------------------------------ 476 $PACKAGE $VERSION: Automatic configuration OK. 477 478 Backends to be built: 479 480 AU file output: .............. yes 481 RAW file output: ............. yes 482 WAV file output: ............. yes 483 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} 498 499 Installation paths: 500 501 libao: ....................... ${LIBDIR} 502 C header files: .............. ${INCLUDEDIR}/ao 503 Documentation: ............... ${DOCDIR} 504 505 Building: 506 507 Type 'make' to compile $PACKAGE. 508 509 Type 'make install' to install $PACKAGE. 510 511------------------------------------------------------------------------ 512]) 513