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.

5193 lines
155KB

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