3 if test x
"$1" = x
"-h" -o x
"$1" = x
"--help" ; then
5 Usage: ./configure [options]
8 -h, --help print this message
11 --prefix=PREFIX install architecture-independent files in PREFIX
13 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
15 --bindir=DIR install binaries in DIR [EPREFIX/bin]
16 --libdir=DIR install libs in DIR [EPREFIX/lib]
17 --includedir=DIR install includes in DIR [PREFIX/include]
18 --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS
19 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS
20 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS
21 --extra-rcflags=ERCFLAGS add ERCFLAGS to RCFLAGS
23 Configuration options:
24 --disable-cli disable cli
25 --system-libx264 use system libx264 instead of internal
26 --enable-shared build shared library
27 --enable-static build static library
28 --disable-opencl disable OpenCL features
29 --disable-gpl disable GPL-only features
30 --disable-thread disable multithreaded encoding
31 --disable-win32thread disable win32threads (windows only)
32 --disable-interlaced disable interlaced encoding support
33 --bit-depth=BIT_DEPTH set output bit depth (8-10) [8]
34 --chroma-format=FORMAT output chroma format (420, 422, 444, all) [all]
37 --disable-asm disable platform-specific assembly optimizations
38 --enable-lto enable link-time optimization
40 --enable-gprof add -pg
42 --enable-pic build position-independent code
45 --host=HOST build programs to run on HOST
46 --cross-prefix=PREFIX use PREFIX for compilation tools
47 --sysroot=SYSROOT root of cross-build tree
49 External library support:
50 --disable-avs disable avisynth support
51 --disable-swscale disable swscale support
52 --disable-lavf disable libavformat support
53 --disable-ffms disable ffmpegsource support
54 --disable-gpac disable gpac support
55 --disable-lsmash disable lsmash support
56 --disable-avi-output disables avi output (using libavformat)
63 echo -n "checking $1... " >> config.log
67 echo "yes" >> config.log
71 echo "no" >> config.log
75 echo "$1" >> config.log
79 # several non gcc compilers issue an incredibly large number of warnings on high warning levels,
80 # suppress them by reducing the warning level rather than having to use #pragmas
82 [[ "$arg" = -falign-loops* ]] && arg
=
83 [ "$arg" = -fno-tree-vectorize ] && arg
=
84 [ "$arg" = -Wshadow ] && arg
=
85 [ "$arg" = -Wno-maybe-uninitialized ] && arg
=
86 [[ "$arg" = -mpreferred-stack-boundary* ]] && arg
=
87 [[ "$arg" = -l* ]] && arg
=
88 [[ "$arg" = -L* ]] && arg
=
89 if [ $compiler_style = MS
]; then
90 [ "$arg" = -ffast-math ] && arg
="-fp:fast"
91 [ "$arg" = -Wall ] && arg
=
92 [ "$arg" = -Werror ] && arg
="-W3 -WX"
93 [ "$arg" = -g ] && arg
=-Z7
94 [ "$arg" = -fomit-frame-pointer ] && arg
=
95 [ "$arg" = -s ] && arg
=
96 [ "$arg" = -fPIC ] && arg
=
98 [ "$arg" = -ffast-math ] && arg
=
99 [ "$arg" = -Wall ] && arg
=
100 [ "$arg" = -Werror ] && arg
="-w3 -Werror"
102 [ $compiler = CL
-a "$arg" = -O3 ] && arg
=-O2
104 [ -n "$arg" ] && echo -n "$arg "
110 arg
=${arg/LIBPATH/libpath}
111 [ "${arg#-libpath:}" == "$arg" -a "${arg#-l}" != "$arg" ] && arg=${arg#-l}.lib
112 [ "${arg#-L}" != "$arg" ] && arg=-libpath:${arg#-L}
113 [ "$arg" = -Wl,--large-address-aware ] && arg=-largeaddressaware
114 [ "$arg" = -s ] && arg=
115 [ "$arg" = -Wl,-Bsymbolic ] && arg=
116 [ "$arg" = -fno-tree-vectorize ] && arg=
117 [ "$arg" = -Werror ] && arg=
118 [ "$arg" = -Wshadow ] && arg=
119 [ "$arg" = -Wmaybe-uninitialized ] && arg=
120 [[ "$arg" = -Qdiag-error* ]] && arg=
122 arg=${arg/pthreadGC/pthreadVC}
123 [ "$arg" = avifil32.lib ] && arg=vfw32.lib
124 [ "$arg" = gpac_static.lib ] && arg=libgpac_static.lib
125 [ "$arg" = x264.lib ] && arg=libx264.lib
127 [ -n "$arg" ] && echo -n "$arg "
133 if [ -z "$1$2" ]; then
134 log_check "whether
$CC works
"
135 elif [ -z "$1" ]; then
140 elif [ -z "$1" ]; then
142 log_check "whether
$CC supports
$3"
144 log_check "whether
$CC supports
$3 with
$2"
147 log_check "for $3 in $1";
151 echo "#include <$arg>" >> conftest.c
153 echo "int main (void) { $3 return 0; }" >> conftest.c
154 if [ $compiler_style = MS
]; then
155 cc_cmd
="$CC conftest.c $(cc_cflags $CFLAGS $CHECK_CFLAGS $2) -link $(cl_ldflags $2 $LDFLAGSCLI $LDFLAGS)"
157 cc_cmd
="$CC conftest.c $CFLAGS $CHECK_CFLAGS $2 $LDFLAGSCLI $LDFLAGS -o conftest"
159 if $cc_cmd >conftest.log
2>&1; then
165 log_msg
"Failed commandline was:"
166 log_msg
"--------------------------------------------------"
168 cat conftest.log
>> config.log
169 log_msg
"--------------------------------------------------"
170 log_msg
"Failed program was:"
171 log_msg
"--------------------------------------------------"
172 cat conftest.c
>> config.log
173 log_msg
"--------------------------------------------------"
179 log_check
"whether $3 is true"
182 echo "#include <$arg>" >> conftest.c
184 echo -e "#if !($3) \n#error $4 \n#endif " >> conftest.c
185 if [ $compiler_style = MS
]; then
186 cpp_cmd
="$CC conftest.c $(cc_cflags $CFLAGS $2) -P"
188 cpp_cmd
="$CC conftest.c $CFLAGS $2 -E -o conftest"
190 if $cpp_cmd >conftest.log
2>&1; then
196 log_msg
"--------------------------------------------------"
197 cat conftest.log
>> config.log
198 log_msg
"--------------------------------------------------"
199 log_msg
"Failed program was:"
200 log_msg
"--------------------------------------------------"
201 cat conftest.c
>> config.log
202 log_msg
"--------------------------------------------------"
208 log_check
"whether $AS supports $1"
209 echo "$1" > conftest
$AS_EXT
210 as_cmd
="$AS conftest$AS_EXT $ASFLAGS $2 -o conftest.o"
211 if $as_cmd >conftest.log
2>&1; then
217 log_msg
"Failed commandline was:"
218 log_msg
"--------------------------------------------------"
220 cat conftest.log
>> config.log
221 log_msg
"--------------------------------------------------"
222 log_msg
"Failed program was:"
223 log_msg
"--------------------------------------------------"
224 cat conftest
$AS_EXT >> config.log
225 log_msg
"--------------------------------------------------"
231 log_check
"whether $RC works"
232 echo "$1" > conftest.rc
233 if [ $compiler = GNU
]; then
234 rc_cmd
="$RC $RCFLAGS -o conftest.o conftest.rc"
236 rc_cmd
="$RC $RCFLAGS -foconftest.o conftest.rc"
238 if $rc_cmd >conftest.log
2>&1; then
244 log_msg
"Failed commandline was:"
245 log_msg
"--------------------------------------------------"
247 cat conftest.log
>> config.log
248 log_msg
"--------------------------------------------------"
249 log_msg
"Failed program was:"
250 log_msg
"--------------------------------------------------"
251 cat conftest.rc
>> config.log
252 log_msg
"--------------------------------------------------"
258 echo "#define $1$([ -n "$2" ] && echo " $2" || echo " 1")" >> config.h
267 configure_system_override
() {
268 log_check
"system libx264 configuration"
269 x264_config_path
="$1/x264_config.h"
270 if [ -e "$x264_config_path" ]; then
273 arg
="$(grep '#define X264_GPL ' $x264_config_path | sed -e 's/#define X264_GPL *//; s/ *$//')"
274 if [ -n "$arg" ]; then
275 [ "$arg" = 0 ] && arg
="no" || arg
="yes"
276 [ "$arg" != "$gpl" ] && die
"Incompatible license with system libx264"
278 arg
="$(grep '#define X264_BIT_DEPTH ' $x264_config_path | sed -e 's/#define X264_BIT_DEPTH *//; s/ *$//')"
279 if [ -n "$arg" ]; then
280 if [ "$arg" != "$bit_depth" ]; then
281 echo "Override output bit depth with system libx264 configuration"
285 arg
="$(grep '#define X264_CHROMA_FORMAT ' $x264_config_path | sed -e 's/#define X264_CHROMA_FORMAT *//; s/ *$//')"
286 if [ -n "$arg" ]; then
287 [ "$arg" = 0 ] && arg
="all" || arg
="${arg#X264_CSP_I}"
288 if [ "$arg" != "$chroma_format" ]; then
289 echo "Override output chroma format with system libx264 configuration"
293 arg
="$(grep '#define X264_INTERLACED ' $x264_config_path | sed -e 's/#define X264_INTERLACED *//; s/ *$//')"
294 if [ -n "$arg" ]; then
295 [ "$arg" = 0 ] && arg
="no" || arg
="yes"
296 if [ "$arg" != "$interlaced" ]; then
297 echo "Override interlaced encoding support with system libx264 configuration"
304 log_msg
"Failed search path was: $x264_config_path"
309 rm -f x264_config.h config.h config.mak config.log x264.pc x264.def
312 # Construct a path to the specified directory relative to the working directory
314 local base
="${PWD%/}"
315 local path
="$(cd "$1" >/dev/null; printf '%s/.' "${PWD%/}")"
318 while [[ $path != "$base/"* ]]; do
323 dirname "$up${path#"$base/"}"
326 SRCPATH
="$(relative_path "$
(dirname "$0")")"
327 echo "$SRCPATH" |
grep -q ' ' && die
"Out of tree builds are impossible with whitespace in source path."
328 [ -e "$SRCPATH/config.h" -o -e "$SRCPATH/x264_config.h" ] && die
"Out of tree builds are impossible with config.h/x264_config.h in source dir."
331 exec_prefix
='${prefix}'
332 bindir
='${exec_prefix}/bin'
333 libdir
='${exec_prefix}/lib'
334 includedir
='${prefix}/include'
338 cli_libx264
="internal"
365 CFLAGS
="$CFLAGS -Wall -I. -I\$(SRCPATH)"
367 LDFLAGSCLI
="$LDFLAGSCLI"
368 ASFLAGS
="$ASFLAGS -I. -I\$(SRCPATH)"
379 # list of all preprocessor HAVE values we can define
380 CONFIG_HAVE
="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
381 LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
382 MSA MMAP WINRT VSX ARM_INLINE_ASM AVI_OUTPUT"
393 exec_prefix
="$optarg"
419 --disable-interlaced)
437 --disable-avi-output)
444 ASFLAGS
="$ASFLAGS $optarg"
447 CFLAGS
="$CFLAGS $optarg"
450 LDFLAGS
="$LDFLAGS $optarg"
453 RCFLAGS
="$RCFLAGS $optarg"
458 --disable-win32thread)
459 [ "$thread" != "no" ] && thread
="posix"
472 LDFLAGS
="$LDFLAGS -pg"
491 cross_prefix
="$optarg"
494 CFLAGS
="$CFLAGS --sysroot=$optarg"
495 LDFLAGS
="$LDFLAGS --sysroot=$optarg"
499 if [ "$bit_depth" -lt "8" -o "$bit_depth" -gt "10" ]; then
500 echo "Supplied bit depth must be in range [8,10]."
503 bit_depth
=`expr $bit_depth + 0`
506 chroma_format
="$optarg"
507 if [ $chroma_format != "420" -a $chroma_format != "422" -a $chroma_format != "444" -a $chroma_format != "all" ]; then
508 echo "Supplied chroma format must be 420, 422, 444 or all."
513 echo "Unknown option $opt, ignored"
518 [ "$cli" = "no" -a "$shared" = "no" -a "$static" = "no" ] && die
"Nothing to build. Enable cli, shared or static."
520 CC
="${CC-${cross_prefix}gcc}"
521 STRIP
="${STRIP-${cross_prefix}strip}"
522 INSTALL
="${INSTALL-install}"
523 PKGCONFIG
="${PKGCONFIG-${cross_prefix}pkg-config}"
525 # ar and ranlib doesn't load the LTO plugin by default, prefer the gcc-prefixed wrappers which does.
526 if ${cross_prefix}gcc-ar
--version >/dev
/null
2>&1; then
527 AR
="${AR-${cross_prefix}gcc-ar}"
529 AR
="${AR-${cross_prefix}ar}"
531 if ${cross_prefix}gcc-ranlib
--version >/dev
/null
2>&1; then
532 RANLIB
="${RANLIB-${cross_prefix}gcc-ranlib}"
534 RANLIB
="${RANLIB-${cross_prefix}ranlib}"
537 if [ "x$host" = x
]; then
538 host=`${SRCPATH}/config.guess`
540 # normalize a triplet into a quadruplet
541 host=`${SRCPATH}/config.sub $host`
544 host_cpu
="${host%%-*}"
546 host_vendor
="${host%%-*}"
549 trap 'rm -rf conftest*' EXIT
551 # test for use of compilers that require specific handling
552 cc_base
=`basename "$CC"`
554 if [[ $host_os = mingw
* ||
$host_os = cygwin
* ]]; then
555 if [[ "$cc_base" = icl ||
"$cc_base" = icl
[\ .
]* ]]; then
556 # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths.
557 [[ $host_os = cygwin
* ]] && die
"Windows Intel Compiler support requires MSYS"
560 CFLAGS
="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -I\$(SRCPATH)/extras"
562 cpp_check
'' '' '_MSC_VER >= 1400' || die
"Windows Intel Compiler support requires Visual Studio 2005 or newer"
563 if cpp_check
'' '' 'defined(_M_AMD64) || defined(_M_X64)' ; then
565 elif cpp_check
'' '' 'defined(_M_IX86)' ; then
568 if cc_check
'' -Qdiag-error:10006,10157 ; then
569 CHECK_CFLAGS
="$CHECK_CFLAGS -Qdiag-error:10006,10157"
571 elif [[ "$cc_base" = cl ||
"$cc_base" = cl
[\ .
]* ]]; then
572 # Standard Microsoft Visual Studio
575 CFLAGS
="$CFLAGS -nologo -GS- -DHAVE_STRING_H -I\$(SRCPATH)/extras"
576 cpp_check
'' '' '_MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324)' || die
"Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer"
577 if cpp_check
'' '' 'defined(_M_AMD64) || defined(_M_X64)' ; then
579 elif cpp_check
'' '' 'defined(_M_IX86)' ; then
581 elif cpp_check
'' '' 'defined(_M_ARM64)' ; then
583 elif cpp_check
'' '' 'defined(_M_ARM)' ; then
587 # MinGW uses broken pre-VS2015 Microsoft printf functions unless it's told to use the POSIX ones.
588 CFLAGS
="$CFLAGS -D_POSIX_C_SOURCE=200112L"
591 if [[ "$cc_base" = icc ||
"$cc_base" = icc
[\ .
]* ]]; then
597 if [ $compiler = GNU
]; then
598 if cc_check
'' -Werror=unknown-warning-option
; then
599 CHECK_CFLAGS
="$CHECK_CFLAGS -Werror=unknown-warning-option"
612 if [ "$pic" = "no" ]; then
613 cc_check
"" -mdynamic-no-pic && CFLAGS
="$CFLAGS -mdynamic-no-pic"
643 cygwin
*|mingw
*|msys
*)
645 if [[ $host_os = cygwin
* ]] && cpp_check
"" "" "defined(__CYGWIN__)" ; then
651 cc_check
'' -lshell32 && LDFLAGSCLI
="$LDFLAGSCLI -lshell32"
652 [ $compiler = GNU
] && RC
="${RC-${cross_prefix}windres}" || RC
="${RC-rc.exe}"
659 if cc_check
"" /usr
/lib
/64/values-xpg6.o
; then
660 LDFLAGS
="$LDFLAGS /usr/lib/64/values-xpg6.o"
662 LDFLAGS
="$LDFLAGS /usr/lib/values-xpg6.o"
664 if test -x /usr
/ucb
/install ; then
665 INSTALL
=/usr
/ucb
/install
666 elif test -x /usr
/bin
/ginstall
; then
668 INSTALL
=/usr
/bin
/ginstall
669 elif test -x /usr
/gnu
/bin
/install ; then
671 INSTALL
=/usr
/gnu
/bin
/install
680 CFLAGS
="$CFLAGS -I\$(SRCPATH)/extras"
686 die
"Unknown system $host, edit the configure"
690 LDFLAGS
="$LDFLAGS $libm"
698 ASFLAGS
="$ASFLAGS -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/"
699 if [ $compiler = GNU
]; then
700 if [[ "$asm" == auto
&& "$CFLAGS" != *-march* ]]; then
701 CFLAGS
="$CFLAGS -march=i686"
703 if [[ "$asm" == auto
&& "$CFLAGS" != *-mfpmath* ]]; then
704 CFLAGS
="$CFLAGS -mfpmath=sse -msse -msse2"
706 CFLAGS
="-m32 $CFLAGS"
707 LDFLAGS
="-m32 $LDFLAGS"
709 if [ "$SYS" = MACOSX
]; then
710 ASFLAGS
="$ASFLAGS -f macho32 -DPREFIX"
711 elif [ "$SYS" = WINDOWS
-o "$SYS" = CYGWIN
]; then
712 ASFLAGS
="$ASFLAGS -f win32 -DPREFIX"
713 LDFLAGS
="$LDFLAGS -Wl,--large-address-aware"
714 [ $compiler = GNU
] && LDFLAGS
="$LDFLAGS -Wl,--dynamicbase,--nxcompat,--tsaware"
715 [ $compiler = GNU
] && RCFLAGS
="--target=pe-i386 $RCFLAGS"
717 ASFLAGS
="$ASFLAGS -f elf32"
724 ASFLAGS
="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
726 [ $compiler = GNU
] && CFLAGS
="-m64 $CFLAGS" && LDFLAGS
="-m64 $LDFLAGS"
727 if [ "$SYS" = MACOSX
]; then
728 ASFLAGS
="$ASFLAGS -f macho64 -DPIC -DPREFIX"
729 if cc_check
'' "-arch x86_64"; then
730 CFLAGS
="$CFLAGS -arch x86_64"
731 LDFLAGS
="$LDFLAGS -arch x86_64"
733 elif [ "$SYS" = WINDOWS
-o "$SYS" = CYGWIN
]; then
734 ASFLAGS
="$ASFLAGS -f win64"
735 if [ $compiler = GNU
]; then
736 # only the GNU toolchain is inconsistent in prefixing function names with _
737 cc_check
"" "-S" && grep -q "_main:" conftest
&& ASFLAGS
="$ASFLAGS -DPREFIX"
738 cc_check
"" "-Wl,--high-entropy-va" && LDFLAGS
="$LDFLAGS -Wl,--high-entropy-va"
739 LDFLAGS
="$LDFLAGS -Wl,--dynamicbase,--nxcompat,--tsaware"
740 LDFLAGSCLI
="$LDFLAGSCLI -Wl,--image-base,0x140000000"
741 SOFLAGS
="$SOFLAGS -Wl,--image-base,0x180000000"
742 RCFLAGS
="--target=pe-x86-64 $RCFLAGS"
745 ASFLAGS
="$ASFLAGS -f elf64"
750 if [ $asm = auto
] ; then
754 if [ $SYS = MACOSX
] ; then
755 CFLAGS
="$CFLAGS -faltivec -fastf -mcpu=G4"
757 CFLAGS
="$CFLAGS -maltivec -mabi=altivec"
758 define HAVE_ALTIVEC_H
760 if [ "$vsx" != "no" ] ; then
762 if cc_check
"" "-mvsx" ; then
763 CFLAGS
="$CFLAGS -mvsx"
780 if [ "$SYS" = MACOSX
] ; then
782 ASFLAGS
="$ASFLAGS -DPREFIX -DPIC" # apple's ld doesn't support movw/movt relocations at all
783 # build for armv7 by default
784 if ! echo $CFLAGS |
grep -Eq '\-arch' ; then
785 CFLAGS
="$CFLAGS -arch armv7"
786 LDFLAGS
="$LDFLAGS -arch armv7"
788 elif [ "$SYS" = WINDOWS
] ; then
789 AS
="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch arm -as-type armasm -force-thumb -- armasm -nologo -ignore 4509}"
798 if [ "$SYS" = MACOSX
] ; then
799 ASFLAGS
="$ASFLAGS -DPREFIX -DPIC"
815 ARCH
="$(echo $host_cpu | tr a-z A-Z)"
819 [ "$vsx" != "yes" ] && vsx
="no"
821 if [ $SYS = WINDOWS
]; then
822 if ! rc_check
"0 RCDATA {0}" ; then
826 if cpp_check
"winapifamily.h" "" "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)" ; then
827 [ $compiler = CL
] || die
"WinRT requires MSVC"
830 LDFLAGS
="$LDFLAGS -appcontainer"
831 if ! cpp_check
"" "" "defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0603" ; then
832 die
"_WIN32_WINNT must be defined to at least 0x0603 (Windows 8.1) for WinRT"
833 elif cpp_check
"" "" "_WIN32_WINNT >= 0x0A00" ; then
834 # Universal Windows Platform (Windows 10)
835 LDFLAGS
="$LDFLAGS -lWindowsApp"
842 log_msg
"x264 configure script"
844 msg
="Command line options:"
854 cc_check || die
"No working C compiler found."
856 if [ $compiler_style = GNU
]; then
857 if cc_check
'' -std=gnu99
'for( int i = 0; i < 9; i++ );' ; then
858 CFLAGS
="$CFLAGS -std=gnu99 -D_GNU_SOURCE"
859 elif cc_check
'' -std=c99
'for( int i = 0; i < 9; i++ );' ; then
860 CFLAGS
="$CFLAGS -std=c99 -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE"
861 elif ! cc_check
'' '' 'for( int i = 0; i < 9; i++ );' ; then
862 die
"C99 compiler is needed for compilation."
866 if [ $shared = yes -a \
( $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" -o $ARCH = "ARM" -o $ARCH = "IA64" -o $ARCH = "PARISC" -o $ARCH = "MIPS" -o $ARCH = "AARCH64" \
) ] ; then
870 if [ $compiler = GNU
-a \
( $ARCH = X86
-o $ARCH = X86_64 \
) ] ; then
871 if cc_check
'' -mpreferred-stack-boundary=6 ; then
872 CFLAGS
="$CFLAGS -mpreferred-stack-boundary=6"
874 elif cc_check
'' -mpreferred-stack-boundary=5 ; then
875 CFLAGS
="$CFLAGS -mpreferred-stack-boundary=5"
877 elif [ $stack_alignment -lt 16 ] && cc_check
'' -mpreferred-stack-boundary=4 ; then
878 CFLAGS
="$CFLAGS -mpreferred-stack-boundary=4"
881 elif [ $compiler = ICC
-a $ARCH = X86
]; then
882 # icc on linux has various degrees of mod16 stack support
883 if [ $SYS = LINUX
]; then
884 # >= 12 defaults to a mod16 stack
885 if cpp_check
"" "" "__INTEL_COMPILER >= 1200" ; then
887 # 11 <= x < 12 is capable of keeping a mod16 stack, but defaults to not doing so.
888 elif cpp_check
"" "" "__INTEL_COMPILER >= 1100" ; then
889 CFLAGS
="$CFLAGS -falign-stack=assume-16-byte"
892 # < 11 is completely incapable of keeping a mod16 stack
896 if [ $asm = auto
-a \
( $ARCH = X86
-o $ARCH = X86_64 \
) ] ; then
897 if ! as_check
"vmovdqa32 [eax]{k1}{z}, zmm0" ; then
898 VER
=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
900 echo "Minimum version is nasm-2.13"
901 echo "If you really want to compile without asm, configure with --disable-asm."
904 cc_check
'' '' '__asm__("pabsw %xmm0, %xmm0");' && define HAVE_X86_INLINE_ASM
908 if [ $asm = auto
-a $ARCH = ARM
] ; then
909 # set flags so neon is built by default
910 [ $compiler == CL
] ||
echo $CFLAGS |
grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS
="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
912 cc_check
'' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM
913 if [ $compiler = CL
] && cpp_check
'' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then
917 elif cc_check
'' '' '__asm__("rev ip, ip");' ; then define HAVE_ARMV6
918 cc_check
'' '' '__asm__("movt r0, #0");' && define HAVE_ARMV6T2
919 cc_check
'' '' '__asm__("vadd.i16 q0, q0, q0");' && define HAVE_NEON
920 ASFLAGS
="$ASFLAGS -c"
922 echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
923 echo "If you really want to run on such a CPU, configure with --disable-asm."
928 if [ $asm = auto
-a $ARCH = AARCH64
] ; then
929 if cc_check
'' '' '__asm__("cmeq v0.8h, v0.8h, #0");' ; then define HAVE_NEON
930 ASFLAGS
="$ASFLAGS -c"
932 echo "no NEON support, try adding -mfpu=neon to CFLAGS"
933 echo "If you really want to run on such a CPU, configure with --disable-asm."
938 if [ $asm = auto
-a \
( $ARCH = ARM
-o $ARCH = AARCH64 \
) ] ; then
939 # check if the assembler supports '.func' (clang 3.5 does not)
940 as_check
".func test${NL}.endfunc" && define HAVE_AS_FUNC
1
943 if [ $asm = auto
-a $ARCH = MIPS
] ; then
944 if ! echo $CFLAGS |
grep -Eq '(-march|-mmsa|-mno-msa)' ; then
945 cc_check
'' '-mmsa -mfp64 -mhard-float' && CFLAGS
="-mmsa -mfp64 -mhard-float $CFLAGS"
948 if cc_check
'' '' '__asm__("addvi.b $w0, $w1, 1");' ; then
951 echo "You specified a pre-MSA CPU in your CFLAGS."
952 echo "If you really want to run on such a CPU, configure with --disable-asm."
957 [ $asm = no
] && AS
=""
958 [ "x$AS" = x
] && asm
="no" || asm
="yes"
963 define STACK_ALIGNMENT
$stack_alignment
964 ASFLAGS
="$ASFLAGS -DSTACK_ALIGNMENT=$stack_alignment"
966 # skip endianness check for Intel Compiler and MSVS, as all supported platforms are little. each have flags that will cause the check to fail as well
967 CPU_ENDIAN
="little-endian"
968 if [ $compiler = GNU
]; then
969 echo "int i[2] = {0x42494745,0}; double f[2] = {0x1.0656e6469616ep+102,0};" > conftest.c
970 $CC $CFLAGS conftest.c
-c -o conftest.o
2>/dev
/null || die
"endian test failed"
971 if (${cross_prefix}strings -a conftest.o |
grep -q BIGE
) && (${cross_prefix}strings -a conftest.o |
grep -q FPendian
) ; then
972 define WORDS_BIGENDIAN
973 CPU_ENDIAN
="big-endian"
974 elif !(${cross_prefix}strings -a conftest.o |
grep -q EGIB
&& ${cross_prefix}strings -a conftest.o |
grep -q naidnePF
) ; then
975 die
"endian test failed"
979 if [ "$cli_libx264" = "system" -a "$shared" != "yes" ] ; then
980 [ "$static" = "yes" ] && die
"Option --system-libx264 can not be used together with --enable-static"
981 if $PKGCONFIG --exists x264
2>/dev
/null
; then
982 X264_LIBS
="$($PKGCONFIG --libs x264)"
983 X264_INCLUDE_DIR
="${X264_INCLUDE_DIR-$($PKGCONFIG --variable=includedir x264)}"
984 configure_system_override
"$X264_INCLUDE_DIR" || die
"Detection of system libx264 configuration failed"
986 die
"Can not find system libx264"
990 # autodetect options that weren't forced nor disabled
993 if [ "$SYS" = "WINDOWS" -a "$thread" = "posix" ] ; then
994 if [ "$gpl" = "no" ] ; then
995 echo "Warning: pthread-win32 is LGPL and is therefore not supported with --disable-gpl"
997 elif cc_check pthread.h
-lpthread "pthread_create(0,0,0,0);" ; then
998 libpthread
="-lpthread"
999 elif cc_check pthread.h
-lpthreadGC2 "pthread_create(0,0,0,0);" ; then
1000 libpthread
="-lpthreadGC2"
1001 elif cc_check pthread.h
"-lpthreadGC2 -lwsock32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
1002 libpthread
="-lpthreadGC2 -lwsock32"
1003 define PTW32_STATIC_LIB
1004 elif cc_check pthread.h
"-lpthreadGC2 -lws2_32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
1005 libpthread
="-lpthreadGC2 -lws2_32"
1006 define PTW32_STATIC_LIB
1010 elif [ "$thread" != "no" ] ; then
1015 define HAVE_BEOSTHREAD
1019 define HAVE_WIN32THREAD
1022 cc_check pthread.h
-lc "pthread_create(0,0,0,0);" && thread
="posix" && libpthread
="-lc"
1025 if cc_check pthread.h
-lpthread "pthread_create(0,0,0,0);" ; then
1027 libpthread
="-lpthread"
1029 cc_check pthread.h
"" "pthread_create(0,0,0,0);" && thread
="posix" && libpthread
=""
1034 if [ "$thread" = "posix" ]; then
1035 LDFLAGS
="$LDFLAGS $libpthread"
1036 define HAVE_POSIXTHREAD
1037 if [ "$SYS" = "LINUX" ] && cc_check sched.h
"-D_GNU_SOURCE -Werror" "cpu_set_t p_aff; return CPU_COUNT(&p_aff);" ; then
1038 define HAVE_CPU_COUNT
1041 [ "$thread" != "no" ] && define HAVE_THREAD
1043 if cc_check
"math.h" "-Werror" "return log2f(2);" ; then
1047 if [ "$SYS" != "WINDOWS" ] && cpp_check
"sys/mman.h unistd.h" "" "defined(MAP_PRIVATE)"; then
1051 if [ "$SYS" = "LINUX" -a \
( "$ARCH" = "X86" -o "$ARCH" = "X86_64" \
) ] && cc_check
"sys/mman.h" "" "MADV_HUGEPAGE;" ; then
1055 if [ "$cli" = "no" ] ; then
1065 if [ "$swscale" = "auto" ] ; then
1067 if $PKGCONFIG --exists libswscale
2>/dev
/null
; then
1068 SWSCALE_LIBS
="$SWSCALE_LIBS $($PKGCONFIG --libs libswscale libavutil)"
1069 SWSCALE_CFLAGS
="$SWSCALE_CFLAGS $($PKGCONFIG --cflags libswscale libavutil)"
1071 [ -z "$SWSCALE_LIBS" ] && SWSCALE_LIBS
="-lswscale -lavutil"
1073 if cc_check
"libswscale/swscale.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "sws_init_context(0,0,0);" ; then
1074 if cpp_check
"libavutil/pixdesc.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "defined(AV_PIX_FMT_FLAG_RGB)" ; then
1077 echo "Warning: AV_PIX_FMT_FLAG_RGB is missing from libavutil, update for swscale support"
1082 if [ "$lavf" = "auto" ] ; then
1084 if $PKGCONFIG --exists libavformat libavcodec libswscale
2>/dev
/null
; then
1085 LAVF_LIBS
="$LAVF_LIBS $($PKGCONFIG --libs libavformat libavcodec libavutil libswscale)"
1086 LAVF_CFLAGS
="$LAVF_CFLAGS $($PKGCONFIG --cflags libavformat libavcodec libavutil libswscale)"
1088 if [ -z "$LAVF_LIBS" -a -z "$LAVF_CFLAGS" ]; then
1089 LAVF_LIBS
="-lavformat"
1090 for lib
in -lpostproc -lavcodec -lswscale -lavutil -lm -lz -lbz2 $libpthread -lavifil32 -lws2_32; do
1091 cc_check
"" $lib && LAVF_LIBS
="$LAVF_LIBS $lib"
1094 LAVF_LIBS
="-L. $LAVF_LIBS"
1095 if cc_check libavformat
/avformat.h
"$LAVF_CFLAGS $LAVF_LIBS" "av_frame_free(0);" ; then
1096 if [ "$swscale" = "yes" ]; then
1099 echo "Warning: libavformat is not supported without swscale support"
1104 if [ "$ffms" = "auto" ] ; then
1105 ffms_major
="2"; ffms_minor
="21"; ffms_micro
="0"; ffms_bump
="0"
1108 if $PKGCONFIG --exists ffms2
2>/dev
/null
; then
1109 FFMS2_LIBS
="$FFMS2_LIBS $($PKGCONFIG --libs ffms2)"
1110 FFMS2_CFLAGS
="$FFMS2_CFLAGS $($PKGCONFIG --cflags ffms2)"
1112 [ -z "$FFMS2_LIBS" ] && FFMS2_LIBS
="-lffms2"
1114 if cc_check ffms.h
"$FFMS2_CFLAGS $FFMS2_LIBS" "FFMS_DestroyVideoSource(0);" ; then
1116 elif cc_check ffms.h
"$FFMS2_CFLAGS $FFMS2_LIBS -lstdc++ $LAVF_LIBS" "FFMS_DestroyVideoSource(0);" ; then
1118 FFMS2_LIBS
="$FFMS2_LIBS -lstdc++ $LAVF_LIBS"
1121 error
="ffms must be at least version $ffms_major.$ffms_minor.$ffms_micro.$ffms_bump"
1122 if [ $ffms = "yes" ] && ! cpp_check
"ffms.h" "$FFMS2_CFLAGS" "FFMS_VERSION >= (($ffms_major << 24) | ($ffms_minor << 16) | ($ffms_micro << 8) | $ffms_bump)" "$error"; then
1124 echo "Warning: $error"
1126 if [ "$ffms" = "yes" -a "$swscale" = "no" ]; then
1127 echo "Warning: ffms is not supported without swscale support"
1132 if [ "$swscale" = "yes" ]; then
1133 LDFLAGSCLI
="$SWSCALE_LIBS $LDFLAGSCLI"
1134 CFLAGS
="$CFLAGS $SWSCALE_CFLAGS"
1136 if [ "$lavf" = "yes" ]; then
1137 LDFLAGSCLI
="$LAVF_LIBS $LDFLAGSCLI"
1138 CFLAGS
="$CFLAGS $LAVF_CFLAGS"
1141 if [ "$ffms" = "yes" ]; then
1142 LDFLAGSCLI
="$FFMS2_LIBS $LDFLAGSCLI"
1143 CFLAGS
="$CFLAGS $FFMS2_CFLAGS"
1148 if [ "$lsmash" = "auto" ] ; then
1150 if $PKGCONFIG --exists liblsmash
2>/dev
/null
; then
1151 LSMASH_LIBS
="$LSMASH_LIBS $($PKGCONFIG --libs liblsmash)"
1152 LSMASH_CFLAGS
="$LSMASH_CFLAGS $($PKGCONFIG --cflags liblsmash)"
1154 [ -z "$LSMASH_LIBS" ] && LSMASH_LIBS
="-llsmash"
1156 if cc_check lsmash.h
"$LSMASH_CFLAGS $LSMASH_LIBS" ; then
1157 if cpp_check lsmash.h
"$LSMASH_CFLAGS" "LSMASH_VERSION_MAJOR > 1 || (LSMASH_VERSION_MAJOR == 1 && LSMASH_VERSION_MINOR >= 5)" ; then
1160 echo "Warning: lsmash is too old, update to rev.895 or later"
1165 if [ "$gpac" = "auto" -a "$lsmash" != "yes" ] ; then
1167 GPAC_LIBS
="-lgpac_static"
1168 cc_check
"" -lz && GPAC_LIBS
="$GPAC_LIBS -lz"
1169 if [ "$SYS" = "WINDOWS" ] ; then
1170 cc_check
"" -lws2_32 && GPAC_LIBS
="$GPAC_LIBS -lws2_32"
1171 cc_check
"" -lwinmm && GPAC_LIBS
="$GPAC_LIBS -lwinmm"
1173 if cc_check gpac
/isomedia.h
"$GPAC_LIBS" ; then
1174 if cc_check gpac
/isomedia.h
"$GPAC_LIBS" "gf_isom_set_pixel_aspect_ratio(0,0,0,0,0);" ; then
1177 echo "Warning: gpac is too old, update to 2007-06-21 UTC or later"
1182 if [ "$lsmash" = "yes" ] ; then
1184 LDFLAGSCLI
="$LSMASH_LIBS $LDFLAGSCLI"
1185 CFLAGS
="$CFLAGS $LSMASH_CFLAGS"
1187 elif [ "$gpac" = "yes" ] ; then
1190 LDFLAGSCLI
="$GPAC_LIBS $LDFLAGSCLI"
1193 if [ "$avi_output" = "auto" ] ; then
1195 if ${cross_prefix}pkg-config
--exists libavformat
2>$DEVNULL; then
1196 AVI_LIBS
="$AVI_LIBS $(${cross_prefix}pkg-config --libs libavformat)"
1197 AVI_CFLAGS
="$AVI_CFLAGS $(${cross_prefix}pkg-config --cflags libavformat)"
1199 if [ -z "$AVI_LIBS" -a -z "$AVI_CFLAGS" ]; then
1200 AVI_LIBS
="-lavformat"
1201 for lib
in -lavcodec -lavutil -lm -lz -lbz2 $libpthread -lavifil32; do
1202 cc_check
"" $lib && AVI_LIBS
="$AVI_LIBS $lib"
1205 AVI_LIBS
="-L. $AVI_LIBS"
1206 if cc_check libavformat
/avformat.h
"$AVI_CFLAGS $AVI_LIBS" ; then
1207 if cc_check libavformat
/avformat.h
"$AVI_CFLAGS $AVI_LIBS" 'av_register_all(); av_guess_format( "avi", NULL, NULL );' ; then
1213 if [ "$avi_output" = "yes" ]; then
1214 LDFLAGSCLI
="$AVI_LIBS $LDFLAGSCLI"
1215 [ -n "$AVI_CFLAGS" ] && CFLAGS
="$CFLAGS $AVI_CFLAGS"
1216 define HAVE_AVI_OUTPUT
1219 if [ "$avs" = "auto" ] ; then
1221 # cygwin can use avisynth if it can use LoadLibrary
1222 if [ $SYS = WINDOWS
] ||
([ $SYS = CYGWIN
] && cc_check windows.h
"" "LoadLibraryW(0);") ; then
1225 define USE_AVXSYNTH
0
1226 elif [ "$SYS" = "LINUX" -o "$SYS" = "MACOSX" ] ; then
1227 # AvxSynth currently only supports Linux and OSX
1230 define USE_AVXSYNTH
1
1232 LDFLAGSCLI
="$AVS_LIBS $LDFLAGSCLI"
1236 cc_check
"stdint.h" "" "uint32_t test_vec __attribute__ ((vector_size (16))) = {0,1,2,3};" && define HAVE_VECTOREXT
1238 if [ "$pic" = "yes" ] ; then
1239 [ "$SYS" != WINDOWS
-a "$SYS" != CYGWIN
] && CFLAGS
="$CFLAGS -fPIC"
1240 ASFLAGS
="$ASFLAGS -DPIC"
1241 # resolve textrels in the x86 asm
1242 cc_check stdio.h
"-shared -Wl,-Bsymbolic" && SOFLAGS
="$SOFLAGS -Wl,-Bsymbolic"
1243 [ $SYS = SunOS
-a "$ARCH" = "X86" ] && SOFLAGS
="$SOFLAGS -mimpure-text"
1246 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
1247 CFLAGS
="$CFLAGS -fomit-frame-pointer"
1250 if [ "$strip" = "yes" ]; then
1251 LDFLAGS
="$LDFLAGS -s"
1254 if [ "$debug" = "yes" ]; then
1255 CFLAGS
="-O1 -g $CFLAGS"
1256 RCFLAGS
="$RCFLAGS -DDEBUG"
1258 CFLAGS
="-O3 -ffast-math $CFLAGS"
1259 if [ "$lto" = "auto" ] && [ $compiler = GNU
] && cc_check
"" "-flto" ; then
1261 CFLAGS
="$CFLAGS -flto"
1262 LDFLAGS
="$LDFLAGS -O3 -flto"
1265 [ "$lto" = "auto" ] && lto
="no"
1267 if cc_check
'' -fno-tree-vectorize ; then
1268 CFLAGS
="$CFLAGS -fno-tree-vectorize"
1271 if [ $SYS = WINDOWS
-a $ARCH = X86
-a $compiler = GNU
] ; then
1272 # workaround gcc/ld bug with alignment of static variables/arrays that are initialized to zero
1273 cc_check
'' -fno-zero-initialized-in-bss && CFLAGS
="$CFLAGS -fno-zero-initialized-in-bss"
1276 if cc_check
"stdio.h" "" "fseeko(stdin,0,0);" ; then
1279 elif cc_check
"stdio.h" "" "fseeko64(stdin,0,0);" ; then
1280 define fseek fseeko64
1281 define ftell ftello64
1282 elif cc_check
"stdio.h" "" "_fseeki64(stdin,0,0);" ; then
1283 define fseek _fseeki64
1284 define ftell _ftelli64
1287 if cc_check
'' -Wshadow ; then
1288 CFLAGS
="-Wshadow $CFLAGS"
1291 if cc_check
'' -Wmaybe-uninitialized ; then
1292 CFLAGS
="-Wno-maybe-uninitialized $CFLAGS"
1295 if [ $compiler = ICC
-o $compiler = ICL
] ; then
1296 if cc_check
'extras/intel_dispatcher.h' '' 'x264_intel_dispatcher_override();' ; then
1297 define HAVE_INTEL_DISPATCHER
1301 if [ "$bit_depth" -gt "8" ]; then
1302 define HIGH_BIT_DEPTH
1303 ASFLAGS
="$ASFLAGS -DHIGH_BIT_DEPTH=1"
1306 ASFLAGS
="$ASFLAGS -DHIGH_BIT_DEPTH=0"
1309 if [ "$chroma_format" != "all" ]; then
1310 define CHROMA_FORMAT CHROMA_
$chroma_format
1313 ASFLAGS
="$ASFLAGS -DBIT_DEPTH=$bit_depth"
1315 [ $gpl = yes ] && define HAVE_GPL
&& x264_gpl
=1 || x264_gpl
=0
1317 [ $interlaced = yes ] && define HAVE_INTERLACED
&& x264_interlaced
=1 || x264_interlaced
=0
1320 if [ "$opencl" = "yes" ]; then
1322 # cygwin can use opencl if it can use LoadLibrary
1323 if [ $SYS = WINDOWS
] ||
([ $SYS = CYGWIN
] && cc_check windows.h
"" "LoadLibraryW(0);") ; then
1326 elif [ "$SYS" = "LINUX" -o "$SYS" = "MACOSX" ] ; then
1331 LDFLAGS
="$LDFLAGS $libdl"
1334 #define undefined vars as 0
1335 for var
in $CONFIG_HAVE; do
1336 grep -q "HAVE_$var 1" config.h || define HAVE_
$var 0
1339 # generate exported config file
1341 config_chroma_format
="X264_CSP_I$chroma_format"
1342 [ "$config_chroma_format" == "X264_CSP_Iall" ] && config_chroma_format
="0"
1343 cat > x264_config.h
<< EOF
1344 #define X264_BIT_DEPTH $bit_depth
1345 #define X264_GPL $x264_gpl
1346 #define X264_INTERLACED $x264_interlaced
1347 #define X264_CHROMA_FORMAT $config_chroma_format
1350 if [ "$cli_libx264" = "system" ] ; then
1351 if [ "$shared" = "yes" ]; then
1352 CLI_LIBX264
='$(SONAME)'
1355 LDFLAGSCLI
="$X264_LIBS $LDFLAGSCLI"
1356 cc_check
'stdint.h x264.h' '' 'x264_encoder_open(0);' || die
"System libx264 can't be used for compilation of this version"
1359 CLI_LIBX264
='$(LIBX264)'
1364 if [ $compiler_style = MS
]; then
1365 AR
="lib.exe -nologo -out:"
1367 if [ $compiler = ICL
]; then
1371 mslink
="$(dirname "$
(command -v cl.exe
2>/dev
/null
)")/link.exe"
1372 [ -x "$mslink" ] && LD
="\"$mslink\" -out:"
1375 LDFLAGS
="-nologo -incremental:no $(cl_ldflags $LDFLAGS)"
1376 LDFLAGSCLI
="$(cl_ldflags $LDFLAGSCLI)"
1379 [ -n "$RC" ] && RCFLAGS
="$RCFLAGS -nologo -I. -I\$(SRCPATH)/extras -fo"
1381 if [ $debug = yes ]; then
1382 LDFLAGS
="-debug $LDFLAGS"
1383 CFLAGS
="-D_DEBUG $CFLAGS"
1385 CFLAGS
="-DNDEBUG $CFLAGS"
1392 [ -n "$RC" ] && RCFLAGS
="$RCFLAGS -I. -o "
1394 [ $compiler != GNU
] && CFLAGS
="$(cc_cflags $CFLAGS)"
1395 if [ $compiler = ICC
-o $compiler = ICL
]; then
1396 # icc does not define __SSE__ until SSE2 optimization and icl never defines it or _M_IX86_FP
1397 [ \
( $ARCH = X86_64
-o $ARCH = X86 \
) -a $asm = yes ] && ! cpp_check
"" "" "defined(__SSE__)" && define __SSE__
1398 PROF_GEN_CC
="${QPRE}prof-gen ${QPRE}prof-dir."
1400 PROF_USE_CC
="${QPRE}prof-use ${QPRE}prof-dir."
1402 elif [ $compiler = CL
]; then
1404 # _M_IX86_FP is only defined on x86
1405 [ $ARCH = X86
] && cpp_check
'' '' '_M_IX86_FP >= 1' && define __SSE__
1406 [ $ARCH = X86_64
] && define __SSE__
1407 # As long as the cli application can't link against the dll, the dll can not be pgo'd.
1408 # pgds are link flag specific and the -dll flag for creating the dll makes it unshareable with the cli
1410 PROF_GEN_LD
="-LTCG:PGINSTRUMENT"
1412 PROF_USE_LD
="-LTCG:PGOPTIMIZE"
1414 PROF_GEN_CC
="-fprofile-generate"
1415 PROF_GEN_LD
="-fprofile-generate"
1416 PROF_USE_CC
="-fprofile-use"
1417 PROF_USE_LD
="-fprofile-use"
1420 # generate config files
1422 cat > config.mak
<< EOF
1425 exec_prefix=$exec_prefix
1428 includedir=$includedir
1434 COMPILER_STYLE=$compiler_style
1449 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
1451 PROF_GEN_CC=$PROF_GEN_CC
1452 PROF_GEN_LD=$PROF_GEN_LD
1453 PROF_USE_CC=$PROF_USE_CC
1454 PROF_USE_LD=$PROF_USE_LD
1458 if [ $compiler_style = MS
]; then
1459 echo '%.o: %.c' >> config.mak
1460 echo ' $(CC) $(CFLAGS) -c -Fo$@ $<' >> config.mak
1463 if [ "$cli" = "yes" ]; then
1464 echo 'default: cli' >> config.mak
1465 echo 'install: install-cli' >> config.mak
1468 if [ "$shared" = "yes" ]; then
1469 API
=$
(grep '#define X264_BUILD' < ${SRCPATH}/x264.h | cut
-f 3 -d ' ')
1470 if [ "$SYS" = "WINDOWS" -o "$SYS" = "CYGWIN" ]; then
1471 echo "SONAME=libx264-$API.dll" >> config.mak
1472 if [ $compiler_style = MS
]; then
1473 echo 'IMPLIBNAME=libx264.dll.lib' >> config.mak
1474 # GNU ld on windows defaults to exporting all global functions if there are no explicit __declspec(dllexport) declarations
1475 # MSVC link does not act similarly, so it is required to make an export definition out of x264.h and use it at link time
1476 echo "SOFLAGS=-dll -def:x264.def -implib:\$(IMPLIBNAME) $SOFLAGS" >> config.mak
1477 echo "EXPORTS" > x264.def
1478 # export API functions
1479 grep "^\(int\|void\|x264_t\).*x264" ${SRCPATH}/x264.h |
sed -e "s/.*\(x264.*\)(.*/\1/;s/open/open_$API/g" >> x264.def
1480 # export API variables/data. must be flagged with the DATA keyword
1481 grep "extern.*x264" ${SRCPATH}/x264.h |
sed -e "s/.*\(x264\w*\)\W.*/\1 DATA/;" >> x264.def
1483 echo 'IMPLIBNAME=libx264.dll.a' >> config.mak
1484 echo "SOFLAGS=-shared -Wl,--out-implib,\$(IMPLIBNAME) $SOFLAGS" >> config.mak
1486 elif [ "$SYS" = "MACOSX" ]; then
1487 echo "SOSUFFIX=dylib" >> config.mak
1488 echo "SONAME=libx264.$API.dylib" >> config.mak
1489 echo "SOFLAGS=-shared -dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress -install_name \$(DESTDIR)\$(libdir)/\$(SONAME) $SOFLAGS" >> config.mak
1490 elif [ "$SYS" = "SunOS" ]; then
1491 echo "SOSUFFIX=so" >> config.mak
1492 echo "SONAME=libx264.so.$API" >> config.mak
1493 echo "SOFLAGS=-shared -Wl,-h,\$(SONAME) $SOFLAGS" >> config.mak
1495 echo "SOSUFFIX=so" >> config.mak
1496 echo "SONAME=libx264.so.$API" >> config.mak
1497 echo "SOFLAGS=-shared -Wl,-soname,\$(SONAME) $SOFLAGS" >> config.mak
1499 echo 'default: lib-shared' >> config.mak
1500 echo 'install: install-lib-shared' >> config.mak
1503 if [ "$static" = "yes" ]; then
1504 echo 'default: lib-static' >> config.mak
1505 echo 'install: install-lib-static' >> config.mak
1508 echo "LDFLAGSCLI = $LDFLAGSCLI" >> config.mak
1509 echo "CLI_LIBX264 = $CLI_LIBX264" >> config.mak
1511 ${SRCPATH}/version.sh
>> x264_config.h
1513 cat > x264.pc
<< EOF
1515 exec_prefix=$exec_prefix
1517 includedir=$includedir
1520 Description: H.264 (MPEG4 AVC) encoder library
1521 Version: $(grep POINTVER < x264_config.h | sed -e 's/.* "//; s/".*//')
1522 Libs: -L$libdir -lx264 $([ "$shared" = "yes" ] || echo $libpthread $libm $libdl)
1523 Libs.private: $([ "$shared" = "yes" ] && echo $libpthread $libm $libdl)
1524 Cflags: -I$includedir
1527 filters
="crop select_every hqdn3d pad vflip"
1529 [ $swscale = yes ] && filters
="resize $filters"
1530 [ $gpl = yes ] && filters
="$filters $gpl_filters"
1531 [ $SYS = WINDOWS
] && filters
="$filters subtitles"
1533 cat > conftest.log
<<EOF
1535 byte order: $CPU_ENDIAN
1538 libx264: $cli_libx264
1542 interlaced: $interlaced
1547 avi output: $avi_output
1557 bit depth: $bit_depth
1558 chroma format: $chroma_format
1562 cat conftest.log
>> config.log
1565 [ "$SRCPATH" != "." ] && ln -sf ${SRCPATH}/Makefile .
/Makefile
1566 mkdir
-p common
/{aarch64
,arm
,mips
,ppc
,x86
} encoder extras filters
/video input output tools
1569 echo "You can run 'make' or 'make fprofiled' now."