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.

4912 lines
145KB

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