1 # Configure paths for libspeex
2 # Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
3 # Shamelessly stolen from:
4 # Jack Moffitt <jack@icecast.org> 10-21-2000
5 # Shamelessly stolen from Owen Taylor and Manish Singh
7 dnl XIPH_PATH_SPEEX([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
8 dnl Test for libspeex, and define SPEEX_CFLAGS and SPEEX_LIBS
10 AC_DEFUN([XIPH_PATH_SPEEX],
12 dnl Get the cflags and libraries
14 AC_ARG_WITH(speex,[ --with-speex=PFX Prefix where libspeex is installed (optional)], speex_prefix="$withval", speex_prefix="")
15 AC_ARG_WITH(speex-libraries,[ --with-speex-libraries=DIR Directory where libspeex library is installed (optional)], speex_libraries="$withval", speex_libraries="")
16 AC_ARG_WITH(speex-includes,[ --with-speex-includes=DIR Directory where libspeex header files are installed (optional)], speex_includes="$withval", speex_includes="")
17 AC_ARG_ENABLE(speextest, [ --disable-speextest Do not try to compile and run a test Speex program],, enable_speextest=yes)
19 if test "x$speex_libraries" != "x" ; then
20 SPEEX_LIBS="-L$speex_libraries"
21 elif test "x$speex_prefix" != "x" ; then
22 SPEEX_LIBS="-L$speex_prefix/lib"
23 elif test "x$prefix" != "xNONE" ; then
24 SPEEX_LIBS="-L$prefix/lib"
27 SPEEX_LIBS="$SPEEX_LIBS -lspeex"
29 if test "x$speex_includes" != "x" ; then
30 SPEEX_CFLAGS="-I$speex_includes"
31 elif test "x$speex_prefix" != "x" ; then
32 SPEEX_CFLAGS="-I$speex_prefix/include"
33 elif test "x$prefix" != "xNONE"; then
34 SPEEX_CFLAGS="-I$prefix/include"
37 AC_MSG_CHECKING(for Speex)
41 if test "x$enable_speextest" = "xyes" ; then
42 ac_save_CFLAGS="$CFLAGS"
44 CFLAGS="$CFLAGS $SPEEX_CFLAGS"
45 LIBS="$LIBS $SPEEX_LIBS"
47 dnl Now check if the installed Speex is sufficiently new.
54 #include <speex/speex.h>
58 system("touch conf.speextest");
62 ],, no_speex=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
63 CFLAGS="$ac_save_CFLAGS"
67 if test "x$no_speex" = "x" ; then
69 ifelse([$1], , :, [$1])
72 if test -f conf.speextest ; then
75 echo "*** Could not run Speex test program, checking why..."
76 CFLAGS="$CFLAGS $SPEEX_CFLAGS"
77 LIBS="$LIBS $SPEEX_LIBS"
80 #include <speex/speex.h>
82 [ echo "*** The test program compiled, but did not run. This usually means"
83 echo "*** that the run-time linker is not finding Speex or finding the wrong"
84 echo "*** version of Speex. If it is not finding Speex, you'll need to set your"
85 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
86 echo "*** to the installed location Also, make sure you have run ldconfig if that"
87 echo "*** is required on your system"
89 echo "*** If you have an old version installed, it is best to remove it, although"
90 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
91 [ echo "*** The test program failed to compile or link. See the file config.log for the"
92 echo "*** exact error that occured. This usually means Speex was incorrectly installed"
93 echo "*** or that you have moved Speex since it was installed." ])
94 CFLAGS="$ac_save_CFLAGS"
99 ifelse([$2], , :, [$2])
101 AC_SUBST(SPEEX_CFLAGS)