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.

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