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.

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