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.

5291 lines
157KB

  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. startcode
  1530. texturedsp
  1531. texturedspenc
  1532. tpeldsp
  1533. vc1dsp
  1534. videodsp
  1535. vp3dsp
  1536. vp56dsp
  1537. vp8dsp
  1538. wma_freqs
  1539. wmv2dsp
  1540. "
  1541. CMDLINE_SELECT="
  1542. $ARCH_EXT_LIST
  1543. $CONFIG_LIST
  1544. $HAVE_LIST_CMDLINE
  1545. $THREADS_LIST
  1546. asm
  1547. cross_compile
  1548. debug
  1549. extra_warnings
  1550. logging
  1551. lto
  1552. optimizations
  1553. rpath
  1554. "
  1555. PATHS_LIST="
  1556. bindir
  1557. datadir
  1558. docdir
  1559. incdir
  1560. libdir
  1561. mandir
  1562. prefix
  1563. shlibdir
  1564. "
  1565. CMDLINE_SET="
  1566. $PATHS_LIST
  1567. ar
  1568. arch
  1569. as
  1570. build_suffix
  1571. cc
  1572. objcc
  1573. cpu
  1574. cross_prefix
  1575. custom_allocator
  1576. dep_cc
  1577. env
  1578. extra_version
  1579. host_cc
  1580. host_cflags
  1581. host_ld
  1582. host_ldflags
  1583. host_libs
  1584. host_os
  1585. ld
  1586. logfile
  1587. malloc_prefix
  1588. nm
  1589. optflags
  1590. pkg_config
  1591. pkg_config_flags
  1592. random_seed
  1593. samples
  1594. sysinclude
  1595. sysroot
  1596. target_exec
  1597. target_os
  1598. target_path
  1599. target_samples
  1600. toolchain
  1601. "
  1602. CMDLINE_APPEND="
  1603. extra_cflags
  1604. extra_objcflags
  1605. host_cppflags
  1606. "
  1607. # code dependency declarations
  1608. # architecture extensions
  1609. armv5te_deps="arm"
  1610. armv6_deps="arm"
  1611. armv6t2_deps="arm"
  1612. armv8_deps="aarch64"
  1613. neon_deps_any="aarch64 arm"
  1614. intrinsics_neon_deps="neon"
  1615. vfp_deps_any="aarch64 arm"
  1616. vfpv3_deps="vfp"
  1617. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1618. altivec_deps="ppc"
  1619. ppc4xx_deps="ppc"
  1620. vsx_deps="altivec"
  1621. power8_deps="vsx"
  1622. cpunop_deps="i686"
  1623. x86_64_select="i686"
  1624. x86_64_suggest="fast_cmov"
  1625. amd3dnow_deps="mmx"
  1626. amd3dnowext_deps="amd3dnow"
  1627. i686_deps="x86"
  1628. mmx_deps="x86"
  1629. mmxext_deps="mmx"
  1630. sse_deps="mmxext"
  1631. sse2_deps="sse"
  1632. sse3_deps="sse2"
  1633. ssse3_deps="sse3"
  1634. sse4_deps="ssse3"
  1635. sse42_deps="sse4"
  1636. avx_deps="sse42"
  1637. xop_deps="avx"
  1638. fma3_deps="avx"
  1639. fma4_deps="avx"
  1640. avx2_deps="avx"
  1641. mmx_external_deps="yasm"
  1642. mmx_inline_deps="inline_asm"
  1643. mmx_suggest="mmx_external mmx_inline"
  1644. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  1645. eval dep=\$${ext}_deps
  1646. eval ${ext}_external_deps='"${dep}_external"'
  1647. eval ${ext}_inline_deps='"${dep}_inline"'
  1648. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1649. done
  1650. aligned_stack_if_any="aarch64 ppc x86"
  1651. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1652. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  1653. fast_unaligned_if_any="aarch64 ppc x86"
  1654. simd_align_16_if_any="altivec neon sse"
  1655. # system capabilities
  1656. symver_if_any="symver_asm_label symver_gnu_asm"
  1657. valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
  1658. # threading support
  1659. atomics_gcc_if="sync_val_compare_and_swap"
  1660. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1661. atomics_win32_if="MemoryBarrier"
  1662. atomics_native_if_any="$ATOMICS_LIST"
  1663. w32threads_deps="atomics_native"
  1664. threads_if_any="$THREADS_LIST"
  1665. # subsystems
  1666. dct_select="rdft"
  1667. dirac_parse_select="golomb"
  1668. error_resilience_select="me_cmp"
  1669. faandct_deps="faan fdctdsp"
  1670. faanidct_deps="faan idctdsp"
  1671. h264dsp_select="startcode"
  1672. intrax8_select="error_resilience"
  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 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"
  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"
  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. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2297. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2298. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2299. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2300. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2301. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2302. find_things_extern(){
  2303. thing=$1
  2304. pattern=$2
  2305. file=$source_path/$3
  2306. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
  2307. }
  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. *-tsan)
  2463. cc_default="${toolchain%-tsan}"
  2464. add_cflags -fsanitize=thread -pie
  2465. add_ldflags -fsanitize=thread -pie
  2466. case "$toolchain" in
  2467. gcc-tsan)
  2468. add_cflags -fPIC
  2469. add_ldflags -fPIC
  2470. ;;
  2471. esac
  2472. ;;
  2473. *-usan)
  2474. cc_default="${toolchain%-usan}"
  2475. add_cflags -fsanitize=undefined
  2476. add_ldflags -fsanitize=undefined
  2477. case "$toolchain" in
  2478. clang-usan)
  2479. add_cflags -O1
  2480. ;;
  2481. esac
  2482. ;;
  2483. valgrind-*)
  2484. target_exec_default="valgrind"
  2485. case "$toolchain" in
  2486. valgrind-massif)
  2487. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2488. ;;
  2489. valgrind-memcheck)
  2490. target_exec_args="--track-origins=yes --leak-check=full"
  2491. ;;
  2492. esac
  2493. ;;
  2494. msvc)
  2495. # Check whether the current MSVC version needs the C99 converter.
  2496. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2497. # support enough of C99 to build libav. Default to the new
  2498. # behaviour if the regexp was unable to match anything, since this
  2499. # successfully parses the version number of existing supported
  2500. # versions that require the converter (MSVC 2010 and 2012).
  2501. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2502. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2503. cc_default="cl"
  2504. else
  2505. cc_default="c99wrap cl"
  2506. fi
  2507. ld_default="$source_path/compat/windows/mslink"
  2508. nm_default="dumpbin -symbols"
  2509. ar_default="lib"
  2510. case "$arch" in
  2511. arm*)
  2512. as_default="armasm"
  2513. ;;
  2514. esac
  2515. target_os_default="win32"
  2516. # Use a relative path for TMPDIR. This makes sure all the
  2517. # ffconf temp files are written with a relative path, avoiding
  2518. # issues with msys/win32 path conversion for MSVC parameters
  2519. # such as -Fo<file> or -out:<file>.
  2520. TMPDIR=.
  2521. ;;
  2522. icl)
  2523. cc_default="icl"
  2524. ld_default="xilink"
  2525. nm_default="dumpbin -symbols"
  2526. ar_default="xilib"
  2527. target_os_default="win32"
  2528. TMPDIR=.
  2529. ;;
  2530. gcov)
  2531. add_cflags -fprofile-arcs -ftest-coverage
  2532. add_ldflags -fprofile-arcs -ftest-coverage
  2533. ;;
  2534. hardened)
  2535. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2536. add_cflags -fno-strict-overflow -fstack-protector-all
  2537. add_ldflags -Wl,-z,relro -Wl,-z,now
  2538. ;;
  2539. ?*)
  2540. die "Unknown toolchain $toolchain"
  2541. ;;
  2542. esac
  2543. test -n "$cross_prefix" && enable cross_compile
  2544. if enabled cross_compile; then
  2545. test -n "$arch" && test -n "$target_os" ||
  2546. die "Must specify target arch and OS when cross-compiling"
  2547. fi
  2548. ar_default="${cross_prefix}${ar_default}"
  2549. cc_default="${cross_prefix}${cc_default}"
  2550. occ_default="${cross_prefix}${occ_default}"
  2551. nm_default="${cross_prefix}${nm_default}"
  2552. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2553. ranlib="${cross_prefix}${ranlib}"
  2554. strip="${cross_prefix}${strip}"
  2555. sysinclude_default="${sysroot}/usr/include"
  2556. set_default arch cc pkg_config sysinclude target_exec target_os
  2557. enabled cross_compile || host_cc_default=$cc
  2558. set_default host_cc
  2559. if ! $pkg_config --version >/dev/null 2>&1; then
  2560. warn "$pkg_config not found, library detection may fail."
  2561. pkg_config=false
  2562. fi
  2563. exesuf() {
  2564. case $1 in
  2565. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2566. esac
  2567. }
  2568. EXESUF=$(exesuf $target_os)
  2569. HOSTEXESUF=$(exesuf $host_os)
  2570. # set temporary file name
  2571. : ${TMPDIR:=$TEMPDIR}
  2572. : ${TMPDIR:=$TMP}
  2573. : ${TMPDIR:=/tmp}
  2574. if ! check_cmd mktemp -u XXXXXX; then
  2575. # simple replacement for missing mktemp
  2576. # NOT SAFE FOR GENERAL USE
  2577. mktemp(){
  2578. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2579. }
  2580. fi
  2581. tmpfile(){
  2582. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2583. (set -C; exec > $tmp) 2>/dev/null ||
  2584. die "Unable to create temporary file in $TMPDIR."
  2585. append TMPFILES $tmp
  2586. eval $1=$tmp
  2587. }
  2588. trap 'rm -f -- $TMPFILES' EXIT
  2589. tmpfile TMPASM .asm
  2590. tmpfile TMPC .c
  2591. tmpfile TMPE $EXESUF
  2592. tmpfile TMPH .h
  2593. tmpfile TMPO .o
  2594. tmpfile TMPS .S
  2595. tmpfile TMPSH .sh
  2596. tmpfile TMPV .ver
  2597. unset -f mktemp
  2598. chmod +x $TMPE
  2599. # make sure we can execute files in $TMPDIR
  2600. cat > $TMPSH 2>> $logfile <<EOF
  2601. #! /bin/sh
  2602. EOF
  2603. chmod +x $TMPSH >> $logfile 2>&1
  2604. if ! $TMPSH >> $logfile 2>&1; then
  2605. cat <<EOF
  2606. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2607. variable to another directory and make sure that it is not mounted noexec.
  2608. EOF
  2609. die "Sanity test failed."
  2610. fi
  2611. armasm_flags(){
  2612. for flag; do
  2613. case $flag in
  2614. # Filter out MSVC cl.exe options from cflags that shouldn't
  2615. # be passed to gas-preprocessor
  2616. -M[TD]*) ;;
  2617. *) echo $flag ;;
  2618. esac
  2619. done
  2620. }
  2621. ccc_flags(){
  2622. for flag; do
  2623. case $flag in
  2624. -std=c99) echo -c99 ;;
  2625. -mcpu=*) echo -arch ${flag#*=} ;;
  2626. -mieee) echo -ieee ;;
  2627. -O*|-fast) echo $flag ;;
  2628. -fno-math-errno) echo -assume nomath_errno ;;
  2629. -g) echo -g3 ;;
  2630. -Wall) echo -msg_enable level2 ;;
  2631. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2632. -Wl,*) echo $flag ;;
  2633. -f*|-W*) ;;
  2634. *) echo $flag ;;
  2635. esac
  2636. done
  2637. }
  2638. cparser_flags(){
  2639. for flag; do
  2640. case $flag in
  2641. -Wno-switch) echo -Wno-switch-enum ;;
  2642. -Wno-format-zero-length) ;;
  2643. -Wdisabled-optimization) ;;
  2644. -Wno-pointer-sign) echo -Wno-other ;;
  2645. *) echo $flag ;;
  2646. esac
  2647. done
  2648. }
  2649. msvc_common_flags(){
  2650. for flag; do
  2651. case $flag in
  2652. # In addition to specifying certain flags under the compiler
  2653. # specific filters, they must be specified here as well or else the
  2654. # generic catch all at the bottom will print the original flag.
  2655. -Wall) ;;
  2656. -std=c99) ;;
  2657. # Common flags
  2658. -fomit-frame-pointer) ;;
  2659. -g) echo -Z7 ;;
  2660. -fno-math-errno) ;;
  2661. -fno-common) ;;
  2662. -fno-signed-zeros) ;;
  2663. -fPIC) ;;
  2664. -mthumb) ;;
  2665. -march=*) ;;
  2666. -lz) echo zlib.lib ;;
  2667. -lavifil32) echo vfw32.lib ;;
  2668. -lavicap32) echo vfw32.lib user32.lib ;;
  2669. -lx264) echo libx264.lib ;;
  2670. -l*) echo ${flag#-l}.lib ;;
  2671. -L*) echo -libpath:${flag#-L} ;;
  2672. *) echo $flag ;;
  2673. esac
  2674. done
  2675. }
  2676. msvc_flags(){
  2677. msvc_common_flags "$@"
  2678. for flag; do
  2679. case $flag in
  2680. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2681. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2682. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2683. -wd4273 -wd4554 -wd4701 ;;
  2684. esac
  2685. done
  2686. }
  2687. icl_flags(){
  2688. msvc_common_flags "$@"
  2689. for flag; do
  2690. case $flag in
  2691. # Despite what Intel's documentation says -Wall, which is supported
  2692. # on Windows, does enable remarks so disable them here.
  2693. -Wall) echo $flag -Qdiag-disable:remark ;;
  2694. -std=c99) echo -Qstd=c99 ;;
  2695. esac
  2696. done
  2697. }
  2698. pgi_flags(){
  2699. for flag; do
  2700. case $flag in
  2701. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2702. -fomit-frame-pointer) echo -Mnoframe ;;
  2703. -g) echo -gopt ;;
  2704. *) echo $flag ;;
  2705. esac
  2706. done
  2707. }
  2708. suncc_flags(){
  2709. for flag; do
  2710. case $flag in
  2711. -march=*|-mcpu=*)
  2712. case "${flag#*=}" in
  2713. native) echo -xtarget=native ;;
  2714. v9|niagara) echo -xarch=sparc ;;
  2715. ultrasparc) echo -xarch=sparcvis ;;
  2716. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2717. i586|pentium) echo -xchip=pentium ;;
  2718. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2719. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2720. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2721. pentium4*) echo -xtarget=pentium4 ;;
  2722. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2723. *-sse3) echo -xarch=sse3 ;;
  2724. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2725. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2726. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2727. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2728. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2729. k8|opteron|athlon64|athlon-fx)
  2730. echo -xarch=sse2a ;;
  2731. athlon*) echo -xarch=pentium_proa ;;
  2732. esac
  2733. ;;
  2734. -std=c99) echo -xc99 ;;
  2735. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2736. -fPIC) echo -KPIC -xcode=pic32 ;;
  2737. -W*,*) echo $flag ;;
  2738. -f*-*|-W*|-mimpure-text) ;;
  2739. -shared) echo -G ;;
  2740. *) echo $flag ;;
  2741. esac
  2742. done
  2743. }
  2744. tms470_flags(){
  2745. for flag; do
  2746. case $flag in
  2747. -march=*|-mcpu=*)
  2748. case "${flag#*=}" in
  2749. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2750. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2751. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2752. armv6*|arm11*) echo -mv=6 ;;
  2753. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2754. echo -mv=5e ;;
  2755. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2756. esac
  2757. ;;
  2758. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2759. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2760. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2761. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2762. -msoft-float) echo --float_support=vfplib ;;
  2763. -O[0-3]|-mf=*) echo $flag ;;
  2764. -g) echo -g -mn ;;
  2765. -pds=*) echo $flag ;;
  2766. -D*|-I*) echo $flag ;;
  2767. --gcc|--abi=*) echo $flag ;;
  2768. -me) echo $flag ;;
  2769. esac
  2770. done
  2771. }
  2772. probe_cc(){
  2773. pfx=$1
  2774. _cc=$2
  2775. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2776. unset _ld_o _ldflags _ld_lib _ld_path
  2777. unset _depflags _DEPCMD _DEPFLAGS
  2778. _flags_filter=echo
  2779. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2780. _type=llvm_gcc
  2781. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  2782. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  2783. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2784. _cflags_speed='-O3'
  2785. _cflags_size='-Os'
  2786. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2787. _type=gcc
  2788. gcc_version=$($_cc --version | head -n1)
  2789. gcc_basever=$($_cc -dumpversion)
  2790. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2791. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2792. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2793. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2794. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2795. fi
  2796. _cflags_speed='-O3'
  2797. _cflags_size='-Os'
  2798. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2799. _type=icc
  2800. _ident=$($_cc --version | head -n1)
  2801. _depflags='-MMD'
  2802. _cflags_speed='-O3'
  2803. _cflags_size='-Os'
  2804. _cflags_noopt='-O1'
  2805. elif $_cc -v 2>&1 | grep -q xlc; then
  2806. _type=xlc
  2807. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2808. _cflags_speed='-O5'
  2809. _cflags_size='-O5 -qcompact'
  2810. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2811. _type=ccc
  2812. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2813. _DEPFLAGS='-M'
  2814. _cflags_speed='-fast'
  2815. _cflags_size='-O1'
  2816. _flags_filter=ccc_flags
  2817. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2818. test -d "$sysroot" || die "No valid sysroot specified."
  2819. _type=armcc
  2820. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  2821. armcc_conf="$PWD/armcc.conf"
  2822. $_cc --arm_linux_configure \
  2823. --arm_linux_config_file="$armcc_conf" \
  2824. --configure_sysroot="$sysroot" \
  2825. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2826. die "Error creating armcc configuration file."
  2827. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2828. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2829. as_default="${cross_prefix}gcc"
  2830. _depflags='-MMD'
  2831. _cflags_speed='-O3'
  2832. _cflags_size='-Os'
  2833. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2834. _type=tms470
  2835. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2836. _flags='--gcc --abi=eabi -me'
  2837. _cc_e='-ppl -fe=$@'
  2838. _cc_o='-fe=$@'
  2839. _depflags='-ppa -ppd=$(@:.o=.d)'
  2840. _cflags_speed='-O3 -mf=5'
  2841. _cflags_size='-O3 -mf=2'
  2842. _flags_filter=tms470_flags
  2843. elif $_cc -v 2>&1 | grep -q clang; then
  2844. _type=clang
  2845. _ident=$($_cc --version 2>/dev/null | head -n1)
  2846. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2847. _cflags_speed='-O3'
  2848. _cflags_size='-Os'
  2849. elif $_cc -V 2>&1 | grep -q Sun; then
  2850. _type=suncc
  2851. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2852. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2853. _DEPFLAGS='-xM1 -xc99'
  2854. _ldflags='-std=c99'
  2855. _cflags_speed='-O5'
  2856. _cflags_size='-O5 -xspace'
  2857. _flags_filter=suncc_flags
  2858. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2859. _type=pathscale
  2860. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2861. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2862. _cflags_speed='-O2'
  2863. _cflags_size='-Os'
  2864. _flags_filter='filter_out -Wdisabled-optimization'
  2865. elif $_cc -v 2>&1 | grep -q Open64; then
  2866. _type=open64
  2867. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2868. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2869. _cflags_speed='-O2'
  2870. _cflags_size='-Os'
  2871. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2872. elif $_cc -V 2>&1 | grep -q Portland; then
  2873. _type=pgi
  2874. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2875. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2876. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2877. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2878. _cflags_noopt="-O1"
  2879. _flags_filter=pgi_flags
  2880. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  2881. _type=armasm
  2882. _ident=$($_cc | head -n1)
  2883. # 4509: "This form of conditional instruction is deprecated"
  2884. _flags="-nologo -ignore 4509"
  2885. _flags_filter=armasm_flags
  2886. elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
  2887. _type=msvc
  2888. _ident=$($_cc 2>&1 | head -n1)
  2889. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2890. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2891. _cflags_speed="-O2"
  2892. _cflags_size="-O1"
  2893. if $_cc -nologo- 2>&1 | grep -q Linker; then
  2894. _ld_o='-out:$@'
  2895. else
  2896. _ld_o='-Fe$@'
  2897. fi
  2898. _cc_o='-Fo$@'
  2899. _cc_e='-P -Fi$@'
  2900. _flags_filter=msvc_flags
  2901. _ld_lib='lib%.a'
  2902. _ld_path='-libpath:'
  2903. _flags='-nologo'
  2904. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS'
  2905. elif $_cc 2>&1 | grep -q Intel; then
  2906. _type=icl
  2907. _ident=$($_cc 2>&1 | head -n1)
  2908. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2909. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2910. # versions (tested) as well.
  2911. _cflags_speed="-O2"
  2912. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2913. if $_cc 2>&1 | grep -q Linker; then
  2914. _ld_o='-out:$@'
  2915. else
  2916. _ld_o='-Fe$@'
  2917. fi
  2918. _cc_o='-Fo$@'
  2919. _cc_e='-P'
  2920. _flags_filter=icl_flags
  2921. _ld_lib='lib%.a'
  2922. _ld_path='-libpath:'
  2923. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2924. _flags='-nologo -Qdiag-error:4044,10157'
  2925. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2926. # with MSVC which enables it by default.
  2927. _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS'
  2928. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2929. _type=cparser
  2930. _ident=$($_cc --version | head -n1)
  2931. _depflags='-MMD'
  2932. _cflags_speed='-O4'
  2933. _cflags_size='-O2'
  2934. _flags_filter=cparser_flags
  2935. fi
  2936. eval ${pfx}_type=\$_type
  2937. eval ${pfx}_ident=\$_ident
  2938. }
  2939. set_ccvars(){
  2940. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2941. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2942. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2943. if [ -n "$_depflags" ]; then
  2944. eval ${1}_DEPFLAGS=\$_depflags
  2945. else
  2946. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2947. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2948. eval DEP${1}FLAGS=\$_flags
  2949. fi
  2950. }
  2951. probe_cc cc "$cc"
  2952. cflags_filter=$_flags_filter
  2953. cflags_speed=$_cflags_speed
  2954. cflags_size=$_cflags_size
  2955. cflags_noopt=$_cflags_noopt
  2956. add_cflags $_flags $_cflags
  2957. cc_ldflags=$_ldflags
  2958. set_ccvars CC
  2959. probe_cc hostcc "$host_cc"
  2960. host_cflags_filter=$_flags_filter
  2961. add_host_cflags $_flags $_cflags
  2962. set_ccvars HOSTCC
  2963. test -n "$cc_type" && enable $cc_type ||
  2964. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2965. : ${as_default:=$cc}
  2966. : ${objcc_default:=$cc}
  2967. : ${dep_cc_default:=$cc}
  2968. : ${ld_default:=$cc}
  2969. : ${host_ld_default:=$host_cc}
  2970. set_default ar as objcc dep_cc ld host_ld
  2971. probe_cc as "$as"
  2972. asflags_filter=$_flags_filter
  2973. add_asflags $_flags $_cflags
  2974. set_ccvars AS
  2975. probe_cc objcc "$objcc"
  2976. objcflags_filter=$_flags_filter
  2977. add_objcflags $_flags $_cflags
  2978. set_ccvars OBJC
  2979. probe_cc ld "$ld"
  2980. ldflags_filter=$_flags_filter
  2981. add_ldflags $_flags $_ldflags
  2982. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2983. LD_O=${_ld_o-$LD_O}
  2984. LD_LIB=${_ld_lib-$LD_LIB}
  2985. LD_PATH=${_ld_path-$LD_PATH}
  2986. probe_cc hostld "$host_ld"
  2987. host_ldflags_filter=$_flags_filter
  2988. add_host_ldflags $_flags $_ldflags
  2989. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2990. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2991. probe_cc depcc "$dep_cc"
  2992. CCDEP=${_DEPCMD:-$DEPCMD}
  2993. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2994. DEPCCFLAGS=$_flags
  2995. fi
  2996. if $ar 2>&1 | grep -q Microsoft; then
  2997. arflags="-nologo"
  2998. ar_o='-out:$@'
  2999. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3000. arflags="rq"
  3001. ar_o='$@'
  3002. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3003. arflags='-Xany -r -c'
  3004. ar_o='$@'
  3005. else
  3006. arflags="rc"
  3007. ar_o='$@'
  3008. fi
  3009. add_cflags $extra_cflags
  3010. add_objcflags $extra_objcflags
  3011. add_asflags $extra_cflags
  3012. if test -n "$sysroot"; then
  3013. case "$cc_type" in
  3014. gcc|llvm_gcc|clang)
  3015. add_cppflags --sysroot="$sysroot"
  3016. add_ldflags --sysroot="$sysroot"
  3017. ;;
  3018. tms470)
  3019. add_cppflags -I"$sysinclude"
  3020. add_ldflags --sysroot="$sysroot"
  3021. ;;
  3022. esac
  3023. fi
  3024. if test "$cpu" = host; then
  3025. enabled cross_compile &&
  3026. die "--cpu=host makes no sense when cross-compiling."
  3027. case "$cc_type" in
  3028. gcc|llvm_gcc)
  3029. check_native(){
  3030. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3031. sed -n "/cc1.*$1=/{
  3032. s/.*$1=\\([^ ]*\\).*/\\1/
  3033. p
  3034. q
  3035. }" $TMPE
  3036. }
  3037. cpu=$(check_native -march || check_native -mcpu)
  3038. ;;
  3039. esac
  3040. test "${cpu:-host}" = host &&
  3041. die "--cpu=host not supported with compiler $cc"
  3042. fi
  3043. # Deal with common $arch aliases
  3044. case "$arch" in
  3045. aarch64|arm64)
  3046. arch="aarch64"
  3047. ;;
  3048. arm*)
  3049. arch="arm"
  3050. ;;
  3051. mips*|IP*)
  3052. case "$arch" in
  3053. *el)
  3054. add_cppflags -EL
  3055. add_ldflags -EL
  3056. ;;
  3057. *eb)
  3058. add_cppflags -EB
  3059. add_ldflags -EB
  3060. ;;
  3061. esac
  3062. arch="mips"
  3063. ;;
  3064. parisc*|hppa*)
  3065. arch="parisc"
  3066. ;;
  3067. "Power Macintosh"|ppc*|powerpc*)
  3068. arch="ppc"
  3069. ;;
  3070. s390|s390x)
  3071. arch="s390"
  3072. ;;
  3073. sh4|sh)
  3074. arch="sh4"
  3075. ;;
  3076. sun4u|sparc*)
  3077. arch="sparc"
  3078. ;;
  3079. tilegx|tile-gx)
  3080. arch="tilegx"
  3081. ;;
  3082. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  3083. arch="x86"
  3084. ;;
  3085. esac
  3086. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3087. enable $arch
  3088. # Add processor-specific flags
  3089. if enabled aarch64; then
  3090. case $cpu in
  3091. armv*)
  3092. cpuflags="-march=$cpu"
  3093. ;;
  3094. *)
  3095. cpuflags="-mcpu=$cpu"
  3096. ;;
  3097. esac
  3098. elif enabled alpha; then
  3099. cpuflags="-mcpu=$cpu"
  3100. elif enabled arm; then
  3101. check_arm_arch() {
  3102. check_cpp_condition stddef.h \
  3103. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3104. $cpuflags
  3105. }
  3106. probe_arm_arch() {
  3107. if check_arm_arch 4; then echo armv4;
  3108. elif check_arm_arch 4T; then echo armv4t;
  3109. elif check_arm_arch 5; then echo armv5;
  3110. elif check_arm_arch 5E; then echo armv5e;
  3111. elif check_arm_arch 5T; then echo armv5t;
  3112. elif check_arm_arch 5TE; then echo armv5te;
  3113. elif check_arm_arch 5TEJ; then echo armv5te;
  3114. elif check_arm_arch 6; then echo armv6;
  3115. elif check_arm_arch 6J; then echo armv6j;
  3116. elif check_arm_arch 6K; then echo armv6k;
  3117. elif check_arm_arch 6Z; then echo armv6z;
  3118. elif check_arm_arch 6ZK; then echo armv6zk;
  3119. elif check_arm_arch 6T2; then echo armv6t2;
  3120. elif check_arm_arch 7; then echo armv7;
  3121. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3122. elif check_arm_arch 7S; then echo armv7-a;
  3123. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3124. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3125. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3126. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3127. fi
  3128. }
  3129. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3130. case $cpu in
  3131. armv*)
  3132. cpuflags="-march=$cpu"
  3133. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3134. ;;
  3135. *)
  3136. cpuflags="-mcpu=$cpu"
  3137. case $cpu in
  3138. cortex-a*) subarch=armv7a ;;
  3139. cortex-r*) subarch=armv7r ;;
  3140. cortex-m*) enable thumb; subarch=armv7m ;;
  3141. arm11*) subarch=armv6 ;;
  3142. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3143. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3144. *) subarch=$(probe_arm_arch) ;;
  3145. esac
  3146. ;;
  3147. esac
  3148. case "$subarch" in
  3149. armv5t*) enable fast_clz ;;
  3150. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3151. esac
  3152. elif enabled avr32; then
  3153. case $cpu in
  3154. ap7[02]0[0-2])
  3155. subarch="avr32_ap"
  3156. cpuflags="-mpart=$cpu"
  3157. ;;
  3158. ap)
  3159. subarch="avr32_ap"
  3160. cpuflags="-march=$cpu"
  3161. ;;
  3162. uc3[ab]*)
  3163. subarch="avr32_uc"
  3164. cpuflags="-mcpu=$cpu"
  3165. ;;
  3166. uc)
  3167. subarch="avr32_uc"
  3168. cpuflags="-march=$cpu"
  3169. ;;
  3170. esac
  3171. elif enabled bfin; then
  3172. cpuflags="-mcpu=$cpu"
  3173. elif enabled mips; then
  3174. cpuflags="-march=$cpu"
  3175. elif enabled ppc; then
  3176. disable ldbrx
  3177. case $(tolower $cpu) in
  3178. 601|ppc601|powerpc601)
  3179. cpuflags="-mcpu=601"
  3180. disable altivec
  3181. ;;
  3182. 603*|ppc603*|powerpc603*)
  3183. cpuflags="-mcpu=603"
  3184. disable altivec
  3185. ;;
  3186. 604*|ppc604*|powerpc604*)
  3187. cpuflags="-mcpu=604"
  3188. disable altivec
  3189. ;;
  3190. g3|75*|ppc75*|powerpc75*)
  3191. cpuflags="-mcpu=750"
  3192. disable altivec
  3193. ;;
  3194. g4|745*|ppc745*|powerpc745*)
  3195. cpuflags="-mcpu=7450"
  3196. disable vsx
  3197. ;;
  3198. 74*|ppc74*|powerpc74*)
  3199. cpuflags="-mcpu=7400"
  3200. disable vsx
  3201. ;;
  3202. g5|970|ppc970|powerpc970)
  3203. cpuflags="-mcpu=970"
  3204. disable vsx
  3205. ;;
  3206. power[3-6]*)
  3207. cpuflags="-mcpu=$cpu"
  3208. disable vsx
  3209. ;;
  3210. power[7-8]*)
  3211. cpuflags="-mcpu=$cpu"
  3212. enable ldbrx
  3213. ;;
  3214. cell)
  3215. cpuflags="-mcpu=cell"
  3216. enable ldbrx
  3217. disable vsx
  3218. ;;
  3219. e500mc)
  3220. cpuflags="-mcpu=e500mc"
  3221. disable altivec
  3222. ;;
  3223. e500v2)
  3224. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3225. disable altivec
  3226. disable dcbzl
  3227. ;;
  3228. e500)
  3229. cpuflags="-mcpu=8540 -mhard-float"
  3230. disable altivec
  3231. disable dcbzl
  3232. ;;
  3233. esac
  3234. elif enabled sparc; then
  3235. case $cpu in
  3236. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3237. cpuflags="-mcpu=$cpu"
  3238. ;;
  3239. ultrasparc*|niagara[234])
  3240. cpuflags="-mcpu=$cpu"
  3241. ;;
  3242. esac
  3243. elif enabled x86; then
  3244. case $cpu in
  3245. i[345]86|pentium)
  3246. cpuflags="-march=$cpu"
  3247. disable i686
  3248. disable mmx
  3249. ;;
  3250. # targets that do NOT support nopl and conditional mov (cmov)
  3251. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3252. cpuflags="-march=$cpu"
  3253. disable i686
  3254. ;;
  3255. # targets that do support nopl and conditional mov (cmov)
  3256. 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*)
  3257. cpuflags="-march=$cpu"
  3258. enable i686
  3259. enable fast_cmov
  3260. ;;
  3261. # targets that do support conditional mov but on which it's slow
  3262. pentium4|pentium4m|prescott|nocona)
  3263. cpuflags="-march=$cpu"
  3264. enable i686
  3265. disable fast_cmov
  3266. ;;
  3267. esac
  3268. fi
  3269. if [ "$cpu" != generic ]; then
  3270. add_cflags $cpuflags
  3271. add_asflags $cpuflags
  3272. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  3273. fi
  3274. # compiler sanity check
  3275. check_exec <<EOF
  3276. int main(void){ return 0; }
  3277. EOF
  3278. if test "$?" != 0; then
  3279. echo "$cc is unable to create an executable file."
  3280. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3281. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3282. echo "Only do this if you know what cross compiling means."
  3283. fi
  3284. die "C compiler test failed."
  3285. fi
  3286. add_cppflags -D_ISOC99_SOURCE
  3287. check_cflags -std=c99
  3288. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3289. #include <stdlib.h>
  3290. EOF
  3291. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3292. #include <stdlib.h>
  3293. EOF
  3294. add_host_cppflags -D_ISOC99_SOURCE
  3295. check_host_cflags -std=c99
  3296. check_host_cflags -Wall
  3297. check_host_cflags -O3
  3298. check_64bit(){
  3299. arch32=$1
  3300. arch64=$2
  3301. expr=$3
  3302. check_code cc "" "int test[2*($expr) - 1]" &&
  3303. subarch=$arch64 || subarch=$arch32
  3304. }
  3305. case "$arch" in
  3306. aarch64|alpha|ia64)
  3307. spic=$shared
  3308. ;;
  3309. mips)
  3310. check_64bit mips mips64 '_MIPS_SIM > 1'
  3311. spic=$shared
  3312. ;;
  3313. parisc)
  3314. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3315. spic=$shared
  3316. ;;
  3317. ppc)
  3318. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3319. spic=$shared
  3320. ;;
  3321. s390)
  3322. check_64bit s390 s390x 'sizeof(void *) > 4'
  3323. spic=$shared
  3324. ;;
  3325. sparc)
  3326. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3327. spic=$shared
  3328. ;;
  3329. x86)
  3330. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3331. if test "$subarch" = "x86_64"; then
  3332. spic=$shared
  3333. fi
  3334. ;;
  3335. esac
  3336. enable $subarch
  3337. enabled spic && enable_weak pic
  3338. # OS specific
  3339. case $target_os in
  3340. aix)
  3341. SHFLAGS=-shared
  3342. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3343. enabled shared && add_ldflags -Wl,-brtl
  3344. ;;
  3345. android)
  3346. disable symver
  3347. enable section_data_rel_ro
  3348. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3349. SLIB_INSTALL_LINKS=
  3350. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  3351. ;;
  3352. haiku)
  3353. prefix_default="/boot/common"
  3354. network_extralibs="-lnetwork"
  3355. host_libs=
  3356. ;;
  3357. sunos)
  3358. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3359. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3360. network_extralibs="-lsocket -lnsl"
  3361. # When using suncc to build, the Solaris linker will mark
  3362. # an executable with each instruction set encountered by
  3363. # the Solaris assembler. As our libraries contain their own
  3364. # guards for processor-specific code, instead suppress
  3365. # generation of the HWCAPS ELF section on Solaris x86 only.
  3366. enabled_all suncc x86 &&
  3367. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3368. add_ldflags -Wl,-M,mapfile
  3369. nm_default='nm -P -g'
  3370. SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
  3371. ;;
  3372. netbsd)
  3373. disable symver
  3374. oss_indev_extralibs="-lossaudio"
  3375. oss_outdev_extralibs="-lossaudio"
  3376. ;;
  3377. openbsd|bitrig)
  3378. disable symver
  3379. SHFLAGS='-shared'
  3380. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3381. SLIB_INSTALL_LINKS=
  3382. oss_indev_extralibs="-lossaudio"
  3383. oss_outdev_extralibs="-lossaudio"
  3384. ;;
  3385. dragonfly)
  3386. disable symver
  3387. ;;
  3388. freebsd)
  3389. ;;
  3390. bsd/os)
  3391. add_extralibs -lpoll -lgnugetopt
  3392. ;;
  3393. darwin)
  3394. enabled ppc && add_asflags -force_cpusubtype_ALL
  3395. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3396. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3397. add_ldflags -Wl,-dynamic,-search_paths_first
  3398. SLIBSUF=".dylib"
  3399. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3400. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3401. objformat="macho"
  3402. enabled x86_64 && objformat="macho64"
  3403. enabled_any pic shared ||
  3404. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3405. ;;
  3406. msys*)
  3407. die "Native MSYS builds are discouraged, please use the MINGW environment.";
  3408. ;;
  3409. mingw32*|mingw64*)
  3410. if test $target_os = "mingw32ce"; then
  3411. disable network
  3412. else
  3413. target_os=mingw32
  3414. fi
  3415. LIBTARGET=i386
  3416. if enabled x86_64; then
  3417. LIBTARGET="i386:x86-64"
  3418. elif enabled arm; then
  3419. LIBTARGET=arm-wince
  3420. fi
  3421. check_ldflags -Wl,--nxcompat
  3422. check_ldflags -Wl,--dynamicbase
  3423. shlibdir_default="$bindir_default"
  3424. SLIBPREF=""
  3425. SLIBSUF=".dll"
  3426. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3427. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3428. 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)'
  3429. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3430. SLIB_INSTALL_LINKS=
  3431. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3432. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3433. 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'
  3434. objformat="win32"
  3435. dlltool="${cross_prefix}dlltool"
  3436. ranlib=:
  3437. enable dos_paths
  3438. ;;
  3439. win32|win64)
  3440. disable symver
  3441. if enabled shared; then
  3442. # Link to the import library instead of the normal static library
  3443. # for shared libs.
  3444. LD_LIB='%.lib'
  3445. # Cannot build both shared and static libs with MSVC or icl.
  3446. disable static
  3447. fi
  3448. shlibdir_default="$bindir_default"
  3449. SLIBPREF=""
  3450. SLIBSUF=".dll"
  3451. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3452. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3453. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3454. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3455. SLIB_INSTALL_LINKS=
  3456. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3457. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3458. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3459. objformat="win32"
  3460. ranlib=:
  3461. enable dos_paths
  3462. ;;
  3463. cygwin*)
  3464. target_os=cygwin
  3465. shlibdir_default="$bindir_default"
  3466. SLIBPREF="cyg"
  3467. SLIBSUF=".dll"
  3468. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3469. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3470. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3471. SLIB_INSTALL_LINKS=
  3472. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3473. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3474. objformat="win32"
  3475. enable dos_paths
  3476. ;;
  3477. *-dos|freedos|opendos)
  3478. network_extralibs="-lsocket"
  3479. objformat="coff"
  3480. enable dos_paths
  3481. add_cppflags -U__STRICT_ANSI__
  3482. ;;
  3483. linux)
  3484. enable dv1394
  3485. enable section_data_rel_ro
  3486. ;;
  3487. irix*)
  3488. target_os=irix
  3489. ranlib="echo ignoring ranlib"
  3490. ;;
  3491. os/2*)
  3492. ln_s="cp -f"
  3493. objformat="aout"
  3494. add_cppflags -D_GNU_SOURCE
  3495. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3496. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3497. LIBSUF="_s.a"
  3498. SLIBPREF=""
  3499. SLIBSUF=".dll"
  3500. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3501. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3502. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3503. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3504. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3505. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3506. emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
  3507. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3508. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3509. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3510. enable dos_paths
  3511. ;;
  3512. gnu/kfreebsd)
  3513. add_cppflags -D_BSD_SOURCE
  3514. ;;
  3515. gnu)
  3516. ;;
  3517. qnx)
  3518. add_cppflags -D_QNX_SOURCE
  3519. network_extralibs="-lsocket"
  3520. ;;
  3521. symbian)
  3522. SLIBSUF=".dll"
  3523. enable dos_paths
  3524. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3525. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3526. add_ldflags -Wl,--target1-abs,--no-undefined \
  3527. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3528. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3529. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3530. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3531. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3532. ;;
  3533. osf1)
  3534. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3535. ;;
  3536. minix)
  3537. ;;
  3538. plan9)
  3539. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3540. -D_REENTRANT_SOURCE \
  3541. -D_RESEARCH_SOURCE \
  3542. -DFD_SETSIZE=96 \
  3543. -DHAVE_SOCK_OPTS
  3544. add_compat strtod.o strtod=avpriv_strtod
  3545. network_extralibs='-lbsd'
  3546. exeobjs=compat/plan9/main.o
  3547. cp_f='cp'
  3548. ;;
  3549. none)
  3550. ;;
  3551. *)
  3552. die "Unknown OS '$target_os'."
  3553. ;;
  3554. esac
  3555. # determine libc flavour
  3556. probe_libc(){
  3557. pfx=$1
  3558. pfx_no_=${pfx%_}
  3559. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3560. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3561. eval ${pfx}libc_type=uclibc
  3562. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3563. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3564. eval ${pfx}libc_type=glibc
  3565. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3566. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3567. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3568. eval ${pfx}libc_type=newlib
  3569. add_${pfx}cppflags -U__STRICT_ANSI__
  3570. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3571. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3572. eval ${pfx}libc_type=mingw64
  3573. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3574. eval test \$${pfx_no_}cc_type = "gcc" &&
  3575. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3576. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3577. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3578. eval ${pfx}libc_type=mingw32
  3579. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3580. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3581. die "ERROR: MinGW32 runtime version must be >= 3.15."
  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 crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3586. eval ${pfx}libc_type=msvcrt
  3587. if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  3588. if [ "$pfx" = host_ ]; then
  3589. add_host_cppflags -Dsnprintf=_snprintf
  3590. else
  3591. add_compat strtod.o strtod=avpriv_strtod
  3592. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3593. _snprintf=avpriv_snprintf \
  3594. vsnprintf=avpriv_vsnprintf
  3595. fi
  3596. fi
  3597. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3598. # 0x601 by default unless something else is set by the user.
  3599. # This can easily lead to us detecting functions only present
  3600. # in such new versions and producing binaries requiring windows 7.0.
  3601. # Therefore explicitly set the default to XP unless the user has
  3602. # set something else on the command line.
  3603. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  3604. # family. For these cases, configure is free to use any functions
  3605. # found in the SDK headers by default. (Alternatively, we could force
  3606. # _WIN32_WINNT to 0x0602 in that case.)
  3607. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3608. { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
  3609. #ifdef WINAPI_FAMILY
  3610. #include <winapifamily.h>
  3611. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  3612. #error not desktop
  3613. #endif
  3614. #endif
  3615. EOF
  3616. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3617. eval ${pfx}libc_type=klibc
  3618. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3619. eval ${pfx}libc_type=bionic
  3620. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3621. eval ${pfx}libc_type=solaris
  3622. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3623. else
  3624. eval ${pfx}libc_type=default
  3625. add_${pfx}cppflags -D_DEFAULT_SOURCE
  3626. fi
  3627. }
  3628. probe_libc
  3629. test -n "$libc_type" && enable libc_$libc_type
  3630. probe_libc host_
  3631. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3632. case $libc_type in
  3633. bionic)
  3634. add_compat strtod.o strtod=avpriv_strtod
  3635. ;;
  3636. esac
  3637. # hacks for compiler/libc/os combinations
  3638. if enabled_all tms470 libc_glibc; then
  3639. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3640. add_cppflags -D__USER_LABEL_PREFIX__=
  3641. add_cppflags -D__builtin_memset=memset
  3642. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3643. add_cflags -pds=48 # incompatible redefinition of macro
  3644. fi
  3645. if enabled_all ccc libc_glibc; then
  3646. add_ldflags -Wl,-z,now # calls to libots crash without this
  3647. fi
  3648. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3649. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3650. esc(){
  3651. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3652. }
  3653. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  3654. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3655. set_default $PATHS_LIST
  3656. set_default nm
  3657. # we need to build at least one lib type
  3658. if ! enabled_any static shared; then
  3659. cat <<EOF
  3660. At least one library type must be built.
  3661. Specify --enable-static to build the static libraries or --enable-shared to
  3662. build the shared libraries as well. To only build the shared libraries specify
  3663. --disable-static in addition to --enable-shared.
  3664. EOF
  3665. exit 1;
  3666. fi
  3667. die_license_disabled() {
  3668. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3669. }
  3670. die_license_disabled gpl libcdio
  3671. die_license_disabled gpl libx264
  3672. die_license_disabled gpl libx265
  3673. die_license_disabled gpl libxavs
  3674. die_license_disabled gpl libxvid
  3675. die_license_disabled gpl x11grab
  3676. die_license_disabled nonfree cuda
  3677. die_license_disabled nonfree libfaac
  3678. die_license_disabled nonfree libfdk_aac
  3679. die_license_disabled nonfree nvenc
  3680. die_license_disabled nonfree openssl
  3681. die_license_disabled version3 libopencore_amrnb
  3682. die_license_disabled version3 libopencore_amrwb
  3683. die_license_disabled version3 libvo_aacenc
  3684. die_license_disabled version3 libvo_amrwbenc
  3685. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3686. disabled optimizations || check_cflags -fomit-frame-pointer
  3687. enable_weak_pic() {
  3688. disabled pic && return
  3689. enable pic
  3690. add_cppflags -DPIC
  3691. case "$target_os" in
  3692. mingw*|cygwin*)
  3693. ;;
  3694. *)
  3695. add_cflags -fPIC
  3696. ;;
  3697. esac
  3698. add_asflags -fPIC
  3699. }
  3700. enabled pic && enable_weak_pic
  3701. check_cc <<EOF || die "Symbol mangling check failed."
  3702. int ff_extern;
  3703. EOF
  3704. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3705. extern_prefix=${sym%%ff_extern*}
  3706. check_cc <<EOF && enable_weak inline_asm
  3707. void foo(void) { __asm__ volatile ("" ::); }
  3708. EOF
  3709. _restrict=
  3710. for restrict_keyword in restrict __restrict__ __restrict; do
  3711. check_cc <<EOF && _restrict=$restrict_keyword && break
  3712. void foo(char * $restrict_keyword p);
  3713. EOF
  3714. done
  3715. check_cc <<EOF && enable pragma_deprecated
  3716. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3717. EOF
  3718. check_cc <<EOF && enable attribute_packed
  3719. struct { int x; } __attribute__((packed)) x;
  3720. EOF
  3721. check_cc <<EOF && enable attribute_may_alias
  3722. union { int x; } __attribute__((may_alias)) x;
  3723. EOF
  3724. check_cc <<EOF || die "endian test failed"
  3725. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3726. EOF
  3727. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3728. check_gas() {
  3729. log "check_gas using '$as' as AS"
  3730. # :vararg is used on aarch64, arm and ppc altivec
  3731. check_as <<EOF || return 1
  3732. .macro m n, y:vararg=0
  3733. \n: .int \y
  3734. .endm
  3735. m x
  3736. EOF
  3737. # .altmacro is only used in arm asm
  3738. ! enabled arm || check_as <<EOF || return 1
  3739. .altmacro
  3740. EOF
  3741. enable gnu_as
  3742. return 0
  3743. }
  3744. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3745. nogas=:
  3746. enabled_any arm aarch64 && nogas=die
  3747. enabled_all ppc altivec && nogas=warn
  3748. as_noop=-v
  3749. case $as_type in
  3750. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3751. gcc) gaspp_as_type=gas ;;
  3752. *) gaspp_as_type=$as_type ;;
  3753. esac
  3754. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3755. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3756. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3757. if ! check_gas ; then
  3758. as=${gas:=$as}
  3759. check_gas || \
  3760. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3761. fi
  3762. check_as <<EOF && enable as_func
  3763. .func test
  3764. .endfunc
  3765. EOF
  3766. fi
  3767. check_inline_asm inline_asm_labels '"1:\n"'
  3768. if enabled aarch64; then
  3769. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3770. # internal assembler in clang 3.3 does not support this instruction
  3771. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3772. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3773. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3774. elif enabled alpha; then
  3775. check_cflags -mieee
  3776. elif enabled arm; then
  3777. enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
  3778. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3779. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3780. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3781. enable vfp_args
  3782. elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  3783. enable vfp_args
  3784. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  3785. case "${cross_prefix:-$cc}" in
  3786. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3787. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3788. __asm__ (".eabi_attribute 28, 1");
  3789. int main(void) { return 0; }
  3790. EOF
  3791. esac
  3792. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3793. fi
  3794. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3795. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3796. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3797. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3798. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3799. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3800. [ $target_os = linux ] || [ $target_os = android ] ||
  3801. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3802. $ARCH_EXT_LIST_ARM
  3803. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3804. check_as <<EOF && enable as_dn_directive
  3805. ra .dn d0.i16
  3806. .unreq ra
  3807. EOF
  3808. # llvm's integrated assembler supports .object_arch from llvm 3.5
  3809. [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
  3810. .object_arch armv4
  3811. EOF
  3812. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3813. elif enabled mips; then
  3814. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3815. # make sure that only an instruction set is enabled
  3816. disable mips64r6 mips32r6 mips64r2 mips32r2 mips64r1 mips32r1
  3817. if enabled mips64; then
  3818. check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
  3819. check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
  3820. check_inline_asm mips64r1 '"daddi $0, $0, 0"'
  3821. else
  3822. check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
  3823. check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
  3824. check_inline_asm mips32r1 '"addi $0, $0, 0"'
  3825. fi
  3826. elif enabled parisc; then
  3827. if enabled gcc; then
  3828. case $($cc -dumpversion) in
  3829. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3830. esac
  3831. fi
  3832. elif enabled ppc; then
  3833. enable local_aligned_8 local_aligned_16
  3834. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3835. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3836. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3837. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3838. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3839. if enabled altivec; then
  3840. check_cflags -maltivec -mabi=altivec &&
  3841. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3842. check_cflags -faltivec
  3843. # check if our compiler supports Motorola AltiVec C API
  3844. check_cc <<EOF || disable altivec
  3845. $inc_altivec_h
  3846. int main(void) {
  3847. vector signed int v1 = (vector signed int) { 0 };
  3848. vector signed int v2 = (vector signed int) { 1 };
  3849. v1 = vec_add(v1, v2);
  3850. return 0;
  3851. }
  3852. EOF
  3853. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3854. fi
  3855. if enabled vsx; then
  3856. check_cflags -mvsx &&
  3857. check_builtin vec_vsx_ld "altivec.h" "__builtin_vec_vsx_ld" || disable vsx
  3858. fi
  3859. if enabled power8; then
  3860. check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
  3861. fi
  3862. elif enabled x86; then
  3863. check_builtin rdtsc intrin.h "__rdtsc()"
  3864. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3865. enable local_aligned_8 local_aligned_16
  3866. # check whether EBP is available on x86
  3867. # As 'i' is stored on the stack, this program will crash
  3868. # if the base pointer is used to access it because the
  3869. # base pointer is cleared in the inline assembly code.
  3870. check_exec_crash <<EOF && enable ebp_available
  3871. volatile int i=0;
  3872. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3873. return i;
  3874. EOF
  3875. # check whether EBX is available on x86
  3876. check_inline_asm ebx_available '""::"b"(0)' &&
  3877. check_inline_asm ebx_available '"":::"%ebx"'
  3878. # check whether xmm clobbers are supported
  3879. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3880. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3881. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3882. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3883. if ! disabled_any asm mmx yasm; then
  3884. if check_cmd $yasmexe --version; then
  3885. enabled x86_64 && yasm_extra="-m amd64"
  3886. yasm_debug="-g dwarf2"
  3887. elif check_cmd nasm -v; then
  3888. yasmexe=nasm
  3889. yasm_debug="-g -F dwarf"
  3890. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3891. fi
  3892. YASMFLAGS="-f $objformat $yasm_extra"
  3893. enabled pic && append YASMFLAGS "-DPIC"
  3894. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3895. case "$objformat" in
  3896. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3897. esac
  3898. check_yasm "movbe ecx, [5]" && enable yasm ||
  3899. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3900. check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
  3901. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  3902. check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
  3903. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3904. check_yasm "CPU amdnop" || disable cpunop
  3905. fi
  3906. case "$cpu" in
  3907. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3908. disable fast_clz
  3909. ;;
  3910. esac
  3911. fi
  3912. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  3913. check_ldflags -Wl,--as-needed
  3914. if check_func dlopen; then
  3915. ldl=
  3916. elif check_func dlopen -ldl; then
  3917. ldl=-ldl
  3918. fi
  3919. if ! disabled network; then
  3920. check_func getaddrinfo $network_extralibs
  3921. check_func inet_aton $network_extralibs
  3922. check_type netdb.h "struct addrinfo"
  3923. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3924. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3925. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3926. check_type poll.h "struct pollfd"
  3927. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3928. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3929. check_type netinet/in.h "struct sockaddr_in6"
  3930. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3931. check_type "sys/types.h sys/socket.h" socklen_t
  3932. # Prefer arpa/inet.h over winsock2
  3933. if check_header arpa/inet.h ; then
  3934. check_func closesocket
  3935. elif check_header winsock2.h ; then
  3936. check_func_headers winsock2.h closesocket -lws2 &&
  3937. network_extralibs="-lws2" ||
  3938. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3939. network_extralibs="-lws2_32"; } || disable winsock2_h network
  3940. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3941. check_type ws2tcpip.h socklen_t
  3942. check_type ws2tcpip.h "struct addrinfo"
  3943. check_type ws2tcpip.h "struct group_source_req"
  3944. check_type ws2tcpip.h "struct ip_mreq_source"
  3945. check_type ws2tcpip.h "struct ipv6_mreq"
  3946. check_type winsock2.h "struct pollfd"
  3947. check_struct winsock2.h "struct sockaddr" sa_len
  3948. check_type ws2tcpip.h "struct sockaddr_in6"
  3949. check_type ws2tcpip.h "struct sockaddr_storage"
  3950. else
  3951. disable network
  3952. fi
  3953. fi
  3954. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3955. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3956. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3957. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3958. case "$custom_allocator" in
  3959. jemalloc)
  3960. # jemalloc by default does not use a prefix
  3961. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  3962. ;;
  3963. tcmalloc)
  3964. require_pkg_config libtcmalloc gperftools/tcmalloc.h tc_malloc
  3965. malloc_prefix=tc_
  3966. ;;
  3967. esac
  3968. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3969. check_func ${malloc_prefix}memalign && enable memalign
  3970. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3971. check_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  3972. check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
  3973. check_func fcntl
  3974. check_func fork
  3975. check_func gethrtime
  3976. check_func getopt
  3977. check_func getrusage
  3978. check_func gettimeofday
  3979. check_func gmtime_r
  3980. check_func isatty
  3981. check_func localtime_r
  3982. check_func mach_absolute_time
  3983. check_func mkstemp
  3984. check_func mmap
  3985. check_func mprotect
  3986. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3987. check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt; }
  3988. check_func sched_getaffinity
  3989. check_func setrlimit
  3990. check_func strerror_r
  3991. check_func sysconf
  3992. check_func sysctl
  3993. check_func usleep
  3994. check_func_headers io.h setmode
  3995. check_func_headers stdlib.h getenv
  3996. check_func_headers windows.h CoTaskMemFree -lole32
  3997. check_func_headers windows.h GetProcessAffinityMask
  3998. check_func_headers windows.h GetProcessTimes
  3999. check_func_headers windows.h GetSystemTimeAsFileTime
  4000. check_func_headers windows.h LoadLibrary
  4001. check_func_headers windows.h MapViewOfFile
  4002. check_func_headers windows.h SetConsoleTextAttribute
  4003. check_func_headers windows.h Sleep
  4004. check_func_headers windows.h VirtualAlloc
  4005. check_struct windows.h "CONDITION_VARIABLE" Ptr
  4006. check_header direct.h
  4007. check_header dlfcn.h
  4008. check_header d3d11.h
  4009. check_header dxva.h
  4010. check_header dxva2api.h
  4011. check_header io.h
  4012. check_header mach/mach_time.h
  4013. check_header malloc.h
  4014. check_header poll.h
  4015. check_header sys/mman.h
  4016. check_header sys/param.h
  4017. check_header sys/resource.h
  4018. check_header sys/select.h
  4019. check_header sys/time.h
  4020. check_header sys/un.h
  4021. check_header unistd.h
  4022. check_header valgrind/valgrind.h
  4023. check_header vdpau/vdpau.h
  4024. check_header vdpau/vdpau_x11.h
  4025. check_header VideoDecodeAcceleration/VDADecoder.h
  4026. check_header windows.h
  4027. check_header X11/extensions/XvMClib.h
  4028. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4029. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  4030. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4031. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4032. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  4033. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  4034. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  4035. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  4036. if ! disabled w32threads && ! enabled pthreads; then
  4037. check_func_headers "windows.h process.h" _beginthreadex &&
  4038. enable w32threads || disable w32threads
  4039. fi
  4040. # check for some common methods of building with pthread support
  4041. # do this before the optional library checks as some of them require pthreads
  4042. if ! disabled pthreads && ! enabled w32threads; then
  4043. enable pthreads
  4044. if check_func pthread_join -pthread; then
  4045. add_cflags -pthread
  4046. add_extralibs -pthread
  4047. elif check_func pthread_join -pthreads; then
  4048. add_cflags -pthreads
  4049. add_extralibs -pthreads
  4050. elif check_func pthread_join -lpthreadGC2; then
  4051. add_extralibs -lpthreadGC2
  4052. elif check_lib pthread.h pthread_join -lpthread; then
  4053. :
  4054. elif ! check_func pthread_join; then
  4055. disable pthreads
  4056. fi
  4057. fi
  4058. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  4059. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  4060. check_lib math.h sin -lm && LIBM="-lm"
  4061. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  4062. atan2f_args=2
  4063. ldexpf_args=2
  4064. powf_args=2
  4065. for func in $MATH_FUNCS; do
  4066. eval check_mathfunc $func \${${func}_args:-1}
  4067. done
  4068. # these are off by default, so fail if requested and not available
  4069. enabled avisynth && { check_lib2 "avisynth/avisynth_c.h windows.h" LoadLibrary ||
  4070. check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl ||
  4071. die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
  4072. enabled cuda && check_lib cuda.h cuInit -lcuda
  4073. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  4074. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  4075. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  4076. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  4077. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4078. enabled libfdk_aac && require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
  4079. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  4080. enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  4081. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  4082. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  4083. done || die "ERROR: libgsm not found"; }
  4084. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4085. enabled libkvazaar && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  4086. enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
  4087. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4088. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4089. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4090. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  4091. enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
  4092. enabled libopenjpeg && { { check_header openjpeg.h && check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC; } ||
  4093. { require_pkg_config libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; } }
  4094. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  4095. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  4096. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  4097. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  4098. enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
  4099. enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
  4100. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4101. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  4102. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4103. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4104. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4105. enabled libvpx && require_pkg_config "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version && {
  4106. enabled libvpx_vp8_decoder && {
  4107. check_pkg_config vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  4108. disable libvpx_vp8_decoder;
  4109. }
  4110. enabled libvpx_vp8_encoder && {
  4111. check_pkg_config vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  4112. disable libvpx_vp8_encoder;
  4113. }
  4114. enabled libvpx_vp9_decoder && {
  4115. check_pkg_config vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  4116. disable libvpx_vp9_decoder;
  4117. }
  4118. enabled libvpx_vp9_encoder && {
  4119. check_pkg_config vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  4120. disable libvpx_vp9_encoder;
  4121. }
  4122. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  4123. die "libvpx enabled but no supported decoders found"
  4124. fi
  4125. }
  4126. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4127. enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
  4128. enabled libx264 && require_pkg_config x264 "stdint.h x264.h" x264_encoder_encode &&
  4129. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  4130. die "ERROR: libx264 version must be >= 0.118."; } &&
  4131. { check_cpp_condition x264.h "X264_MPEG2" &&
  4132. enable libx262; }
  4133. enabled libx265 && require_pkg_config x265 x265.h x265_api_get &&
  4134. { check_cpp_condition x265.h "X265_BUILD >= 57" ||
  4135. die "ERROR: libx265 version must be >= 57."; }
  4136. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  4137. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4138. enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  4139. { ! enabled cross_compile && {
  4140. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
  4141. add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ;
  4142. check_lib interface/mmal/mmal.h mmal_port_connect ; }
  4143. check_lib interface/mmal/mmal.h mmal_port_connect ; } ||
  4144. die "ERROR: mmal not found"; }
  4145. enabled openssl && { check_pkg_config openssl openssl/ssl.h SSL_library_init && {
  4146. add_cflags $openssl_cflags && add_extralibs $openssl_libs; }||
  4147. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4148. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4149. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4150. die "ERROR: openssl not found"; }
  4151. if enabled gnutls; then
  4152. { check_lib2 gmp.h mpz_export -lgmp && enable gmp; } ||
  4153. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  4154. fi
  4155. # libdc1394 check
  4156. if enabled libdc1394; then
  4157. { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new &&
  4158. enable libdc1394_2; } ||
  4159. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  4160. enable libdc1394_1; } ||
  4161. die "ERROR: No version of libdc1394 found "
  4162. fi
  4163. if enabled nvenc; then
  4164. enabled cuda || check_header cuda.h || die "ERROR: cuda.h not found.";
  4165. check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found.";
  4166. check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 5" ||
  4167. die "ERROR: NVENC API version 4 or older is not supported";
  4168. fi
  4169. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  4170. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4171. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4172. enable sdl
  4173. fi
  4174. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  4175. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  4176. check_header linux/fb.h
  4177. check_header linux/videodev2.h
  4178. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  4179. check_header AVFoundation/AVFoundation.h &&
  4180. check_objcflags -fobjc-arc &&
  4181. add_extralibs -framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia ||
  4182. disable AVFoundation_AVFoundation_h
  4183. check_header sys/videoio.h
  4184. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  4185. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4186. # w32api 3.12 had it defined wrong
  4187. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4188. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4189. { check_header dev/bktr/ioctl_meteor.h &&
  4190. check_header dev/bktr/ioctl_bt848.h; } ||
  4191. { check_header machine/ioctl_meteor.h &&
  4192. check_header machine/ioctl_bt848.h; } ||
  4193. { check_header dev/video/meteor/ioctl_meteor.h &&
  4194. check_header dev/video/bktr/ioctl_bt848.h; } ||
  4195. check_header dev/ic/bt8xx.h
  4196. check_header sndio.h
  4197. check_header sys/soundcard.h
  4198. check_header soundcard.h
  4199. enabled_any alsa_indev alsa_outdev &&
  4200. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4201. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  4202. check_func jack_port_get_latency_range -ljack
  4203. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4204. if enabled libcdio; then
  4205. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4206. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4207. die "ERROR: No usable libcdio/cdparanoia found"
  4208. fi
  4209. check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  4210. if enabled libxcb || enabled x11grab && ! disabled libxcb; then
  4211. check_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles || {
  4212. enabled libxcb && die "ERROR: libxcb not found";
  4213. } && disable x11grab && enable libxcb
  4214. disabled libxcb_shm ||
  4215. check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
  4216. enabled libxcb_shm && die "ERROR: libxcb_shm not found";
  4217. } && check_header sys/shm.h && enable libxcb_shm
  4218. disabled libxcb_xfixes ||
  4219. check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
  4220. enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
  4221. } && enable libxcb_xfixes
  4222. add_cflags "$xcb_event_cflags $xcb_shm_cflags $xcb_xfixes_cflags"
  4223. add_extralibs "$xcb_event_libs $xcb_shm_libs $xcb_xfixes_libs"
  4224. fi
  4225. if enabled x11grab; then
  4226. enabled xlib || die "ERROR: Xlib not found"
  4227. require Xext X11/extensions/XShm.h XShmCreateImage -lXext
  4228. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  4229. fi
  4230. enabled vaapi && enabled xlib &&
  4231. check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
  4232. enable vaapi_x11
  4233. enabled vdpau &&
  4234. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4235. disable vdpau
  4236. enabled vdpau && enabled xlib &&
  4237. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  4238. prepend avconv_libs $($ldflags_filter "-lvdpau") &&
  4239. enable vdpau_x11
  4240. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4241. # add some useful compiler flags if supported
  4242. check_cflags -Wdeclaration-after-statement
  4243. check_cflags -Wall
  4244. check_cflags -Wdisabled-optimization
  4245. check_cflags -Wpointer-arith
  4246. check_cflags -Wredundant-decls
  4247. check_cflags -Wwrite-strings
  4248. check_cflags -Wtype-limits
  4249. check_cflags -Wundef
  4250. check_cflags -Wmissing-prototypes
  4251. check_cflags -Wstrict-prototypes
  4252. enabled extra_warnings && check_cflags -Winline
  4253. enabled extra_warnings && check_cflags -Wcast-qual
  4254. check_disable_warning(){
  4255. warning_flag=-W${1#-Wno-}
  4256. test_cflags $warning_flag && add_cflags $1
  4257. }
  4258. check_disable_warning -Wno-parentheses
  4259. check_disable_warning -Wno-switch
  4260. check_disable_warning -Wno-format-zero-length
  4261. check_disable_warning -Wno-pointer-sign
  4262. # add some linker flags
  4263. check_ldflags -Wl,--warn-common
  4264. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4265. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
  4266. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4267. # add some strip flags
  4268. # -wN '..@*' is more selective than -x, but not available everywhere.
  4269. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  4270. enabled neon_clobber_test &&
  4271. check_ldflags -Wl,--wrap,avcodec_open2 \
  4272. -Wl,--wrap,avcodec_decode_audio4 \
  4273. -Wl,--wrap,avcodec_decode_video2 \
  4274. -Wl,--wrap,avcodec_decode_subtitle2 \
  4275. -Wl,--wrap,avcodec_encode_audio2 \
  4276. -Wl,--wrap,avcodec_encode_video2 \
  4277. -Wl,--wrap,avcodec_encode_subtitle \
  4278. -Wl,--wrap,avresample_convert ||
  4279. disable neon_clobber_test
  4280. enabled xmm_clobber_test &&
  4281. check_ldflags -Wl,--wrap,avcodec_open2 \
  4282. -Wl,--wrap,avcodec_decode_audio4 \
  4283. -Wl,--wrap,avcodec_decode_video2 \
  4284. -Wl,--wrap,avcodec_decode_subtitle2 \
  4285. -Wl,--wrap,avcodec_encode_audio2 \
  4286. -Wl,--wrap,avcodec_encode_video2 \
  4287. -Wl,--wrap,avcodec_encode_subtitle \
  4288. -Wl,--wrap,avresample_convert \
  4289. -Wl,--wrap,sws_scale ||
  4290. disable xmm_clobber_test
  4291. echo "X { local: *; };" > $TMPV
  4292. if test_ldflags -Wl,--version-script,$TMPV; then
  4293. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4294. elif test_ldflags -Wl,-M,$TMPV; then
  4295. append SHFLAGS '-Wl,-M,\$(SUBDIR)lib\$(NAME).ver-sol2'
  4296. fi
  4297. check_cc <<EOF && enable symver_asm_label
  4298. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4299. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4300. EOF
  4301. check_cc <<EOF && enable symver_gnu_asm
  4302. __asm__(".symver ff_foo,av_foo@VERSION");
  4303. void ff_foo(void) {}
  4304. EOF
  4305. if [ -z "$optflags" ]; then
  4306. if enabled small; then
  4307. optflags=$cflags_size
  4308. elif enabled optimizations; then
  4309. optflags=$cflags_speed
  4310. else
  4311. optflags=$cflags_noopt
  4312. fi
  4313. fi
  4314. check_optflags(){
  4315. check_cflags "$@"
  4316. enabled lto && check_ldflags "$@"
  4317. }
  4318. if enabled lto; then
  4319. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4320. check_cflags -flto
  4321. check_ldflags -flto $cpuflags
  4322. fi
  4323. check_optflags $optflags
  4324. check_optflags -fno-math-errno
  4325. check_optflags -fno-signed-zeros
  4326. if enabled icc; then
  4327. # Just warnings, no remarks
  4328. check_cflags -w1
  4329. # -wd: Disable following warnings
  4330. # 144, 167, 556: -Wno-pointer-sign
  4331. # 1292: attribute "foo" ignored
  4332. # 1419: external declaration in primary source file
  4333. # 10006: ignoring unknown option -fno-signed-zeros
  4334. # 10148: ignoring unknown option -Wno-parentheses
  4335. # 10156: ignoring option '-W'; no argument required
  4336. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  4337. # 11030: Warning unknown option --as-needed
  4338. # 10156: ignoring option '-export'; no argument required
  4339. check_ldflags -wd10156,11030
  4340. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4341. enable ebp_available
  4342. if enabled x86_32; then
  4343. icc_version=$($cc -dumpversion)
  4344. test ${icc_version%%.*} -ge 11 &&
  4345. check_cflags -falign-stack=maintain-16-byte ||
  4346. disable aligned_stack
  4347. fi
  4348. elif enabled ccc; then
  4349. # disable some annoying warnings
  4350. add_cflags -msg_disable bitnotint
  4351. add_cflags -msg_disable mixfuncvoid
  4352. add_cflags -msg_disable nonstandcast
  4353. add_cflags -msg_disable unsupieee
  4354. elif enabled gcc; then
  4355. check_optflags -fno-tree-vectorize
  4356. check_cflags -Werror=implicit-function-declaration
  4357. check_cflags -Werror=missing-prototypes
  4358. check_cflags -Werror=return-type
  4359. check_cflags -Werror=declaration-after-statement
  4360. check_cflags -Werror=vla
  4361. check_cflags -Werror=format-security
  4362. check_cflags -fdiagnostics-color=auto
  4363. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4364. elif enabled llvm_gcc; then
  4365. check_cflags -mllvm -stack-alignment=16
  4366. elif enabled clang; then
  4367. check_cflags -mllvm -stack-alignment=16
  4368. check_cflags -Qunused-arguments
  4369. check_cflags -Werror=implicit-function-declaration
  4370. check_cflags -Werror=missing-prototypes
  4371. check_cflags -Werror=return-type
  4372. elif enabled cparser; then
  4373. add_cflags -Wno-missing-variable-declarations
  4374. add_cflags -Wno-empty-statement
  4375. elif enabled armcc; then
  4376. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4377. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4378. # 2523: use of inline assembly is deprecated
  4379. add_cflags -W${armcc_opt},--diag_suppress=2523
  4380. add_cflags -W${armcc_opt},--diag_suppress=1207
  4381. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4382. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4383. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4384. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4385. elif enabled tms470; then
  4386. add_cflags -pds=824 -pds=837
  4387. disable inline_asm
  4388. elif enabled pathscale; then
  4389. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4390. elif enabled_any msvc icl; then
  4391. enabled x86_32 && disable aligned_stack
  4392. enabled_all x86_32 debug && add_cflags -Oy-
  4393. enabled debug && add_ldflags -debug
  4394. enable pragma_deprecated
  4395. if enabled icl; then
  4396. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4397. # (correctly) on icl 13.x.
  4398. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4399. add_cflags -Qansi-alias
  4400. # icl will pass the inline asm tests but inline asm is currently
  4401. # not supported (build will fail)
  4402. disable inline_asm
  4403. fi
  4404. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  4405. check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2
  4406. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  4407. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  4408. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  4409. # MSVC 2013 and newer can handle it fine.
  4410. # If this declspec fails, force including stdlib.h before the restrict redefinition
  4411. # happens in config.h.
  4412. if [ $_restrict != restrict ]; then
  4413. check_cc <<EOF || add_cflags -FIstdlib.h
  4414. __declspec($_restrict) void* foo(int);
  4415. EOF
  4416. fi
  4417. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  4418. fi
  4419. for pfx in "" host_; do
  4420. varname=${pfx%_}cc_type
  4421. eval "type=\$$varname"
  4422. if [ $type = "msvc" ]; then
  4423. check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  4424. static inline int foo(int a) { return a; }
  4425. EOF
  4426. fi
  4427. done
  4428. case $as_type in
  4429. clang)
  4430. add_asflags -Qunused-arguments
  4431. ;;
  4432. esac
  4433. case $ld_type in
  4434. clang)
  4435. check_ldflags -Qunused-arguments
  4436. ;;
  4437. esac
  4438. case $target_os in
  4439. osf1)
  4440. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4441. ;;
  4442. plan9)
  4443. add_cppflags -Dmain=plan9_main
  4444. ;;
  4445. esac
  4446. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4447. check_deps $CONFIG_LIST \
  4448. $CONFIG_EXTRA \
  4449. $HAVE_LIST \
  4450. $ALL_COMPONENTS \
  4451. enabled_all dxva2 CoTaskMemFree &&
  4452. prepend avconv_libs $($ldflags_filter "-lole32") &&
  4453. enable dxva2_lib
  4454. ! enabled_any memalign posix_memalign aligned_malloc &&
  4455. enabled simd_align_16 && enable memalign_hack
  4456. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4457. for thread in $THREADS_LIST; do
  4458. if enabled $thread; then
  4459. test -n "$thread_type" &&
  4460. die "ERROR: Only one thread type must be selected." ||
  4461. thread_type="$thread"
  4462. fi
  4463. done
  4464. enabled zlib && add_cppflags -DZLIB_CONST
  4465. # conditional library dependencies, in linking order
  4466. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4467. enabled resample_filter && prepend avfilter_deps "avresample"
  4468. enabled scale_filter && prepend avfilter_deps "swscale"
  4469. enabled opus_decoder && prepend avcodec_deps "avresample"
  4470. expand_deps(){
  4471. lib_deps=${1}_deps
  4472. eval "deps=\$$lib_deps"
  4473. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4474. unique $lib_deps
  4475. }
  4476. map 'expand_deps $v' $LIBRARY_LIST
  4477. echo "install prefix $prefix"
  4478. echo "source path $source_path"
  4479. echo "C compiler $cc"
  4480. echo "C library $libc_type"
  4481. if test "$host_cc" != "$cc"; then
  4482. echo "host C compiler $host_cc"
  4483. echo "host C library $host_libc_type"
  4484. fi
  4485. echo "ARCH $arch ($cpu)"
  4486. if test "$build_suffix" != ""; then
  4487. echo "build suffix $build_suffix"
  4488. fi
  4489. if test "$extra_version" != ""; then
  4490. echo "version string suffix $extra_version"
  4491. fi
  4492. echo "big-endian ${bigendian-no}"
  4493. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4494. if enabled x86; then
  4495. echo "${yasmexe} ${yasm-no}"
  4496. echo "MMX enabled ${mmx-no}"
  4497. echo "MMXEXT enabled ${mmxext-no}"
  4498. echo "3DNow! enabled ${amd3dnow-no}"
  4499. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4500. echo "SSE enabled ${sse-no}"
  4501. echo "SSSE3 enabled ${ssse3-no}"
  4502. echo "AVX enabled ${avx-no}"
  4503. echo "XOP enabled ${xop-no}"
  4504. echo "FMA3 enabled ${fma3-no}"
  4505. echo "FMA4 enabled ${fma4-no}"
  4506. echo "i686 features enabled ${i686-no}"
  4507. echo "CMOV is fast ${fast_cmov-no}"
  4508. echo "EBX available ${ebx_available-no}"
  4509. echo "EBP available ${ebp_available-no}"
  4510. fi
  4511. if enabled aarch64; then
  4512. echo "NEON enabled ${neon-no}"
  4513. echo "VFP enabled ${vfp-no}"
  4514. fi
  4515. if enabled arm; then
  4516. echo "ARMv5TE enabled ${armv5te-no}"
  4517. echo "ARMv6 enabled ${armv6-no}"
  4518. echo "ARMv6T2 enabled ${armv6t2-no}"
  4519. echo "VFP enabled ${vfp-no}"
  4520. echo "NEON enabled ${neon-no}"
  4521. fi
  4522. if enabled ppc; then
  4523. echo "AltiVec enabled ${altivec-no}"
  4524. echo "VSX enabled ${vsx-no}"
  4525. echo "POWER8 enabled ${power8-no}"
  4526. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4527. echo "dcbzl available ${dcbzl-no}"
  4528. fi
  4529. echo "debug symbols ${debug-no}"
  4530. echo "optimize for size ${small-no}"
  4531. echo "optimizations ${optimizations-no}"
  4532. echo "static ${static-no}"
  4533. echo "shared ${shared-no}"
  4534. echo "new filter support ${avfilter-no}"
  4535. echo "network support ${network-no}"
  4536. echo "threading support ${thread_type-no}"
  4537. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4538. echo "SDL support ${sdl-no}"
  4539. test -n "$random_seed" &&
  4540. echo "random seed ${random_seed}"
  4541. echo
  4542. echo "External libraries:"
  4543. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4544. echo
  4545. echo "Libraries:"
  4546. print_enabled '' $LIBRARY_LIST | print_3_columns
  4547. echo
  4548. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4549. echo "Enabled ${type}s:"
  4550. eval list=\$$(toupper $type)_LIST
  4551. print_enabled '_*' $list | print_3_columns
  4552. echo
  4553. done
  4554. license="LGPL version 2.1 or later"
  4555. if enabled nonfree; then
  4556. license="nonfree and unredistributable"
  4557. elif enabled gplv3; then
  4558. license="GPL version 3 or later"
  4559. elif enabled lgplv3; then
  4560. license="LGPL version 3 or later"
  4561. elif enabled gpl; then
  4562. license="GPL version 2 or later"
  4563. fi
  4564. echo "License: $license"
  4565. echo "Creating config.mak and config.h..."
  4566. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4567. config_files="$TMPH config.mak"
  4568. cat > config.mak <<EOF
  4569. # Automatically generated by configure - do not modify!
  4570. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4571. prefix=$prefix
  4572. LIBDIR=\$(DESTDIR)$libdir
  4573. SHLIBDIR=\$(DESTDIR)$shlibdir
  4574. INCDIR=\$(DESTDIR)$incdir
  4575. BINDIR=\$(DESTDIR)$bindir
  4576. DATADIR=\$(DESTDIR)$datadir
  4577. DOCDIR=\$(DESTDIR)$docdir
  4578. MANDIR=\$(DESTDIR)$mandir
  4579. SRC_PATH=$source_path
  4580. CC_IDENT=$cc_ident
  4581. ARCH=$arch
  4582. INTRINSICS=$intrinsics
  4583. CC=$cc
  4584. OBJCC=$cc
  4585. AS=$as
  4586. OBJCC=$objcc
  4587. LD=$ld
  4588. DEPCC=$dep_cc
  4589. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4590. DEPAS=$as
  4591. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4592. YASM=$yasmexe
  4593. DEPYASM=$yasmexe
  4594. AR=$ar
  4595. ARFLAGS=$arflags
  4596. AR_O=$ar_o
  4597. RANLIB=$ranlib
  4598. STRIP=$strip
  4599. LN_S=$ln_s
  4600. CPPFLAGS=$CPPFLAGS
  4601. CFLAGS=$CFLAGS
  4602. OBJCFLAGS=$OBJCFLAGS
  4603. ASFLAGS=$ASFLAGS
  4604. AS_C=$AS_C
  4605. AS_O=$AS_O
  4606. OBJCC_C=$OBJCC_C
  4607. OBJCC_E=$OBJCC_E
  4608. OBJCC_O=$OBJCC_O
  4609. CC_C=$CC_C
  4610. CC_E=$CC_E
  4611. CC_O=$CC_O
  4612. LD_O=$LD_O
  4613. LD_LIB=$LD_LIB
  4614. LD_PATH=$LD_PATH
  4615. DLLTOOL=$dlltool
  4616. LDFLAGS=$LDFLAGS
  4617. LDEXEFLAGS=$LDEXEFLAGS
  4618. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4619. STRIPFLAGS=$STRIPFLAGS
  4620. YASMFLAGS=$YASMFLAGS
  4621. BUILDSUF=$build_suffix
  4622. FULLNAME=$FULLNAME
  4623. LIBPREF=$LIBPREF
  4624. LIBSUF=$LIBSUF
  4625. LIBNAME=$LIBNAME
  4626. SLIBPREF=$SLIBPREF
  4627. SLIBSUF=$SLIBSUF
  4628. EXESUF=$EXESUF
  4629. EXTRA_VERSION=$extra_version
  4630. CCDEP=$CCDEP
  4631. CCDEP_FLAGS=$CCDEP_FLAGS
  4632. ASDEP=$ASDEP
  4633. ASDEP_FLAGS=$ASDEP_FLAGS
  4634. CC_DEPFLAGS=$CC_DEPFLAGS
  4635. AS_DEPFLAGS=$AS_DEPFLAGS
  4636. HOSTCC=$host_cc
  4637. HOSTLD=$host_ld
  4638. HOSTCFLAGS=$host_cflags
  4639. HOSTCPPFLAGS=$host_cppflags
  4640. HOSTEXESUF=$HOSTEXESUF
  4641. HOSTLDFLAGS=$host_ldflags
  4642. HOSTLIBS=$host_libs
  4643. DEPHOSTCC=$host_cc
  4644. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4645. HOSTCCDEP=$HOSTCCDEP
  4646. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4647. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4648. HOSTCC_C=$HOSTCC_C
  4649. HOSTCC_O=$HOSTCC_O
  4650. HOSTLD_O=$HOSTLD_O
  4651. TARGET_EXEC=$target_exec $target_exec_args
  4652. TARGET_PATH=$target_path
  4653. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4654. CFLAGS-avplay=$sdl_cflags
  4655. ZLIB=$($ldflags_filter -lz)
  4656. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4657. EXTRALIBS=$extralibs
  4658. COMPAT_OBJS=$compat_objs
  4659. EXEOBJS=$exeobjs
  4660. INSTALL=install
  4661. LIBTARGET=${LIBTARGET}
  4662. SLIBNAME=${SLIBNAME}
  4663. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4664. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4665. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4666. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4667. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4668. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4669. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4670. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4671. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4672. EOF
  4673. get_version(){
  4674. lcname=lib${1}
  4675. name=$(toupper $lcname)
  4676. file=$source_path/$lcname/version.h
  4677. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4678. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4679. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4680. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4681. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4682. }
  4683. map 'get_version $v' $LIBRARY_LIST
  4684. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
  4685. print_program_libs(){
  4686. eval "program_libs=\$${1}_libs"
  4687. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  4688. }
  4689. map 'print_program_libs $v' $PROGRAM_LIST
  4690. cat > $TMPH <<EOF
  4691. /* Automatically generated by configure - do not modify! */
  4692. #ifndef LIBAV_CONFIG_H
  4693. #define LIBAV_CONFIG_H
  4694. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4695. #define LIBAV_LICENSE "$(c_escape $license)"
  4696. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4697. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4698. #define restrict $_restrict
  4699. #define EXTERN_PREFIX "${extern_prefix}"
  4700. #define EXTERN_ASM ${extern_prefix}
  4701. #define SLIBSUF "$SLIBSUF"
  4702. EOF
  4703. test -n "$malloc_prefix" &&
  4704. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4705. if enabled yasm; then
  4706. append config_files $TMPASM
  4707. printf '' >$TMPASM
  4708. fi
  4709. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4710. print_config ARCH_ "$config_files" $ARCH_LIST
  4711. print_config HAVE_ "$config_files" $HAVE_LIST
  4712. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4713. $CONFIG_EXTRA \
  4714. $ALL_COMPONENTS \
  4715. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4716. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4717. cp_if_changed $TMPH config.h
  4718. touch .config
  4719. enabled yasm && cp_if_changed $TMPASM config.asm
  4720. cat > $TMPH <<EOF
  4721. /* Generated by ffconf */
  4722. #ifndef AVUTIL_AVCONFIG_H
  4723. #define AVUTIL_AVCONFIG_H
  4724. EOF
  4725. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4726. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4727. cp_if_changed $TMPH libavutil/avconfig.h
  4728. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4729. # build pkg-config files
  4730. lib_version(){
  4731. eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
  4732. }
  4733. pkgconfig_generate(){
  4734. name=$1
  4735. shortname=${name#lib}${build_suffix}
  4736. comment=$2
  4737. version=$3
  4738. libs=$4
  4739. requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
  4740. requires=${requires%, }
  4741. enabled ${name#lib} || return 0
  4742. mkdir -p $name
  4743. cat <<EOF > $name/$name.pc
  4744. prefix=$prefix
  4745. exec_prefix=\${prefix}
  4746. libdir=$libdir
  4747. includedir=$incdir
  4748. Name: $name
  4749. Description: $comment
  4750. Version: $version
  4751. Requires: $(enabled shared || echo $requires)
  4752. Requires.private: $(enabled shared && echo $requires)
  4753. Conflicts:
  4754. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4755. Libs.private: $(enabled shared && echo $libs)
  4756. Cflags: -I\${includedir}
  4757. EOF
  4758. cat <<EOF > $name/$name-uninstalled.pc
  4759. prefix=
  4760. exec_prefix=
  4761. libdir=\${pcfiledir}
  4762. includedir=${source_path}
  4763. Name: $name
  4764. Description: $comment
  4765. Version: $version
  4766. Requires: $requires
  4767. Conflicts:
  4768. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  4769. Cflags: -I\${includedir}
  4770. EOF
  4771. }
  4772. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM"
  4773. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  4774. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
  4775. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
  4776. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  4777. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM"
  4778. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"