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.

4896 lines
144KB

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