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.

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