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.

4941 lines
146KB

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