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.

5188 lines
154KB

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