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.

5304 lines
158KB

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