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