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.

5303 lines
158KB

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