You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5124 lines
158KB

  1. #!/bin/sh
  2. #
  3. # FFmpeg configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken FFmpeg."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --fatal-warnings fail if any configure warning is generated
  72. --prefix=PREFIX install in PREFIX [$prefix]
  73. --bindir=DIR install binaries in DIR [PREFIX/bin]
  74. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  75. --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
  76. --libdir=DIR install libs in DIR [PREFIX/lib]
  77. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  78. --incdir=DIR install includes in DIR [PREFIX/include]
  79. --mandir=DIR install man page in DIR [PREFIX/share/man]
  80. --enable-rpath use rpath to allow installing libraries in paths
  81. not part of the dynamic linker search path
  82. Licensing options:
  83. --enable-gpl allow use of GPL code, the resulting libs
  84. and binaries will be under GPL [no]
  85. --enable-version3 upgrade (L)GPL to version 3 [no]
  86. --enable-nonfree allow use of nonfree code, the resulting libs
  87. and binaries will be unredistributable [no]
  88. Configuration options:
  89. --disable-static do not build static libraries [no]
  90. --enable-shared build shared libraries [no]
  91. --enable-small optimize for size instead of speed
  92. --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
  93. --enable-gray enable full grayscale support (slower color)
  94. --disable-swscale-alpha disable alpha channel support in swscale
  95. --disable-all disable building components, libraries and programs
  96. --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no]
  97. --enable-incompatible-fork-abi enable incompatible Libav fork ABI (deprecated) [no]
  98. Program options:
  99. --disable-programs do not build command line programs
  100. --disable-ffmpeg disable ffmpeg build
  101. --disable-ffplay disable ffplay build
  102. --disable-ffprobe disable ffprobe build
  103. --disable-ffserver disable ffserver build
  104. Documentation options:
  105. --disable-doc do not build documentation
  106. --disable-htmlpages do not build HTML documentation pages
  107. --disable-manpages do not build man documentation pages
  108. --disable-podpages do not build POD documentation pages
  109. --disable-txtpages do not build text documentation pages
  110. Component options:
  111. --disable-avdevice disable libavdevice build
  112. --disable-avcodec disable libavcodec build
  113. --disable-avformat disable libavformat build
  114. --disable-avutil disable libavutil build
  115. --disable-swresample disable libswresample build
  116. --disable-swscale disable libswscale build
  117. --disable-postproc disable libpostproc build
  118. --disable-avfilter disable libavfilter build
  119. --enable-avresample enable libavresample build [no]
  120. --disable-pthreads disable pthreads [auto]
  121. --disable-w32threads disable Win32 threads [auto]
  122. --disable-os2threads disable OS/2 threads [auto]
  123. --disable-network disable network support [no]
  124. --disable-dct disable DCT code
  125. --disable-dwt disable DWT code
  126. --disable-error-resilience disable error resilience code
  127. --disable-lsp disable LSP code
  128. --disable-lzo disable LZO decoder code
  129. --disable-mdct disable MDCT code
  130. --disable-rdft disable RDFT code
  131. --disable-fft disable FFT code
  132. Hardware accelerators:
  133. --disable-dxva2 disable DXVA2 code [autodetect]
  134. --disable-vaapi disable VAAPI code [autodetect]
  135. --enable-vda enable VDA code
  136. --disable-vdpau disable VDPAU code [autodetect]
  137. Individual component options:
  138. --disable-everything disable all components listed below
  139. --disable-encoder=NAME disable encoder NAME
  140. --enable-encoder=NAME enable encoder NAME
  141. --disable-encoders disable all encoders
  142. --disable-decoder=NAME disable decoder NAME
  143. --enable-decoder=NAME enable decoder NAME
  144. --disable-decoders disable all decoders
  145. --disable-hwaccel=NAME disable hwaccel NAME
  146. --enable-hwaccel=NAME enable hwaccel NAME
  147. --disable-hwaccels disable all hwaccels
  148. --disable-muxer=NAME disable muxer NAME
  149. --enable-muxer=NAME enable muxer NAME
  150. --disable-muxers disable all muxers
  151. --disable-demuxer=NAME disable demuxer NAME
  152. --enable-demuxer=NAME enable demuxer NAME
  153. --disable-demuxers disable all demuxers
  154. --enable-parser=NAME enable parser NAME
  155. --disable-parser=NAME disable parser NAME
  156. --disable-parsers disable all parsers
  157. --enable-bsf=NAME enable bitstream filter NAME
  158. --disable-bsf=NAME disable bitstream filter NAME
  159. --disable-bsfs disable all bitstream filters
  160. --enable-protocol=NAME enable protocol NAME
  161. --disable-protocol=NAME disable protocol NAME
  162. --disable-protocols disable all protocols
  163. --enable-indev=NAME enable input device NAME
  164. --disable-indev=NAME disable input device NAME
  165. --disable-indevs disable input devices
  166. --enable-outdev=NAME enable output device NAME
  167. --disable-outdev=NAME disable output device NAME
  168. --disable-outdevs disable output devices
  169. --disable-devices disable all devices
  170. --enable-filter=NAME enable filter NAME
  171. --disable-filter=NAME disable filter NAME
  172. --disable-filters disable all filters
  173. External library support:
  174. --enable-avisynth enable reading of AviSynth script files [no]
  175. --disable-bzlib disable bzlib [autodetect]
  176. --enable-fontconfig enable fontconfig
  177. --enable-frei0r enable frei0r video filtering
  178. --enable-gnutls enable gnutls [no]
  179. --disable-iconv disable iconv [autodetect]
  180. --enable-ladspa enable LADSPA audio filtering
  181. --enable-libaacplus enable AAC+ encoding via libaacplus [no]
  182. --enable-libass enable libass subtitles rendering [no]
  183. --enable-libbluray enable BluRay reading using libbluray [no]
  184. --enable-libcaca enable textual display using libcaca
  185. --enable-libcelt enable CELT decoding via libcelt [no]
  186. --enable-libcdio enable audio CD grabbing with libcdio
  187. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  188. and libraw1394 [no]
  189. --enable-libfaac enable AAC encoding via libfaac [no]
  190. --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
  191. --enable-libflite enable flite (voice synthesis) support via libflite [no]
  192. --enable-libfreetype enable libfreetype [no]
  193. --enable-libgme enable Game Music Emu via libgme [no]
  194. --enable-libgsm enable GSM de/encoding via libgsm [no]
  195. --enable-libiec61883 enable iec61883 via libiec61883 [no]
  196. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  197. --enable-libmodplug enable ModPlug via libmodplug [no]
  198. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  199. --enable-libnut enable NUT (de)muxing via libnut,
  200. native (de)muxer exists [no]
  201. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  202. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  203. --enable-libopencv enable video filtering via libopencv [no]
  204. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  205. --enable-libopus enable Opus decoding via libopus [no]
  206. --enable-libpulse enable Pulseaudio input via libpulse [no]
  207. --enable-libquvi enable quvi input via libquvi [no]
  208. --enable-librtmp enable RTMP[E] support via librtmp [no]
  209. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  210. --enable-libshine enable fixed-point MP3 encoding via libshine [no]
  211. --enable-libsoxr enable Include libsoxr resampling [no]
  212. --enable-libspeex enable Speex de/encoding via libspeex [no]
  213. --enable-libssh enable SFTP protocol via libssh [no]
  214. --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
  215. --enable-libtheora enable Theora encoding via libtheora [no]
  216. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  217. --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
  218. --enable-libv4l2 enable libv4l2/v4l-utils [no]
  219. --enable-libvidstab enable video stabilization using vid.stab [no]
  220. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  221. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  222. --enable-libvorbis enable Vorbis en/decoding via libvorbis,
  223. native implementation exists [no]
  224. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  225. --enable-libwavpack enable wavpack encoding via libwavpack [no]
  226. --enable-libx264 enable H.264 encoding via x264 [no]
  227. --enable-libxavs enable AVS encoding via xavs [no]
  228. --enable-libxvid enable Xvid encoding via xvidcore,
  229. native MPEG-4/Xvid encoder exists [no]
  230. --enable-libzmq enable message passing via libzmq [no]
  231. --enable-libzvbi enable teletext support via libzvbi [no]
  232. --enable-openal enable OpenAL 1.1 capture support [no]
  233. --enable-opencl enable OpenCL code
  234. --enable-openssl enable openssl [no]
  235. --enable-x11grab enable X11 grabbing [no]
  236. --disable-zlib disable zlib [autodetect]
  237. Advanced options (experts only):
  238. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  239. --enable-cross-compile assume a cross-compiler is used
  240. --sysroot=PATH root of cross-build tree
  241. --sysinclude=PATH location of cross-build system headers
  242. --target-os=OS compiler targets OS [$target_os]
  243. --target-exec=CMD command to run executables on target
  244. --target-path=DIR path to view of build directory on target
  245. --target-samples=DIR path to samples directory on target
  246. --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks
  247. --toolchain=NAME set tool defaults according to NAME
  248. --nm=NM use nm tool NM [$nm_default]
  249. --ar=AR use archive tool AR [$ar_default]
  250. --as=AS use assembler AS [$as_default]
  251. --windres=WINDRES use windows resource compiler WINDRES [$windres_default]
  252. --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
  253. --cc=CC use C compiler CC [$cc_default]
  254. --cxx=CXX use C compiler CXX [$cxx_default]
  255. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  256. --ld=LD use linker LD [$ld_default]
  257. --host-cc=HOSTCC use host C compiler HOSTCC
  258. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  259. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  260. --host-ld=HOSTLD use host linker HOSTLD
  261. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  262. --host-libs=HLIBS use libs HLIBS when linking for host
  263. --host-os=OS compiler host OS [$target_os]
  264. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  265. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  266. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  267. --extra-libs=ELIBS add ELIBS [$ELIBS]
  268. --extra-version=STRING version string suffix []
  269. --optflags=OPTFLAGS override optimization-related compiler flags
  270. --build-suffix=SUFFIX library name suffix []
  271. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  272. --progs-suffix=SUFFIX program name suffix []
  273. --arch=ARCH select architecture [$arch]
  274. --cpu=CPU select the minimum required CPU (affects
  275. instruction selection, may crash on older CPUs)
  276. --enable-pic build position-independent code
  277. --enable-sram allow use of on-chip SRAM
  278. --enable-thumb compile for Thumb instruction set
  279. --disable-symver disable symbol versioning
  280. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  281. --disable-safe-bitstream-reader
  282. disable buffer boundary checking in bitreaders
  283. (faster, but may crash)
  284. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  285. --enable-lto use link-time optimization
  286. Optimization options (experts only):
  287. --disable-asm disable all assembler optimizations
  288. --disable-altivec disable AltiVec optimizations
  289. --disable-amd3dnow disable 3DNow! optimizations
  290. --disable-amd3dnowext disable 3DNow! extended optimizations
  291. --disable-mmx disable MMX optimizations
  292. --disable-mmxext disable MMXEXT optimizations
  293. --disable-sse disable SSE optimizations
  294. --disable-sse2 disable SSE2 optimizations
  295. --disable-sse3 disable SSE3 optimizations
  296. --disable-ssse3 disable SSSE3 optimizations
  297. --disable-sse4 disable SSE4 optimizations
  298. --disable-sse42 disable SSE4.2 optimizations
  299. --disable-avx disable AVX optimizations
  300. --disable-fma4 disable FMA4 optimizations
  301. --disable-avx2 disable AVX2 optimizations
  302. --disable-armv5te disable armv5te optimizations
  303. --disable-armv6 disable armv6 optimizations
  304. --disable-armv6t2 disable armv6t2 optimizations
  305. --disable-vfp disable VFP optimizations
  306. --disable-neon disable NEON optimizations
  307. --disable-vis disable VIS optimizations
  308. --disable-inline-asm disable use of inline assembler
  309. --disable-yasm disable use of yasm assembler
  310. --disable-mips32r2 disable MIPS32R2 optimizations
  311. --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations
  312. --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
  313. --disable-mipsfpu disable floating point MIPS optimizations
  314. --disable-fast-unaligned consider unaligned accesses slow
  315. Developer options (useful when working on FFmpeg itself):
  316. --disable-debug disable debugging symbols
  317. --enable-debug=LEVEL set the debug level [$debuglevel]
  318. --disable-optimizations disable compiler optimizations
  319. --enable-extra-warnings enable more compiler warnings
  320. --disable-stripping disable stripping of executables and shared libraries
  321. --assert-level=level 0(default), 1 or 2, amount of assertion testing,
  322. 2 causes a slowdown at runtime.
  323. --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  324. --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
  325. leaks and errors, using the specified valgrind binary.
  326. Cannot be combined with --target-exec
  327. --enable-ftrapv Trap arithmetic overflows
  328. --samples=PATH location of test samples for FATE, if not set use
  329. \$FATE_SAMPLES at make invocation time.
  330. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  331. should be used only for debugging purposes)
  332. --enable-random randomly enable/disable components
  333. --disable-random
  334. --enable-random=LIST randomly enable/disable specific components or
  335. --disable-random=LIST component groups. LIST is a comma-separated list
  336. of NAME[:PROB] entries where NAME is a component
  337. (group) and PROB the probability associated with
  338. NAME (default 0.5).
  339. --random-seed=VALUE seed value for --enable/disable-random
  340. NOTE: Object files are built at the place where configure is launched.
  341. EOF
  342. exit 0
  343. }
  344. quotes='""'
  345. log(){
  346. echo "$@" >> $logfile
  347. }
  348. log_file(){
  349. log BEGIN $1
  350. pr -n -t $1 >> $logfile
  351. log END $1
  352. }
  353. echolog(){
  354. log "$@"
  355. echo "$@"
  356. }
  357. warn(){
  358. log "WARNING: $*"
  359. WARNINGS="${WARNINGS}WARNING: $*\n"
  360. }
  361. die(){
  362. echolog "$@"
  363. cat <<EOF
  364. If you think configure made a mistake, make sure you are using the latest
  365. version from Git. If the latest version fails, report the problem to the
  366. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  367. EOF
  368. if disabled logging; then
  369. cat <<EOF
  370. Rerun configure with logging enabled (do not use --disable-logging), and
  371. include the log this produces with your report.
  372. EOF
  373. else
  374. cat <<EOF
  375. Include the log file "$logfile" produced by configure as this will help
  376. solving the problem.
  377. EOF
  378. fi
  379. exit 1
  380. }
  381. # Avoid locale weirdness, besides we really just want to translate ASCII.
  382. toupper(){
  383. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  384. }
  385. tolower(){
  386. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  387. }
  388. c_escape(){
  389. echo "$*" | sed 's/["\\]/\\\0/g'
  390. }
  391. sh_quote(){
  392. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  393. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  394. echo "$v"
  395. }
  396. cleanws(){
  397. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//;s/\r//g'
  398. }
  399. filter(){
  400. pat=$1
  401. shift
  402. for v; do
  403. eval "case $v in $pat) echo $v ;; esac"
  404. done
  405. }
  406. filter_out(){
  407. pat=$1
  408. shift
  409. for v; do
  410. eval "case $v in $pat) ;; *) echo $v ;; esac"
  411. done
  412. }
  413. map(){
  414. m=$1
  415. shift
  416. for v; do eval $m; done
  417. }
  418. add_suffix(){
  419. suffix=$1
  420. shift
  421. for v; do echo ${v}${suffix}; done
  422. }
  423. set_all(){
  424. value=$1
  425. shift
  426. for var in $*; do
  427. eval $var=$value
  428. done
  429. }
  430. set_weak(){
  431. value=$1
  432. shift
  433. for var; do
  434. eval : \${$var:=$value}
  435. done
  436. }
  437. sanitize_var_name(){
  438. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  439. }
  440. set_safe(){
  441. var=$1
  442. shift
  443. eval $(sanitize_var_name "$var")='$*'
  444. }
  445. get_safe(){
  446. eval echo \$$(sanitize_var_name "$1")
  447. }
  448. pushvar(){
  449. for pvar in $*; do
  450. eval level=\${${pvar}_level:=0}
  451. eval ${pvar}_${level}="\$$pvar"
  452. eval ${pvar}_level=$(($level+1))
  453. done
  454. }
  455. popvar(){
  456. for pvar in $*; do
  457. eval level=\${${pvar}_level:-0}
  458. test $level = 0 && continue
  459. eval level=$(($level-1))
  460. eval $pvar="\${${pvar}_${level}}"
  461. eval ${pvar}_level=$level
  462. eval unset ${pvar}_${level}
  463. done
  464. }
  465. enable(){
  466. set_all yes $*
  467. }
  468. disable(){
  469. set_all no $*
  470. }
  471. enable_weak(){
  472. set_weak yes $*
  473. }
  474. disable_weak(){
  475. set_weak no $*
  476. }
  477. enable_safe(){
  478. for var; do
  479. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  480. done
  481. }
  482. disable_safe(){
  483. for var; do
  484. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  485. done
  486. }
  487. do_enable_deep(){
  488. for var; do
  489. enabled $var && continue
  490. eval sel="\$${var}_select"
  491. eval sgs="\$${var}_suggest"
  492. pushvar var sgs
  493. enable_deep $sel
  494. popvar sgs
  495. enable_deep_weak $sgs
  496. popvar var
  497. done
  498. }
  499. enable_deep(){
  500. do_enable_deep $*
  501. enable $*
  502. }
  503. enable_deep_weak(){
  504. for var; do
  505. disabled $var && continue
  506. pushvar var
  507. do_enable_deep $var
  508. popvar var
  509. enable_weak $var
  510. done
  511. }
  512. enabled(){
  513. test "${1#!}" = "$1" && op== || op=!=
  514. eval test "x\$${1#!}" $op "xyes"
  515. }
  516. disabled(){
  517. test "${1#!}" = "$1" && op== || op=!=
  518. eval test "x\$${1#!}" $op "xno"
  519. }
  520. enabled_all(){
  521. for opt; do
  522. enabled $opt || return 1
  523. done
  524. }
  525. disabled_all(){
  526. for opt; do
  527. disabled $opt || return 1
  528. done
  529. }
  530. enabled_any(){
  531. for opt; do
  532. enabled $opt && return 0
  533. done
  534. }
  535. disabled_any(){
  536. for opt; do
  537. disabled $opt && return 0
  538. done
  539. return 1
  540. }
  541. set_default(){
  542. for opt; do
  543. eval : \${$opt:=\$${opt}_default}
  544. done
  545. }
  546. is_in(){
  547. value=$1
  548. shift
  549. for var in $*; do
  550. [ $var = $value ] && return 0
  551. done
  552. return 1
  553. }
  554. do_check_deps(){
  555. for cfg; do
  556. cfg="${cfg#!}"
  557. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  558. disabled ${cfg}_checking && continue
  559. enable ${cfg}_checking
  560. append allopts $cfg
  561. eval dep_all="\$${cfg}_deps"
  562. eval dep_any="\$${cfg}_deps_any"
  563. eval dep_sel="\$${cfg}_select"
  564. eval dep_sgs="\$${cfg}_suggest"
  565. eval dep_ifa="\$${cfg}_if"
  566. eval dep_ifn="\$${cfg}_if_any"
  567. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  568. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  569. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  570. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  571. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  572. enabled_all $dep_all || disable $cfg
  573. enabled_any $dep_any || disable $cfg
  574. disabled_any $dep_sel && disable $cfg
  575. if enabled $cfg; then
  576. enable_deep $dep_sel
  577. enable_deep_weak $dep_sgs
  578. fi
  579. disable ${cfg}_checking
  580. done
  581. }
  582. check_deps(){
  583. unset allopts
  584. do_check_deps "$@"
  585. for cfg in $allopts; do
  586. enabled $cfg || continue
  587. eval dep_extralibs="\$${cfg}_extralibs"
  588. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  589. done
  590. }
  591. print_config(){
  592. pfx=$1
  593. files=$2
  594. shift 2
  595. map 'eval echo "$v \${$v:-no}"' "$@" |
  596. awk "BEGIN { split(\"$files\", files) }
  597. {
  598. c = \"$pfx\" toupper(\$1);
  599. v = \$2;
  600. sub(/yes/, 1, v);
  601. sub(/no/, 0, v);
  602. for (f in files) {
  603. file = files[f];
  604. if (file ~ /\\.h\$/) {
  605. printf(\"#define %s %d\\n\", c, v) >>file;
  606. } else if (file ~ /\\.asm\$/) {
  607. printf(\"%%define %s %d\\n\", c, v) >>file;
  608. } else if (file ~ /\\.mak\$/) {
  609. n = -v ? \"\" : \"!\";
  610. printf(\"%s%s=yes\\n\", n, c) >>file;
  611. } else if (file ~ /\\.texi\$/) {
  612. pre = -v ? \"\" : \"@c \";
  613. yesno = \$2;
  614. c2 = tolower(c);
  615. gsub(/_/, \"-\", c2);
  616. printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
  617. }
  618. }
  619. }"
  620. }
  621. print_enabled(){
  622. suf=$1
  623. shift
  624. for v; do
  625. enabled $v && printf "%s\n" ${v%$suf};
  626. done
  627. }
  628. append(){
  629. var=$1
  630. shift
  631. eval "$var=\"\$$var $*\""
  632. }
  633. prepend(){
  634. var=$1
  635. shift
  636. eval "$var=\"$* \$$var\""
  637. }
  638. add_cppflags(){
  639. append CPPFLAGS "$@"
  640. }
  641. add_cflags(){
  642. append CFLAGS $($cflags_filter "$@")
  643. }
  644. add_cxxflags(){
  645. append CXXFLAGS $($cflags_filter "$@")
  646. }
  647. add_asflags(){
  648. append ASFLAGS $($asflags_filter "$@")
  649. }
  650. add_ldflags(){
  651. append LDFLAGS $($ldflags_filter "$@")
  652. }
  653. add_stripflags(){
  654. append ASMSTRIPFLAGS "$@"
  655. }
  656. add_extralibs(){
  657. prepend extralibs $($ldflags_filter "$@")
  658. }
  659. add_host_cppflags(){
  660. append host_cppflags "$@"
  661. }
  662. add_host_cflags(){
  663. append host_cflags $($host_cflags_filter "$@")
  664. }
  665. add_host_ldflags(){
  666. append host_ldflags $($host_ldflags_filter "$@")
  667. }
  668. add_compat(){
  669. append compat_objs $1
  670. shift
  671. map 'add_cppflags -D$v' "$@"
  672. }
  673. check_cmd(){
  674. log "$@"
  675. "$@" >> $logfile 2>&1
  676. }
  677. cc_o(){
  678. eval printf '%s\\n' $CC_O
  679. }
  680. cc_e(){
  681. eval printf '%s\\n' $CC_E
  682. }
  683. check_cc(){
  684. log check_cc "$@"
  685. cat > $TMPC
  686. log_file $TMPC
  687. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  688. }
  689. check_cxx(){
  690. log check_cxx "$@"
  691. cat > $TMPCPP
  692. log_file $TMPCPP
  693. check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
  694. }
  695. check_cpp(){
  696. log check_cpp "$@"
  697. cat > $TMPC
  698. log_file $TMPC
  699. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  700. }
  701. as_o(){
  702. eval printf '%s\\n' $AS_O
  703. }
  704. check_as(){
  705. log check_as "$@"
  706. cat > $TMPS
  707. log_file $TMPS
  708. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  709. }
  710. check_inline_asm(){
  711. log check_inline_asm "$@"
  712. name="$1"
  713. code="$2"
  714. shift 2
  715. disable $name
  716. check_cc "$@" <<EOF && enable $name
  717. void foo(void){ __asm__ volatile($code); }
  718. EOF
  719. }
  720. check_insn(){
  721. log check_insn "$@"
  722. check_inline_asm ${1}_inline "\"$2\""
  723. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  724. }
  725. check_yasm(){
  726. log check_yasm "$@"
  727. echo "$1" > $TMPS
  728. log_file $TMPS
  729. shift 1
  730. check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
  731. }
  732. ld_o(){
  733. eval printf '%s\\n' $LD_O
  734. }
  735. check_ld(){
  736. log check_ld "$@"
  737. type=$1
  738. shift 1
  739. flags=$(filter_out '-l*|*.so' $@)
  740. libs=$(filter '-l*|*.so' $@)
  741. check_$type $($cflags_filter $flags) || return
  742. flags=$($ldflags_filter $flags)
  743. libs=$($ldflags_filter $libs)
  744. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  745. }
  746. check_code(){
  747. log check_code "$@"
  748. check=$1
  749. headers=$2
  750. code=$3
  751. shift 3
  752. {
  753. for hdr in $headers; do
  754. echo "#include <$hdr>"
  755. done
  756. echo "int main(void) { $code; return 0; }"
  757. } | check_$check "$@"
  758. }
  759. check_cppflags(){
  760. log check_cppflags "$@"
  761. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  762. int x;
  763. EOF
  764. }
  765. test_cflags(){
  766. log test_cflags "$@"
  767. set -- $($cflags_filter "$@")
  768. check_cc "$@" <<EOF
  769. int x;
  770. EOF
  771. }
  772. check_cflags(){
  773. log check_cflags "$@"
  774. test_cflags "$@" && add_cflags "$@"
  775. }
  776. check_cxxflags(){
  777. log check_cxxflags "$@"
  778. set -- $($cflags_filter "$@")
  779. check_cxx "$@" <<EOF && append CXXFLAGS "$@"
  780. int x;
  781. EOF
  782. }
  783. test_ldflags(){
  784. log test_ldflags "$@"
  785. check_ld "cc" "$@" <<EOF
  786. int main(void){ return 0; }
  787. EOF
  788. }
  789. check_ldflags(){
  790. log check_ldflags "$@"
  791. test_ldflags "$@" && add_ldflags "$@"
  792. }
  793. test_stripflags(){
  794. log test_stripflags "$@"
  795. # call check_cc to get a fresh TMPO
  796. check_cc <<EOF
  797. int main(void) { return 0; }
  798. EOF
  799. check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
  800. }
  801. check_stripflags(){
  802. log check_stripflags "$@"
  803. test_stripflags "$@" && add_stripflags "$@"
  804. }
  805. check_header(){
  806. log check_header "$@"
  807. header=$1
  808. shift
  809. disable_safe $header
  810. check_cpp "$@" <<EOF && enable_safe $header
  811. #include <$header>
  812. int x;
  813. EOF
  814. }
  815. check_func(){
  816. log check_func "$@"
  817. func=$1
  818. shift
  819. disable $func
  820. check_ld "cc" "$@" <<EOF && enable $func
  821. extern int $func();
  822. int main(void){ $func(); }
  823. EOF
  824. }
  825. check_mathfunc(){
  826. log check_mathfunc "$@"
  827. func=$1
  828. narg=$2
  829. shift 2
  830. test $narg = 2 && args="f, g" || args="f"
  831. disable $func
  832. check_ld "cc" "$@" <<EOF && enable $func
  833. #include <math.h>
  834. float foo(float f, float g) { return $func($args); }
  835. int main(void){ return (int) foo; }
  836. EOF
  837. }
  838. check_func_headers(){
  839. log check_func_headers "$@"
  840. headers=$1
  841. funcs=$2
  842. shift 2
  843. {
  844. for hdr in $headers; do
  845. echo "#include <$hdr>"
  846. done
  847. for func in $funcs; do
  848. echo "long check_$func(void) { return (long) $func; }"
  849. done
  850. echo "int main(void) { return 0; }"
  851. } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
  852. }
  853. check_class_headers_cpp(){
  854. log check_class_headers_cpp "$@"
  855. headers=$1
  856. classes=$2
  857. shift 2
  858. {
  859. for hdr in $headers; do
  860. echo "#include <$hdr>"
  861. done
  862. echo "int main(void) { "
  863. i=1
  864. for class in $classes; do
  865. echo "$class obj$i;"
  866. i=$(expr $i + 1)
  867. done
  868. echo "return 0; }"
  869. } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
  870. }
  871. check_cpp_condition(){
  872. log check_cpp_condition "$@"
  873. header=$1
  874. condition=$2
  875. shift 2
  876. check_cpp "$@" <<EOF
  877. #include <$header>
  878. #if !($condition)
  879. #error "unsatisfied condition: $condition"
  880. #endif
  881. EOF
  882. }
  883. check_lib(){
  884. log check_lib "$@"
  885. header="$1"
  886. func="$2"
  887. shift 2
  888. check_header $header && check_func $func "$@" && add_extralibs "$@"
  889. }
  890. check_lib2(){
  891. log check_lib2 "$@"
  892. headers="$1"
  893. funcs="$2"
  894. shift 2
  895. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  896. }
  897. check_lib_cpp(){
  898. log check_lib_cpp "$@"
  899. headers="$1"
  900. classes="$2"
  901. shift 2
  902. check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
  903. }
  904. check_pkg_config(){
  905. log check_pkg_config "$@"
  906. pkg="$1"
  907. headers="$2"
  908. funcs="$3"
  909. shift 3
  910. check_cmd $pkg_config --exists --print-errors $pkg || return
  911. pkg_cflags=$($pkg_config --cflags $pkg)
  912. pkg_libs=$($pkg_config --libs $pkg)
  913. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  914. set_safe ${pkg}_cflags $pkg_cflags &&
  915. set_safe ${pkg}_libs $pkg_libs
  916. }
  917. check_exec(){
  918. check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  919. }
  920. check_exec_crash(){
  921. code=$(cat)
  922. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  923. # are safe but may not be available everywhere. Thus we use
  924. # raise(SIGTERM) instead. The check is run in a subshell so we
  925. # can redirect the "Terminated" message from the shell. SIGBUS
  926. # is not defined by standard C so it is used conditionally.
  927. (check_exec "$@") >> $logfile 2>&1 <<EOF
  928. #include <signal.h>
  929. static void sighandler(int sig){
  930. raise(SIGTERM);
  931. }
  932. int foo(void){
  933. $code
  934. }
  935. int (*func_ptr)(void) = foo;
  936. int main(void){
  937. signal(SIGILL, sighandler);
  938. signal(SIGFPE, sighandler);
  939. signal(SIGSEGV, sighandler);
  940. #ifdef SIGBUS
  941. signal(SIGBUS, sighandler);
  942. #endif
  943. return func_ptr();
  944. }
  945. EOF
  946. }
  947. check_type(){
  948. log check_type "$@"
  949. headers=$1
  950. type=$2
  951. shift 2
  952. disable_safe "$type"
  953. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  954. }
  955. check_struct(){
  956. log check_struct "$@"
  957. headers=$1
  958. struct=$2
  959. member=$3
  960. shift 3
  961. disable_safe "${struct}_${member}"
  962. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  963. enable_safe "${struct}_${member}"
  964. }
  965. check_builtin(){
  966. log check_builtin "$@"
  967. name=$1
  968. headers=$2
  969. builtin=$3
  970. shift 3
  971. disable "$name"
  972. check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
  973. }
  974. require(){
  975. name="$1"
  976. header="$2"
  977. func="$3"
  978. shift 3
  979. check_lib $header $func "$@" || die "ERROR: $name not found"
  980. }
  981. require2(){
  982. name="$1"
  983. headers="$2"
  984. func="$3"
  985. shift 3
  986. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  987. }
  988. require_cpp(){
  989. name="$1"
  990. headers="$2"
  991. classes="$3"
  992. shift 3
  993. check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
  994. }
  995. require_pkg_config(){
  996. pkg="$1"
  997. check_pkg_config "$@" || die "ERROR: $pkg not found"
  998. add_cflags $(get_safe ${pkg}_cflags)
  999. add_extralibs $(get_safe ${pkg}_libs)
  1000. }
  1001. hostcc_o(){
  1002. eval printf '%s\\n' $HOSTCC_O
  1003. }
  1004. check_host_cc(){
  1005. log check_host_cc "$@"
  1006. cat > $TMPC
  1007. log_file $TMPC
  1008. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  1009. }
  1010. check_host_cppflags(){
  1011. log check_host_cppflags "$@"
  1012. check_host_cc "$@" <<EOF && append host_cppflags "$@"
  1013. int x;
  1014. EOF
  1015. }
  1016. check_host_cflags(){
  1017. log check_host_cflags "$@"
  1018. set -- $($host_cflags_filter "$@")
  1019. check_host_cc "$@" <<EOF && append host_cflags "$@"
  1020. int x;
  1021. EOF
  1022. }
  1023. apply(){
  1024. file=$1
  1025. shift
  1026. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  1027. }
  1028. cp_if_changed(){
  1029. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  1030. mkdir -p "$(dirname $2)"
  1031. $cp_f "$1" "$2"
  1032. }
  1033. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  1034. # system-dependent things.
  1035. COMPONENT_LIST="
  1036. bsfs
  1037. decoders
  1038. demuxers
  1039. encoders
  1040. filters
  1041. hwaccels
  1042. indevs
  1043. muxers
  1044. outdevs
  1045. parsers
  1046. protocols
  1047. "
  1048. EXAMPLE_LIST="
  1049. decoding_encoding_example
  1050. demuxing_decoding_example
  1051. filtering_audio_example
  1052. filtering_video_example
  1053. metadata_example
  1054. muxing_example
  1055. resampling_audio_example
  1056. scaling_video_example
  1057. transcode_aac_example
  1058. "
  1059. EXTERNAL_LIBRARY_LIST="
  1060. avisynth
  1061. bzlib
  1062. crystalhd
  1063. fontconfig
  1064. frei0r
  1065. gnutls
  1066. iconv
  1067. ladspa
  1068. libaacplus
  1069. libass
  1070. libbluray
  1071. libcaca
  1072. libcdio
  1073. libcelt
  1074. libdc1394
  1075. libfaac
  1076. libfdk_aac
  1077. libflite
  1078. libfreetype
  1079. libgme
  1080. libgsm
  1081. libiec61883
  1082. libilbc
  1083. libmodplug
  1084. libmp3lame
  1085. libnut
  1086. libopencore_amrnb
  1087. libopencore_amrwb
  1088. libopencv
  1089. libopenjpeg
  1090. libopus
  1091. libpulse
  1092. libquvi
  1093. librtmp
  1094. libschroedinger
  1095. libshine
  1096. libsoxr
  1097. libspeex
  1098. libssh
  1099. libstagefright_h264
  1100. libtheora
  1101. libtwolame
  1102. libutvideo
  1103. libv4l2
  1104. libvidstab
  1105. libvo_aacenc
  1106. libvo_amrwbenc
  1107. libvorbis
  1108. libvpx
  1109. libwavpack
  1110. libx264
  1111. libxavs
  1112. libxvid
  1113. libzmq
  1114. libzvbi
  1115. openal
  1116. opencl
  1117. openssl
  1118. x11grab
  1119. zlib
  1120. "
  1121. DOCUMENT_LIST="
  1122. doc
  1123. htmlpages
  1124. manpages
  1125. podpages
  1126. txtpages
  1127. "
  1128. HWACCEL_LIST="
  1129. dxva2
  1130. vaapi
  1131. vda
  1132. vdpau
  1133. "
  1134. LIBRARY_LIST="
  1135. avcodec
  1136. avdevice
  1137. avfilter
  1138. avformat
  1139. avresample
  1140. avutil
  1141. postproc
  1142. swresample
  1143. swscale
  1144. "
  1145. PROGRAM_LIST="
  1146. ffplay
  1147. ffprobe
  1148. ffserver
  1149. ffmpeg
  1150. "
  1151. CONFIG_LIST="
  1152. $COMPONENT_LIST
  1153. $DOCUMENT_LIST
  1154. $EXAMPLE_LIST
  1155. $EXTERNAL_LIBRARY_LIST
  1156. $HWACCEL_LIST
  1157. $LIBRARY_LIST
  1158. $PROGRAM_LIST
  1159. dct
  1160. dwt
  1161. error_resilience
  1162. fast_unaligned
  1163. fft
  1164. ftrapv
  1165. gpl
  1166. gray
  1167. hardcoded_tables
  1168. incompatible_libav_abi
  1169. incompatible_fork_abi
  1170. lsp
  1171. lzo
  1172. mdct
  1173. memalign_hack
  1174. memory_poisoning
  1175. network
  1176. nonfree
  1177. pic
  1178. rdft
  1179. runtime_cpudetect
  1180. safe_bitstream_reader
  1181. shared
  1182. small
  1183. sram
  1184. static
  1185. swscale_alpha
  1186. thumb
  1187. version3
  1188. xmm_clobber_test
  1189. "
  1190. THREADS_LIST='
  1191. pthreads
  1192. w32threads
  1193. os2threads
  1194. '
  1195. ATOMICS_LIST='
  1196. atomics_gcc
  1197. atomics_suncc
  1198. atomics_win32
  1199. '
  1200. ARCH_LIST='
  1201. aarch64
  1202. alpha
  1203. arm
  1204. avr32
  1205. avr32_ap
  1206. avr32_uc
  1207. bfin
  1208. ia64
  1209. m68k
  1210. mips
  1211. mips64
  1212. parisc
  1213. ppc
  1214. ppc64
  1215. s390
  1216. sh4
  1217. sparc
  1218. sparc64
  1219. tilegx
  1220. tilepro
  1221. tomi
  1222. x86
  1223. x86_32
  1224. x86_64
  1225. '
  1226. ARCH_EXT_LIST_ARM='
  1227. armv5te
  1228. armv6
  1229. armv6t2
  1230. neon
  1231. vfp
  1232. vfpv3
  1233. '
  1234. ARCH_EXT_LIST_X86='
  1235. amd3dnow
  1236. amd3dnowext
  1237. avx
  1238. avx2
  1239. fma4
  1240. i686
  1241. mmx
  1242. mmxext
  1243. sse
  1244. sse2
  1245. sse3
  1246. sse4
  1247. sse42
  1248. ssse3
  1249. '
  1250. ARCH_EXT_LIST="
  1251. $ARCH_EXT_LIST_ARM
  1252. $ARCH_EXT_LIST_X86
  1253. altivec
  1254. ppc4xx
  1255. vis
  1256. mipsfpu
  1257. mips32r2
  1258. mipsdspr1
  1259. mipsdspr2
  1260. "
  1261. HAVE_LIST_CMDLINE='
  1262. inline_asm
  1263. symver
  1264. yasm
  1265. '
  1266. HAVE_LIST_PUB='
  1267. bigendian
  1268. fast_unaligned
  1269. incompatible_libav_abi
  1270. incompatible_fork_abi
  1271. '
  1272. MATH_FUNCS="
  1273. atanf
  1274. atan2f
  1275. cbrt
  1276. cbrtf
  1277. cosf
  1278. exp2
  1279. exp2f
  1280. expf
  1281. isinf
  1282. isnan
  1283. ldexpf
  1284. llrint
  1285. llrintf
  1286. log2
  1287. log2f
  1288. log10f
  1289. lrint
  1290. lrintf
  1291. powf
  1292. rint
  1293. round
  1294. roundf
  1295. sinf
  1296. trunc
  1297. truncf
  1298. "
  1299. HAVE_LIST="
  1300. $ARCH_EXT_LIST
  1301. $(add_suffix _external $ARCH_EXT_LIST)
  1302. $(add_suffix _inline $ARCH_EXT_LIST)
  1303. $HAVE_LIST_CMDLINE
  1304. $HAVE_LIST_PUB
  1305. $THREADS_LIST
  1306. $ATOMICS_LIST
  1307. $MATH_FUNCS
  1308. access
  1309. aligned_malloc
  1310. aligned_stack
  1311. alsa_asoundlib_h
  1312. altivec_h
  1313. arpa_inet_h
  1314. asm_mod_q
  1315. asm_mod_y
  1316. asm_types_h
  1317. atomic_cas_ptr
  1318. atomics_native
  1319. attribute_may_alias
  1320. attribute_packed
  1321. cdio_paranoia_h
  1322. cdio_paranoia_paranoia_h
  1323. CL_cl_h
  1324. clock_gettime
  1325. closesocket
  1326. CommandLineToArgvW
  1327. cpunop
  1328. CryptGenRandom
  1329. dcbzl
  1330. dev_bktr_ioctl_bt848_h
  1331. dev_bktr_ioctl_meteor_h
  1332. dev_ic_bt8xx_h
  1333. dev_video_bktr_ioctl_bt848_h
  1334. dev_video_meteor_ioctl_meteor_h
  1335. direct_h
  1336. dlfcn_h
  1337. dlopen
  1338. dos_paths
  1339. dxva_h
  1340. ebp_available
  1341. ebx_available
  1342. fast_64bit
  1343. fast_clz
  1344. fast_cmov
  1345. fcntl
  1346. fork
  1347. getaddrinfo
  1348. gethrtime
  1349. getopt
  1350. GetProcessAffinityMask
  1351. GetProcessMemoryInfo
  1352. GetProcessTimes
  1353. GetSystemTimeAsFileTime
  1354. getrusage
  1355. getservbyport
  1356. gettimeofday
  1357. glob
  1358. gnu_as
  1359. gnu_windres
  1360. gsm_h
  1361. ibm_asm
  1362. inet_aton
  1363. io_h
  1364. inline_asm_labels
  1365. isatty
  1366. jack_port_get_latency_range
  1367. kbhit
  1368. ldbrx
  1369. libdc1394_1
  1370. libdc1394_2
  1371. local_aligned_16
  1372. local_aligned_8
  1373. localtime_r
  1374. loongson
  1375. lzo1x_999_compress
  1376. machine_ioctl_bt848_h
  1377. machine_ioctl_meteor_h
  1378. machine_rw_barrier
  1379. makeinfo
  1380. malloc_h
  1381. MapViewOfFile
  1382. memalign
  1383. MemoryBarrier
  1384. mkstemp
  1385. mm_empty
  1386. mmap
  1387. mprotect
  1388. msvcrt
  1389. nanosleep
  1390. openjpeg_1_5_openjpeg_h
  1391. PeekNamedPipe
  1392. perl
  1393. pod2man
  1394. poll_h
  1395. posix_memalign
  1396. pragma_deprecated
  1397. pthread_cancel
  1398. rdtsc
  1399. rsync_contimeout
  1400. sarestart
  1401. sched_getaffinity
  1402. sdl
  1403. SetConsoleTextAttribute
  1404. setmode
  1405. setrlimit
  1406. Sleep
  1407. sndio_h
  1408. socklen_t
  1409. soundcard_h
  1410. strerror_r
  1411. struct_addrinfo
  1412. struct_group_source_req
  1413. struct_ip_mreq_source
  1414. struct_ipv6_mreq
  1415. struct_pollfd
  1416. struct_rusage_ru_maxrss
  1417. struct_sctp_event_subscribe
  1418. struct_sockaddr_in6
  1419. struct_sockaddr_sa_len
  1420. struct_sockaddr_storage
  1421. struct_stat_st_mtim_tv_nsec
  1422. struct_v4l2_frmivalenum_discrete
  1423. symver_asm_label
  1424. symver_gnu_asm
  1425. sync_val_compare_and_swap
  1426. sysconf
  1427. sysctl
  1428. sys_mman_h
  1429. sys_param_h
  1430. sys_resource_h
  1431. sys_select_h
  1432. sys_soundcard_h
  1433. sys_time_h
  1434. sys_un_h
  1435. sys_videoio_h
  1436. termios_h
  1437. texi2html
  1438. threads
  1439. unistd_h
  1440. usleep
  1441. vdpau_x11
  1442. vfp_args
  1443. VirtualAlloc
  1444. windows_h
  1445. winsock2_h
  1446. xform_asm
  1447. xlib
  1448. xmm_clobbers
  1449. "
  1450. # options emitted with CONFIG_ prefix but not available on the command line
  1451. CONFIG_EXTRA="
  1452. aandcttables
  1453. ac3dsp
  1454. audio_frame_queue
  1455. dsputil
  1456. exif
  1457. frame_thread_encoder
  1458. gcrypt
  1459. golomb
  1460. gplv3
  1461. h263dsp
  1462. h264chroma
  1463. h264dsp
  1464. h264pred
  1465. h264qpel
  1466. hpeldsp
  1467. huffman
  1468. lgplv3
  1469. lpc
  1470. mpegaudio
  1471. mpegaudiodsp
  1472. mpegvideo
  1473. mpegvideoenc
  1474. nettle
  1475. rangecoder
  1476. riffdec
  1477. riffenc
  1478. rtpdec
  1479. rtpenc_chain
  1480. sinewin
  1481. videodsp
  1482. vp3dsp
  1483. "
  1484. CMDLINE_SELECT="
  1485. $ARCH_EXT_LIST
  1486. $CONFIG_LIST
  1487. $HAVE_LIST_CMDLINE
  1488. $THREADS_LIST
  1489. asm
  1490. cross_compile
  1491. debug
  1492. extra_warnings
  1493. logging
  1494. lto
  1495. optimizations
  1496. rpath
  1497. stripping
  1498. "
  1499. PATHS_LIST='
  1500. bindir
  1501. datadir
  1502. docdir
  1503. incdir
  1504. libdir
  1505. mandir
  1506. prefix
  1507. shlibdir
  1508. '
  1509. CMDLINE_SET="
  1510. $PATHS_LIST
  1511. ar
  1512. arch
  1513. as
  1514. assert_level
  1515. build_suffix
  1516. cc
  1517. cpu
  1518. cross_prefix
  1519. cxx
  1520. dep_cc
  1521. extra_version
  1522. host_cc
  1523. host_cflags
  1524. host_ld
  1525. host_ldflags
  1526. host_libs
  1527. host_os
  1528. install
  1529. ld
  1530. logfile
  1531. malloc_prefix
  1532. nm
  1533. optflags
  1534. pkg_config
  1535. progs_suffix
  1536. random_seed
  1537. samples
  1538. strip
  1539. sysinclude
  1540. sysroot
  1541. target_exec
  1542. target_os
  1543. target_path
  1544. target_samples
  1545. tempprefix
  1546. toolchain
  1547. valgrind
  1548. yasmexe
  1549. "
  1550. CMDLINE_APPEND="
  1551. extra_cflags
  1552. extra_cxxflags
  1553. host_cppflags
  1554. "
  1555. # code dependency declarations
  1556. # architecture extensions
  1557. armv5te_deps="arm"
  1558. armv6_deps="arm"
  1559. armv6t2_deps="arm"
  1560. neon_deps="arm"
  1561. vfp_deps="arm"
  1562. vfpv3_deps="vfp"
  1563. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1564. mipsfpu_deps="mips"
  1565. mips32r2_deps="mips"
  1566. mipsdspr1_deps="mips"
  1567. mipsdspr2_deps="mips"
  1568. altivec_deps="ppc"
  1569. ppc4xx_deps="ppc"
  1570. vis_deps="sparc"
  1571. cpunop_deps="i686"
  1572. x86_64_select="i686"
  1573. x86_64_suggest="fast_cmov"
  1574. amd3dnow_deps="mmx"
  1575. amd3dnowext_deps="amd3dnow"
  1576. mmx_deps="x86"
  1577. mmxext_deps="mmx"
  1578. sse_deps="mmxext"
  1579. sse2_deps="sse"
  1580. sse3_deps="sse2"
  1581. ssse3_deps="sse3"
  1582. sse4_deps="ssse3"
  1583. sse42_deps="sse4"
  1584. avx_deps="sse42"
  1585. fma4_deps="avx"
  1586. avx2_deps="avx"
  1587. mmx_external_deps="yasm"
  1588. mmx_inline_deps="inline_asm"
  1589. mmx_suggest="mmx_external mmx_inline"
  1590. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
  1591. eval dep=\$${ext}_deps
  1592. eval ${ext}_external_deps='"${dep}_external"'
  1593. eval ${ext}_inline_deps='"${dep}_inline"'
  1594. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1595. done
  1596. aligned_stack_if_any="ppc x86"
  1597. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1598. fast_clz_if_any="alpha avr32 mips ppc x86"
  1599. fast_unaligned_if_any="ppc x86"
  1600. inline_asm_deps="!tms470"
  1601. need_memalign="altivec neon sse"
  1602. symver_if_any="symver_asm_label symver_gnu_asm"
  1603. log2_deps="!msvcrt"
  1604. # subsystems
  1605. dct_select="rdft"
  1606. error_resilience_select="dsputil"
  1607. frame_thread_encoder_deps="encoders threads"
  1608. lpc_select="dsputil"
  1609. mdct_select="fft"
  1610. rdft_select="fft"
  1611. mpegaudio_select="mpegaudiodsp"
  1612. mpegaudiodsp_select="dct"
  1613. mpegvideo_select="dsputil h264chroma hpeldsp videodsp"
  1614. mpegvideoenc_select="mpegvideo"
  1615. # decoders / encoders
  1616. aac_decoder_select="mdct sinewin"
  1617. aac_encoder_select="audio_frame_queue mdct sinewin"
  1618. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1619. ac3_decoder_select="mdct ac3dsp ac3_parser dsputil"
  1620. ac3_encoder_select="mdct ac3dsp dsputil"
  1621. ac3_fixed_encoder_select="mdct ac3dsp dsputil"
  1622. aic_decoder_select="dsputil golomb"
  1623. alac_encoder_select="lpc"
  1624. als_decoder_select="dsputil"
  1625. amrnb_decoder_select="lsp"
  1626. amrwb_decoder_select="lsp"
  1627. amv_decoder_select="dsputil hpeldsp exif"
  1628. amv_encoder_select="aandcttables"
  1629. ape_decoder_select="dsputil"
  1630. asv1_decoder_select="dsputil"
  1631. asv1_encoder_select="dsputil"
  1632. asv2_decoder_select="dsputil"
  1633. asv2_encoder_select="dsputil"
  1634. atrac1_decoder_select="mdct sinewin"
  1635. atrac3_decoder_select="mdct"
  1636. avrn_decoder_select="exif"
  1637. bink_decoder_select="dsputil hpeldsp"
  1638. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1639. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1640. cavs_decoder_select="dsputil golomb h264chroma videodsp"
  1641. cllc_decoder_select="dsputil"
  1642. comfortnoise_encoder_select="lpc"
  1643. cook_decoder_select="dsputil mdct sinewin"
  1644. cscd_decoder_select="lzo"
  1645. cscd_decoder_suggest="zlib"
  1646. dca_decoder_select="mdct"
  1647. dirac_decoder_select="dsputil dwt golomb videodsp"
  1648. dnxhd_decoder_select="dsputil"
  1649. dnxhd_encoder_select="aandcttables dsputil mpegvideoenc"
  1650. dvvideo_decoder_select="dsputil"
  1651. dvvideo_encoder_select="dsputil"
  1652. dxa_decoder_select="zlib"
  1653. eac3_decoder_select="ac3_decoder"
  1654. eac3_encoder_select="ac3_encoder"
  1655. eamad_decoder_select="aandcttables dsputil mpegvideo"
  1656. eatgq_decoder_select="aandcttables"
  1657. eatqi_decoder_select="aandcttables error_resilience mpegvideo"
  1658. exr_decoder_select="zlib"
  1659. ffv1_decoder_select="dsputil golomb rangecoder"
  1660. ffv1_encoder_select="dsputil rangecoder"
  1661. ffvhuff_decoder_select="dsputil"
  1662. ffvhuff_encoder_select="dsputil huffman"
  1663. flac_decoder_select="golomb"
  1664. flac_encoder_select="dsputil golomb lpc"
  1665. flashsv_decoder_select="zlib"
  1666. flashsv_encoder_select="zlib"
  1667. flashsv2_encoder_select="zlib"
  1668. flashsv2_decoder_select="zlib"
  1669. flv_decoder_select="h263_decoder"
  1670. flv_encoder_select="h263_encoder"
  1671. fourxm_decoder_select="dsputil"
  1672. fraps_decoder_select="dsputil huffman"
  1673. g2m_decoder_select="dsputil zlib"
  1674. g729_decoder_select="dsputil"
  1675. h261_decoder_select="error_resilience mpegvideo"
  1676. h261_encoder_select="aandcttables mpegvideoenc"
  1677. h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
  1678. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1679. h263i_decoder_select="h263_decoder"
  1680. h263p_encoder_select="h263_encoder"
  1681. h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1682. h264_decoder_suggest="error_resilience"
  1683. hevc_decoder_select="dsputil golomb videodsp"
  1684. huffyuv_decoder_select="dsputil"
  1685. huffyuv_encoder_select="dsputil huffman"
  1686. iac_decoder_select="dsputil fft mdct sinewin"
  1687. imc_decoder_select="dsputil fft mdct sinewin"
  1688. indeo3_decoder_select="hpeldsp"
  1689. interplay_video_decoder_select="hpeldsp"
  1690. jpegls_decoder_select="dsputil golomb hpeldsp exif"
  1691. jpegls_encoder_select="golomb"
  1692. jv_decoder_select="dsputil"
  1693. lagarith_decoder_select="dsputil"
  1694. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1695. loco_decoder_select="golomb"
  1696. mdec_decoder_select="dsputil error_resilience mpegvideo"
  1697. metasound_decoder_select="lsp mdct sinewin"
  1698. mimic_decoder_select="dsputil hpeldsp"
  1699. mjpeg_decoder_select="dsputil hpeldsp exif"
  1700. mjpegb_decoder_select="dsputil hpeldsp exif"
  1701. mjpeg_encoder_select="aandcttables dsputil mpegvideoenc"
  1702. mlp_decoder_select="dsputil mlp_parser"
  1703. motionpixels_decoder_select="dsputil"
  1704. mp1_decoder_select="mpegaudio"
  1705. mp1float_decoder_select="mpegaudio"
  1706. mp2_decoder_select="mpegaudio"
  1707. mp2float_decoder_select="mpegaudio"
  1708. mp3_decoder_select="mpegaudio"
  1709. mp3adu_decoder_select="mpegaudio"
  1710. mp3adufloat_decoder_select="mpegaudio"
  1711. mp3float_decoder_select="mpegaudio"
  1712. mp3on4_decoder_select="mpegaudio"
  1713. mp3on4float_decoder_select="mpegaudio"
  1714. mpc7_decoder_select="dsputil mpegaudiodsp"
  1715. mpc8_decoder_select="dsputil mpegaudiodsp"
  1716. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1717. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1718. mpeg1video_decoder_select="error_resilience mpegvideo"
  1719. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1720. mpeg2video_decoder_select="error_resilience mpegvideo"
  1721. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1722. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1723. mpeg4_encoder_select="h263_encoder"
  1724. msmpeg4v1_decoder_select="h263_decoder"
  1725. msmpeg4v2_decoder_select="h263_decoder"
  1726. msmpeg4v2_encoder_select="h263_encoder"
  1727. msmpeg4v3_decoder_select="h263_decoder"
  1728. msmpeg4v3_encoder_select="h263_encoder"
  1729. mss2_decoder_select="error_resilience vc1_decoder"
  1730. mxpeg_decoder_select="dsputil hpeldsp exif"
  1731. nellymoser_decoder_select="mdct sinewin"
  1732. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1733. nuv_decoder_select="dsputil lzo"
  1734. png_decoder_select="zlib"
  1735. png_encoder_select="dsputil zlib"
  1736. prores_decoder_select="dsputil"
  1737. prores_encoder_select="dsputil"
  1738. qcelp_decoder_select="lsp"
  1739. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1740. ra_144_encoder_select="audio_frame_queue lpc"
  1741. ralf_decoder_select="golomb"
  1742. rtjpeg_decoder_select="dsputil"
  1743. rv10_decoder_select="error_resilience h263_decoder h263dsp"
  1744. rv10_encoder_select="h263_encoder"
  1745. rv20_decoder_select="error_resilience h263_decoder h263dsp"
  1746. rv20_encoder_select="h263_encoder"
  1747. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1748. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1749. shorten_decoder_select="golomb"
  1750. sipr_decoder_select="lsp"
  1751. snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder"
  1752. snow_encoder_select="aandcttables dsputil dwt h264qpel hpeldsp mpegvideoenc rangecoder"
  1753. sonic_decoder_select="golomb"
  1754. sonic_encoder_select="golomb"
  1755. sonic_ls_encoder_select="golomb"
  1756. sp5x_decoder_select="dsputil hpeldsp exif"
  1757. svq1_decoder_select="hpeldsp"
  1758. svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
  1759. svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel hpeldsp mpegvideo videodsp"
  1760. svq3_decoder_suggest="error_resilience zlib"
  1761. tak_decoder_select="dsputil"
  1762. theora_decoder_select="vp3_decoder"
  1763. tiff_decoder_suggest="zlib"
  1764. tiff_encoder_suggest="zlib"
  1765. thp_decoder_select="dsputil hpeldsp exif"
  1766. truehd_decoder_select="mlp_parser"
  1767. truemotion2_decoder_select="dsputil"
  1768. truespeech_decoder_select="dsputil"
  1769. tscc_decoder_select="zlib"
  1770. twinvq_decoder_select="mdct lsp sinewin"
  1771. utvideo_decoder_select="dsputil"
  1772. utvideo_encoder_select="dsputil huffman"
  1773. vble_decoder_select="dsputil"
  1774. vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel"
  1775. vc1image_decoder_select="vc1_decoder"
  1776. vorbis_decoder_select="mdct"
  1777. vorbis_encoder_select="mdct"
  1778. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1779. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1780. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1781. vp6a_decoder_select="vp6_decoder"
  1782. vp6f_decoder_select="vp6_decoder"
  1783. vp8_decoder_select="h264pred videodsp"
  1784. vp9_decoder_select="videodsp"
  1785. webp_decoder_select="vp8_decoder"
  1786. wmapro_decoder_select="mdct sinewin"
  1787. wmav1_decoder_select="mdct sinewin"
  1788. wmav1_encoder_select="mdct sinewin"
  1789. wmav2_decoder_select="mdct sinewin"
  1790. wmav2_encoder_select="mdct sinewin"
  1791. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1792. wmv1_decoder_select="h263_decoder"
  1793. wmv1_encoder_select="h263_encoder"
  1794. wmv2_decoder_select="h263_decoder videodsp"
  1795. wmv2_encoder_select="h263_encoder"
  1796. wmv3_decoder_select="vc1_decoder"
  1797. wmv3image_decoder_select="wmv3_decoder"
  1798. zerocodec_decoder_select="zlib"
  1799. zlib_decoder_select="zlib"
  1800. zlib_encoder_select="zlib"
  1801. zmbv_decoder_select="zlib"
  1802. zmbv_encoder_select="zlib"
  1803. # hardware accelerators
  1804. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  1805. dxva2_deps="dxva2api_h"
  1806. vaapi_deps="va_va_h"
  1807. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1808. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1809. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1810. h263_vaapi_hwaccel_deps="vaapi"
  1811. h263_vaapi_hwaccel_select="h263_decoder"
  1812. h263_vdpau_hwaccel_deps="vdpau"
  1813. h263_vdpau_hwaccel_select="h263_decoder"
  1814. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  1815. h264_dxva2_hwaccel_deps="dxva2"
  1816. h264_dxva2_hwaccel_select="h264_decoder"
  1817. h264_vaapi_hwaccel_deps="vaapi"
  1818. h264_vaapi_hwaccel_select="h264_decoder"
  1819. h264_vda_decoder_deps="vda"
  1820. h264_vda_decoder_select="h264_decoder"
  1821. h264_vda_hwaccel_deps="vda"
  1822. h264_vda_hwaccel_select="h264_decoder"
  1823. h264_vdpau_decoder_deps="vdpau"
  1824. h264_vdpau_decoder_select="h264_decoder"
  1825. h264_vdpau_hwaccel_deps="vdpau"
  1826. h264_vdpau_hwaccel_select="h264_decoder"
  1827. mpeg_vdpau_decoder_deps="vdpau"
  1828. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  1829. mpeg1_vdpau_decoder_deps="vdpau"
  1830. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  1831. mpeg1_vdpau_hwaccel_deps="vdpau"
  1832. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1833. mpeg2_crystalhd_decoder_select="crystalhd"
  1834. mpeg2_dxva2_hwaccel_deps="dxva2"
  1835. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1836. mpeg2_vaapi_hwaccel_deps="vaapi"
  1837. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1838. mpeg2_vdpau_hwaccel_deps="vdpau"
  1839. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1840. mpeg4_crystalhd_decoder_select="crystalhd"
  1841. mpeg4_vaapi_hwaccel_deps="vaapi"
  1842. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1843. mpeg4_vdpau_decoder_deps="vdpau"
  1844. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  1845. mpeg4_vdpau_hwaccel_deps="vdpau"
  1846. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1847. msmpeg4_crystalhd_decoder_select="crystalhd"
  1848. vc1_crystalhd_decoder_select="crystalhd"
  1849. vc1_dxva2_hwaccel_deps="dxva2"
  1850. vc1_dxva2_hwaccel_select="vc1_decoder"
  1851. vc1_vaapi_hwaccel_deps="vaapi"
  1852. vc1_vaapi_hwaccel_select="vc1_decoder"
  1853. vc1_vdpau_decoder_deps="vdpau"
  1854. vc1_vdpau_decoder_select="vc1_decoder"
  1855. vc1_vdpau_hwaccel_deps="vdpau"
  1856. vc1_vdpau_hwaccel_select="vc1_decoder"
  1857. wmv3_crystalhd_decoder_select="crystalhd"
  1858. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1859. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1860. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1861. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1862. # parsers
  1863. h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1864. hevc_parser_select="hevc_decoder"
  1865. mpeg4video_parser_select="error_resilience mpegvideo"
  1866. mpegvideo_parser_select="error_resilience mpegvideo"
  1867. vc1_parser_select="mpegvideo"
  1868. # external libraries
  1869. libaacplus_encoder_deps="libaacplus"
  1870. libcelt_decoder_deps="libcelt"
  1871. libfaac_encoder_deps="libfaac"
  1872. libfaac_encoder_select="audio_frame_queue"
  1873. libfdk_aac_decoder_deps="libfdk_aac"
  1874. libfdk_aac_encoder_deps="libfdk_aac"
  1875. libfdk_aac_encoder_select="audio_frame_queue"
  1876. libgme_demuxer_deps="libgme"
  1877. libgsm_decoder_deps="libgsm"
  1878. libgsm_encoder_deps="libgsm"
  1879. libgsm_ms_decoder_deps="libgsm"
  1880. libgsm_ms_encoder_deps="libgsm"
  1881. libilbc_decoder_deps="libilbc"
  1882. libilbc_encoder_deps="libilbc"
  1883. libmodplug_demuxer_deps="libmodplug"
  1884. libmp3lame_encoder_deps="libmp3lame"
  1885. libmp3lame_encoder_select="audio_frame_queue"
  1886. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1887. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1888. libopencore_amrnb_encoder_select="audio_frame_queue"
  1889. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1890. libopenjpeg_decoder_deps="libopenjpeg"
  1891. libopenjpeg_encoder_deps="libopenjpeg"
  1892. libopus_decoder_deps="libopus"
  1893. libopus_encoder_deps="libopus"
  1894. libopus_encoder_select="audio_frame_queue"
  1895. libquvi_demuxer_deps="libquvi"
  1896. libschroedinger_decoder_deps="libschroedinger"
  1897. libschroedinger_encoder_deps="libschroedinger"
  1898. libshine_encoder_deps="libshine"
  1899. libshine_encoder_select="audio_frame_queue"
  1900. libspeex_decoder_deps="libspeex"
  1901. libspeex_encoder_deps="libspeex"
  1902. libspeex_encoder_select="audio_frame_queue"
  1903. libstagefright_h264_decoder_deps="libstagefright_h264"
  1904. libtheora_encoder_deps="libtheora"
  1905. libtwolame_encoder_deps="libtwolame"
  1906. libvo_aacenc_encoder_deps="libvo_aacenc"
  1907. libvo_aacenc_encoder_select="audio_frame_queue"
  1908. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1909. libvorbis_decoder_deps="libvorbis"
  1910. libvorbis_encoder_deps="libvorbis"
  1911. libvorbis_encoder_select="audio_frame_queue"
  1912. libvpx_vp8_decoder_deps="libvpx"
  1913. libvpx_vp8_encoder_deps="libvpx"
  1914. libvpx_vp9_decoder_deps="libvpx"
  1915. libvpx_vp9_encoder_deps="libvpx"
  1916. libwavpack_encoder_deps="libwavpack"
  1917. libx264_encoder_deps="libx264"
  1918. libx264rgb_encoder_deps="libx264"
  1919. libxavs_encoder_deps="libxavs"
  1920. libxvid_encoder_deps="libxvid"
  1921. libutvideo_decoder_deps="libutvideo"
  1922. libutvideo_encoder_deps="libutvideo"
  1923. libzvbi_teletext_decoder_deps="libzvbi"
  1924. # demuxers / muxers
  1925. ac3_demuxer_select="ac3_parser"
  1926. asf_demuxer_select="riffdec"
  1927. asf_muxer_select="riffenc"
  1928. asf_stream_muxer_select="asf_muxer"
  1929. avi_demuxer_select="riffdec"
  1930. avi_muxer_select="riffenc"
  1931. avisynth_demuxer_deps="avisynth"
  1932. avisynth_demuxer_select="riffdec"
  1933. caf_demuxer_select="riffdec"
  1934. dirac_demuxer_select="dirac_parser"
  1935. dts_demuxer_select="dca_parser"
  1936. dtshd_demuxer_select="dca_parser"
  1937. dxa_demuxer_select="riffdec"
  1938. eac3_demuxer_select="ac3_parser"
  1939. f4v_muxer_select="mov_muxer"
  1940. flac_demuxer_select="flac_parser"
  1941. hds_muxer_select="flv_muxer"
  1942. hls_muxer_select="mpegts_muxer"
  1943. ipod_muxer_select="mov_muxer"
  1944. ismv_muxer_select="mov_muxer"
  1945. libnut_demuxer_deps="libnut"
  1946. libnut_muxer_deps="libnut"
  1947. matroska_audio_muxer_select="matroska_muxer"
  1948. matroska_demuxer_select="riffdec"
  1949. matroska_demuxer_suggest="bzlib lzo zlib"
  1950. matroska_muxer_select="riffenc"
  1951. mmf_muxer_select="riffenc"
  1952. mov_demuxer_select="riffdec"
  1953. mov_demuxer_suggest="zlib"
  1954. mov_muxer_select="riffenc rtpenc_chain"
  1955. mp3_demuxer_select="mpegaudio_parser"
  1956. mp4_muxer_select="mov_muxer"
  1957. mpegts_muxer_select="adts_muxer latm_muxer"
  1958. mpegtsraw_demuxer_select="mpegts_demuxer"
  1959. mxf_d10_muxer_select="mxf_muxer"
  1960. nut_muxer_select="riffenc"
  1961. nuv_demuxer_select="riffdec"
  1962. ogg_demuxer_select="golomb"
  1963. psp_muxer_select="mov_muxer"
  1964. rtp_demuxer_select="sdp_demuxer"
  1965. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1966. rtsp_demuxer_select="http_protocol rtpdec"
  1967. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1968. sap_demuxer_select="sdp_demuxer"
  1969. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1970. sdp_demuxer_select="rtpdec"
  1971. smoothstreaming_muxer_select="ismv_muxer"
  1972. spdif_muxer_select="aac_parser"
  1973. tak_demuxer_select="tak_parser"
  1974. tg2_muxer_select="mov_muxer"
  1975. tgp_muxer_select="mov_muxer"
  1976. vobsub_demuxer_select="mpegps_demuxer"
  1977. w64_demuxer_select="wav_demuxer"
  1978. w64_muxer_select="wav_muxer"
  1979. wav_demuxer_select="riffdec"
  1980. wav_muxer_select="riffenc"
  1981. webm_muxer_select="riffenc"
  1982. wtv_demuxer_select="riffdec"
  1983. xmv_demuxer_select="riffdec"
  1984. xwma_demuxer_select="riffdec"
  1985. # indevs / outdevs
  1986. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1987. alsa_outdev_deps="alsa_asoundlib_h"
  1988. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1989. caca_outdev_deps="libcaca"
  1990. dshow_indev_deps="IBaseFilter"
  1991. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  1992. dv1394_indev_deps="dv1394"
  1993. dv1394_indev_select="dv_demuxer"
  1994. fbdev_indev_deps="linux_fb_h"
  1995. fbdev_outdev_deps="linux_fb_h"
  1996. iec61883_indev_deps="libiec61883"
  1997. jack_indev_deps="jack_jack_h sem_timedwait"
  1998. lavfi_indev_deps="avfilter"
  1999. libcdio_indev_deps="libcdio"
  2000. libdc1394_indev_deps="libdc1394"
  2001. libv4l2_indev_deps="libv4l2"
  2002. openal_indev_deps="openal"
  2003. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2004. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2005. pulse_indev_deps="libpulse"
  2006. pulse_outdev_deps="libpulse"
  2007. sdl_outdev_deps="sdl"
  2008. sndio_indev_deps="sndio_h"
  2009. sndio_outdev_deps="sndio_h"
  2010. v4l_indev_deps="linux_videodev_h"
  2011. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2012. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  2013. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2014. vfwcap_indev_extralibs="-lavicap32"
  2015. xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
  2016. xv_outdev_extralibs="-lXv -lX11 -lXext"
  2017. x11grab_indev_deps="x11grab"
  2018. # protocols
  2019. bluray_protocol_deps="libbluray"
  2020. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2021. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  2022. ffrtmpcrypt_protocol_select="tcp_protocol"
  2023. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2024. ffrtmphttp_protocol_select="http_protocol"
  2025. ftp_protocol_select="tcp_protocol"
  2026. gopher_protocol_select="network"
  2027. httpproxy_protocol_select="tcp_protocol"
  2028. http_protocol_select="tcp_protocol"
  2029. https_protocol_select="tls_protocol"
  2030. librtmp_protocol_deps="librtmp"
  2031. librtmpe_protocol_deps="librtmp"
  2032. librtmps_protocol_deps="librtmp"
  2033. librtmpt_protocol_deps="librtmp"
  2034. librtmpte_protocol_deps="librtmp"
  2035. libssh_protocol_deps="libssh"
  2036. mmsh_protocol_select="http_protocol"
  2037. mmst_protocol_select="network"
  2038. rtmp_protocol_deps="!librtmp_protocol"
  2039. rtmp_protocol_select="tcp_protocol"
  2040. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2041. rtmps_protocol_deps="!librtmp_protocol"
  2042. rtmps_protocol_select="tls_protocol"
  2043. rtmpt_protocol_select="ffrtmphttp_protocol"
  2044. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2045. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2046. rtp_protocol_select="udp_protocol"
  2047. sctp_protocol_deps="struct_sctp_event_subscribe"
  2048. sctp_protocol_select="network"
  2049. srtp_protocol_select="rtp_protocol"
  2050. tcp_protocol_select="network"
  2051. tls_protocol_deps_any="openssl gnutls"
  2052. tls_protocol_select="tcp_protocol"
  2053. udp_protocol_select="network"
  2054. unix_protocol_deps="sys_un_h"
  2055. unix_protocol_select="network"
  2056. # filters
  2057. aconvert_filter_deps="swresample"
  2058. amovie_filter_deps="avcodec avformat"
  2059. aresample_filter_deps="swresample"
  2060. ass_filter_deps="libass"
  2061. asyncts_filter_deps="avresample"
  2062. atempo_filter_deps="avcodec"
  2063. atempo_filter_select="rdft"
  2064. azmq_filter_deps="libzmq"
  2065. blackframe_filter_deps="gpl"
  2066. boxblur_filter_deps="gpl"
  2067. colormatrix_filter_deps="gpl"
  2068. cropdetect_filter_deps="gpl"
  2069. dctdnoiz_filter_deps="avcodec"
  2070. dctdnoiz_filter_select="fft"
  2071. delogo_filter_deps="gpl"
  2072. deshake_filter_deps="avcodec"
  2073. deshake_filter_select="dsputil"
  2074. drawtext_filter_deps="libfreetype"
  2075. ebur128_filter_deps="gpl"
  2076. flite_filter_deps="libflite"
  2077. frei0r_filter_deps="frei0r dlopen"
  2078. frei0r_filter_extralibs='$ldl'
  2079. frei0r_src_filter_deps="frei0r dlopen"
  2080. frei0r_src_filter_extralibs='$ldl'
  2081. geq_filter_deps="gpl"
  2082. histeq_filter_deps="gpl"
  2083. hqdn3d_filter_deps="gpl"
  2084. interlace_filter_deps="gpl"
  2085. kerndeint_filter_deps="gpl"
  2086. ladspa_filter_deps="ladspa dlopen"
  2087. mcdeint_filter_deps="avcodec gpl"
  2088. movie_filter_deps="avcodec avformat"
  2089. mp_filter_deps="gpl avcodec swscale inline_asm"
  2090. mpdecimate_filter_deps="gpl avcodec"
  2091. mptestsrc_filter_deps="gpl"
  2092. negate_filter_deps="lut_filter"
  2093. perspective_filter_deps="gpl"
  2094. resample_filter_deps="avresample"
  2095. ocv_filter_deps="libopencv"
  2096. owdenoise_filter_deps="gpl"
  2097. pan_filter_deps="swresample"
  2098. phase_filter_deps="gpl"
  2099. pp_filter_deps="gpl postproc"
  2100. pullup_filter_deps="gpl"
  2101. removelogo_filter_deps="avcodec avformat swscale"
  2102. sab_filter_deps="gpl swscale"
  2103. scale_filter_deps="swscale"
  2104. smartblur_filter_deps="gpl swscale"
  2105. showspectrum_filter_deps="avcodec"
  2106. showspectrum_filter_select="rdft"
  2107. spp_filter_deps="gpl avcodec"
  2108. spp_filter_select="fft"
  2109. stereo3d_filter_deps="gpl"
  2110. subtitles_filter_deps="avformat avcodec libass"
  2111. super2xsai_filter_deps="gpl"
  2112. tinterlace_filter_deps="gpl"
  2113. vidstabdetect_filter_deps="libvidstab"
  2114. vidstabtransform_filter_deps="libvidstab"
  2115. yadif_filter_deps="gpl"
  2116. pixfmts_super2xsai_test_deps="super2xsai_filter"
  2117. tinterlace_merge_test_deps="tinterlace_filter"
  2118. tinterlace_pad_test_deps="tinterlace_filter"
  2119. zmq_filter_deps="libzmq"
  2120. # examples
  2121. decoding_encoding_example_deps="avcodec avutil"
  2122. demuxing_decoding_example_deps="avcodec avformat avutil"
  2123. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  2124. filtering_video_example_deps="avfilter avcodec avformat avutil"
  2125. metadata_example_deps="avformat avutil"
  2126. muxing_example_deps="avcodec avformat avutil swscale"
  2127. resampling_audio_example_deps="avutil swresample"
  2128. scaling_video_example_deps="avutil swscale"
  2129. transcode_aac_example_deps="avcodec avformat swresample"
  2130. # libraries
  2131. avcodec_deps="avutil"
  2132. avdevice_deps="avutil avcodec avformat"
  2133. avfilter_deps="avutil"
  2134. avformat_deps="avutil avcodec"
  2135. avresample_deps="avutil"
  2136. postproc_deps="avutil gpl"
  2137. swscale_deps="avutil"
  2138. # programs
  2139. ffmpeg_deps="avcodec avfilter avformat swresample"
  2140. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  2141. null_filter
  2142. setpts_filter trim_filter"
  2143. ffplay_deps="avcodec avformat swscale swresample sdl"
  2144. ffplay_select="rdft crop_filter"
  2145. ffprobe_deps="avcodec avformat"
  2146. ffserver_deps="avformat fork sarestart"
  2147. ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
  2148. ffserver_extralibs='$ldl'
  2149. # documentation
  2150. podpages_deps="perl"
  2151. manpages_deps="perl pod2man"
  2152. htmlpages_deps="perl texi2html"
  2153. txtpages_deps="perl makeinfo"
  2154. doc_deps_any="manpages htmlpages podpages txtpages"
  2155. # default parameters
  2156. logfile="config.log"
  2157. # installation paths
  2158. prefix_default="/usr/local"
  2159. bindir_default='${prefix}/bin'
  2160. datadir_default='${prefix}/share/ffmpeg'
  2161. docdir_default='${prefix}/share/doc/ffmpeg'
  2162. incdir_default='${prefix}/include'
  2163. libdir_default='${prefix}/lib'
  2164. mandir_default='${prefix}/share/man'
  2165. shlibdir_default="$libdir_default"
  2166. # toolchain
  2167. ar_default="ar"
  2168. cc_default="gcc"
  2169. cxx_default="g++"
  2170. host_cc_default="gcc"
  2171. cp_f="cp -f"
  2172. install="install"
  2173. ln_s="ln -s -f"
  2174. nm_default="nm -g"
  2175. objformat="elf"
  2176. pkg_config_default=pkg-config
  2177. ranlib="ranlib"
  2178. strip_default="strip"
  2179. yasmexe_default="yasm"
  2180. windres_default="windres"
  2181. nogas=":"
  2182. # machine
  2183. arch_default=$(uname -m)
  2184. cpu="generic"
  2185. # OS
  2186. target_os_default=$(tolower $(uname -s))
  2187. host_os=$target_os_default
  2188. # configurable options
  2189. enable $PROGRAM_LIST
  2190. enable $DOCUMENT_LIST
  2191. enable $EXAMPLE_LIST
  2192. enable $(filter_out avresample $LIBRARY_LIST)
  2193. enable stripping
  2194. enable asm
  2195. enable debug
  2196. enable doc
  2197. enable optimizations
  2198. enable runtime_cpudetect
  2199. enable safe_bitstream_reader
  2200. enable static
  2201. enable swscale_alpha
  2202. # Enable hwaccels by default.
  2203. enable dxva2 vaapi vdpau
  2204. # build settings
  2205. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2206. LIBPREF="lib"
  2207. LIBSUF=".a"
  2208. FULLNAME='$(NAME)$(BUILDSUF)'
  2209. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2210. SLIBPREF="lib"
  2211. SLIBSUF=".so"
  2212. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2213. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2214. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2215. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2216. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2217. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2218. asflags_filter=echo
  2219. cflags_filter=echo
  2220. ldflags_filter=echo
  2221. AS_C='-c'
  2222. AS_O='-o $@'
  2223. CC_C='-c'
  2224. CC_E='-E -o $@'
  2225. CC_O='-o $@'
  2226. CXX_C='-c'
  2227. CXX_O='-o $@'
  2228. LD_O='-o $@'
  2229. LD_LIB='-l%'
  2230. LD_PATH='-L'
  2231. HOSTCC_C='-c'
  2232. HOSTCC_O='-o $@'
  2233. HOSTLD_O='-o $@'
  2234. host_cflags='-O3 -g'
  2235. host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
  2236. host_libs='-lm'
  2237. host_cflags_filter=echo
  2238. host_ldflags_filter=echo
  2239. target_path='$(CURDIR)'
  2240. # since the object filename is not given with the -MM flag, the compiler
  2241. # is only able to print the basename, and we must add the path ourselves
  2242. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2243. DEPFLAGS='-MM'
  2244. # find source path
  2245. if test -f configure; then
  2246. source_path=.
  2247. else
  2248. source_path=$(cd $(dirname "$0"); pwd)
  2249. echo "$source_path" | grep -q '[[:blank:]]' &&
  2250. die "Out of tree builds are impossible with whitespace in source path."
  2251. test -e "$source_path/config.h" &&
  2252. die "Out of tree builds are impossible with config.h in source dir."
  2253. fi
  2254. for v in "$@"; do
  2255. r=${v#*=}
  2256. l=${v%"$r"}
  2257. r=$(sh_quote "$r")
  2258. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2259. done
  2260. find_things(){
  2261. thing=$1
  2262. pattern=$2
  2263. file=$source_path/$3
  2264. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2265. }
  2266. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2267. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2268. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2269. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2270. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2271. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2272. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2273. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2274. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2275. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2276. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2277. ALL_COMPONENTS="
  2278. $BSF_LIST
  2279. $DECODER_LIST
  2280. $DEMUXER_LIST
  2281. $ENCODER_LIST
  2282. $FILTER_LIST
  2283. $HWACCEL_LIST
  2284. $INDEV_LIST
  2285. $MUXER_LIST
  2286. $OUTDEV_LIST
  2287. $PARSER_LIST
  2288. $PROTOCOL_LIST
  2289. "
  2290. for n in $COMPONENT_LIST; do
  2291. v=$(toupper ${n%s})_LIST
  2292. eval enable \$$v
  2293. eval ${n}_if_any="\$$v"
  2294. done
  2295. enable $ARCH_EXT_LIST
  2296. die_unknown(){
  2297. echo "Unknown option \"$1\"."
  2298. echo "See $0 --help for available options."
  2299. exit 1
  2300. }
  2301. print_3_columns() {
  2302. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2303. }
  2304. show_list() {
  2305. suffix=_$1
  2306. shift
  2307. echo $* | sed s/$suffix//g | print_3_columns
  2308. exit 0
  2309. }
  2310. rand_list(){
  2311. IFS=', '
  2312. set -- $*
  2313. unset IFS
  2314. for thing; do
  2315. comp=${thing%:*}
  2316. prob=${thing#$comp}
  2317. prob=${prob#:}
  2318. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2319. echo "prob ${prob:-0.5}"
  2320. printf '%s\n' $comp
  2321. done
  2322. }
  2323. do_random(){
  2324. action=$1
  2325. shift
  2326. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2327. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2328. }
  2329. for opt do
  2330. optval="${opt#*=}"
  2331. case "$opt" in
  2332. --extra-ldflags=*)
  2333. add_ldflags $optval
  2334. ;;
  2335. --extra-libs=*)
  2336. add_extralibs $optval
  2337. ;;
  2338. --disable-devices)
  2339. disable $INDEV_LIST $OUTDEV_LIST
  2340. ;;
  2341. --enable-debug=*)
  2342. debuglevel="$optval"
  2343. ;;
  2344. --disable-programs)
  2345. disable $PROGRAM_LIST
  2346. ;;
  2347. --disable-everything)
  2348. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2349. ;;
  2350. --disable-all)
  2351. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2352. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2353. ;;
  2354. --enable-random|--disable-random)
  2355. action=${opt%%-random}
  2356. do_random ${action#--} $COMPONENT_LIST
  2357. ;;
  2358. --enable-random=*|--disable-random=*)
  2359. action=${opt%%-random=*}
  2360. do_random ${action#--} $optval
  2361. ;;
  2362. --enable-*=*|--disable-*=*)
  2363. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2364. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2365. eval list=\$$(toupper $thing)_LIST
  2366. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2367. list=$(filter "$name" $list)
  2368. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2369. $action $list
  2370. ;;
  2371. --enable-?*|--disable-?*)
  2372. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2373. if is_in $option $COMPONENT_LIST; then
  2374. test $action = disable && action=unset
  2375. eval $action \$$(toupper ${option%s})_LIST
  2376. elif is_in $option $CMDLINE_SELECT; then
  2377. $action $option
  2378. else
  2379. die_unknown $opt
  2380. fi
  2381. ;;
  2382. --list-*)
  2383. NAME="${opt#--list-}"
  2384. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2385. NAME=${NAME%s}
  2386. eval show_list $NAME \$$(toupper $NAME)_LIST
  2387. ;;
  2388. --help|-h) show_help
  2389. ;;
  2390. --fatal-warnings) enable fatal_warnings
  2391. ;;
  2392. *)
  2393. optname="${opt%%=*}"
  2394. optname="${optname#--}"
  2395. optname=$(echo "$optname" | sed 's/-/_/g')
  2396. if is_in $optname $CMDLINE_SET; then
  2397. eval $optname='$optval'
  2398. elif is_in $optname $CMDLINE_APPEND; then
  2399. append $optname "$optval"
  2400. else
  2401. die_unknown $opt
  2402. fi
  2403. ;;
  2404. esac
  2405. done
  2406. disabled logging && logfile=/dev/null
  2407. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2408. set >> $logfile
  2409. test -n "$cross_prefix" && enable cross_compile
  2410. if enabled cross_compile; then
  2411. test -n "$arch" && test -n "$target_os" ||
  2412. die "Must specify target arch and OS when cross-compiling"
  2413. fi
  2414. ar_default="${cross_prefix}${ar_default}"
  2415. cc_default="${cross_prefix}${cc_default}"
  2416. cxx_default="${cross_prefix}${cxx_default}"
  2417. nm_default="${cross_prefix}${nm_default}"
  2418. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2419. ranlib="${cross_prefix}${ranlib}"
  2420. strip_default="${cross_prefix}${strip_default}"
  2421. windres_default="${cross_prefix}${windres_default}"
  2422. sysinclude_default="${sysroot}/usr/include"
  2423. test -n "$valgrind" && toolchain="valgrind-memcheck"
  2424. case "$toolchain" in
  2425. clang-asan)
  2426. cc_default="clang"
  2427. add_cflags -fsanitize=address
  2428. add_ldflags -fsanitize=address
  2429. ;;
  2430. clang-tsan)
  2431. cc_default="clang"
  2432. add_cflags -fsanitize=thread -pie
  2433. add_ldflags -fsanitize=thread -pie
  2434. ;;
  2435. gcc-asan)
  2436. cc_default="gcc"
  2437. add_cflags -fsanitize=address
  2438. add_ldflags -fsanitize=address
  2439. ;;
  2440. gcc-tsan)
  2441. cc_default="gcc"
  2442. add_cflags -fsanitize=thread -pie -fPIC
  2443. add_ldflags -fsanitize=thread -pie -fPIC
  2444. ;;
  2445. valgrind-massif)
  2446. target_exec_default=${valgrind:-"valgrind"}
  2447. target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc"
  2448. ;;
  2449. valgrind-memcheck)
  2450. target_exec_default=${valgrind:-"valgrind"}
  2451. target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp"
  2452. ;;
  2453. msvc)
  2454. # Check whether the current MSVC version needs the C99 converter.
  2455. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2456. # support enough of C99 to build ffmpeg. Default to the new
  2457. # behaviour if the regexp was unable to match anything, since this
  2458. # successfully parses the version number of existing supported
  2459. # versions that require the converter (MSVC 2010 and 2012).
  2460. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2461. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2462. cc_default="cl"
  2463. else
  2464. cc_default="c99wrap cl"
  2465. fi
  2466. ld_default="link"
  2467. nm_default="dumpbin -symbols"
  2468. ar_default="lib"
  2469. target_os_default="win32"
  2470. # Use a relative path for TMPDIR. This makes sure all the
  2471. # ffconf temp files are written with a relative path, avoiding
  2472. # issues with msys/win32 path conversion for MSVC parameters
  2473. # such as -Fo<file> or -out:<file>.
  2474. TMPDIR=.
  2475. ;;
  2476. icl)
  2477. cc_default="icl"
  2478. ld_default="xilink"
  2479. nm_default="dumpbin -symbols"
  2480. ar_default="xilib"
  2481. target_os_default="win32"
  2482. TMPDIR=.
  2483. ;;
  2484. gcov)
  2485. add_cflags -fprofile-arcs -ftest-coverage
  2486. add_ldflags -fprofile-arcs -ftest-coverage
  2487. ;;
  2488. hardened)
  2489. add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
  2490. add_ldflags -Wl,-z,relro -Wl,-z,now
  2491. ;;
  2492. ?*)
  2493. die "Unknown toolchain $toolchain"
  2494. ;;
  2495. esac
  2496. set_default arch cc cxx pkg_config strip sysinclude target_exec target_os yasmexe
  2497. enabled cross_compile || host_cc_default=$cc
  2498. set_default host_cc
  2499. if ! $pkg_config --version >/dev/null 2>&1; then
  2500. warn "$pkg_config not found, library detection may fail."
  2501. pkg_config=false
  2502. fi
  2503. exesuf() {
  2504. case $1 in
  2505. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2506. esac
  2507. }
  2508. EXESUF=$(exesuf $target_os)
  2509. HOSTEXESUF=$(exesuf $host_os)
  2510. # set temporary file name
  2511. : ${TMPDIR:=$TEMPDIR}
  2512. : ${TMPDIR:=$TMP}
  2513. : ${TMPDIR:=/tmp}
  2514. if [ -n "$tempprefix" ] ; then
  2515. mktemp(){
  2516. echo $tempprefix.${HOSTNAME}.${UID}
  2517. }
  2518. elif ! check_cmd mktemp -u XXXXXX; then
  2519. # simple replacement for missing mktemp
  2520. # NOT SAFE FOR GENERAL USE
  2521. mktemp(){
  2522. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2523. }
  2524. fi
  2525. tmpfile(){
  2526. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2527. (set -C; exec > $tmp) 2>/dev/null ||
  2528. die "Unable to create temporary file in $TMPDIR."
  2529. append TMPFILES $tmp
  2530. eval $1=$tmp
  2531. }
  2532. trap 'rm -f -- $TMPFILES' EXIT
  2533. tmpfile TMPASM .asm
  2534. tmpfile TMPC .c
  2535. tmpfile TMPCPP .cpp
  2536. tmpfile TMPE $EXESUF
  2537. tmpfile TMPH .h
  2538. tmpfile TMPO .o
  2539. tmpfile TMPS .S
  2540. tmpfile TMPSH .sh
  2541. tmpfile TMPV .ver
  2542. unset -f mktemp
  2543. chmod +x $TMPE
  2544. # make sure we can execute files in $TMPDIR
  2545. cat > $TMPSH 2>> $logfile <<EOF
  2546. #! /bin/sh
  2547. EOF
  2548. chmod +x $TMPSH >> $logfile 2>&1
  2549. if ! $TMPSH >> $logfile 2>&1; then
  2550. cat <<EOF
  2551. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2552. variable to another directory and make sure that it is not mounted noexec.
  2553. EOF
  2554. die "Sanity test failed."
  2555. fi
  2556. ccc_flags(){
  2557. for flag; do
  2558. case $flag in
  2559. -std=c99) echo -c99 ;;
  2560. -mcpu=*) echo -arch ${flag#*=} ;;
  2561. -mieee) echo -ieee ;;
  2562. -O*|-fast) echo $flag ;;
  2563. -fno-math-errno) echo -assume nomath_errno ;;
  2564. -g) echo -g3 ;;
  2565. -Wall) echo -msg_enable level2 ;;
  2566. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2567. -Wl,*) echo $flag ;;
  2568. -f*|-W*) ;;
  2569. *) echo $flag ;;
  2570. esac
  2571. done
  2572. }
  2573. cparser_flags(){
  2574. for flag; do
  2575. case $flag in
  2576. -Wno-switch) echo -Wno-switch-enum ;;
  2577. -Wno-format-zero-length) ;;
  2578. -Wdisabled-optimization) ;;
  2579. -Wno-pointer-sign) echo -Wno-other ;;
  2580. *) echo $flag ;;
  2581. esac
  2582. done
  2583. }
  2584. msvc_common_flags(){
  2585. for flag; do
  2586. case $flag in
  2587. # In addition to specifying certain flags under the compiler
  2588. # specific filters, they must be specified here as well or else the
  2589. # generic catch all at the bottom will print the original flag.
  2590. -Wall) ;;
  2591. -std=c99) ;;
  2592. # Common flags
  2593. -fomit-frame-pointer) ;;
  2594. -g) echo -Z7 ;;
  2595. -fno-math-errno) ;;
  2596. -fno-common) ;;
  2597. -fno-signed-zeros) ;;
  2598. -fPIC) ;;
  2599. -mthumb) ;;
  2600. -march=*) ;;
  2601. -lz) echo zlib.lib ;;
  2602. -lavifil32) echo vfw32.lib ;;
  2603. -lavicap32) echo vfw32.lib user32.lib ;;
  2604. -l*) echo ${flag#-l}.lib ;;
  2605. *) echo $flag ;;
  2606. esac
  2607. done
  2608. }
  2609. msvc_flags(){
  2610. msvc_common_flags "$@"
  2611. for flag; do
  2612. case $flag in
  2613. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2614. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2615. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2616. -wd4554 \
  2617. -wd4273 ;;
  2618. esac
  2619. done
  2620. }
  2621. icl_flags(){
  2622. msvc_common_flags "$@"
  2623. for flag; do
  2624. case $flag in
  2625. # Despite what Intel's documentation says -Wall, which is supported
  2626. # on Windows, does enable remarks so disable them here.
  2627. -Wall) echo $flag -Qdiag-disable:remark ;;
  2628. -std=c99) echo -Qstd=c99 ;;
  2629. esac
  2630. done
  2631. }
  2632. pgi_flags(){
  2633. for flag; do
  2634. case $flag in
  2635. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2636. -fomit-frame-pointer) echo -Mnoframe ;;
  2637. -g) echo -gopt ;;
  2638. *) echo $flag ;;
  2639. esac
  2640. done
  2641. }
  2642. suncc_flags(){
  2643. for flag; do
  2644. case $flag in
  2645. -march=*|-mcpu=*)
  2646. case "${flag#*=}" in
  2647. native) echo -xtarget=native ;;
  2648. v9|niagara) echo -xarch=sparc ;;
  2649. ultrasparc) echo -xarch=sparcvis ;;
  2650. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2651. i586|pentium) echo -xchip=pentium ;;
  2652. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2653. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2654. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2655. pentium4*) echo -xtarget=pentium4 ;;
  2656. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2657. *-sse3) echo -xarch=sse3 ;;
  2658. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2659. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2660. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2661. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2662. bdver*) echo -xarch=avx ;;
  2663. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2664. k8|opteron|athlon64|athlon-fx)
  2665. echo -xarch=sse2a ;;
  2666. athlon*) echo -xarch=pentium_proa ;;
  2667. esac
  2668. ;;
  2669. -std=c99) echo -xc99 ;;
  2670. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2671. -fPIC) echo -KPIC -xcode=pic32 ;;
  2672. -W*,*) echo $flag ;;
  2673. -f*-*|-W*|-mimpure-text) ;;
  2674. -shared) echo -G ;;
  2675. *) echo $flag ;;
  2676. esac
  2677. done
  2678. }
  2679. tms470_flags(){
  2680. for flag; do
  2681. case $flag in
  2682. -march=*|-mcpu=*)
  2683. case "${flag#*=}" in
  2684. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2685. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2686. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2687. armv6*|arm11*) echo -mv=6 ;;
  2688. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2689. echo -mv=5e ;;
  2690. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2691. esac
  2692. ;;
  2693. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2694. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2695. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2696. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2697. -msoft-float) echo --float_support=vfplib ;;
  2698. -O[0-3]|-mf=*) echo $flag ;;
  2699. -g) echo -g -mn ;;
  2700. -pds=*) echo $flag ;;
  2701. -D*|-I*) echo $flag ;;
  2702. --gcc|--abi=*) echo $flag ;;
  2703. -me) echo $flag ;;
  2704. esac
  2705. done
  2706. }
  2707. probe_cc(){
  2708. pfx=$1
  2709. _cc=$2
  2710. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2711. unset _ld_o _ldflags _ld_lib _ld_path
  2712. unset _depflags _DEPCMD _DEPFLAGS
  2713. _flags_filter=echo
  2714. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  2715. true # no-op to avoid reading stdin in following checks
  2716. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2717. _type=llvm_gcc
  2718. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2719. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2720. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2721. _cflags_speed='-O3'
  2722. _cflags_size='-Os'
  2723. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2724. _type=gcc
  2725. gcc_version=$($_cc --version | head -n1)
  2726. gcc_basever=$($_cc -dumpversion)
  2727. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2728. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2729. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2730. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2731. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2732. fi
  2733. _cflags_speed='-O3'
  2734. _cflags_size='-Os'
  2735. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2736. _type=icc
  2737. _ident=$($_cc --version | head -n1)
  2738. _depflags='-MMD'
  2739. _cflags_speed='-O3'
  2740. _cflags_size='-Os'
  2741. _cflags_noopt='-O1'
  2742. elif $_cc -v 2>&1 | grep -q xlc; then
  2743. _type=xlc
  2744. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2745. _cflags_speed='-O5'
  2746. _cflags_size='-O5 -qcompact'
  2747. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2748. _type=ccc
  2749. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2750. _DEPFLAGS='-M'
  2751. _cflags_speed='-fast'
  2752. _cflags_size='-O1'
  2753. _flags_filter=ccc_flags
  2754. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2755. test -d "$sysroot" || die "No valid sysroot specified."
  2756. _type=armcc
  2757. _ident=$($_cc --vsn | head -n1)
  2758. armcc_conf="$PWD/armcc.conf"
  2759. $_cc --arm_linux_configure \
  2760. --arm_linux_config_file="$armcc_conf" \
  2761. --configure_sysroot="$sysroot" \
  2762. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2763. die "Error creating armcc configuration file."
  2764. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2765. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2766. as_default="${cross_prefix}gcc"
  2767. _depflags='-MMD'
  2768. _cflags_speed='-O3'
  2769. _cflags_size='-Os'
  2770. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2771. _type=tms470
  2772. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2773. _flags='--gcc --abi=eabi -me'
  2774. _cc_e='-ppl -fe=$@'
  2775. _cc_o='-fe=$@'
  2776. _depflags='-ppa -ppd=$(@:.o=.d)'
  2777. _cflags_speed='-O3 -mf=5'
  2778. _cflags_size='-O3 -mf=2'
  2779. _flags_filter=tms470_flags
  2780. elif $_cc -v 2>&1 | grep -q clang; then
  2781. _type=clang
  2782. _ident=$($_cc --version | head -n1)
  2783. _depflags='-MMD'
  2784. _cflags_speed='-O3'
  2785. _cflags_size='-Os'
  2786. elif $_cc -V 2>&1 | grep -q Sun; then
  2787. _type=suncc
  2788. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2789. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2790. _DEPFLAGS='-xM1 -xc99'
  2791. _ldflags='-std=c99'
  2792. _cflags_speed='-O5'
  2793. _cflags_size='-O5 -xspace'
  2794. _flags_filter=suncc_flags
  2795. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2796. _type=pathscale
  2797. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2798. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2799. _cflags_speed='-O2'
  2800. _cflags_size='-Os'
  2801. _flags_filter='filter_out -Wdisabled-optimization'
  2802. elif $_cc -v 2>&1 | grep -q Open64; then
  2803. _type=open64
  2804. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2805. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2806. _cflags_speed='-O2'
  2807. _cflags_size='-Os'
  2808. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2809. elif $_cc -V 2>&1 | grep -q Portland; then
  2810. _type=pgi
  2811. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2812. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2813. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2814. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2815. _cflags_noopt="-O"
  2816. _flags_filter=pgi_flags
  2817. elif $_cc 2>&1 | grep -q Microsoft; then
  2818. _type=msvc
  2819. _ident=$($cc 2>&1 | head -n1)
  2820. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2821. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2822. _cflags_speed="-O2"
  2823. _cflags_size="-O1"
  2824. if $_cc 2>&1 | grep -q Linker; then
  2825. _ld_o='-out:$@'
  2826. else
  2827. _ld_o='-Fe$@'
  2828. fi
  2829. _cc_o='-Fo$@'
  2830. _cc_e='-P -Fi$@'
  2831. _flags_filter=msvc_flags
  2832. _ld_lib='lib%.a'
  2833. _ld_path='-libpath:'
  2834. _flags='-nologo'
  2835. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2836. if [ $pfx = hostcc ]; then
  2837. append _cflags -Dsnprintf=_snprintf
  2838. fi
  2839. disable stripping
  2840. elif $_cc 2>&1 | grep -q Intel; then
  2841. _type=icl
  2842. _ident=$($cc 2>&1 | head -n1)
  2843. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2844. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2845. # versions (tested) as well.
  2846. _cflags_speed="-O2"
  2847. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2848. if $_cc 2>&1 | grep -q Linker; then
  2849. _ld_o='-out:$@'
  2850. else
  2851. _ld_o='-Fe$@'
  2852. fi
  2853. _cc_o='-Fo$@'
  2854. _cc_e='-P'
  2855. _flags_filter=icl_flags
  2856. _ld_lib='lib%.a'
  2857. _ld_path='-libpath:'
  2858. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2859. _flags='-nologo -Qdiag-error:4044,10157'
  2860. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2861. # with MSVC which enables it by default.
  2862. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2863. if [ $pfx = hostcc ]; then
  2864. append _cflags -Dsnprintf=_snprintf
  2865. fi
  2866. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2867. _type=cparser
  2868. _ident=$($_cc --version | head -n1)
  2869. _depflags='-MMD'
  2870. _cflags_speed='-O4'
  2871. _cflags_size='-O2'
  2872. _flags_filter=cparser_flags
  2873. fi
  2874. eval ${pfx}_type=\$_type
  2875. eval ${pfx}_ident=\$_ident
  2876. }
  2877. set_ccvars(){
  2878. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2879. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2880. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2881. if [ -n "$_depflags" ]; then
  2882. eval ${1}_DEPFLAGS=\$_depflags
  2883. else
  2884. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2885. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2886. eval DEP${1}FLAGS=\$_flags
  2887. fi
  2888. }
  2889. probe_cc cc "$cc"
  2890. cflags_filter=$_flags_filter
  2891. cflags_speed=$_cflags_speed
  2892. cflags_size=$_cflags_size
  2893. cflags_noopt=$_cflags_noopt
  2894. add_cflags $_flags $_cflags
  2895. cc_ldflags=$_ldflags
  2896. set_ccvars CC
  2897. probe_cc hostcc "$host_cc"
  2898. host_cflags_filter=$_flags_filter
  2899. add_host_cflags $_flags $_cflags
  2900. set_ccvars HOSTCC
  2901. test -n "$cc_type" && enable $cc_type ||
  2902. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2903. : ${as_default:=$cc}
  2904. : ${dep_cc_default:=$cc}
  2905. : ${ld_default:=$cc}
  2906. : ${host_ld_default:=$host_cc}
  2907. set_default ar as dep_cc ld host_ld windres
  2908. probe_cc as "$as"
  2909. asflags_filter=$_flags_filter
  2910. add_asflags $_flags $_cflags
  2911. set_ccvars AS
  2912. probe_cc ld "$ld"
  2913. ldflags_filter=$_flags_filter
  2914. add_ldflags $_flags $_ldflags
  2915. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2916. LD_O=${_ld_o-$LD_O}
  2917. LD_LIB=${_ld_lib-$LD_LIB}
  2918. LD_PATH=${_ld_path-$LD_PATH}
  2919. probe_cc hostld "$host_ld"
  2920. host_ldflags_filter=$_flags_filter
  2921. add_host_ldflags $_flags $_ldflags
  2922. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2923. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2924. probe_cc depcc "$dep_cc"
  2925. CCDEP=${_DEPCMD:-$DEPCMD}
  2926. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2927. DEPCCFLAGS=$_flags
  2928. fi
  2929. if $ar 2>&1 | grep -q Microsoft; then
  2930. arflags="-nologo"
  2931. ar_o='-out:$@'
  2932. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2933. arflags="rq"
  2934. ar_o='$@'
  2935. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  2936. arflags='-Xany -r -c'
  2937. ar_o='$@'
  2938. else
  2939. arflags="rc"
  2940. ar_o='$@'
  2941. fi
  2942. add_cflags $extra_cflags
  2943. add_cxxflags $extra_cxxflags
  2944. add_asflags $extra_cflags
  2945. if test -n "$sysroot"; then
  2946. case "$cc_type" in
  2947. gcc|llvm_gcc|clang)
  2948. add_cppflags --sysroot="$sysroot"
  2949. add_ldflags --sysroot="$sysroot"
  2950. ;;
  2951. tms470)
  2952. add_cppflags -I"$sysinclude"
  2953. add_ldflags --sysroot="$sysroot"
  2954. ;;
  2955. esac
  2956. fi
  2957. if test "$cpu" = host; then
  2958. enabled cross_compile &&
  2959. die "--cpu=host makes no sense when cross-compiling."
  2960. case "$cc_type" in
  2961. gcc|llvm_gcc)
  2962. check_native(){
  2963. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2964. sed -n "/cc1.*$1=/{
  2965. s/.*$1=\\([^ ]*\\).*/\\1/
  2966. p
  2967. q
  2968. }" $TMPE
  2969. }
  2970. cpu=$(check_native -march || check_native -mcpu)
  2971. ;;
  2972. esac
  2973. test "${cpu:-host}" = host &&
  2974. die "--cpu=host not supported with compiler $cc"
  2975. fi
  2976. # Deal with common $arch aliases
  2977. case "$arch" in
  2978. aarch64|arm64)
  2979. arch="aarch64"
  2980. ;;
  2981. arm*|iPad*|iPhone*)
  2982. arch="arm"
  2983. ;;
  2984. mips*|IP*)
  2985. arch="mips"
  2986. ;;
  2987. parisc*|hppa*)
  2988. arch="parisc"
  2989. ;;
  2990. "Power Macintosh"|ppc*|powerpc*)
  2991. arch="ppc"
  2992. ;;
  2993. s390|s390x)
  2994. arch="s390"
  2995. ;;
  2996. sh4|sh)
  2997. arch="sh4"
  2998. ;;
  2999. sun4u|sparc*)
  3000. arch="sparc"
  3001. ;;
  3002. tilegx|tile-gx)
  3003. arch="tilegx"
  3004. ;;
  3005. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  3006. arch="x86"
  3007. ;;
  3008. esac
  3009. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3010. enable $arch
  3011. # Add processor-specific flags
  3012. if enabled aarch64; then
  3013. case $cpu in
  3014. armv*)
  3015. cpuflags="-march=$cpu"
  3016. ;;
  3017. *)
  3018. cpuflags="-mcpu=$cpu"
  3019. ;;
  3020. esac
  3021. elif enabled alpha; then
  3022. cpuflags="-mcpu=$cpu"
  3023. elif enabled arm; then
  3024. check_arm_arch() {
  3025. check_cpp_condition stddef.h \
  3026. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3027. $cpuflags
  3028. }
  3029. probe_arm_arch() {
  3030. if check_arm_arch 4; then echo armv4;
  3031. elif check_arm_arch 4T; then echo armv4t;
  3032. elif check_arm_arch 5; then echo armv5;
  3033. elif check_arm_arch 5E; then echo armv5e;
  3034. elif check_arm_arch 5T; then echo armv5t;
  3035. elif check_arm_arch 5TE; then echo armv5te;
  3036. elif check_arm_arch 5TEJ; then echo armv5te;
  3037. elif check_arm_arch 6; then echo armv6;
  3038. elif check_arm_arch 6J; then echo armv6j;
  3039. elif check_arm_arch 6K; then echo armv6k;
  3040. elif check_arm_arch 6Z; then echo armv6z;
  3041. elif check_arm_arch 6ZK; then echo armv6zk;
  3042. elif check_arm_arch 6T2; then echo armv6t2;
  3043. elif check_arm_arch 7; then echo armv7;
  3044. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3045. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3046. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3047. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3048. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3049. fi
  3050. }
  3051. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3052. case $cpu in
  3053. armv*)
  3054. cpuflags="-march=$cpu"
  3055. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3056. ;;
  3057. *)
  3058. cpuflags="-mcpu=$cpu"
  3059. case $cpu in
  3060. cortex-a*) subarch=armv7a ;;
  3061. cortex-r*) subarch=armv7r ;;
  3062. cortex-m*) enable thumb; subarch=armv7m ;;
  3063. arm11*) subarch=armv6 ;;
  3064. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3065. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3066. *) subarch=$(probe_arm_arch) ;;
  3067. esac
  3068. ;;
  3069. esac
  3070. case "$subarch" in
  3071. armv5t*) enable fast_clz ;;
  3072. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3073. esac
  3074. elif enabled avr32; then
  3075. case $cpu in
  3076. ap7[02]0[0-2])
  3077. subarch="avr32_ap"
  3078. cpuflags="-mpart=$cpu"
  3079. ;;
  3080. ap)
  3081. subarch="avr32_ap"
  3082. cpuflags="-march=$cpu"
  3083. ;;
  3084. uc3[ab]*)
  3085. subarch="avr32_uc"
  3086. cpuflags="-mcpu=$cpu"
  3087. ;;
  3088. uc)
  3089. subarch="avr32_uc"
  3090. cpuflags="-march=$cpu"
  3091. ;;
  3092. esac
  3093. elif enabled bfin; then
  3094. cpuflags="-mcpu=$cpu"
  3095. elif enabled mips; then
  3096. cpuflags="-march=$cpu"
  3097. case $cpu in
  3098. 24kc)
  3099. disable mipsfpu
  3100. disable mipsdspr1
  3101. disable mipsdspr2
  3102. ;;
  3103. 24kf*)
  3104. disable mipsdspr1
  3105. disable mipsdspr2
  3106. ;;
  3107. 24kec|34kc|1004kc)
  3108. disable mipsfpu
  3109. disable mipsdspr2
  3110. ;;
  3111. 24kef*|34kf*|1004kf*)
  3112. disable mipsdspr2
  3113. ;;
  3114. 74kc)
  3115. disable mipsfpu
  3116. ;;
  3117. esac
  3118. elif enabled ppc; then
  3119. case $(tolower $cpu) in
  3120. 601|ppc601|powerpc601)
  3121. cpuflags="-mcpu=601"
  3122. disable altivec
  3123. ;;
  3124. 603*|ppc603*|powerpc603*)
  3125. cpuflags="-mcpu=603"
  3126. disable altivec
  3127. ;;
  3128. 604*|ppc604*|powerpc604*)
  3129. cpuflags="-mcpu=604"
  3130. disable altivec
  3131. ;;
  3132. g3|75*|ppc75*|powerpc75*)
  3133. cpuflags="-mcpu=750"
  3134. disable altivec
  3135. ;;
  3136. g4|745*|ppc745*|powerpc745*)
  3137. cpuflags="-mcpu=7450"
  3138. ;;
  3139. 74*|ppc74*|powerpc74*)
  3140. cpuflags="-mcpu=7400"
  3141. ;;
  3142. g5|970|ppc970|powerpc970)
  3143. cpuflags="-mcpu=970"
  3144. ;;
  3145. power[3-7]*)
  3146. cpuflags="-mcpu=$cpu"
  3147. ;;
  3148. cell)
  3149. cpuflags="-mcpu=cell"
  3150. enable ldbrx
  3151. ;;
  3152. e500mc)
  3153. cpuflags="-mcpu=e500mc"
  3154. disable altivec
  3155. ;;
  3156. e500v2)
  3157. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3158. disable altivec
  3159. ;;
  3160. e500)
  3161. cpuflags="-mcpu=8540 -mhard-float"
  3162. disable altivec
  3163. ;;
  3164. esac
  3165. elif enabled sparc; then
  3166. case $cpu in
  3167. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3168. cpuflags="-mcpu=$cpu"
  3169. disable vis
  3170. ;;
  3171. ultrasparc*|niagara[234])
  3172. cpuflags="-mcpu=$cpu"
  3173. ;;
  3174. esac
  3175. elif enabled x86; then
  3176. case $cpu in
  3177. i[345]86|pentium)
  3178. cpuflags="-march=$cpu"
  3179. disable mmx
  3180. ;;
  3181. # targets that do NOT support nopl and conditional mov (cmov)
  3182. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3183. cpuflags="-march=$cpu"
  3184. disable i686
  3185. ;;
  3186. # targets that do support nopl and conditional mov (cmov)
  3187. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
  3188. cpuflags="-march=$cpu"
  3189. enable i686
  3190. enable fast_cmov
  3191. ;;
  3192. # targets that do support conditional mov but on which it's slow
  3193. pentium4|pentium4m|prescott|nocona)
  3194. cpuflags="-march=$cpu"
  3195. enable i686
  3196. disable fast_cmov
  3197. ;;
  3198. esac
  3199. fi
  3200. if [ "$cpu" != generic ]; then
  3201. add_cflags $cpuflags
  3202. add_asflags $cpuflags
  3203. fi
  3204. # compiler sanity check
  3205. check_exec <<EOF
  3206. int main(void){ return 0; }
  3207. EOF
  3208. if test "$?" != 0; then
  3209. echo "$cc is unable to create an executable file."
  3210. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3211. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3212. echo "Only do this if you know what cross compiling means."
  3213. fi
  3214. die "C compiler test failed."
  3215. fi
  3216. add_cppflags -D_ISOC99_SOURCE
  3217. add_cxxflags -D__STDC_CONSTANT_MACROS
  3218. check_cflags -std=c99
  3219. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3220. #include <stdlib.h>
  3221. EOF
  3222. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3223. #include <stdlib.h>
  3224. EOF
  3225. check_host_cflags -std=c99
  3226. check_host_cflags -Wall
  3227. check_64bit(){
  3228. arch32=$1
  3229. arch64=$2
  3230. expr=$3
  3231. check_code cc "" "int test[2*($expr) - 1]" &&
  3232. subarch=$arch64 || subarch=$arch32
  3233. }
  3234. case "$arch" in
  3235. aarch64|alpha|ia64)
  3236. spic=$shared
  3237. ;;
  3238. mips)
  3239. check_64bit mips mips64 '_MIPS_SIM > 1'
  3240. spic=$shared
  3241. ;;
  3242. parisc)
  3243. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3244. spic=$shared
  3245. ;;
  3246. ppc)
  3247. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3248. spic=$shared
  3249. ;;
  3250. sparc)
  3251. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3252. spic=$shared
  3253. ;;
  3254. x86)
  3255. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3256. if test "$subarch" = "x86_64"; then
  3257. spic=$shared
  3258. fi
  3259. ;;
  3260. ppc)
  3261. check_cc <<EOF && subarch="ppc64"
  3262. int test[(int)sizeof(char*) - 7];
  3263. EOF
  3264. ;;
  3265. esac
  3266. enable $subarch
  3267. enabled spic && enable_weak pic
  3268. # OS specific
  3269. case $target_os in
  3270. aix)
  3271. SHFLAGS=-shared
  3272. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3273. enabled shared && add_ldflags -Wl,-brtl
  3274. ;;
  3275. haiku)
  3276. prefix_default="/boot/common"
  3277. network_extralibs="-lnetwork"
  3278. host_libs=
  3279. ;;
  3280. sunos)
  3281. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3282. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3283. network_extralibs="-lsocket -lnsl"
  3284. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3285. # When using suncc to build, the Solaris linker will mark
  3286. # an executable with each instruction set encountered by
  3287. # the Solaris assembler. As our libraries contain their own
  3288. # guards for processor-specific code, instead suppress
  3289. # generation of the HWCAPS ELF section on Solaris x86 only.
  3290. enabled_all suncc x86 &&
  3291. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3292. add_ldflags -Wl,-M,mapfile
  3293. nm_default='nm -P -g'
  3294. ;;
  3295. netbsd)
  3296. disable symver
  3297. oss_indev_extralibs="-lossaudio"
  3298. oss_outdev_extralibs="-lossaudio"
  3299. enabled gcc || check_ldflags -Wl,-zmuldefs
  3300. ;;
  3301. openbsd|bitrig)
  3302. disable symver
  3303. SHFLAGS='-shared'
  3304. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3305. SLIB_INSTALL_LINKS=
  3306. oss_indev_extralibs="-lossaudio"
  3307. oss_outdev_extralibs="-lossaudio"
  3308. ;;
  3309. dragonfly)
  3310. disable symver
  3311. ;;
  3312. freebsd)
  3313. ;;
  3314. bsd/os)
  3315. add_extralibs -lpoll -lgnugetopt
  3316. strip="strip -d"
  3317. ;;
  3318. darwin)
  3319. gas="gas-preprocessor.pl $cc"
  3320. enabled ppc && add_asflags -force_cpusubtype_ALL
  3321. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3322. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3323. strip="${strip} -x"
  3324. add_ldflags -Wl,-dynamic,-search_paths_first
  3325. SLIBSUF=".dylib"
  3326. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3327. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3328. objformat="macho"
  3329. enabled x86_64 && objformat="macho64"
  3330. enabled_any pic shared ||
  3331. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3332. ;;
  3333. mingw32*)
  3334. if test $target_os = "mingw32ce"; then
  3335. disable network
  3336. else
  3337. target_os=mingw32
  3338. fi
  3339. LIBTARGET=i386
  3340. if enabled x86_64; then
  3341. LIBTARGET="i386:x86-64"
  3342. elif enabled arm; then
  3343. LIBTARGET=arm-wince
  3344. fi
  3345. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3346. check_ldflags -Wl,--nxcompat
  3347. check_ldflags -Wl,--dynamicbase
  3348. shlibdir_default="$bindir_default"
  3349. SLIBPREF=""
  3350. SLIBSUF=".dll"
  3351. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3352. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3353. dlltool="${cross_prefix}dlltool"
  3354. if check_cmd lib.exe -list; then
  3355. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3356. if enabled x86_64; then
  3357. LIBTARGET=x64
  3358. fi
  3359. elif check_cmd $dlltool --version; then
  3360. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  3361. fi
  3362. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3363. SLIB_INSTALL_LINKS=
  3364. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3365. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3366. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  3367. objformat="win32"
  3368. ranlib=:
  3369. enable dos_paths
  3370. ;;
  3371. win32|win64)
  3372. disable symver
  3373. if enabled shared; then
  3374. # Link to the import library instead of the normal static library
  3375. # for shared libs.
  3376. LD_LIB='%.lib'
  3377. # Cannot build both shared and static libs with MSVC or icl.
  3378. disable static
  3379. fi
  3380. shlibdir_default="$bindir_default"
  3381. SLIBPREF=""
  3382. SLIBSUF=".dll"
  3383. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3384. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3385. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3386. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3387. SLIB_INSTALL_LINKS=
  3388. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3389. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3390. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3391. objformat="win32"
  3392. ranlib=:
  3393. enable dos_paths
  3394. ;;
  3395. cygwin*)
  3396. target_os=cygwin
  3397. shlibdir_default="$bindir_default"
  3398. SLIBPREF="cyg"
  3399. SLIBSUF=".dll"
  3400. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3401. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3402. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3403. SLIB_INSTALL_LINKS=
  3404. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3405. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3406. objformat="win32"
  3407. enable dos_paths
  3408. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3409. ;;
  3410. *-dos|freedos|opendos)
  3411. network_extralibs="-lsocket"
  3412. objformat="coff"
  3413. enable dos_paths
  3414. add_cppflags -U__STRICT_ANSI__
  3415. ;;
  3416. linux)
  3417. enable dv1394
  3418. ;;
  3419. irix*)
  3420. target_os=irix
  3421. ranlib="echo ignoring ranlib"
  3422. ;;
  3423. os/2*)
  3424. strip="lxlite -CS"
  3425. ln_s="cp -f"
  3426. objformat="aout"
  3427. add_cppflags -D_GNU_SOURCE
  3428. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3429. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3430. LIBSUF="_s.a"
  3431. SLIBPREF=""
  3432. SLIBSUF=".dll"
  3433. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3434. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3435. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3436. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3437. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3438. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3439. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3440. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3441. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3442. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3443. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3444. enable dos_paths
  3445. enable_weak os2threads
  3446. ;;
  3447. gnu/kfreebsd)
  3448. add_cppflags -D_BSD_SOURCE
  3449. ;;
  3450. gnu)
  3451. ;;
  3452. qnx)
  3453. add_cppflags -D_QNX_SOURCE
  3454. network_extralibs="-lsocket"
  3455. ;;
  3456. symbian)
  3457. SLIBSUF=".dll"
  3458. enable dos_paths
  3459. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3460. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3461. add_ldflags -Wl,--target1-abs,--no-undefined \
  3462. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3463. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3464. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3465. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3466. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3467. ;;
  3468. osf1)
  3469. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3470. ;;
  3471. minix)
  3472. ;;
  3473. plan9)
  3474. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3475. -D_REENTRANT_SOURCE \
  3476. -D_RESEARCH_SOURCE \
  3477. -DFD_SETSIZE=96 \
  3478. -DHAVE_SOCK_OPTS
  3479. add_compat strtod.o strtod=avpriv_strtod
  3480. network_extralibs='-lbsd'
  3481. exeobjs=compat/plan9/main.o
  3482. disable ffserver
  3483. cp_f='cp'
  3484. ;;
  3485. none)
  3486. ;;
  3487. *)
  3488. die "Unknown OS '$target_os'."
  3489. ;;
  3490. esac
  3491. # determine libc flavour
  3492. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3493. if check_cpp_condition features.h "defined __UCLIBC__"; then
  3494. libc_type=uclibc
  3495. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3496. elif check_cpp_condition features.h "defined __GLIBC__"; then
  3497. libc_type=glibc
  3498. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3499. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3500. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3501. libc_type=newlib
  3502. add_cppflags -U__STRICT_ANSI__
  3503. elif check_header _mingw.h; then
  3504. libc_type=mingw
  3505. check_cpp_condition _mingw.h \
  3506. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  3507. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3508. die "ERROR: MinGW runtime version must be >= 3.15."
  3509. add_cppflags -U__STRICT_ANSI__
  3510. if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
  3511. __MINGW64_VERSION_MAJOR < 3"; then
  3512. add_compat msvcrt/snprintf.o
  3513. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3514. else
  3515. add_cppflags -D__USE_MINGW_ANSI_STDIO=1
  3516. fi
  3517. elif check_cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3518. libc_type=msvcrt
  3519. add_compat strtod.o strtod=avpriv_strtod
  3520. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3521. _snprintf=avpriv_snprintf \
  3522. vsnprintf=avpriv_vsnprintf
  3523. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3524. # 0x601 by default unless something else is set by the user.
  3525. # This can easily lead to us detecting functions only present
  3526. # in such new versions and producing binaries requiring windows 7.0.
  3527. # Therefore explicitly set the default to XP unless the user has
  3528. # set something else on the command line.
  3529. check_cpp_condition stdlib.h "defined(_WIN32_WINNT)" || add_cppflags -D_WIN32_WINNT=0x0502
  3530. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3531. libc_type=klibc
  3532. elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3533. libc_type=bionic
  3534. add_compat strtod.o strtod=avpriv_strtod
  3535. fi
  3536. test -n "$libc_type" && enable $libc_type
  3537. # hacks for compiler/libc/os combinations
  3538. if enabled_all tms470 glibc; then
  3539. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3540. add_cppflags -D__USER_LABEL_PREFIX__=
  3541. add_cppflags -D__builtin_memset=memset
  3542. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3543. add_cflags -pds=48 # incompatible redefinition of macro
  3544. fi
  3545. if enabled_all ccc glibc; then
  3546. add_ldflags -Wl,-z,now # calls to libots crash without this
  3547. fi
  3548. esc(){
  3549. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3550. }
  3551. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3552. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3553. set_default $PATHS_LIST
  3554. set_default nm
  3555. # we need to build at least one lib type
  3556. if ! enabled_any static shared; then
  3557. cat <<EOF
  3558. At least one library type must be built.
  3559. Specify --enable-static to build the static libraries or --enable-shared to
  3560. build the shared libraries as well. To only build the shared libraries specify
  3561. --disable-static in addition to --enable-shared.
  3562. EOF
  3563. exit 1;
  3564. fi
  3565. # backward compatibility layer for incompatible_libav/fork_abi
  3566. enabled incompatible_fork_abi && enable incompatible_libav_abi
  3567. enabled incompatible_libav_abi && enable incompatible_fork_abi
  3568. die_license_disabled() {
  3569. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3570. }
  3571. die_license_disabled_gpl() {
  3572. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3573. }
  3574. die_license_disabled gpl frei0r
  3575. die_license_disabled gpl libcdio
  3576. die_license_disabled gpl libutvideo
  3577. die_license_disabled gpl libvidstab
  3578. die_license_disabled gpl libx264
  3579. die_license_disabled gpl libxavs
  3580. die_license_disabled gpl libxvid
  3581. die_license_disabled gpl libzvbi
  3582. die_license_disabled gpl x11grab
  3583. die_license_disabled nonfree libaacplus
  3584. die_license_disabled nonfree libfaac
  3585. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3586. enabled gpl && die_license_disabled_gpl nonfree openssl
  3587. die_license_disabled version3 libopencore_amrnb
  3588. die_license_disabled version3 libopencore_amrwb
  3589. die_license_disabled version3 libvo_aacenc
  3590. die_license_disabled version3 libvo_amrwbenc
  3591. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3592. disabled optimizations || check_cflags -fomit-frame-pointer
  3593. enable_weak_pic() {
  3594. disabled pic && return
  3595. enable pic
  3596. add_cppflags -DPIC
  3597. case "$target_os" in
  3598. mingw*|cygwin*)
  3599. ;;
  3600. *)
  3601. add_cflags -fPIC
  3602. ;;
  3603. esac
  3604. add_asflags -fPIC
  3605. }
  3606. enabled pic && enable_weak_pic
  3607. check_cc <<EOF || die "Symbol mangling check failed."
  3608. int ff_extern;
  3609. EOF
  3610. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3611. extern_prefix=${sym%%ff_extern*}
  3612. check_cc <<EOF && enable_weak inline_asm
  3613. void foo(void) { __asm__ volatile ("" ::); }
  3614. EOF
  3615. _restrict=
  3616. for restrict_keyword in restrict __restrict__ __restrict; do
  3617. check_cc <<EOF && _restrict=$restrict_keyword && break
  3618. void foo(char * $restrict_keyword p);
  3619. EOF
  3620. done
  3621. check_cc <<EOF && enable pragma_deprecated
  3622. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3623. EOF
  3624. check_cc <<EOF && enable attribute_packed
  3625. struct { int x; } __attribute__((packed)) x;
  3626. EOF
  3627. check_cc <<EOF && enable attribute_may_alias
  3628. union { int x; } __attribute__((may_alias)) x;
  3629. EOF
  3630. check_cc <<EOF || die "endian test failed"
  3631. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3632. EOF
  3633. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3634. check_inline_asm inline_asm_labels '"1:\n"'
  3635. if enabled alpha; then
  3636. check_cflags -mieee
  3637. elif enabled arm; then
  3638. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3639. float func(float a, float b){ return a+b; }
  3640. EOF
  3641. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3642. nogas=die
  3643. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3644. enable vfp_args
  3645. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3646. case "${cross_prefix:-$cc}" in
  3647. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3648. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3649. __asm__ (".eabi_attribute 28, 1");
  3650. int main(void) { return 0; }
  3651. EOF
  3652. esac
  3653. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3654. fi
  3655. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3656. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3657. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3658. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3659. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3660. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3661. [ $target_os = linux ] ||
  3662. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3663. $ARCH_EXT_LIST_ARM
  3664. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3665. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3666. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3667. elif enabled mips; then
  3668. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3669. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3670. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3671. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3672. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3673. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3674. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3675. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3676. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3677. elif enabled parisc; then
  3678. if enabled gcc; then
  3679. case $($cc -dumpversion) in
  3680. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3681. esac
  3682. fi
  3683. elif enabled ppc; then
  3684. enable local_aligned_8 local_aligned_16
  3685. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3686. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3687. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3688. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3689. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3690. if enabled altivec; then
  3691. if ! enabled_any pic ppc64; then
  3692. nogas=warn
  3693. fi
  3694. check_cflags -maltivec -mabi=altivec &&
  3695. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3696. check_cflags -faltivec
  3697. # check if our compiler supports Motorola AltiVec C API
  3698. check_cc <<EOF || disable altivec
  3699. $inc_altivec_h
  3700. int main(void) {
  3701. vector signed int v1 = (vector signed int) { 0 };
  3702. vector signed int v2 = (vector signed int) { 1 };
  3703. v1 = vec_add(v1, v2);
  3704. return 0;
  3705. }
  3706. EOF
  3707. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3708. fi
  3709. elif enabled sparc; then
  3710. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3711. elif enabled x86; then
  3712. check_builtin rdtsc intrin.h "__rdtsc()"
  3713. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3714. enable local_aligned_8 local_aligned_16
  3715. # check whether EBP is available on x86
  3716. # As 'i' is stored on the stack, this program will crash
  3717. # if the base pointer is used to access it because the
  3718. # base pointer is cleared in the inline assembly code.
  3719. check_exec_crash <<EOF && enable ebp_available
  3720. volatile int i=0;
  3721. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3722. return i;
  3723. EOF
  3724. # check whether EBX is available on x86
  3725. check_inline_asm ebx_available '""::"b"(0)' &&
  3726. check_inline_asm ebx_available '"":::"%ebx"'
  3727. # check whether xmm clobbers are supported
  3728. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3729. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3730. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3731. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3732. if ! disabled_any asm mmx yasm; then
  3733. if check_cmd $yasmexe --version; then
  3734. enabled x86_64 && yasm_extra="-m amd64"
  3735. yasm_debug="-g dwarf2"
  3736. elif check_cmd nasm -v; then
  3737. yasmexe=nasm
  3738. yasm_debug="-g -F dwarf"
  3739. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3740. fi
  3741. YASMFLAGS="-f $objformat $yasm_extra"
  3742. enabled pic && append YASMFLAGS "-DPIC"
  3743. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3744. case "$objformat" in
  3745. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3746. esac
  3747. check_yasm "movbe ecx, [5]" && enable yasm ||
  3748. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3749. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external avresample
  3750. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3751. check_yasm "CPU amdnop" && enable cpunop
  3752. fi
  3753. case "$cpu" in
  3754. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3755. disable fast_clz
  3756. ;;
  3757. esac
  3758. fi
  3759. if enabled asm; then
  3760. as=${gas:=$as}
  3761. check_as <<EOF && enable gnu_as || \
  3762. $nogas "GNU assembler not found, install gas-preprocessor"
  3763. .macro m n
  3764. \n: .int 0
  3765. .endm
  3766. m x
  3767. EOF
  3768. fi
  3769. check_ldflags -Wl,--as-needed
  3770. if check_func dlopen; then
  3771. ldl=
  3772. elif check_func dlopen -ldl; then
  3773. ldl=-ldl
  3774. fi
  3775. if ! disabled network; then
  3776. check_type "sys/types.h sys/socket.h" socklen_t
  3777. check_type netdb.h "struct addrinfo"
  3778. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3779. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3780. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3781. check_type netinet/in.h "struct sockaddr_in6"
  3782. check_type poll.h "struct pollfd"
  3783. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3784. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3785. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3786. check_func getaddrinfo $network_extralibs
  3787. check_func getservbyport $network_extralibs
  3788. # Prefer arpa/inet.h over winsock2
  3789. if check_header arpa/inet.h ; then
  3790. check_func closesocket
  3791. elif check_header winsock2.h ; then
  3792. check_func_headers winsock2.h closesocket -lws2 &&
  3793. network_extralibs="-lws2" ||
  3794. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3795. network_extralibs="-lws2_32"; }
  3796. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3797. check_type ws2tcpip.h socklen_t
  3798. check_type ws2tcpip.h "struct addrinfo"
  3799. check_type ws2tcpip.h "struct group_source_req"
  3800. check_type ws2tcpip.h "struct ip_mreq_source"
  3801. check_type ws2tcpip.h "struct ipv6_mreq"
  3802. check_type winsock2.h "struct pollfd"
  3803. check_type ws2tcpip.h "struct sockaddr_in6"
  3804. check_type ws2tcpip.h "struct sockaddr_storage"
  3805. check_struct winsock2.h "struct sockaddr" sa_len
  3806. else
  3807. disable network
  3808. fi
  3809. fi
  3810. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3811. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3812. check_func access
  3813. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3814. check_func fcntl
  3815. check_func fork
  3816. check_func_headers stdlib.h getenv
  3817. check_func gethrtime
  3818. check_func getopt
  3819. check_func getrusage
  3820. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3821. check_func gettimeofday
  3822. check_func inet_aton $network_extralibs
  3823. check_func isatty
  3824. check_func localtime_r
  3825. check_func ${malloc_prefix}memalign && enable memalign
  3826. check_func mkstemp
  3827. check_func mmap
  3828. check_func mprotect
  3829. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3830. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3831. check_func setrlimit
  3832. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  3833. check_func strerror_r
  3834. check_func sched_getaffinity
  3835. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3836. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3837. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3838. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3839. check_builtin sarestart signal.h "SA_RESTART"
  3840. check_func sysconf
  3841. check_func sysctl
  3842. check_func usleep
  3843. check_func_headers conio.h kbhit
  3844. check_func_headers windows.h PeekNamedPipe
  3845. check_func_headers io.h setmode
  3846. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3847. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3848. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3849. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3850. check_func_headers windows.h GetProcessAffinityMask
  3851. check_func_headers windows.h GetProcessTimes
  3852. check_func_headers windows.h GetSystemTimeAsFileTime
  3853. check_func_headers windows.h MapViewOfFile
  3854. check_func_headers windows.h SetConsoleTextAttribute
  3855. check_func_headers windows.h Sleep
  3856. check_func_headers windows.h VirtualAlloc
  3857. check_func_headers glob.h glob
  3858. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  3859. check_header cl/cl.h
  3860. check_header direct.h
  3861. check_header dlfcn.h
  3862. check_header dxva.h
  3863. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3864. check_header io.h
  3865. check_header libcrystalhd/libcrystalhd_if.h
  3866. check_header malloc.h
  3867. check_header poll.h
  3868. check_header sys/mman.h
  3869. check_header sys/param.h
  3870. check_header sys/resource.h
  3871. check_header sys/select.h
  3872. check_header sys/time.h
  3873. check_header sys/un.h
  3874. check_header termios.h
  3875. check_header unistd.h
  3876. check_header vdpau/vdpau.h
  3877. check_header vdpau/vdpau_x11.h
  3878. check_header VideoDecodeAcceleration/VDADecoder.h
  3879. check_header windows.h
  3880. check_header X11/extensions/XvMClib.h
  3881. check_header asm/types.h
  3882. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3883. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3884. if ! disabled w32threads && ! enabled pthreads; then
  3885. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3886. fi
  3887. # check for some common methods of building with pthread support
  3888. # do this before the optional library checks as some of them require pthreads
  3889. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3890. enable pthreads
  3891. if check_func pthread_join && check_func pthread_create; then
  3892. :
  3893. elif check_func pthread_join -pthread && check_func pthread_create -pthread; then
  3894. add_cflags -pthread
  3895. add_extralibs -pthread
  3896. elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
  3897. add_cflags -pthreads
  3898. add_extralibs -pthreads
  3899. elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
  3900. add_extralibs -lpthreadGC2
  3901. elif ! check_lib pthread.h pthread_join -lpthread && ! check_lib pthread.h pthread_create -lpthread; then
  3902. disable pthreads
  3903. fi
  3904. fi
  3905. for thread in $THREADS_LIST; do
  3906. if enabled $thread; then
  3907. test -n "$thread_type" &&
  3908. die "ERROR: Only one thread type must be selected." ||
  3909. thread_type="$thread"
  3910. fi
  3911. done
  3912. if enabled pthreads; then
  3913. check_func pthread_cancel
  3914. fi
  3915. enabled sync_val_compare_and_swap && enable atomics_gcc
  3916. enabled_all atomic_cas_ptr machine_rw_barrier && enable atomics_suncc
  3917. enabled MemoryBarrier && enable atomics_win32
  3918. check_lib math.h sin -lm && LIBM="-lm"
  3919. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3920. atan2f_args=2
  3921. ldexpf_args=2
  3922. powf_args=2
  3923. for func in $MATH_FUNCS; do
  3924. eval check_mathfunc $func \${${func}_args:-1}
  3925. done
  3926. # these are off by default, so fail if requested and not available
  3927. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  3928. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3929. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  3930. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3931. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3932. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3933. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  3934. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3935. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3936. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3937. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3938. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3939. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3940. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3941. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3942. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3943. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3944. 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"
  3945. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3946. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3947. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  3948. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3949. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3950. done || die "ERROR: libgsm not found"; }
  3951. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3952. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3953. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3954. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3955. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3956. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3957. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3958. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  3959. check_lib openjpeg.h opj_version -lopenjpeg ||
  3960. die "ERROR: libopenjpeg not found"; }
  3961. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3962. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3963. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  3964. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3965. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3966. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  3967. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  3968. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  3969. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3970. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3971. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3972. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3973. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3974. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3975. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3976. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3977. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3978. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3979. enabled libvidstab && require_pkg_config vidstab vid.stab/libvidstab.h vsMotionDetectInit
  3980. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3981. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3982. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3983. enabled libvpx && {
  3984. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3985. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3986. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
  3987. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  3988. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3989. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3990. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  3991. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3992. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3993. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3994. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3995. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3996. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  3997. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
  3998. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3999. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  4000. die "ERROR: openal not found"; } &&
  4001. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  4002. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  4003. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  4004. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  4005. die "ERROR: opencl not found"; } &&
  4006. { ! enabled_any w32threads os2threads ||
  4007. die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
  4008. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  4009. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  4010. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  4011. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4012. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4013. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4014. die "ERROR: openssl not found"; }
  4015. if enabled gnutls; then
  4016. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  4017. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  4018. fi
  4019. # libdc1394 check
  4020. if enabled libdc1394; then
  4021. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  4022. enable libdc1394_2; } ||
  4023. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  4024. enable libdc1394_1; } ||
  4025. die "ERROR: No version of libdc1394 found "
  4026. fi
  4027. SDL_CONFIG="${cross_prefix}sdl-config"
  4028. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  4029. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4030. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4031. enable sdl
  4032. else
  4033. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  4034. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  4035. sdl_libs=$("${SDL_CONFIG}" --libs)
  4036. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  4037. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4038. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4039. enable sdl
  4040. fi
  4041. fi
  4042. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  4043. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  4044. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  4045. perl -v > /dev/null 2>&1 && enable perl || disable perl
  4046. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  4047. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  4048. check_header linux/fb.h
  4049. check_header linux/videodev.h
  4050. check_header linux/videodev2.h
  4051. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  4052. check_header sys/videoio.h
  4053. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  4054. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4055. # w32api 3.12 had it defined wrong
  4056. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4057. check_type "dshow.h" IBaseFilter
  4058. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4059. { check_header dev/bktr/ioctl_meteor.h &&
  4060. check_header dev/bktr/ioctl_bt848.h; } ||
  4061. { check_header machine/ioctl_meteor.h &&
  4062. check_header machine/ioctl_bt848.h; } ||
  4063. { check_header dev/video/meteor/ioctl_meteor.h &&
  4064. check_header dev/video/bktr/ioctl_bt848.h; } ||
  4065. check_header dev/ic/bt8xx.h
  4066. check_header sndio.h
  4067. if check_struct sys/soundcard.h audio_buf_info bytes; then
  4068. enable_safe sys/soundcard.h
  4069. else
  4070. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  4071. #include <sys/soundcard.h>
  4072. audio_buf_info abc;
  4073. EOF
  4074. fi
  4075. check_header soundcard.h
  4076. enabled_any alsa_indev alsa_outdev &&
  4077. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4078. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  4079. check_func jack_port_get_latency_range -ljack
  4080. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4081. if enabled libcdio; then
  4082. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4083. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4084. die "ERROR: libcdio-paranoia not found"
  4085. fi
  4086. check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  4087. enabled x11grab &&
  4088. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  4089. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
  4090. { enabled xlib || die "ERROR: Xlib not found"; }
  4091. enabled vaapi &&
  4092. check_lib va/va.h vaInitialize -lva ||
  4093. disable vaapi
  4094. enabled vdpau &&
  4095. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4096. disable vdpau
  4097. enabled vdpau && enabled xlib &&
  4098. check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  4099. enable vdpau_x11
  4100. # Funny iconv installations are not unusual, so check it after all flags have been set
  4101. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  4102. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4103. # add some useful compiler flags if supported
  4104. check_cflags -Wdeclaration-after-statement
  4105. check_cflags -Wall
  4106. check_cflags -Wdisabled-optimization
  4107. check_cflags -Wpointer-arith
  4108. check_cflags -Wredundant-decls
  4109. check_cflags -Wwrite-strings
  4110. check_cflags -Wtype-limits
  4111. check_cflags -Wundef
  4112. check_cflags -Wmissing-prototypes
  4113. check_cflags -Wno-pointer-to-int-cast
  4114. check_cflags -Wstrict-prototypes
  4115. enabled extra_warnings && check_cflags -Winline
  4116. check_disable_warning(){
  4117. warning_flag=-W${1#-Wno-}
  4118. test_cflags $warning_flag && add_cflags $1
  4119. }
  4120. check_disable_warning -Wno-parentheses
  4121. check_disable_warning -Wno-switch
  4122. check_disable_warning -Wno-format-zero-length
  4123. check_disable_warning -Wno-pointer-sign
  4124. # add some linker flags
  4125. check_ldflags -Wl,--warn-common
  4126. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4127. enabled rpath && add_ldflags -Wl,-rpath=$libdir
  4128. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4129. # add some strip flags
  4130. # -wN '..@*' is more selective than -x, but not available everywhere.
  4131. check_stripflags -wN \'..@*\' || check_stripflags -x
  4132. enabled xmm_clobber_test &&
  4133. check_ldflags -Wl,--wrap,avcodec_open2 \
  4134. -Wl,--wrap,avcodec_decode_audio4 \
  4135. -Wl,--wrap,avcodec_decode_video2 \
  4136. -Wl,--wrap,avcodec_decode_subtitle2 \
  4137. -Wl,--wrap,avcodec_encode_audio2 \
  4138. -Wl,--wrap,avcodec_encode_video \
  4139. -Wl,--wrap,avcodec_encode_video2 \
  4140. -Wl,--wrap,avcodec_encode_subtitle \
  4141. -Wl,--wrap,sws_scale ||
  4142. disable xmm_clobber_test
  4143. echo "X{};" > $TMPV
  4144. if test_ldflags -Wl,--version-script,$TMPV; then
  4145. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4146. check_cc <<EOF && enable symver_asm_label
  4147. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4148. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4149. EOF
  4150. check_cc <<EOF && enable symver_gnu_asm
  4151. __asm__(".symver ff_foo,av_foo@VERSION");
  4152. void ff_foo(void) {}
  4153. EOF
  4154. fi
  4155. if [ -z "$optflags" ]; then
  4156. if enabled small; then
  4157. optflags=$cflags_size
  4158. elif enabled optimizations; then
  4159. optflags=$cflags_speed
  4160. else
  4161. optflags=$cflags_noopt
  4162. fi
  4163. fi
  4164. check_optflags(){
  4165. check_cflags "$@"
  4166. enabled lto && check_ldflags "$@"
  4167. }
  4168. if enabled lto; then
  4169. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4170. check_cflags -flto
  4171. check_ldflags -flto $cpuflags
  4172. fi
  4173. check_optflags $optflags
  4174. check_optflags -fno-math-errno
  4175. check_optflags -fno-signed-zeros
  4176. enabled ftrapv && check_cflags -ftrapv
  4177. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  4178. int x;
  4179. EOF
  4180. if enabled icc; then
  4181. # Just warnings, no remarks
  4182. check_cflags -w1
  4183. # -wd: Disable following warnings
  4184. # 144, 167, 556: -Wno-pointer-sign
  4185. # 188: enumerated type mixed with another type
  4186. # 1292: attribute "foo" ignored
  4187. # 1419: external declaration in primary source file
  4188. # 10006: ignoring unknown option -fno-signed-zeros
  4189. # 10148: ignoring unknown option -Wno-parentheses
  4190. # 10156: ignoring option '-W'; no argument required
  4191. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  4192. # 11030: Warning unknown option --as-needed
  4193. # 10156: ignoring option '-export'; no argument required
  4194. check_ldflags -wd10156,11030
  4195. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4196. enable ebp_available
  4197. if enabled x86_32; then
  4198. icc_version=$($cc -dumpversion)
  4199. test ${icc_version%%.*} -ge 11 &&
  4200. check_cflags -falign-stack=maintain-16-byte ||
  4201. disable aligned_stack
  4202. fi
  4203. elif enabled ccc; then
  4204. # disable some annoying warnings
  4205. add_cflags -msg_disable bitnotint
  4206. add_cflags -msg_disable mixfuncvoid
  4207. add_cflags -msg_disable nonstandcast
  4208. add_cflags -msg_disable unsupieee
  4209. elif enabled gcc; then
  4210. check_optflags -fno-tree-vectorize
  4211. check_cflags -Werror=implicit-function-declaration
  4212. check_cflags -Werror=missing-prototypes
  4213. check_cflags -Werror=return-type
  4214. check_cflags -Werror=vla
  4215. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4216. elif enabled llvm_gcc; then
  4217. check_cflags -mllvm -stack-alignment=16
  4218. elif enabled clang; then
  4219. check_cflags -mllvm -stack-alignment=16
  4220. check_cflags -Qunused-arguments
  4221. check_cflags -Werror=implicit-function-declaration
  4222. check_cflags -Werror=missing-prototypes
  4223. check_cflags -Werror=return-type
  4224. elif enabled cparser; then
  4225. add_cflags -Wno-missing-variable-declarations
  4226. add_cflags -Wno-empty-statement
  4227. elif enabled armcc; then
  4228. # 2523: use of inline assembler is deprecated
  4229. add_cflags -W${armcc_opt},--diag_suppress=2523
  4230. add_cflags -W${armcc_opt},--diag_suppress=1207
  4231. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4232. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4233. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4234. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4235. elif enabled tms470; then
  4236. add_cflags -pds=824 -pds=837
  4237. elif enabled pathscale; then
  4238. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4239. elif enabled_any msvc icl; then
  4240. enabled x86_32 && disable aligned_stack
  4241. enabled_all x86_32 debug && add_cflags -Oy-
  4242. enabled debug && add_ldflags -debug
  4243. enable pragma_deprecated
  4244. if enabled icl; then
  4245. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4246. # (correctly) on icl 13.x.
  4247. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4248. add_cflags -Qansi-alias
  4249. # icl will pass the inline asm tests but inline asm is currently
  4250. # not supported (build will fail)
  4251. disabled inline_asm || warn "inline asm disabled due to issues with it in ICL"
  4252. disable inline_asm
  4253. fi
  4254. fi
  4255. case $target_os in
  4256. osf1)
  4257. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4258. ;;
  4259. plan9)
  4260. add_cppflags -Dmain=plan9_main
  4261. ;;
  4262. esac
  4263. enable frame_thread_encoder
  4264. enabled_any $THREADS_LIST && enable threads
  4265. enabled_any $ATOMICS_LIST && enable atomics_native
  4266. enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
  4267. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4268. check_deps $CONFIG_LIST \
  4269. $CONFIG_EXTRA \
  4270. $HAVE_LIST \
  4271. $ALL_COMPONENTS \
  4272. if test $target_os = "haiku"; then
  4273. disable memalign
  4274. disable posix_memalign
  4275. fi
  4276. ! enabled_any memalign posix_memalign aligned_malloc &&
  4277. enabled_any $need_memalign && enable memalign_hack
  4278. # add_dep lib dep
  4279. # -> enable ${lib}_deps_${dep}
  4280. # -> add $dep to ${lib}_deps only once
  4281. add_dep() {
  4282. lib=$1
  4283. dep=$2
  4284. enabled "${lib}_deps_${dep}" && return 0
  4285. enable "${lib}_deps_${dep}"
  4286. prepend "${lib}_deps" $dep
  4287. }
  4288. # merge deps lib components
  4289. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  4290. merge_deps() {
  4291. lib=$1
  4292. shift
  4293. for comp in $*; do
  4294. enabled $comp || continue
  4295. eval "dep=\"\$${comp}_deps\""
  4296. for d in $dep; do
  4297. add_dep $lib $d
  4298. done
  4299. done
  4300. }
  4301. merge_deps libavfilter $FILTER_LIST
  4302. echo "install prefix $prefix"
  4303. echo "source path $source_path"
  4304. echo "C compiler $cc"
  4305. if test "$host_cc" != "$cc"; then
  4306. echo "host C compiler $host_cc"
  4307. fi
  4308. echo "C library $libc_type"
  4309. echo "ARCH $arch ($cpu)"
  4310. if test "$build_suffix" != ""; then
  4311. echo "build suffix $build_suffix"
  4312. fi
  4313. if test "$progs_suffix" != ""; then
  4314. echo "progs suffix $progs_suffix"
  4315. fi
  4316. if test "$extra_version" != ""; then
  4317. echo "version string suffix $extra_version"
  4318. fi
  4319. echo "big-endian ${bigendian-no}"
  4320. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4321. if enabled x86; then
  4322. echo "${yasmexe} ${yasm-no}"
  4323. echo "MMX enabled ${mmx-no}"
  4324. echo "MMXEXT enabled ${mmxext-no}"
  4325. echo "3DNow! enabled ${amd3dnow-no}"
  4326. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4327. echo "SSE enabled ${sse-no}"
  4328. echo "SSSE3 enabled ${ssse3-no}"
  4329. echo "AVX enabled ${avx-no}"
  4330. echo "FMA4 enabled ${fma4-no}"
  4331. echo "i686 features enabled ${i686-no}"
  4332. echo "CMOV is fast ${fast_cmov-no}"
  4333. echo "EBX available ${ebx_available-no}"
  4334. echo "EBP available ${ebp_available-no}"
  4335. fi
  4336. if enabled arm; then
  4337. echo "ARMv5TE enabled ${armv5te-no}"
  4338. echo "ARMv6 enabled ${armv6-no}"
  4339. echo "ARMv6T2 enabled ${armv6t2-no}"
  4340. echo "VFP enabled ${vfp-no}"
  4341. echo "NEON enabled ${neon-no}"
  4342. echo "THUMB enabled ${thumb-no}"
  4343. fi
  4344. if enabled mips; then
  4345. echo "MIPS FPU enabled ${mipsfpu-no}"
  4346. echo "MIPS32R2 enabled ${mips32r2-no}"
  4347. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  4348. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  4349. fi
  4350. if enabled ppc; then
  4351. echo "AltiVec enabled ${altivec-no}"
  4352. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4353. echo "dcbzl available ${dcbzl-no}"
  4354. fi
  4355. if enabled sparc; then
  4356. echo "VIS enabled ${vis-no}"
  4357. fi
  4358. echo "debug symbols ${debug-no}"
  4359. echo "strip symbols ${stripping-no}"
  4360. echo "optimize for size ${small-no}"
  4361. echo "optimizations ${optimizations-no}"
  4362. echo "static ${static-no}"
  4363. echo "shared ${shared-no}"
  4364. echo "postprocessing support ${postproc-no}"
  4365. echo "new filter support ${avfilter-no}"
  4366. echo "network support ${network-no}"
  4367. echo "threading support ${thread_type-no}"
  4368. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4369. echo "SDL support ${sdl-no}"
  4370. echo "opencl enabled ${opencl-no}"
  4371. echo "libzvbi enabled ${libzvbi-no}"
  4372. echo "texi2html enabled ${texi2html-no}"
  4373. echo "perl enabled ${perl-no}"
  4374. echo "pod2man enabled ${pod2man-no}"
  4375. echo "makeinfo enabled ${makeinfo-no}"
  4376. test -n "$random_seed" &&
  4377. echo "random seed ${random_seed}"
  4378. echo
  4379. echo "External libraries:"
  4380. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4381. echo
  4382. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4383. echo "Enabled ${type}s:"
  4384. eval list=\$$(toupper $type)_LIST
  4385. print_enabled '_*' $list | print_3_columns
  4386. echo
  4387. done
  4388. license="LGPL version 2.1 or later"
  4389. if enabled nonfree; then
  4390. license="nonfree and unredistributable"
  4391. elif enabled gplv3; then
  4392. license="GPL version 3 or later"
  4393. elif enabled lgplv3; then
  4394. license="LGPL version 3 or later"
  4395. elif enabled gpl; then
  4396. license="GPL version 2 or later"
  4397. fi
  4398. echo "License: $license"
  4399. echo "Creating config.mak, config.h, and doc/config.texi..."
  4400. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4401. enabled stripping || strip="echo skipping strip"
  4402. config_files="$TMPH config.mak doc/config.texi"
  4403. cat > config.mak <<EOF
  4404. # Automatically generated by configure - do not modify!
  4405. ifndef FFMPEG_CONFIG_MAK
  4406. FFMPEG_CONFIG_MAK=1
  4407. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4408. prefix=$prefix
  4409. LIBDIR=\$(DESTDIR)$libdir
  4410. SHLIBDIR=\$(DESTDIR)$shlibdir
  4411. INCDIR=\$(DESTDIR)$incdir
  4412. BINDIR=\$(DESTDIR)$bindir
  4413. DATADIR=\$(DESTDIR)$datadir
  4414. DOCDIR=\$(DESTDIR)$docdir
  4415. MANDIR=\$(DESTDIR)$mandir
  4416. SRC_PATH=$source_path
  4417. ifndef MAIN_MAKEFILE
  4418. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4419. endif
  4420. CC_IDENT=$cc_ident
  4421. ARCH=$arch
  4422. CC=$cc
  4423. CXX=$cxx
  4424. AS=$as
  4425. LD=$ld
  4426. DEPCC=$dep_cc
  4427. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4428. DEPAS=$as
  4429. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4430. YASM=$yasmexe
  4431. DEPYASM=$yasmexe
  4432. AR=$ar
  4433. ARFLAGS=$arflags
  4434. AR_O=$ar_o
  4435. RANLIB=$ranlib
  4436. STRIP=$strip
  4437. CP=cp -p
  4438. LN_S=$ln_s
  4439. CPPFLAGS=$CPPFLAGS
  4440. CFLAGS=$CFLAGS
  4441. CXXFLAGS=$CXXFLAGS
  4442. ASFLAGS=$ASFLAGS
  4443. AS_C=$AS_C
  4444. AS_O=$AS_O
  4445. CC_C=$CC_C
  4446. CC_E=$CC_E
  4447. CC_O=$CC_O
  4448. CXX_C=$CXX_C
  4449. CXX_O=$CXX_O
  4450. LD_O=$LD_O
  4451. LD_LIB=$LD_LIB
  4452. LD_PATH=$LD_PATH
  4453. DLLTOOL=$dlltool
  4454. WINDRES=$windres
  4455. LDFLAGS=$LDFLAGS
  4456. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4457. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  4458. YASMFLAGS=$YASMFLAGS
  4459. BUILDSUF=$build_suffix
  4460. PROGSSUF=$progs_suffix
  4461. FULLNAME=$FULLNAME
  4462. LIBPREF=$LIBPREF
  4463. LIBSUF=$LIBSUF
  4464. LIBNAME=$LIBNAME
  4465. SLIBPREF=$SLIBPREF
  4466. SLIBSUF=$SLIBSUF
  4467. EXESUF=$EXESUF
  4468. EXTRA_VERSION=$extra_version
  4469. CCDEP=$CCDEP
  4470. CXXDEP=$CXXDEP
  4471. CCDEP_FLAGS=$CCDEP_FLAGS
  4472. ASDEP=$ASDEP
  4473. ASDEP_FLAGS=$ASDEP_FLAGS
  4474. CC_DEPFLAGS=$CC_DEPFLAGS
  4475. AS_DEPFLAGS=$AS_DEPFLAGS
  4476. HOSTCC=$host_cc
  4477. HOSTLD=$host_ld
  4478. HOSTCFLAGS=$host_cflags
  4479. HOSTCPPFLAGS=$host_cppflags
  4480. HOSTEXESUF=$HOSTEXESUF
  4481. HOSTLDFLAGS=$host_ldflags
  4482. HOSTLIBS=$host_libs
  4483. DEPHOSTCC=$host_cc
  4484. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4485. HOSTCCDEP=$HOSTCCDEP
  4486. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4487. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4488. HOSTCC_C=$HOSTCC_C
  4489. HOSTCC_O=$HOSTCC_O
  4490. HOSTLD_O=$HOSTLD_O
  4491. TARGET_EXEC=$target_exec $target_exec_args
  4492. TARGET_PATH=$target_path
  4493. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4494. LIBS-ffplay=$sdl_libs
  4495. CFLAGS-ffplay=$sdl_cflags
  4496. ZLIB=$($ldflags_filter -lz)
  4497. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4498. EXTRALIBS=$extralibs
  4499. COMPAT_OBJS=$compat_objs
  4500. EXEOBJS=$exeobjs
  4501. INSTALL=$install
  4502. LIBTARGET=${LIBTARGET}
  4503. SLIBNAME=${SLIBNAME}
  4504. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4505. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4506. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4507. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4508. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4509. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4510. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4511. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4512. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4513. NOREDZONE_FLAGS=$noredzone_flags
  4514. EOF
  4515. get_version(){
  4516. lcname=lib${1}
  4517. name=$(toupper $lcname)
  4518. file=$source_path/$lcname/version.h
  4519. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4520. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4521. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4522. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4523. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4524. }
  4525. map 'get_version $v' $LIBRARY_LIST
  4526. cat > $TMPH <<EOF
  4527. /* Automatically generated by configure - do not modify! */
  4528. #ifndef FFMPEG_CONFIG_H
  4529. #define FFMPEG_CONFIG_H
  4530. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4531. #define FFMPEG_LICENSE "$(c_escape $license)"
  4532. #define CONFIG_THIS_YEAR 2013
  4533. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4534. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4535. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4536. #define av_restrict $_restrict
  4537. #define EXTERN_PREFIX "${extern_prefix}"
  4538. #define EXTERN_ASM ${extern_prefix}
  4539. #define BUILDSUF "$build_suffix"
  4540. #define SLIBSUF "$SLIBSUF"
  4541. #define HAVE_MMX2 HAVE_MMXEXT
  4542. EOF
  4543. test -n "$assert_level" &&
  4544. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4545. test -n "$malloc_prefix" &&
  4546. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4547. if enabled yasm; then
  4548. append config_files $TMPASM
  4549. printf '' >$TMPASM
  4550. fi
  4551. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4552. mkdir -p doc
  4553. echo "@c auto-generated by configure" > doc/config.texi
  4554. print_config ARCH_ "$config_files" $ARCH_LIST
  4555. print_config HAVE_ "$config_files" $HAVE_LIST
  4556. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4557. $CONFIG_EXTRA \
  4558. $ALL_COMPONENTS \
  4559. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4560. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4561. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4562. cp_if_changed $TMPH config.h
  4563. touch .config
  4564. enabled yasm && cp_if_changed $TMPASM config.asm
  4565. cat > $TMPH <<EOF
  4566. /* Generated by ffconf */
  4567. #ifndef AVUTIL_AVCONFIG_H
  4568. #define AVUTIL_AVCONFIG_H
  4569. EOF
  4570. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4571. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4572. cp_if_changed $TMPH libavutil/avconfig.h
  4573. if test -n "$WARNINGS"; then
  4574. printf "\n$WARNINGS"
  4575. enabled fatal_warnings && exit 1
  4576. fi
  4577. # build pkg-config files
  4578. pkgconfig_generate(){
  4579. name=$1
  4580. shortname=${name#lib}${build_suffix}
  4581. comment=$2
  4582. version=$3
  4583. libs=$4
  4584. requires=$5
  4585. enabled ${name#lib} || return 0
  4586. mkdir -p $name
  4587. cat <<EOF > $name/$name${build_suffix}.pc
  4588. prefix=$prefix
  4589. exec_prefix=\${prefix}
  4590. libdir=$libdir
  4591. includedir=$incdir
  4592. Name: $name
  4593. Description: $comment
  4594. Version: $version
  4595. Requires: $(enabled shared || echo $requires)
  4596. Requires.private: $(enabled shared && echo $requires)
  4597. Conflicts:
  4598. Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
  4599. Libs.private: $(enabled shared && echo $libs)
  4600. Cflags: -I\${includedir}
  4601. EOF
  4602. mkdir -p doc/examples/pc-uninstalled
  4603. includedir=${source_path}
  4604. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4605. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4606. prefix=
  4607. exec_prefix=
  4608. libdir=\${pcfiledir}/../../../$name
  4609. includedir=${includedir}
  4610. Name: $name
  4611. Description: $comment
  4612. Version: $version
  4613. Requires: $requires
  4614. Conflicts:
  4615. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4616. Cflags: -I\${includedir}
  4617. EOF
  4618. }
  4619. lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4620. enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4621. enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4622. enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4623. enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4624. enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4625. enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4626. lavfi_libs=${lavfi_libs%, }
  4627. lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4628. enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4629. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4630. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4631. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4632. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
  4633. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  4634. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4635. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4636. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4637. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4638. fix_ffmpeg_remote(){
  4639. git_remote_from=$1
  4640. git_remote_to=$2
  4641. fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
  4642. if [ "$fixme_remote" != "" ]; then
  4643. echolog "
  4644. Outdated domain in git config, the official domain for ffmpeg git is since
  4645. November 2011, source.ffmpeg.org, both the old and the new point to the same
  4646. repository and server. To update it enter the following commands:
  4647. "
  4648. for remote in $fixme_remote; do
  4649. echolog "git remote set-url $remote $git_remote_to"
  4650. done
  4651. fi
  4652. }
  4653. if test -f "$source_path/.git/config"; then
  4654. remote_from=git.videolan.org
  4655. remote_to=source.ffmpeg.org
  4656. fix_ffmpeg_remote git@$remote_from:ffmpeg git@$remote_to:ffmpeg
  4657. fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
  4658. fi