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.

4947 lines
146KB

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