1 # Configure paths for libdv
2 # copied from vorbis.m4 by Thomas
3 # checks for libdv 0.9.5 since that added an extra argument to _init
4 # Shamelessly stolen from Owen Taylor and Manish Singh
6 dnl AM_PATH_LIBDV([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7 dnl Test for liblibdv, and define LIBDV_CFLAGS and LIBDV_LIBS
9 AC_DEFUN(AM_PATH_LIBDV,
11 dnl Get the cflags and libraries
13 AC_ARG_WITH(libdv,[ --with-libdv=PFX Prefix where libdv is installed (optional)], libdv_prefix="$withval", libdv_prefix="")
14 AC_ARG_WITH(libdv-libraries,[ --with-libdv-libraries=DIR Directory where libdv library is installed (optional)], libdv_libraries="$withval", libdv_libraries="")
15 AC_ARG_WITH(libdv-includes,[ --with-libdv-includes=DIR Directory where libdv header files are installed (optional)], libdv_includes="$withval", libdv_includes="")
16 AC_ARG_ENABLE(libdvtest, [ --disable-libdvtest Do not try to compile and run a test libdv program],, enable_libdvtest=yes)
18 if test "x$libdv_libraries" != "x" ; then
19 LIBDV_LIBS="-L$libdv_libraries"
20 elif test "x$libdv_prefix" != "x" ; then
21 LIBDV_LIBS="-L$libdv_prefix/lib"
22 elif test "x$prefix" != "xNONE"; then
23 LIBDV_LIBS="-L$prefix/lib"
26 LIBDV_LIBS="$LIBDV_LIBS -ldv -lm"
28 if test "x$libdv_includes" != "x" ; then
29 LIBDV_CFLAGS="-I$libdv_includes"
30 elif test "x$libdv_prefix" != "x" ; then
31 LIBDV_CFLAGS="-I$libdv_prefix/include"
32 elif test "x$prefix" != "xNONE"; then
33 LIBDV_CFLAGS="-I$prefix/include"
37 AC_MSG_CHECKING(for libdv)
41 if test "x$enable_libdvtest" = "xyes" ; then
42 ac_save_CFLAGS="$CFLAGS"
44 CFLAGS="$CFLAGS $LIBDV_CFLAGS"
45 LIBS="$LIBS $LIBDV_LIBS"
47 dnl Now check if the installed libdv is sufficiently new.
49 dnl rm -f conf.libdvtest
58 dv_decoder_new (0, 0, 0);
62 ],, no_libdv=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
63 CFLAGS="$ac_save_CFLAGS"
67 if test "x$no_libdv" = "x" ; then
69 ifelse([$1], , :, [$1])
72 if test -f conf.libdvtest ; then
75 echo "*** Could not run libdv test program, checking why..."
76 CFLAGS="$CFLAGS $LIBDV_CFLAGS"
77 LIBS="$LIBS $LIBDV_LIBS"
82 [ echo "*** The test program compiled, but did not run. This usually means"
83 echo "*** that the run-time linker is not finding libdv or finding the wrong"
84 echo "*** version of libdv. If it is not finding libdv, 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 libdv was incorrectly installed"
93 echo "*** or that you have moved libdv since it was installed." ])
94 CFLAGS="$ac_save_CFLAGS"
101 ifelse([$2], , :, [$2])
103 AC_SUBST(LIBDV_CFLAGS)
105 AC_SUBST(LIBDVFILE_LIBS)
106 AC_SUBST(LIBDVENC_LIBS)
107 dnl rm -f conf.libdvtest