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.

4949 lines
147KB

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