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