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.

5305 lines
157KB

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