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.

5243 lines
156KB

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