1 # Configure paths for libebml
3 dnl PATH_EBML([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
4 dnl Test for libebml, and define EBML_CFLAGS and EBML_LIBS
8 dnl Get the cflags and libraries
10 AC_ARG_WITH(ebml-prefix,[ --with-ebml-prefix=PFX Prefix where libebml is installed (optional)], ebml_prefix="$withval", ebml_prefix="")
11 AC_ARG_WITH(ebml-include,[ --with-ebml-include=DIR Path to where the libebml include files installed (optional)], ebml_include="$withval", ebml_include="")
12 AC_ARG_WITH(ebml-lib,[ --with-ebml-lib=DIR Path to where the libebml library installed (optional)], ebml_lib="$withval", ebml_lib="")
13 AC_ARG_ENABLE(ebmltest, [ --disable-ebmltest Do not try to compile and run a test EBML program],, enable_ebmltest=yes)
15 if test "x$ebml_prefix" != "x"; then
16 ebml_args="$ebml_args --prefix=$ebml_prefix"
17 if test "x$ebml_include" != "x"; then
18 EBML_CFLAGS="-I$ebml_include"
20 EBML_CFLAGS="-I$ebml_prefix/include/ebml"
22 if test "x$ebml_lib" != "x"; then
23 EBML_LIBS="-L$ebml_lib"
25 EBML_LIBS="-L$ebml_prefix/lib"
27 elif test "x$prefix" != "xNONE"; then
28 ebml_args="$ebml_args --prefix=$prefix"
29 if test "x$ebml_include" != "x"; then
30 EBML_CFLAGS="-I$ebml_include"
32 EBML_CFLAGS="-I$prefix/include/ebml"
34 if test "x$ebml_lib" != "x"; then
35 EBML_LIBS="-L$ebml_lib"
37 EBML_LIBS="-L$prefix/lib"
40 if test "x$ebml_include" != "x"; then
41 EBML_CFLAGS="-I$ebml_include"
43 EBML_CFLAGS="-I/usr/include/ebml -I/usr/local/include/ebml"
45 if test "x$ebml_lib" != "x"; then
46 EBML_LIBS="-L$ebml_lib"
48 EBML_LIBS="-L/usr/local/lib"
52 EBML_LIBS="$EBML_LIBS -lebml"
54 AC_MSG_CHECKING(for EBML)
58 if test "x$enable_ebmltest" = "xyes" ; then
59 ac_save_CFLAGS="$CFLAGS"
61 CFLAGS="$CFLAGS $EBML_CFLAGS"
62 LIBS="$LIBS $EBML_LIBS"
64 dnl Now check if the installed EBML is sufficiently new.
71 #include <EbmlConfig.h>
75 system("touch conf.ebmltest");
79 ],, no_ebml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
80 CFLAGS="$ac_save_CFLAGS"
84 if test "x$no_ebml" = "x" ; then
86 ifelse([$1], , :, [$1])
89 if test -f conf.ebmltest ; then
92 echo "*** Could not run Ebml test program, checking why..."
93 CFLAGS="$CFLAGS $EBML_CFLAGS"
94 LIBS="$LIBS $EBML_LIBS"
97 #include <EbmlConfig.h>
99 [ echo "*** The test program compiled, but did not run. This usually means"
100 echo "*** that the run-time linker is not finding EBML or finding the wrong"
101 echo "*** version of EBML. If it is not finding EBML, you'll need to set your"
102 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
103 echo "*** to the installed location Also, make sure you have run ldconfig if that"
104 echo "*** is required on your system"
106 echo "*** If you have an old version installed, it is best to remove it, although"
107 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
108 [ echo "*** The test program failed to compile or link. See the file config.log for the"
109 echo "*** exact error that occured. This usually means EBML was incorrectly installed"
110 echo "*** or that you have moved EBML since it was installed." ])
111 CFLAGS="$ac_save_CFLAGS"
116 ifelse([$2], , :, [$2])
118 AC_SUBST(EBML_CFLAGS)
123 # Configure paths for libmatroska
125 dnl PATH_MATROSKA(MIN_VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
126 dnl Test for libmatroska, and define MATROSKA_CFLAGS and MATROSKA_LIBS
128 AC_DEFUN([PATH_MATROSKA],
130 dnl Get the cflags and libraries
132 AC_ARG_WITH(matroska-prefix,[ --with-matroska-prefix=PFX Prefix where libmatroska is installed (optional)], matroska_prefix="$withval", matroska_prefix="")
133 AC_ARG_WITH(matroska-include,[ --with-matroska-include=DIR Path to where the libmatroska include files installed (optional)], matroska_include="$withval", matroska_include="")
134 AC_ARG_WITH(matroska-lib,[ --with-matroska-lib=DIR Path to where the libmatroska library installed (optional)], matroska_lib="$withval", matroska_lib="")
135 AC_ARG_ENABLE(matroskatest, [ --disable-matroskatest Do not try to compile and run a test Matroska program],, enable_matroskatest=yes)
137 if test "x$matroska_prefix" != "x"; then
138 matroska_args="$matroska_args --prefix=$matroska_prefix"
139 if test "x$matroska_include" != "x"; then
140 MATROSKA_CFLAGS="-I$matroska_include"
142 MATROSKA_CFLAGS="-I$matroska_prefix/include/matroska"
144 if test "x$matroska_lib" != "x"; then
145 MATROSKA_LIBS="-L$matroska_lib"
147 MATROSKA_LIBS="-L$matroska_prefix/lib"
149 elif test "x$prefix" != "xNONE"; then
150 matroska_args="$matroska_args --prefix=$prefix"
151 if test "x$matroska_include" != "x"; then
152 MATROSKA_CFLAGS="-I$matroska_include"
154 MATROSKA_CFLAGS="-I$prefix/include/matroska"
156 if test "x$matroska_lib" != "x"; then
157 MATROSKA_LIBS="-L$matroska_lib"
159 MATROSKA_LIBS="-L$prefix/lib"
162 if test "x$matroska_include" != "x"; then
163 MATROSKA_CFLAGS="-I$matroska_include"
165 MATROSKA_CFLAGS="-I/usr/include/matroska -I/usr/local/include/matroska"
167 if test "x$matroska_lib" != "x"; then
168 MATROSKA_LIBS="-L$matroska_lib"
170 MATROSKA_LIBS="-L/usr/local/lib"
174 MATROSKA_LIBS="$MATROSKA_LIBS -lmatroska"
176 AC_MSG_CHECKING(for Matroska)
180 if test "x$enable_matroskatest" = "xyes" ; then
181 ac_save_CXXFLAGS="$CXXFLAGS"
183 CXXFLAGS="$CXXFLAGS $MATROSKA_CFLAGS $EBML_CFLAGS"
184 LIBS="$LIBS $MATROSKA_LIBS $EBML_LIBS"
186 dnl Now check if the installed Matroska is sufficiently new.
188 rm -f conf.matroskatest
194 #include <EbmlConfig.h>
195 #include <KaxVersion.h>
197 using namespace LIBMATROSKA_NAMESPACE;
202 f = fopen("conf.matroskatest", "wb");
205 fprintf(f, "%s\n", KaxCodeVersion.c_str());
210 ],, no_matroska=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
212 CXXFLAGS="$ac_save_CXXFLAGS"
216 if test "x$no_matroska" = "x" -a -f conf.matroskatest ; then
219 AC_MSG_CHECKING(Matroska version)
221 matroska_version=`cat conf.matroskatest`
222 mk_MAJVER=`echo $1 | cut -d"." -f1`
223 mk_MINVER=`echo $1 | cut -d"." -f2`
224 mk_RELVER=`echo $1 | cut -d"." -f3`
225 mver_ok=`sed 's;\.;\ ;g' < conf.matroskatest | (read -a mver
226 if test ${mver[[0]]} -gt $mk_MAJVER ; then
228 elif test ${mver[[0]]} -lt $mk_MAJVER ; then
231 if test ${mver[[1]]} -gt $mk_MINVER ; then
233 elif test ${mver[[1]]} -lt $mk_MINVER ; then
236 if test ${mver[[2]]} -ge $mk_RELVER ; then
244 if test "$mver_ok" = "1" ; then
245 AC_MSG_RESULT($matroska_version ok)
246 ifelse([$2], , :, [$2])
248 AC_MSG_RESULT($matroska_version too old)
249 echo '*** Your Matroska version is too old. Upgrade to at least version'
250 echo '*** $1 and re-run configure.'
251 ifelse([$3], , :, [$3])
256 ifelse([$3], , :, [$3])
259 AC_SUBST(MATROSKA_CFLAGS)
260 AC_SUBST(MATROSKA_LIBS)
261 rm -f conf.matroskatest