1# ao.m4 2# Configure paths for libao 3# Jack Moffitt <jack@icecast.org> 10-21-2000 4# Shamelessly stolen from Owen Taylor and Manish Singh 5 6dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 7dnl Test for libao, and define AO_CFLAGS and AO_LIBS 8dnl 9AC_DEFUN([XIPH_PATH_AO], 10[dnl 11dnl Get the cflags and libraries 12dnl 13AC_ARG_WITH(ao, 14 AS_HELP_STRING([--with-ao=PFX], [Prefix where libao is installed (optional)]), 15 [ao_prefix="$withval"], [ao_prefix=""]) 16AC_ARG_WITH(ao-libraries, 17 AS_HELP_STRING([--with-ao-libraries=DIR], 18 [Directory where libao library is installed (optional)]), 19 [ao_libraries="$withval"], [ao_libraries=""]) 20AC_ARG_WITH(ao-includes, 21 AS_HELP_STRING([--with-ao-includes=DIR], 22 [Directory where libao header files are installed (optional)]), 23 [ao_includes="$withval"], [ao_includes=""]) 24AC_ARG_ENABLE(aotest, 25 AS_HELP_STRING([--disable-aotest], 26 [Do not try to compile and run a test ao program]),, 27 [enable_aotest=yes]) 28 29 30 if test "x$ao_libraries" != "x" ; then 31 AO_LIBS="-L$ao_libraries" 32 elif test "x$ao_prefix" != "x"; then 33 AO_LIBS="-L$ao_prefix/lib" 34 elif test "x$prefix" != "xNONE"; then 35 AO_LIBS="-L$prefix/lib" 36 fi 37 38 if test "x$ao_includes" != "x" ; then 39 AO_CFLAGS="-I$ao_includes" 40 elif test "x$ao_prefix" != "x"; then 41 AO_CFLAGS="-I$ao_prefix/include" 42 elif test "x$prefix" != "xNONE"; then 43 AO_CFLAGS="-I$prefix/include" 44 fi 45 46 # see where dl* and friends live 47 AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [ 48 AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [ 49 AC_MSG_WARN([could not find dlopen() needed by libao sound drivers 50 your system may not be supported.]) 51 ]) 52 ]) 53 54 AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS" 55 56 AC_MSG_CHECKING(for ao) 57 no_ao="" 58 59 60 if test "x$enable_aotest" = "xyes" ; then 61 ac_save_CFLAGS="$CFLAGS" 62 ac_save_LIBS="$LIBS" 63 CFLAGS="$CFLAGS $AO_CFLAGS" 64 LIBS="$LIBS $AO_LIBS" 65dnl 66dnl Now check if the installed ao is sufficiently new. 67dnl 68 rm -f conf.aotest 69 AC_TRY_RUN([ 70#include <stdio.h> 71#include <stdlib.h> 72#include <string.h> 73#include <ao/ao.h> 74 75int main () 76{ 77 system("touch conf.aotest"); 78 return 0; 79} 80 81],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 82 CFLAGS="$ac_save_CFLAGS" 83 LIBS="$ac_save_LIBS" 84 fi 85 86 if test "x$no_ao" = "x" ; then 87 AC_MSG_RESULT(yes) 88 ifelse([$1], , :, [$1]) 89 else 90 AC_MSG_RESULT(no) 91 if test -f conf.aotest ; then 92 : 93 else 94 echo "*** Could not run ao test program, checking why..." 95 CFLAGS="$CFLAGS $AO_CFLAGS" 96 LIBS="$LIBS $AO_LIBS" 97 AC_TRY_LINK([ 98#include <stdio.h> 99#include <ao/ao.h> 100], [ return 0; ], 101 [ echo "*** The test program compiled, but did not run. This usually means" 102 echo "*** that the run-time linker is not finding ao or finding the wrong" 103 echo "*** version of ao. If it is not finding ao, you'll need to set your" 104 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 105 echo "*** to the installed location Also, make sure you have run ldconfig if that" 106 echo "*** is required on your system" 107 echo "***" 108 echo "*** If you have an old version installed, it is best to remove it, although" 109 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 110 [ echo "*** The test program failed to compile or link. See the file config.log for the" 111 echo "*** exact error that occured. This usually means ao was incorrectly installed" 112 echo "*** or that you have moved ao since it was installed." ]) 113 CFLAGS="$ac_save_CFLAGS" 114 LIBS="$ac_save_LIBS" 115 fi 116 AO_CFLAGS="" 117 AO_LIBS="" 118 ifelse([$2], , :, [$2]) 119 fi 120 AC_SUBST(AO_CFLAGS) 121 AC_SUBST(AO_LIBS) 122 rm -f conf.aotest 123]) 124