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.

4922 lines
145KB

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