]> sjero.net Git - linphone/blob - m4/video.m4
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / m4 / video.m4
1 AC_DEFUN([LP_CHECK_DEP],[
2         dnl $1=dependency description
3         dnl $2=dependency short name, will be suffixed with _CFLAGS and _LIBS
4         dnl $3=headers's place
5         dnl $4=lib's place
6         dnl $5=header to check
7         dnl $6=lib to check
8         dnl $7=function to check in library
9         
10         NAME=$2
11         dep_headersdir=$3
12         dep_libsdir=$4
13         dep_header=$5
14         dep_lib=$6
15         dep_funclib=$7
16         other_libs=$8   
17         
18         if test "$dep_headersdir" != "/usr/include" ; then
19                 eval ${NAME}_CFLAGS=\"-I$dep_headersdir \"
20         fi
21         eval ${NAME}_LIBS=\"-L$dep_libsdir -l$dep_lib\"
22         
23         CPPFLAGS_save=$CPPFLAGS
24         LDFLAGS_save=$LDFLAGS
25         CPPFLAGS="-I$dep_headersdir "
26         LDFLAGS="-L$dep_libsdir "
27         
28         AC_CHECK_HEADERS([$dep_header],[AC_CHECK_LIB([$dep_lib],[$dep_funclib],found=yes,found=no, [$other_libs])
29         ],found=no)
30         
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)
36         else
37                 eval ${NAME}_found=no
38                 eval ${NAME}_CFLAGS=
39                 eval ${NAME}_LIBS=
40         fi
41         CPPFLAGS=$CPPFLAGS_save
42         LDFLAGS=$LDFLAGS_save
43         
44 ])
45
46
47 AC_DEFUN([LP_CHECK_VIDEO],[
48
49         dnl conditionnal build of video support
50         AC_ARG_ENABLE(video,
51                   [  --enable-video    Turn on video support compiling: not functionnal for the moment],
52                   [case "${enableval}" in
53                         yes) video=true ;;
54                         no)  video=false ;;
55                         *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
56                   esac],[video=false])
57                   
58         AC_ARG_WITH( ffmpeg,
59                   [  --with-ffmpeg              Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
60                   [ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
61         
62         AC_ARG_WITH( sdl,
63                   [  --with-sdl         Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
64                   [ libsdldir=${withval}],[ libsdldir=/usr ])
65         
66         if test "$video" = "true"; then
67                 
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])
72                 dnl fi
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]) ])
74                 
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])
78                 fi
79         
80                 VIDEO_CFLAGS=" $FFMPEG_CFLAGS $SDL_CFLAGS"
81                 VIDEO_LIBS=" $FFMPEG_LIBS $SDL_LIBS"
82                 
83                 AC_DEFINE(VIDEO_ENABLED,1,[Set when video support is enabled])
84                 
85         fi
86         
87         AC_SUBST(VIDEO_CFLAGS)
88         AC_SUBST(VIDEO_LIBS)
89 ])