]> git.sesse.net Git - ffmpeg/blobdiff - configure
Disable vhook on Interix, patch by Pete Ross, pross xvid org.
[ffmpeg] / configure
index ebeca1cc43d045e7c5310f6fd76c650361fddb25..45a52039182b7c8231d3a027c31428851a20d0f0 100755 (executable)
--- a/configure
+++ b/configure
@@ -68,9 +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-beosthreads     use BeOS threads [default=no]"
+  echo "  --enable-os2threads      use OS/2 threads [default=no]"
   echo "  --enable-pthreads        use pthreads [default=no]"
   echo "  --enable-w32threads      use Win32 threads [default=no]"
   echo "  --enable-x11grab         enable X11 grabbing [default=no]"
@@ -131,6 +134,7 @@ show_help(){
   echo "  --disable-ffserver       disable ffserver build"
   echo "  --disable-ffplay         disable ffplay build"
   echo "  --enable-small           optimize for size instead of speed"
+  echo "  --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
   echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
   echo "  --disable-encoder=NAME   disables encoder NAME"
   echo "  --enable-encoder=NAME    enables encoder NAME"
@@ -153,6 +157,7 @@ show_help(){
   echo "  --enable-protocol=NAME   enables protocol NAME"
   echo "  --disable-protocol=NAME  disables protocol NAME"
   echo "  --disable-protocols      disables all protocols"
+  echo "  --disable-devices        disables all devices"
   echo "  --list-decoders          show all available decoders"
   echo "  --list-encoders          show all available encoders"
   echo "  --list-muxers            show all available muxers"
@@ -160,6 +165,8 @@ show_help(){
   echo "  --list-parsers           show all available parsers"
   echo "  --list-protocols         show all available protocols"
   echo "  --list-bsfs              show all available bitstream filters"
+  echo "  --list-indevs            show all available input devices"
+  echo "  --list-outdevs           show all available output devices"
   echo
   echo "Developer options (useful when working on FFmpeg itself):"
   echo "  --enable-gprof           enable profiling with gprof [$gprof]"
@@ -191,7 +198,7 @@ die(){
     cat <<EOF
 If you think configure made a mistake, make sure you are using the latest
 version from SVN.  If the latest version fails, report the problem to the
-ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
+ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
 EOF
     if enabled logging; then
         cat <<EOF
@@ -208,13 +215,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(){
@@ -486,7 +493,7 @@ check_func2(){
     done
     check_ld "$@" <<EOF && enable $func
 $incs
-int main(void){
+int main(int argc, char **argv){
     (void) $func;
     return 0;
 }
@@ -547,6 +554,23 @@ int main(void){
 EOF
 }
 
+check_type(){
+    log check_type "$@"
+    headers=$1
+    type=$2
+    shift 2
+    disable $type
+    incs=""
+    for hdr in $headers; do
+        incs="$incs
+#include <$hdr>"
+    done
+    check_cc "$@" <<EOF && enable $type
+$incs
+$type v;
+EOF
+}
+
 require(){
     name="$1"
     header="$2"
@@ -591,7 +615,9 @@ COMPONENT_LIST="
     decoders
     demuxers
     encoders
+    indevs
     muxers
+    outdevs
     parsers
     protocols
 "
@@ -606,10 +632,10 @@ CONFIG_LIST="
     gpl
     gprof
     gray
+    hardcoded_tables
     ipv6
     liba52
     liba52bin
-    libamr
     libamr_nb
     libamr_wb
     libdc1394
@@ -626,6 +652,7 @@ CONFIG_LIST="
     memalign_hack
     mpegaudio_hp
     network
+    nonfree
     powerpc_perf
     pp
     small
@@ -637,6 +664,7 @@ CONFIG_LIST="
 
 THREADS_LIST='
     beosthreads
+    os2threads
     pthreads
     w32threads
 '
@@ -699,6 +727,10 @@ HAVE_LIST="
     getrusage
     imlib2
     inet_aton
+    libdc1394_1
+    libdc1394_2
+    llrint
+    lrint
     lrintf
     machine_ioctl_bt848_h
     machine_ioctl_meteor_h
@@ -707,10 +739,14 @@ HAVE_LIST="
     mkstemp
     mlib
     ppc64
+    round
+    roundf
     sdl
     sdl_video_size
+    socklen_t
     soundcard_h
-    sys_poll_h
+    poll_h
+    sys_select_h
     sys_soundcard_h
     termios_h
     threads
@@ -793,7 +829,7 @@ audio_beos_muxer_deps="audio_beos"
 audio_beos_muxer_extralibs="-lmedia -lbe"
 avisynth_demuxer_deps="avisynth"
 bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
-dv1394_demuxer_deps="dv1394"
+dv1394_demuxer_deps="dv1394 dv_demuxer"
 libdc1394_demuxer_deps="libdc1394"
 libnut_demuxer_deps="libnut"
 libnut_muxer_deps="libnut"
@@ -801,9 +837,9 @@ mp3_demuxer_deps="mpegaudio_parser"
 oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
 oss_muxer_deps_any="soundcard_h sys_soundcard_h"
 redir_demuxer_deps="network"
-rtp_muxer_deps="network mpegts_demuxer"
-rtsp_demuxer_deps="rtp_protocol rtp_muxer"
-sdp_demuxer_deps="rtsp_demuxer"
+rtp_muxer_deps="network rtp_protocol"
+rtsp_demuxer_deps="sdp_demuxer"
+sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
 v4l2_demuxer_deps="linux_videodev2_h"
 v4l_demuxer_deps="linux_videodev_h"
 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
@@ -846,7 +882,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'
 
@@ -888,7 +924,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)'
@@ -914,15 +949,22 @@ 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)
 
 enable $ARCH_EXT_LIST \
        $DECODER_LIST \
@@ -1007,7 +1049,7 @@ for opt do
     ;;
     --disable-protocols) disable $PROTOCOL_LIST
     ;;
-    --disable-devices) disable "$INDEV_LIST $OUTDEV_LIST"
+    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
     ;;
     --enable-*=*|--disable-*=*)
     eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
@@ -1124,7 +1166,6 @@ case $targetos in
             add_cflags "-fno-expensive-optimizations"
             ;;
         esac
-        LDCONFIG="echo ignoring ldconfig"
         SHFLAGS=-nostart
         # enable BeOS things
         enable audio_beos
@@ -1149,7 +1190,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)'
@@ -1211,6 +1251,13 @@ case $targetos in
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
         SHFLAGS='-shared -Wl,--enable-auto-image-base'
         ;;
+    *-dos|freedos|opendos)
+        enable memalign_hack
+        disable ffplay ffserver vhook
+        disable $INDEV_LIST $OUTDEV_LIST
+        network_extralibs="-lsocket"
+        EXESUF=".exe"
+        ;;
     linux)
         LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
         enable dv1394
@@ -1219,6 +1266,37 @@ case $targetos in
         targetos=irix
         ranlib="echo ignoring ranlib"
         ;;
+    os/2*)
+        ar="emxomfar -p256"
+        ranlib="echo ignoring ranlib"
+        strip="lxlite"
+        ln_s="cp -f"
+        add_cflags "-Zomf"
+        EXESUF=".exe"
+        FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
+        SHFLAGS='$(NAME).def -Zdll -Zomf'
+        FFSERVERLDFLAGS=""
+        LIBSUF="_s.lib"
+        SLIBPREF=""
+        SLIBSUF=".dll"
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
+        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(NAME).def; \
+          echo PROTMODE >> $(NAME).def; \
+          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \
+          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \
+          echo EXPORTS >> $(NAME).def; \
+          emxexp -o $(OBJS) >> $(NAME).def'
+        SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \
+          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"
+        ;;
+    interix)
+        disable vhook
+        ;;
+
     *)
         targetos="${targetos}-UNKNOWN"
         ;;
@@ -1287,6 +1365,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"
@@ -1357,7 +1439,7 @@ if test $cpu != "generic"; then
             enable fast_cmov
         ;;
         # targets that do support conditional mov but on which it's slow
-        pentium4|prescott|nocona)
+        pentium4|pentium4m|prescott|nocona)
             add_cflags "-march=$cpu"
             enable cmov
             disable fast_cmov
@@ -1365,10 +1447,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"
         ;;
@@ -1500,7 +1578,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
@@ -1520,7 +1598,8 @@ 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
 
 # check for some common methods of building with pthread support
@@ -1530,10 +1609,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
@@ -1549,21 +1628,20 @@ done
 
 check_lib math.h sin -lm
 
-# test for lrintf in math.h
-check_exec <<EOF && enable lrintf || disable lrintf
+# test for C99 functions in math.h
+for func in llrint lrint lrintf round roundf; do
+    check_exec <<EOF && enable $func || disable $func
 #define _ISOC9X_SOURCE  1
 #include <math.h>
-int main(void) { return (lrintf(3.999f) > 0)?0:1; }
+int main(void) { return ($func(3.999f) > 0)?0:1; }
 EOF
-
-enabled_any libamr_nb libamr_wb && enable libamr
+done
 
 # 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
 enabled libamr_nb  && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
 enabled libamr_wb  && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
-enabled libdc1394  && require  libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
 enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
@@ -1571,13 +1649,23 @@ 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
 
 # disable the native AC-3 decoder if liba52 is enabled
 enabled liba52 && disable ac3_decoder
 
+# libdc1394 check
+if enabled libdc1394; then
+    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
+        enable libdc1394_2; } ||
+    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
+        enable libdc1394_1; } ||
+    die "ERROR: No version of libdc1394 found "
+fi
+
+
 _restrict=
 for restrict_keyword in restrict __restrict__ __restrict; do
     check_cc <<EOF && _restrict=$restrict_keyword && break
@@ -1613,7 +1701,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
@@ -1621,7 +1709,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;
@@ -1634,6 +1722,8 @@ fi
 
 texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html
 
+check_type sys/socket.h socklen_t
+
 ##########################################
 # Network check
 
@@ -1643,6 +1733,7 @@ if enabled network; then
         check_func closesocket
     elif check_header winsock2.h ; then
         network_extralibs="-lws2_32"
+        check_type ws2tcpip.h socklen_t
         check_func2 winsock2.h closesocket
     fi
 fi
@@ -1696,11 +1787,15 @@ 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
 check_ldflags -Wl,--warn-common
 check_ldflags $LDLATEFLAGS
+check_ldflags -Wl,-Bsymbolic
 
 if enabled small; then
     check_cflags -Os            # not all compilers support -Os
@@ -1833,11 +1928,8 @@ echo "libvorbis enabled         ${libvorbis-no}"
 echo "x264 enabled              ${libx264-no}"
 echo "XviD enabled              ${libxvid-no}"
 echo "zlib enabled              ${zlib-no}"
-enabled gpl &&
-    echo "License: GPL" ||
-    echo "License: LGPL"
 
-for type in decoder encoder parser demuxer muxer protocol bsf; do
+for type in decoder encoder parser demuxer muxer protocol bsf indev outdev; do
     echo "Enabled ${type}s:"
     ucname="\$`toupper $type`_LIST"
     list="`eval echo $ucname`"
@@ -1849,6 +1941,12 @@ for type in decoder encoder parser demuxer muxer protocol bsf; do
     echo $partlist
 done
 
+enabled nonfree &&
+    echo "License: unredistributable" ||
+    (enabled gpl &&
+        echo "License: GPL" ||
+        echo "License: LGPL")
+
 echo "Creating config.mak and config.h..."
 
 echo "# Automatically generated by configure - do not modify!" > config.mak
@@ -1868,7 +1966,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 ||
@@ -1908,14 +2005,18 @@ 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
+    grep "#define ${name}_VERSION_TRIPLET " "$file" | sed 's/[^0-9,]//g' | tr , .
+}
 
+sws_version=$(get_version  LIBSWSCALE  libswscale/swscale.h)
+pp_version=$(get_version   LIBPOSTPROC libpostproc/postprocess.h)
+lavc_version=$(get_version LIBAVCODEC  libavcodec/avcodec.h)
+lavd_version=$(get_version LIBAVDEVICE libavdevice/avdevice.h)
+lavf_version=$(get_version LIBAVFORMAT libavformat/avformat.h)
+lavu_version=$(get_version LIBAVUTIL   libavutil/avutil.h)
 
 if enabled shared; then
     echo "BUILD_SHARED=yes" >> config.mak
@@ -1935,6 +2036,7 @@ if enabled shared; then
     echo "SLIBNAME=${SLIBNAME}" >> config.mak
     echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
     echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
+    echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
     echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
     echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
     echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
@@ -2031,7 +2133,6 @@ comment=$2
 version=$3
 libs=$4
 requires=$5
-include=$6
 cat <<EOF >$name.pc
 prefix=$PREFIX
 exec_prefix=\${prefix}
@@ -2044,7 +2145,7 @@ Version: $version
 Requires: $requires
 Conflicts:
 Libs: -L\${libdir} $libs
-Cflags: -I\${includedir} -I\${includedir}/$include
+Cflags: -I\${includedir}
 EOF
 }
 
@@ -2059,7 +2160,7 @@ cat <<EOF >$name-uninstalled.pc
 prefix=
 exec_prefix=
 libdir=\${pcfiledir}/$name
-includedir=\${pcfiledir}/$name
+includedir=\${pcfiledir}
 
 Name: $name
 Description: $comment
@@ -2071,27 +2172,27 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
+pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil ""
 pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
 
-pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
+pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version"
 pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
 
-pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
+pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version"
 pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
 
-pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version" ffmpeg
+pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version"
 pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$lavd_version" "$extralibs" "$pkg_requires libavformat = $lavf_version"
 if enabled pp; then
-    pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
+    pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc ""
     pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
 fi
 
 if enabled swscaler; then
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version" ffmpeg
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version"
     pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version"
 else
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" ffmpeg
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
     pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
     apply libswscale.pc sed s/^Libs:.*$/Libs:/
     apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/