]> git.sesse.net Git - ffmpeg/blobdiff - configure
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / configure
index 85d24871a357cd8deea8f817bee74d2fae1318ba..f027832dd4129f34b472172f97e4907fdd1eacab 100755 (executable)
--- a/configure
+++ b/configure
@@ -267,6 +267,7 @@ Advanced options (experts only):
   --nm=NM                  use nm tool NM [$nm_default]
   --ar=AR                  use archive tool AR [$ar_default]
   --as=AS                  use assembler AS [$as_default]
+  --windres=WINDRES        use windows resource compiler WINDRES [$windres_default]
   --yasmexe=EXE            use yasm-compatible assembler EXE [$yasmexe_default]
   --cc=CC                  use C compiler CC [$cc_default]
   --cxx=CXX                use C compiler CXX [$cxx_default]
@@ -1127,6 +1128,26 @@ require_pkg_config(){
     add_extralibs $(get_safe ${pkg}_libs)
 }
 
+require_libfreetype(){
+    log require_libfreetype "$@"
+    pkg="freetype2"
+    check_cmd $pkg_config --exists --print-errors $pkg \
+      || die "ERROR: $pkg not found"
+    pkg_cflags=$($pkg_config --cflags $pkg)
+    pkg_libs=$($pkg_config --libs $pkg)
+    {
+        echo "#include <ft2build.h>"
+        echo "#include FT_FREETYPE_H"
+        echo "long check_func(void) { return (long) FT_Init_FreeType; }"
+        echo "int main(void) { return 0; }"
+    } | check_ld "cc" $pkg_cflags $pkg_libs \
+      && set_safe ${pkg}_cflags $pkg_cflags \
+      && set_safe ${pkg}_libs   $pkg_libs \
+      || die "ERROR: $pkg not found"
+    add_cflags    $(get_safe ${pkg}_cflags)
+    add_extralibs $(get_safe ${pkg}_libs)
+}
+
 hostcc_o(){
     eval printf '%s\\n' $HOSTCC_O
 }
@@ -1509,6 +1530,7 @@ HAVE_LIST="
     gettimeofday
     glob
     gnu_as
+    gnu_windres
     gsm_h
     ibm_asm
     inet_aton
@@ -1518,6 +1540,7 @@ HAVE_LIST="
     jack_port_get_latency_range
     kbhit
     ldbrx
+    libc_msvcrt
     libdc1394_1
     libdc1394_2
     local_aligned_16
@@ -1537,7 +1560,6 @@ HAVE_LIST="
     mm_empty
     mmap
     mprotect
-    msvcrt
     nanosleep
     openjpeg_1_5_openjpeg_h
     PeekNamedPipe
@@ -1772,7 +1794,7 @@ need_memalign="altivec neon sse"
 
 symver_if_any="symver_asm_label symver_gnu_asm"
 
-log2_deps="!msvcrt"
+log2_deps="!libc_msvcrt"
 
 # subsystems
 dct_select="rdft"
@@ -2335,8 +2357,8 @@ ffserver_extralibs='$ldl'
 # documentation
 podpages_deps="perl"
 manpages_deps="perl pod2man"
-htmlpages_deps="texi2html"
-txtpages_deps="makeinfo"
+htmlpages_deps="perl texi2html"
+txtpages_deps="perl makeinfo"
 doc_deps_any="manpages htmlpages podpages txtpages"
 
 # default parameters
@@ -2367,6 +2389,7 @@ pkg_config_default=pkg-config
 ranlib="ranlib"
 strip_default="strip"
 yasmexe_default="yasm"
+windres_default="windres"
 
 nogas=":"
 
@@ -2637,6 +2660,7 @@ nm_default="${cross_prefix}${nm_default}"
 pkg_config_default="${cross_prefix}${pkg_config_default}"
 ranlib="${cross_prefix}${ranlib}"
 strip_default="${cross_prefix}${strip_default}"
+windres_default="${cross_prefix}${windres_default}"
 
 sysinclude_default="${sysroot}/usr/include"
 
@@ -3155,7 +3179,7 @@ test -n "$cc_type" && enable $cc_type ||
 : ${dep_cc_default:=$cc}
 : ${ld_default:=$cc}
 : ${host_ld_default:=$host_cc}
-set_default ar as dep_cc ld host_ld
+set_default ar as dep_cc ld host_ld windres
 
 probe_cc as "$as"
 asflags_filter=$_flags_filter
@@ -3576,7 +3600,6 @@ case $target_os in
         SHFLAGS='-shared -Wl,-h,$$(@F)'
         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
         network_extralibs="-lsocket -lnsl"
-        add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
         # When using suncc to build, the Solaris linker will mark
         # an executable with each instruction set encountered by
         # the Solaris assembler.  As our libraries contain their own
@@ -3637,6 +3660,7 @@ case $target_os in
         elif enabled arm; then
             LIBTARGET=arm-wince
         fi
+        enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
         check_ldflags -Wl,--nxcompat
         check_ldflags -Wl,--dynamicbase
         shlibdir_default="$bindir_default"
@@ -3699,6 +3723,7 @@ case $target_os in
         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
         objformat="win32"
         enable dos_paths
+        enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
         ;;
     *-dos|freedos|opendos)
         network_extralibs="-lsocket"
@@ -3795,26 +3820,24 @@ elif check_cpp_condition features.h "defined __GLIBC__"; then
 elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
     libc_type=newlib
     add_cppflags -U__STRICT_ANSI__
-elif check_header _mingw.h; then
-    libc_type=mingw
-    check_cpp_condition _mingw.h \
-        "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
-            (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
-        die "ERROR: MinGW runtime version must be >= 3.15."
-    add_cppflags -U__STRICT_ANSI__
-    if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
-            __MINGW64_VERSION_MAJOR < 3"; then
+# MinGW64 is backwards compatible with MinGW32, so check for it first.
+elif check_cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
+    libc_type=mingw64
+    if check_cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
         add_compat msvcrt/snprintf.o
         add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
     else
         add_cppflags -D__USE_MINGW_ANSI_STDIO=1
     fi
-elif check_func_headers stdlib.h _get_doserrno; then
+    add_cppflags -U__STRICT_ANSI__
+elif check_cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
+    libc_type=mingw32
+    check_cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
+        (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
+        die "ERROR: MinGW32 runtime version must be >= 3.15."
+    add_cppflags -U__STRICT_ANSI__
+elif check_cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
     libc_type=msvcrt
-    add_compat strtod.o strtod=avpriv_strtod
-    add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
-                                 _snprintf=avpriv_snprintf  \
-                                 vsnprintf=avpriv_vsnprintf
     # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
     # 0x601 by default unless something else is set by the user.
     # This can easily lead to us detecting functions only present
@@ -3826,14 +3849,28 @@ elif check_cpp_condition stddef.h "defined __KLIBC__"; then
     libc_type=klibc
 elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
     libc_type=bionic
-    add_compat strtod.o strtod=avpriv_strtod
+elif check_cpp_condition sys/brand.h "defined SOLARIS_BRAND_NAME"; then
+    libc_type=solaris
+    add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
 fi
 
-test -n "$libc_type" && enable $libc_type
+test -n "$libc_type" && enable libc_$libc_type
+
+case $libc_type in
+    bionic)
+        add_compat strtod.o strtod=avpriv_strtod
+        ;;
+    msvcrt)
+        add_compat strtod.o strtod=avpriv_strtod
+        add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
+                                     _snprintf=avpriv_snprintf  \
+                                     vsnprintf=avpriv_vsnprintf
+        ;;
+esac
 
 # hacks for compiler/libc/os combinations
 
-if enabled_all tms470 glibc; then
+if enabled_all tms470 libc_glibc; then
     CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
     add_cppflags -D__USER_LABEL_PREFIX__=
     add_cppflags -D__builtin_memset=memset
@@ -3841,7 +3878,7 @@ if enabled_all tms470 glibc; then
     add_cflags   -pds=48    # incompatible redefinition of macro
 fi
 
-if enabled_all ccc glibc; then
+if enabled_all ccc libc_glibc; then
     add_ldflags -Wl,-z,now  # calls to libots crash without this
 fi
 
@@ -4254,17 +4291,17 @@ fi
 # do this before the optional library checks as some of them require pthreads
 if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
     enable pthreads
-    if check_func pthread_create; then
+    if check_func pthread_join && check_func pthread_create; then
         :
-    elif check_func pthread_create -pthread; then
+    elif check_func pthread_join -pthread && check_func pthread_create -pthread; then
         add_cflags -pthread
         add_extralibs -pthread
-    elif check_func pthread_create -pthreads; then
+    elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
         add_cflags -pthreads
         add_extralibs -pthreads
-    elif check_func pthread_create -lpthreadGC2; then
+    elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
         add_extralibs -lpthreadGC2
-    elif ! check_lib pthread.h pthread_create -lpthread; then
+    elif ! check_lib pthread.h pthread_join -lpthread && ! check_lib pthread.h pthread_create -lpthread; then
         disable pthreads
     fi
 fi
@@ -4316,7 +4353,7 @@ enabled libfaac           && require2 libfaac "stdint.h faac.h" faacEncGetVersio
 enabled libfdk_aac        && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
 enabled libflite          && require2 libflite "flite/flite.h" flite_init $flite_libs
-enabled libfreetype       && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
+enabled libfreetype       && require_libfreetype
 enabled libgme            && require  libgme gme/gme.h gme_new_emu -lgme -lstdc++
 enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
                                    check_lib "${gsm_hdr}" gsm_create -lgsm && break;
@@ -4724,6 +4761,10 @@ merge_deps libavfilter $FILTER_LIST
 echo "install prefix            $prefix"
 echo "source path               $source_path"
 echo "C compiler                $cc"
+if test "$host_cc" != "$cc"; then
+    echo "host C compiler           $host_cc"
+fi
+echo "C library                 $libc_type"
 echo "ARCH                      $arch ($cpu)"
 if test "$build_suffix" != ""; then
     echo "build suffix              $build_suffix"
@@ -4878,6 +4919,8 @@ LD_O=$LD_O
 LD_LIB=$LD_LIB
 LD_PATH=$LD_PATH
 DLLTOOL=$dlltool
+WINDRES=$windres
+DEPWINDRES=$dep_cc
 LDFLAGS=$LDFLAGS
 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
 ASMSTRIPFLAGS=$ASMSTRIPFLAGS
@@ -4965,6 +5008,7 @@ cat > $TMPH <<EOF
 #define av_restrict $_restrict
 #define EXTERN_PREFIX "${extern_prefix}"
 #define EXTERN_ASM ${extern_prefix}
+#define BUILDSUF "$build_suffix"
 #define SLIBSUF "$SLIBSUF"
 #define HAVE_MMX2 HAVE_MMXEXT
 EOF