[vls-devel] Re: patch for configure.in to take care of ffmpeg compiled with mp3lame

Jean-Paul Saman saman at natlab.research.philips.com
Mon Aug 18 10:33:14 CEST 2003


Tristan Leteurtre wrote:
> On Mon, Aug 18, 2003, Jean-Paul Saman wrote:
> 
>>- It would be better to try and detect the presence of the lame library 
>>inside ffmpeg configure item, e.g: checking if "--with-mp3lame" is set.


> Sure. Is there a proper way to do that ?

When there is an option --with-mp3lame then you could do the same as 
ffmpeg libavcodec detection.

AC_ARG_WITH(mp3lame,
AC_HELP_STRING(--with-mp3lame=[PATH], path to lame header files))

[..snip..]

dnl Test for lame.h
   AC_MSG_CHECKING(for lame headers in ${with_mp3lame})
   if test "x$with_mp3lame" != x
   then
     test_CFLAGS="-I${with_mp3lame/include"
   fi
   save_CPPFLAGS="${CPPFLAGS}"
   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
   AC_CHECK_HEADERS([lame.h],
                    [V4LINPUT_CCFLAGS="${V4LINPUT_CCFLAGS} ${test_CFLAGS}"
                     V4LINPUT_DCFLAGS="${V4LINPUT_DCFLAGS} ${test_CFLAGS}"],
                    [AC_MSG_ERROR([Could not find mp3lame headers])])
   CPPFLAGS="${save_CPPFLAGS}"

dnl Test for the lib existence
   if test -f "${with_mp3lame}/libmp3lame/libmp3lame.a"
   then
     V4LINPUT_LIB="${V4LINPUT_LIB} ${with_mp3lame}/libmp3lame/libmp3lame.a"
     V4LINPUT_DCFLAGS="${V4LINPUT_DCFLAGS} -I${with_mp3lame}/include"
     V4LINPUT_LCFLAGS="${V4LINPUT_LCFLAGS} -L${with_mp3lame}/libmp3lame"
     BUILTINS="${BUILTINS} v4linput v4lreader raw2ts"
   else
     AC_MSG_ERROR([cannot find ${with_mp3lame}/libmp3lame/libmp3lame.a, 
make sure
you compiled libmp3lame in ${with_libmp3lame}/libmp3lame])
   fi
fi

Ehmmmmmmmm, this looks exactly a lot like Phillipe van Hecke did, but 
just a tad different.

The result is that when --with-mp3lame is ommitted it is assumed that 
ffmepg is built without. But when it is added then it is assumed that 
ffmpeg is built with mp3lame support.

Alternatives:
-------------
More elaborate tests could be made with AC_TRY_RUN( ) e.g: something 
like this:

#include <libavcodec/libavcodec.h>
#inlcude <lame.h>
main (void) {
   // think of something that forces a link with mp3lame.
}

But the downside is that these tests are not that portable. So then a 
caching value should take presedence above the actually test.

Or do a CHECK_LIB() to support a known function e.g: lame_init_old() 
inside mp3lame. Check autoconf user manual how to do this. This test is 
more portable AFAIK.

-- 
Kind greetings,

Jean-Paul Saman



-- 
This is the vls-devel mailing-list, see http://www.videolan.org/streaming/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the vls-devel mailing list