Commit 472b2f19 authored by Christophe Mutricy's avatar Christophe Mutricy

Reorder the ffmpeg detection. Please test, there is so many corner case :(

parent 3004ad4e
...@@ -2348,35 +2348,13 @@ AC_CHECK_HEADERS(id3tag.h, [ ...@@ -2348,35 +2348,13 @@ AC_CHECK_HEADERS(id3tag.h, [
dnl dnl
dnl ffmpeg decoder/demuxer plugin dnl ffmpeg decoder/demuxer plugin
dnl dnl
dnl we try to find ffmpeg using : 1- ffmpeg-config, 2- pkg-config dnl we try to find ffmpeg using : 1- given tree 2- ffmpeg-config, 3- pkg-config
dnl 3- default place, 4- given tree dnl 4- default place,
AC_ARG_ENABLE(ffmpeg, AC_ARG_ENABLE(ffmpeg,
[ --enable-ffmpeg ffmpeg codec (default enabled)]) [ --enable-ffmpeg ffmpeg codec (default enabled)])
if test "${enable_ffmpeg}" != "no" if test "${enable_ffmpeg}" != "no"
then then
dnl Look for a ffmpeg-config (we are on debian )
FFMPEG_PATH="${PATH}"
AC_ARG_WITH(ffmpeg-config-path,
[ --with-ffmpeg-config-path=PATH ffmpeg-config path (default search in \$PATH)],
[ if test "${with_ffmpeg_config_path}" != "no"
then
FFMPEG_PATH="${with_ffmpeg_config_path}"
fi ])
AC_PATH_PROG(FFMPEG_CONFIG, ffmpeg-config, no, ${FFMPEG_PATH})
if test "${FFMPEG_CONFIG}" != "no"
then
AC_CHECK_HEADERS(ffmpeg/avcodec.h)
AC_CHECK_HEADERS(postproc/postprocess.h)
VLC_ADD_PLUGINS([ffmpeg])
if test "${enable_sout}" != "no"; then
VLC_ADD_PLUGINS([stream_out_switcher])
fi
VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --cflags`])
VLC_ADD_LDFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --plugin-libs avcodec avformat postproc`])
else
dnl Those options have to be here because the .pc can be bogus for ffmpeg previous nov 05 dnl Those options have to be here because the .pc can be bogus for ffmpeg previous nov 05
...@@ -2412,53 +2390,12 @@ dnl Those options have to be here because the .pc can be bogus for ffmpeg previo ...@@ -2412,53 +2390,12 @@ dnl Those options have to be here because the .pc can be bogus for ffmpeg previo
VLC_ADD_LDFLAGS([ffmpeg],[-lz]) VLC_ADD_LDFLAGS([ffmpeg],[-lz])
fi]) fi])
dnl Trying with pkg-config
PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat],
[
AC_CHECK_HEADERS(ffmpeg/avcodec.h)
AC_CHECK_HEADERS(postproc/postprocess.h)
VLC_ADD_BUILTINS([ffmpeg])
if test "${enable_sout}" != "no"; then
VLC_ADD_BUILTINS([stream_out_switcher])
fi
VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}])
VLC_ADD_LDFLAGS([ffmpeg],[${FFMPEG_LIBS}])
],[
dnl
dnl test for !(--with-ffmpeg-tree)
dnl
if test "${with_ffmpeg_tree}" = "no" -o -z "${with_ffmpeg_tree}"; then
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
AC_CHECK_HEADERS(ffmpeg/avcodec.h, [], [AC_MSG_ERROR([Missing header file ffmpeg/avcodec.h.])] )
AC_CHECK_HEADERS(postproc/postprocess.h, [], [AC_MSG_ERROR([Missing header file postproc/postprocess.h.])] )
AC_CHECK_LIB(avutil, av_add_i, [
VLC_ADD_LDFLAGS([ffmpeg],[-lavutil])
LDAVUTIL="-lavutil"])
AC_CHECK_LIB(avcodec, avcodec_init, [
VLC_ADD_BUILTINS([ffmpeg])
VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
if test "${enable_sout}" != "no"; then
VLC_ADD_BUILTINS([stream_out_switcher])
fi],
[ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (cvs version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ], [$LDAVUTIL])
AC_CHECK_LIB(avformat, av_open_input_stream, [
AC_DEFINE(HAVE_LIBAVFORMAT, 1,
[Define if you have ffmpeg's libavformat.])
VLC_ADD_LDFLAGS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
LDFLAGS="${LDFLAGS_save}"
CPPFLAGS="${CPPFLAGS_save}"
fi
dnl dnl
dnl test for --with-ffmpeg-tree dnl test for --with-ffmpeg-tree
dnl dnl
AC_ARG_WITH(ffmpeg-tree,
[ --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then
AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree}) AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`" real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
...@@ -2532,16 +2469,79 @@ dnl Trying with pkg-config ...@@ -2532,16 +2469,79 @@ dnl Trying with pkg-config
VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavformat ${real_ffmpeg_tree}/libavformat/libavformat.a]) VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavformat ${real_ffmpeg_tree}/libavformat/libavformat.a])
VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavformat]) VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavformat])
fi fi
else
dnl Look for a ffmpeg-config (we are on debian )
FFMPEG_PATH="${PATH}"
AC_ARG_WITH(ffmpeg-config-path,
[ --with-ffmpeg-config-path=PATH ffmpeg-config path (default search in \$PATH)],
[ if test "${with_ffmpeg_config_path}" != "no"
then
FFMPEG_PATH="${with_ffmpeg_config_path}"
fi ])
AC_PATH_PROG(FFMPEG_CONFIG, ffmpeg-config, no, ${FFMPEG_PATH})
if test "${FFMPEG_CONFIG}" != "no"
then
AC_CHECK_HEADERS(ffmpeg/avcodec.h)
AC_CHECK_HEADERS(postproc/postprocess.h)
VLC_ADD_PLUGINS([ffmpeg])
if test "${enable_sout}" != "no"; then
VLC_ADD_PLUGINS([stream_out_switcher])
fi
VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --cflags`])
VLC_ADD_LDFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --plugin-libs avcodec avformat postproc`])
else
dnl Trying with pkg-config
PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat],
[
AC_CHECK_HEADERS(ffmpeg/avcodec.h)
AC_CHECK_HEADERS(postproc/postprocess.h)
VLC_ADD_BUILTINS([ffmpeg])
if test "${enable_sout}" != "no"; then
VLC_ADD_BUILTINS([stream_out_switcher])
fi fi
]) VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}])
AC_ARG_WITH(ffmpeg-tree, VLC_ADD_LDFLAGS([ffmpeg],[${FFMPEG_LIBS}])
[ --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
],[
dnl
dnl last chance: at the default place
dnl
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
AC_CHECK_HEADERS(ffmpeg/avcodec.h, [], [AC_MSG_ERROR([Missing header file ffmpeg/avcodec.h.])] )
AC_CHECK_HEADERS(postproc/postprocess.h, [], [AC_MSG_ERROR([Missing header file postproc/postprocess.h.])] )
AC_CHECK_LIB(avutil, av_add_i, [
VLC_ADD_LDFLAGS([ffmpeg],[-lavutil])
LDAVUTIL="-lavutil"])
AC_CHECK_LIB(avcodec, avcodec_init, [
VLC_ADD_BUILTINS([ffmpeg])
VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
if test "${enable_sout}" != "no"; then
VLC_ADD_BUILTINS([stream_out_switcher])
fi],
[ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (cvs version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ], [$LDAVUTIL])
AC_CHECK_LIB(avformat, av_open_input_stream, [
AC_DEFINE(HAVE_LIBAVFORMAT, 1,
[Define if you have ffmpeg's libavformat.])
VLC_ADD_LDFLAGS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
LDFLAGS="${LDFLAGS_save}"
CPPFLAGS="${CPPFLAGS_save}"
])
fi
fi fi
fi fi
dnl dnl
dnl ffmpeg decoder/demuxer plugin dnl ffmpegaltivec plugin
dnl dnl
AC_ARG_ENABLE(ffmpegaltivec, AC_ARG_ENABLE(ffmpegaltivec,
[ --enable-ffmpegaltivec ffmpegaltivec codec (DO NOT USE)]) [ --enable-ffmpegaltivec ffmpegaltivec codec (DO NOT USE)])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment