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.

4924 lines
145KB

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