]> git.sesse.net Git - ffmpeg/blobdiff - configure
Support setting the debuglevel (-g level) with --enable-debug=#
[ffmpeg] / configure
index 189f6e84549ae848f399492d53329f89d256b50c..591863347c3a4b18734bcbced37809d1231218ba 100755 (executable)
--- a/configure
+++ b/configure
@@ -68,8 +68,12 @@ show_help(){
   echo "  --disable-shared         do not build shared libraries [default=yes]"
   echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
   echo "                           and ffmpeg will be under GPL [default=no]"
+  echo "  --enable-nonfree         allow use of nonfree code, the resulting libav*"
+  echo "                           and ffmpeg will be unredistributable [default=no]"
   echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
   echo "  --enable-swscaler        software scaler support [default=no]"
+  echo "  --enable-avfilter        video filter support (replaces vhook) [default=no]"
+  echo "  --enable-avfilter-lavf   video filters dependant on avformat [default=no]"
   echo "  --enable-beosthreads     use BeOS threads [default=no]"
   echo "  --enable-os2threads      use OS/2 threads [default=no]"
   echo "  --enable-pthreads        use pthreads [default=no]"
@@ -213,13 +217,13 @@ EOF
     exit 1
 }
 
-# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
+# Avoid locale weirdness, besides we really just want to translate ASCII.
 toupper(){
-    echo "$@" | tr '[a-z]' '[A-Z]'
+    echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
 }
 
 tolower(){
-    echo "$@" | tr '[A-Z]' '[a-z]'
+    echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
 }
 
 set_all(){
@@ -491,7 +495,7 @@ check_func2(){
     done
     check_ld "$@" <<EOF && enable $func
 $incs
-int main(void){
+int main(int argc, char **argv){
     (void) $func;
     return 0;
 }
@@ -613,6 +617,7 @@ COMPONENT_LIST="
     decoders
     demuxers
     encoders
+    filters
     indevs
     muxers
     outdevs
@@ -622,6 +627,8 @@ COMPONENT_LIST="
 
 CONFIG_LIST="
     $COMPONENT_LIST
+    avfilter
+    avfilter_lavf
     avisynth
     beos_netserver
     ffmpeg
@@ -634,7 +641,6 @@ CONFIG_LIST="
     ipv6
     liba52
     liba52bin
-    libamr
     libamr_nb
     libamr_wb
     libdc1394
@@ -651,6 +657,7 @@ CONFIG_LIST="
     memalign_hack
     mpegaudio_hp
     network
+    nonfree
     powerpc_perf
     pp
     small
@@ -725,6 +732,7 @@ HAVE_LIST="
     getrusage
     imlib2
     inet_aton
+    inline_asm
     libdc1394_1
     libdc1394_2
     llrint
@@ -743,7 +751,7 @@ HAVE_LIST="
     sdl_video_size
     socklen_t
     soundcard_h
-    sys_poll_h
+    poll_h
     sys_select_h
     sys_soundcard_h
     termios_h
@@ -849,6 +857,9 @@ rtp_protocol_deps="udp_protocol"
 tcp_protocol_deps="network"
 udp_protocol_deps="network"
 
+# filters
+vsrc_movie_deps="avfilter_lavf"
+
 # programs
 ffplay_deps="sdl"
 ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
@@ -880,7 +891,7 @@ logfile="config.err"
 PREFIX="/usr/local"
 libdir='$(PREFIX)/lib'
 shlibdir="$libdir"
-incdir='$(PREFIX)/include/ffmpeg'
+incdir='$(PREFIX)/include'
 mandir='$(PREFIX)/share/man'
 bindir='$(PREFIX)/bin'
 
@@ -922,7 +933,6 @@ SHFLAGS='-shared -Wl,-soname,$@'
 VHOOKSHFLAGS='$(SHFLAGS)'
 LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
 FFSERVERLDFLAGS=-Wl,-E
-LDCONFIG="ldconfig"
 LIBPREF="lib"
 LIBSUF=".a"
 FULLNAME='$(NAME)$(BUILDSUF)'
@@ -948,15 +958,25 @@ fi
 
 FFMPEG_CONFIGURATION="$@"
 
-ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
-DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
-PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
-BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
-MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
-DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
-OUTDEV_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavdevice/alldevices.c"`
-INDEV_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavdevice/alldevices.c"`
-PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
+find_things(){
+    thing=$1
+    pattern=$2
+    file=$source_path/$3
+    sed -n "s/^[^#]*$pattern.*(.*, *\\(.*\\)).*/\\1_$thing/p" "$file"
+}
+
+ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
+DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
+PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
+BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
+MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
+DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
+OUTDEV_LIST=$(find_things   muxer    _MUX     libavdevice/alldevices.c)
+INDEV_LIST=$(find_things    demuxer  DEMUX    libavdevice/alldevices.c)
+PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
+VIDEO_FILTER_LIST=$(find_things vf_ VF_ libavfilter/allfilters.c)
+SRC_FILTER_LIST=$(find_things vsrc_ VSRC_ libavfilter/allfilters.c)
+FILTER_LIST="$SRC_FILTER_LIST $VIDEO_FILTER_LIST"
 
 enable $ARCH_EXT_LIST \
        $DECODER_LIST \
@@ -965,6 +985,7 @@ enable $ARCH_EXT_LIST \
        $BSF_LIST \
        $DEMUXER_LIST \
        $MUXER_LIST \
+       $FILTER_LIST \
        $PROTOCOL_LIST \
        $INDEV_LIST \
        $OUTDEV_LIST \
@@ -1033,6 +1054,8 @@ for opt do
     ;;
     --disable-muxers) disable $MUXER_LIST
     ;;
+    --disable-filters) disable $FILTER_LIST
+    ;;
     --disable-demuxers) disable $DEMUXER_LIST
     ;;
     --disable-parsers) disable $PARSER_LIST
@@ -1043,10 +1066,13 @@ for opt do
     ;;
     --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
     ;;
+    --enable-debug=*) debuglevel="$optval"
+    ;;
     --enable-*=*|--disable-*=*)
     eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
     case "$thing" in
         encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;;
+        filter) $action ${optval} ;;
         *) die_unknown "$opt" ;;
     esac
     ;;
@@ -1158,7 +1184,6 @@ case $targetos in
             add_cflags "-fno-expensive-optimizations"
             ;;
         esac
-        LDCONFIG="echo ignoring ldconfig"
         SHFLAGS=-nostart
         # enable BeOS things
         enable audio_beos
@@ -1183,7 +1208,6 @@ case $targetos in
     openbsd)
         disable need_memalign
         LIBOBJFLAGS='$(PIC)'
-        LDCONFIG='ldconfig -m $(SHLIBDIR)'
         SHFLAGS='-shared'
         SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
         SLIBNAME_WITH_VERSION='$(SLIBNAME)'
@@ -1285,7 +1309,10 @@ case $targetos in
           emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;'
         SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
-        vhook="no"
+        disable vhook
+        ;;
+    interix)
+        disable vhook
         ;;
 
     *)
@@ -1356,6 +1383,10 @@ if ! enabled gpl; then
     die_gpl_disabled "The software scaler"     swscaler
 fi
 
+if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
+    die "libamr is nonfree and --enable-nonfree is not specified."
+fi
+
 check_deps $ARCH_EXT_LIST
 
 test -z "$need_memalign" && need_memalign="$mmx"
@@ -1365,7 +1396,7 @@ if test $targetos = darwin; then
     if test -n "`$cc -v 2>&1 | grep xlc`"; then
         add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
     else
-        add_cflags "-no-cpp-precomp -pipe"
+        add_cflags "-pipe"
         check_cflags "-force_cpusubtype_ALL"
         check_cflags "-Wno-sign-compare"
         disabled shared && add_cflags -mdynamic-no-pic
@@ -1434,10 +1465,6 @@ if test $cpu != "generic"; then
         sparc64)
             add_cflags "-mcpu=v9"
         ;;
-        bf*) #bf531 bf532 bf533 bf561 bf5xx all get this config
-            add_cflags "-mfdpic"
-            add_ldflags "-mfdpic"
-        ;;
         arm*)
             add_cflags "-mcpu=$cpu"
         ;;
@@ -1485,6 +1512,8 @@ if test "$?" != 0; then
     die "C compiler test failed."
 fi
 
+check_asm inline_asm '""'
+
 if enabled x86; then
     # check whether EBP is available on x86
     # As 'i' is stored on the stack, this program will crash
@@ -1569,7 +1598,7 @@ fi
 check_func  fork
 check_func  gethrtime
 check_func  getrusage
-check_func  inet_aton
+check_func  inet_aton $network_extralibs
 check_func  memalign
 check_func  mkstemp
 check_func2 windows.h GetProcessTimes
@@ -1589,7 +1618,7 @@ enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
 # ffserver uses poll(),
 # if it's not found we can emulate it using select().
 if enabled ffserver; then
-    check_header sys/poll.h
+    check_header poll.h
     check_header sys/select.h
 fi
 
@@ -1600,10 +1629,10 @@ if enabled pthreads; then
         :
     elif check_func pthread_create -pthread; then
         add_cflags -pthread
-        add_ldflags -pthread
+        add_extralibs -pthread
     elif check_func pthread_create -pthreads; then
         add_cflags -pthreads
-        add_ldflags -pthreads
+        add_extralibs -pthreads
     elif ! check_lib pthread.h pthread_create -lpthread; then
         die "ERROR: can't find pthreads library"
     fi
@@ -1628,8 +1657,6 @@ int main(void) { return ($func(3.999f) > 0)?0:1; }
 EOF
 done
 
-enabled_any libamr_nb libamr_wb && enable libamr
-
 # these are off by default, so fail if requested and not available
 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
 enabled liba52     && require  liba52 a52dec/a52.h a52_init -la52
@@ -1642,7 +1669,7 @@ enabled libmp3lame && require  LAME lame/lame.h lame_init -lmp3lame -lm
 enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
 enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
-enabled libx264    && require  x264 x264.h x264_encoder_open -lx264
+enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
 enabled libxvid    && require  Xvid xvid.h xvid_global -lxvidcore
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 
@@ -1694,7 +1721,7 @@ if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
     sdl_cflags=`"${SDL_CONFIG}" --cflags`
     temp_cflags $sdl_cflags
     temp_extralibs `"${SDL_CONFIG}" --libs`
-    if check_lib SDL.h SDL_Init; then
+    if check_lib2 SDL.h SDL_Init; then
         _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
         if test "$_sdlversion" -lt 121 ; then
             enable sdl_too_old
@@ -1702,7 +1729,7 @@ if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
             enable sdl
             check_cc $sdl_cflags <<EOF && enable sdl_video_size
 #include <SDL.h>
-int main(void){
+int main(int argc, char **argv){
     const SDL_VideoInfo *vi = SDL_GetVideoInfo();
     int w = vi->current_w;
     return 0;
@@ -1770,7 +1797,7 @@ check_header X11/extensions/XShm.h      &&
 check_func XOpenDisplay -lX11           &&
 check_func XShmCreateImage -lX11 -lXext
 
-enabled debug && add_cflags -g
+enabled debug && add_cflags -g"$debuglevel"
 
 # add some useful compiler flags if supported
 check_cflags -Wdeclaration-after-statement
@@ -1780,6 +1807,9 @@ check_cflags -Wdisabled-optimization
 check_cflags -Wpointer-arith
 check_cflags -Wredundant-decls
 check_cflags -Wno-pointer-sign
+check_cflags -Wcast-qual
+check_cflags -Wwrite-strings
+check_cflags -Wtype-limits
 enabled extra_warnings && check_cflags -Winline
 
 # add some linker flags
@@ -1798,6 +1828,8 @@ elif enabled optimizations; then
         add_cflags "-O3"
     fi
 fi
+check_cflags -fno-math-errno
+check_cflags -fno-signed-zeros
 
 # PIC flags for shared library objects where they are needed
 if enabled shared; then
@@ -1827,6 +1859,7 @@ enabled_any $ENCODER_LIST      && enable encoders
 enabled_any $BSF_LIST          && enable bsfs
 enabled_any $DEMUXER_LIST      && enable demuxers
 enabled_any $MUXER_LIST        && enable muxers
+enabled_any $FILTER_LIST       && enable filters
 enabled_any $INDEV_LIST        && enable demuxers
 enabled_any $OUTDEV_LIST       && enable muxers
 enabled_any $PROTOCOL_LIST     && enable protocols
@@ -1841,6 +1874,7 @@ check_deps $CONFIG_LIST       \
            $BSF_LIST          \
            $DEMUXER_LIST      \
            $MUXER_LIST        \
+           $FILTER_LIST       \
            $INDEV_LIST        \
            $OUTDEV_LIST       \
            $PROTOCOL_LIST     \
@@ -1886,6 +1920,8 @@ echo "static                    ${static-no}"
 echo "shared                    ${shared-no}"
 echo "postprocessing support    ${pp-no}"
 echo "software scaler enabled   ${swscaler-no}"
+echo "new filter support        ${avfilter-no}"
+echo "filters using lavformat   ${avfilter-lavf-no}"
 echo "video hooking             ${vhook-no}"
 if enabled vhook; then
     echo "Imlib2 support            ${imlib2-no}"
@@ -1918,22 +1954,22 @@ echo "libvorbis enabled         ${libvorbis-no}"
 echo "x264 enabled              ${libx264-no}"
 echo "XviD enabled              ${libxvid-no}"
 echo "zlib enabled              ${zlib-no}"
+echo
 
-for type in decoder encoder parser demuxer muxer protocol bsf indev outdev; do
+for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
     echo "Enabled ${type}s:"
-    ucname="\$`toupper $type`_LIST"
-    list="`eval echo $ucname`"
-    partlist=""
+    eval list=\$$(toupper $type)_LIST
     for part in $list; do
-        enabled $part && partlist="$partlist $part"
-    done
-    partlist=`echo $partlist | sed s/_$type//g | tr ' ' '\n' | sort`
-    echo $partlist
+        enabled $part && echo ${part%_*}
+    done | sort | pr -3 -t
+    echo
 done
 
-enabled gpl &&
-    echo "License: GPL" ||
-    echo "License: LGPL"
+enabled nonfree &&
+    echo "License: unredistributable" ||
+    (enabled gpl &&
+        echo "License: GPL" ||
+        echo "License: LGPL")
 
 echo "Creating config.mak and config.h..."
 
@@ -1954,7 +1990,6 @@ echo "MAKE=$make" >> config.mak
 echo "CC=$cc" >> config.mak
 echo "AR=$ar" >> config.mak
 echo "RANLIB=$ranlib" >> config.mak
-echo "LDCONFIG=$LDCONFIG" >> config.mak
 echo "LN_S=$ln_s" >> config.mak
 enabled dostrip &&
     echo "STRIP=$strip" >> config.mak ||
@@ -1994,30 +2029,38 @@ if enabled texi2html; then
     echo "BUILD_DOC=yes" >> config.mak
 fi
 
-sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
-pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
-lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
-lavd_version=`grep '#define LIBAVDEVICE_VERSION ' "$source_path/libavdevice/avdevice.h" | sed 's/[^0-9\.]//g'`
-lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
-lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
-
+get_version(){
+    name=$1
+    file=$source_path/$2
+    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
+    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
+}
 
+get_version LIBSWSCALE  libswscale/swscale.h
+get_version LIBPOSTPROC libpostproc/postprocess.h
+get_version LIBAVCODEC  libavcodec/avcodec.h
+get_version LIBAVDEVICE libavdevice/avdevice.h
+get_version LIBAVFORMAT libavformat/avformat.h
+get_version LIBAVUTIL   libavutil/avutil.h
+get_version LIBAVFILTER libavfilter/avfilter.h
 
 if enabled shared; then
     echo "BUILD_SHARED=yes" >> config.mak
     echo "PIC=-fPIC -DPIC" >> config.mak
-    echo "SPPMAJOR=${pp_version%%.*}" >> config.mak
-    echo "SPPVERSION=$pp_version" >> config.mak
-    echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
-    echo "LAVCVERSION=$lavc_version" >> config.mak
-    echo "LAVDMAJOR=${lavd_version%%.*}" >> config.mak
-    echo "LAVDVERSION=$lavd_version" >> config.mak
-    echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
-    echo "LAVFVERSION=$lavf_version" >> config.mak
-    echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
-    echo "LAVUVERSION=$lavu_version" >> config.mak
-    echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
-    echo "SWSVERSION=$sws_version" >> config.mak
+    echo "SPPMAJOR=$LIBPOSTPROC_VERSION_MAJOR" >> config.mak
+    echo "SPPVERSION=$LIBPOSTPROC_VERSION" >> config.mak
+    echo "LAVCMAJOR=$LIBAVCODEC_VERSION_MAJOR" >> config.mak
+    echo "LAVCVERSION=$LIBAVCODEC_VERSION" >> config.mak
+    echo "LAVDMAJOR=$LIBAVDEVICE_VERSION_MAJOR" >> config.mak
+    echo "LAVDVERSION=$LIBAVDEVICE_VERSION" >> config.mak
+    echo "LAVFMAJOR=$LIBAVFORMAT_VERSION_MAJOR" >> config.mak
+    echo "LAVFVERSION=$LIBAVFORMAT_VERSION" >> config.mak
+    echo "LAVUMAJOR=$LIBAVUTIL_VERSION_MAJOR" >> config.mak
+    echo "LAVUVERSION=$LIBAVUTIL_VERSION" >> config.mak
+    echo "LAVFIMAJOR=$LIBAVFILTER_VERSION_MAJOR" >> config.mak
+    echo "LAVFIVERSION=$LIBAVFILTER_VERSION" >> config.mak
+    echo "SWSMAJOR=$LIBSWSCALE_VERSION_MAJOR" >> config.mak
+    echo "SWSVERSION=$LIBSWSCALE_VERSION" >> config.mak
     echo "SLIBNAME=${SLIBNAME}" >> config.mak
     echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
     echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
@@ -2038,6 +2081,7 @@ print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
                                       $BSF_LIST          \
                                       $DEMUXER_LIST      \
                                       $MUXER_LIST        \
+                                      $FILTER_LIST       \
                                       $PROTOCOL_LIST     \
                                       $INDEV_LIST        \
                                       $OUTDEV_LIST       \
@@ -2081,6 +2125,7 @@ if enabled source_path_used; then
         libavcodec/sh4    \
         libavcodec/sparc  \
         libavdevice       \
+        libavfilter       \
         libavformat       \
         libavutil         \
         libpostproc       \
@@ -2095,6 +2140,7 @@ if enabled source_path_used; then
         doc/texi2pod.pl      \
         libavcodec/Makefile  \
         libavdevice/Makefile \
+        libavfilter/Makefile \
         libavformat/Makefile \
         libavutil/Makefile   \
         libpostproc/Makefile \
@@ -2118,7 +2164,6 @@ comment=$2
 version=$3
 libs=$4
 requires=$5
-include=$6
 cat <<EOF >$name.pc
 prefix=$PREFIX
 exec_prefix=\${prefix}
@@ -2131,7 +2176,7 @@ Version: $version
 Requires: $requires
 Conflicts:
 Libs: -L\${libdir} $libs
-Cflags: -I\${includedir}/$include
+Cflags: -I\${includedir}
 EOF
 }
 
@@ -2146,7 +2191,7 @@ cat <<EOF >$name-uninstalled.pc
 prefix=
 exec_prefix=
 libdir=\${pcfiledir}/$name
-includedir=\${pcfiledir}/$name
+includedir=\${pcfiledir}
 
 Name: $name
 Description: $comment
@@ -2158,28 +2203,33 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
-pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
+pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" -lavutil ""
+pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
 
-pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
-pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
+pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "-lavcodec $extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
 
-pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
-pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
+pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "-lavformat $extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
+pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
 
-pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version" ffmpeg
-pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$lavd_version" "$extralibs" "$pkg_requires libavformat = $lavf_version"
+pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "-lavdevice $extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
+pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
 if enabled pp; then
-    pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
-    pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
+    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" -lpostproc ""
+    pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
 fi
 
 if enabled swscaler; then
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version" ffmpeg
-    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version"
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" -lswscale "libavutil = $LIBAVUTIL_VERSION"
+    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
 else
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" ffmpeg
-    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
+    pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
     apply libswscale.pc sed s/^Libs:.*$/Libs:/
     apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/
 fi
+
+if enabled avfilter; then
+  pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "-lavfilter $extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION" ffmpeg
+  pkgconfig_generate_uninstalled libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
+fi