2 AC_DEFUN([MS_CHECK_DEP],[
3 dnl $1=dependency description
4 dnl $2=dependency short name, will be suffixed with _CFLAGS and _LIBS
9 dnl $7=function to check in library
19 CPPFLAGS_save=$CPPFLAGS
25 ms_check_dep_mingw_found=yes
28 if test "$ms_check_dep_mingw_found" != "yes" ; then
29 CPPFLAGS=`echo "-I$dep_headersdir"|sed -e "s:-I/usr/include[\ ]*$::"`
30 LDFLAGS=`echo "-L$dep_libsdir"|sed -e "s:-L/usr/lib\(64\)*[\ ]*::"`
32 CPPFLAGS="-I$dep_headersdir"
33 LDFLAGS="-L$dep_libsdir"
41 $2_LIBS="$LDFLAGS $LIBS"
43 AC_CHECK_HEADERS([$dep_header],[AC_CHECK_LIB([$dep_lib],[$dep_funclib],found=yes,found=no, [$other_libs])
46 if test "$found" = "yes" ; then
55 CPPFLAGS=$CPPFLAGS_save
61 AC_DEFUN([MS_CHECK_VIDEO],[
63 dnl conditionnal build of video support
65 [ --enable-video Turn on video support compiling],
66 [case "${enableval}" in
69 *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
73 [ --with-ffmpeg Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
74 [ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
76 if test "$video" = "true"; then
78 dnl test for ffmpeg presence
79 PKG_CHECK_MODULES(FFMPEG, [libavcodec >= 51.0.0 ],ffmpeg_found=yes , ffmpeg_found=no)
80 if test x$ffmpeg_found = xno ; then
81 AC_MSG_ERROR([Could not find libavcodec (from ffmpeg) headers and library. This is mandatory for video support])
83 PKG_CHECK_MODULES(SWSCALE, [libswscale >= 0.7.0 ],swscale_found=yes , swscale_found=no)
84 if test x$swscale_found = xno ; then
85 AC_MSG_ERROR([Could not find libswscale (from ffmpeg) headers and library. This is mandatory for video support])
88 dnl check for new/old ffmpeg header file layout
89 CPPFLAGS_save=$CPPFLAGS
90 CPPFLAGS="$FFMPEG_CFLAGS $CPPFLAGS"
91 AC_CHECK_HEADERS(libavcodec/avcodec.h)
92 CPPFLAGS=$CPPFLAGS_save
94 dnl to workaround a bug on debian and ubuntu, check if libavcodec needs -lvorbisenc to compile
95 AC_CHECK_LIB(avcodec,avcodec_register_all, novorbis=yes , [
96 LIBS="$LIBS -lvorbisenc"
99 dnl when swscale feature is not provided by
100 dnl libswscale, its features are swallowed by
101 dnl libavcodec, but without swscale.h and without any
102 dnl declaration into avcodec.h (this is to be
103 dnl considered as an ffmpeg bug).
105 dnl #if defined(HAVE_LIBAVCODEC_AVCODEC_H) && !defined(HAVE_LIBSWSCALE_SWSCALE_H)
106 dnl # include "swscale.h" // private linhone swscale.h
108 CPPFLAGS_save=$CPPFLAGS
109 CPPFLAGS="$SWSCALE_CFLAGS $CPPFLAGS"
110 AC_CHECK_HEADERS(libswscale/swscale.h)
111 CPPFLAGS=$CPPFLAGS_save
114 [ --disable-sdl Disable SDL support],
115 [case "${enableval}" in
116 yes) enable_sdl=true ;;
117 no) enable_sdl=false ;;
118 *) AC_MSG_ERROR(bad value ${enableval} for --disable-sdl) ;;
119 esac],[enable_sdl=true])
122 if test "$enable_sdl" = "true"; then
123 PKG_CHECK_MODULES(SDL, [sdl >= 1.2.0 ],sdl_found=yes,sdl_found=no)
125 if test "$sdl_found" = "no" && test "$mingw_found" != "yes"; then
126 AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
130 AC_ARG_ENABLE(theora,
131 [ --disable-theora Disable theora support],
132 [case "${enableval}" in
135 *) AC_MSG_ERROR(bad value ${enableval} for --disable-theora) ;;
138 if test x$theora = xtrue; then
139 PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7 ], [have_theora=yes],
144 [ --disable-x11 Disable X11 support],
145 [case "${enableval}" in
146 yes) enable_x11=true ;;
147 no) enable_x11=false ;;
148 *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
149 esac],[enable_x11=true])
151 if test "$enable_x11" = "true"; then
152 AC_CHECK_HEADERS(X11/Xlib.h)
155 VIDEO_CFLAGS=" $FFMPEG_CFLAGS -DVIDEO_ENABLED"
156 VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS"
158 if test "$sdl_found" = "yes" ; then
159 VIDEO_CFLAGS="$VIDEO_CFLAGS $SDL_CFLAGS -DHAVE_SDL"
160 VIDEO_LIBS="$VIDEO_LIBS $SDL_LIBS"
163 if test "${ac_cv_header_X11_Xlib_h}" = "yes" ; then
164 VIDEO_LIBS="$VIDEO_LIBS -lX11"
167 if test "$mingw_found" = "yes" ; then
168 VIDEO_LIBS="$VIDEO_LIBS -lvfw32"
173 LIBS="$LIBS -framework QuickTime"
178 AC_SUBST(VIDEO_CFLAGS)