1 AC_DEFUN([LP_CHECK_DEP],[
2 dnl $1=dependency description
3 dnl $2=dependency short name, will be suffixed with _CFLAGS and _LIBS
8 dnl $7=function to check in library
18 if test "$dep_headersdir" != "/usr/include" ; then
19 eval ${NAME}_CFLAGS=\"-I$dep_headersdir \"
21 eval ${NAME}_LIBS=\"-L$dep_libsdir -l$dep_lib\"
23 CPPFLAGS_save=$CPPFLAGS
25 CPPFLAGS="-I$dep_headersdir "
26 LDFLAGS="-L$dep_libsdir "
28 AC_CHECK_HEADERS([$dep_header],[AC_CHECK_LIB([$dep_lib],[$dep_funclib],found=yes,found=no, [$other_libs])
31 if test "$found" = "yes" ; then
32 eval ${NAME}_found=yes
33 AC_DEFINE([HAVE_${NAME}],1,[Defined when we have found $1])
34 AC_SUBST(${NAME}_CFLAGS)
35 AC_SUBST(${NAME}_LIBS)
41 CPPFLAGS=$CPPFLAGS_save
47 AC_DEFUN([LP_CHECK_VIDEO],[
49 dnl conditionnal build of video support
51 [ --enable-video Turn on video support compiling: not functionnal for the moment],
52 [case "${enableval}" in
55 *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
59 [ --with-ffmpeg Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
60 [ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
63 [ --with-sdl Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
64 [ libsdldir=${withval}],[ libsdldir=/usr ])
66 if test "$video" = "true"; then
68 dnl test for ffmpeg presence
69 dnl LP_CHECK_DEP([ffmpeg],[FFMPEG],[${ffmpegdir}/include/ffmpeg],[${ffmpegdir}/lib],[avcodec.h],[avcodec],[avcodec_init], [-lavutils -lm])
70 dnl if test "$FFMPEG_found" = "no" ; then
71 dnl AC_MSG_ERROR([Could not find ffmpeg headers and library. This is mandatory for video support])
73 PKG_CHECK_MODULES(FFMPEG, [libavcodec >= 50.0.0 ], , [ AC_MSG_ERROR([Could not find ffmpeg headers and library. This is mandatory for video support]) ])
75 LP_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
76 if test "$SDL_found" = "no" ; then
77 AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
80 VIDEO_CFLAGS=" $FFMPEG_CFLAGS $SDL_CFLAGS"
81 VIDEO_LIBS=" $FFMPEG_LIBS $SDL_LIBS"
83 AC_DEFINE(VIDEO_ENABLED,1,[Set when video support is enabled])
87 AC_SUBST(VIDEO_CFLAGS)