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
155KB

  1. #!/bin/sh
  2. #
  3. # Libav configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken Libav."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --prefix=PREFIX install in PREFIX [$prefix]
  72. --bindir=DIR install binaries in DIR [PREFIX/bin]
  73. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  74. --docdir=DIR install documentation in DIR [PREFIX/share/doc/libav]
  75. --libdir=DIR install libs in DIR [PREFIX/lib]
  76. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  77. --incdir=DIR install includes in DIR [PREFIX/include]
  78. --mandir=DIR install man page in DIR [PREFIX/share/man]
  79. --enable-rpath use rpath when linking programs [USE WITH CARE]
  80. Licensing options:
  81. --enable-gpl allow use of GPL code, the resulting libs
  82. and binaries will be under GPL [no]
  83. --enable-version3 upgrade (L)GPL to version 3 [no]
  84. --enable-nonfree allow use of nonfree code, the resulting libs
  85. and binaries will be unredistributable [no]
  86. Configuration options:
  87. --disable-static do not build static libraries [no]
  88. --enable-shared build shared libraries [no]
  89. --enable-small optimize for size instead of speed
  90. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  91. --enable-gray enable full grayscale support (slower color)
  92. --disable-swscale-alpha disable alpha channel support in swscale
  93. --disable-all disable building components, libraries and programs
  94. Program options:
  95. --disable-programs do not build command line programs
  96. --disable-avconv disable avconv build
  97. --disable-avplay disable avplay build
  98. --disable-avprobe disable avprobe build
  99. --disable-avserver deprecated, does nothing
  100. Component options:
  101. --disable-doc do not build documentation
  102. --disable-avdevice disable libavdevice build
  103. --disable-avcodec disable libavcodec build
  104. --disable-avformat disable libavformat build
  105. --disable-avutil disable libavutil build
  106. --disable-swscale disable libswscale build
  107. --disable-avfilter disable video filter support [no]
  108. --disable-avresample disable libavresample build [no]
  109. --disable-pthreads disable pthreads [auto]
  110. --disable-w32threads disable Win32 threads [auto]
  111. --disable-network disable network support [no]
  112. --disable-dct disable DCT code
  113. --disable-error-resilience disable error resilience code
  114. --disable-lsp disable LSP code
  115. --disable-lzo disable LZO decoder code
  116. --disable-mdct disable MDCT code
  117. --disable-rdft disable RDFT code
  118. --disable-fft disable FFT code
  119. --disable-faan disable floating point AAN (I)DCT code
  120. Hardware accelerators:
  121. --enable-d3d11va enable D3D11VA code
  122. --enable-dxva2 enable DXVA2 code
  123. --enable-vaapi enable VAAPI code
  124. --enable-vda enable VDA code
  125. --enable-vdpau enable VDPAU code
  126. Individual component options:
  127. --disable-everything disable all components listed below
  128. --disable-encoder=NAME disable encoder NAME
  129. --enable-encoder=NAME enable encoder NAME
  130. --disable-encoders disable all encoders
  131. --disable-decoder=NAME disable decoder NAME
  132. --enable-decoder=NAME enable decoder NAME
  133. --disable-decoders disable all decoders
  134. --disable-hwaccel=NAME disable hwaccel NAME
  135. --enable-hwaccel=NAME enable hwaccel NAME
  136. --disable-hwaccels disable all hwaccels
  137. --disable-muxer=NAME disable muxer NAME
  138. --enable-muxer=NAME enable muxer NAME
  139. --disable-muxers disable all muxers
  140. --disable-demuxer=NAME disable demuxer NAME
  141. --enable-demuxer=NAME enable demuxer NAME
  142. --disable-demuxers disable all demuxers
  143. --enable-parser=NAME enable parser NAME
  144. --disable-parser=NAME disable parser NAME
  145. --disable-parsers disable all parsers
  146. --enable-bsf=NAME enable bitstream filter NAME
  147. --disable-bsf=NAME disable bitstream filter NAME
  148. --disable-bsfs disable all bitstream filters
  149. --enable-protocol=NAME enable protocol NAME
  150. --disable-protocol=NAME disable protocol NAME
  151. --disable-protocols disable all protocols
  152. --enable-indev=NAME enable input device NAME
  153. --disable-indev=NAME disable input device NAME
  154. --disable-indevs disable input devices
  155. --enable-outdev=NAME enable output device NAME
  156. --disable-outdev=NAME disable output device NAME
  157. --disable-outdevs disable output devices
  158. --disable-devices disable all devices
  159. --enable-filter=NAME enable filter NAME
  160. --disable-filter=NAME disable filter NAME
  161. --disable-filters disable all filters
  162. External library support:
  163. --enable-avisynth enable reading of AviSynth script files [no]
  164. --enable-bzlib enable bzlib [autodetect]
  165. --enable-frei0r enable frei0r video filtering
  166. --enable-gnutls enable gnutls [no]
  167. --enable-libbs2b enable bs2b DSP library [no]
  168. --enable-libcdio enable audio CD grabbing with libcdio
  169. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  170. and libraw1394 [no]
  171. --enable-libdcadec enable DCA decoding via libdcadec [no]
  172. --enable-libfaac enable AAC encoding via libfaac [no]
  173. --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
  174. --enable-libfreetype enable libfreetype [no]
  175. --enable-libgsm enable GSM de/encoding via libgsm [no]
  176. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  177. --enable-libkvazaar enable HEVC encoding via libkvazaar [no]
  178. --enable-libmfx enable HW acceleration through libmfx
  179. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  180. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  181. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  182. --enable-libopencv enable video filtering via libopencv [no]
  183. --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
  184. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  185. --enable-libopus enable Opus de/encoding via libopus [no]
  186. --enable-libpulse enable Pulseaudio input via libpulse [no]
  187. --enable-librtmp enable RTMP[E] support via librtmp [no]
  188. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  189. --enable-libsnappy enable Snappy compression [no]
  190. --enable-libspeex enable Speex de/encoding via libspeex [no]
  191. --enable-libtheora enable Theora encoding via libtheora [no]
  192. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  193. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  194. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  195. --enable-libvorbis enable Vorbis encoding via libvorbis [no]
  196. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  197. --enable-libwavpack enable wavpack encoding via libwavpack [no]
  198. --enable-libwebp enable WebP encoding via libwebp [no]
  199. --enable-libx264 enable H.264 encoding via x264 [no]
  200. --enable-libx265 enable HEVC encoding via x265 [no]
  201. --enable-libxavs enable AVS encoding via xavs [no]
  202. --enable-libxcb enable X11 grabbing using XCB [no]
  203. --enable-libxcb-shm enable X11 grabbing shm communication [auto]
  204. --enable-libxcb-xfixes enable X11 grabbing mouse rendering [auto]
  205. --enable-libxvid enable Xvid encoding via xvidcore,
  206. native MPEG-4/Xvid encoder exists [no]
  207. --enable-mmal enable decoding via MMAL [no]
  208. --enable-nvenc enable encoding via NVENC [no]
  209. --enable-openssl enable openssl [no]
  210. --enable-x11grab enable X11 grabbing (legacy) [no]
  211. --enable-zlib enable zlib [autodetect]
  212. Toolchain options:
  213. --arch=ARCH select architecture [$arch]
  214. --cpu=CPU select the minimum required CPU (affects
  215. instruction selection, may crash on older CPUs)
  216. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  217. --enable-cross-compile assume a cross-compiler is used
  218. --sysroot=PATH root of cross-build tree
  219. --sysinclude=PATH location of cross-build system headers
  220. --target-os=OS compiler targets OS [$target_os]
  221. --target-exec=CMD command to run executables on target
  222. --target-path=DIR path to view of build directory on target
  223. --target-samples=DIR path to samples directory on target
  224. --toolchain=NAME set tool defaults according to NAME
  225. --nm=NM use nm tool
  226. --ar=AR use archive tool AR [$ar_default]
  227. --as=AS use assembler AS [$as_default]
  228. --cc=CC use C compiler CC [$cc_default]
  229. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  230. --ld=LD use linker LD
  231. --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
  232. --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  233. --host-cc=HOSTCC use host C compiler HOSTCC
  234. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  235. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  236. --host-ld=HOSTLD use host linker HOSTLD
  237. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  238. --host-libs=HLIBS use libs HLIBS when linking for host
  239. --host-os=OS compiler host OS [$target_os]
  240. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  241. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  242. --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
  243. --extra-libs=ELIBS add ELIBS [$ELIBS]
  244. --extra-version=STRING version string suffix []
  245. --optflags=OPTFLAGS override optimization-related compiler flags
  246. --build-suffix=SUFFIX library name suffix []
  247. --enable-pic build position-independent code
  248. --enable-thumb compile for Thumb instruction set
  249. --enable-lto use link-time optimization
  250. --env="ENV=override" override the environment variables
  251. Advanced options (experts only):
  252. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  253. --custom-allocator=NAME use a supported custom allocator
  254. --disable-symver disable symbol versioning
  255. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  256. --disable-safe-bitstream-reader
  257. disable buffer boundary checking in bitreaders
  258. (faster, but may crash)
  259. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  260. --enable-sram allow use of on-chip SRAM
  261. Optimization options (experts only):
  262. --disable-asm disable all assembly optimizations
  263. --disable-altivec disable AltiVec optimizations
  264. --disable-vsx disable VSX optimizations
  265. --disable-power8 disable POWER8 optimizations
  266. --disable-amd3dnow disable 3DNow! optimizations
  267. --disable-amd3dnowext disable 3DNow! extended optimizations
  268. --disable-mmx disable MMX optimizations
  269. --disable-mmxext disable MMXEXT optimizations
  270. --disable-sse disable SSE optimizations
  271. --disable-sse2 disable SSE2 optimizations
  272. --disable-sse3 disable SSE3 optimizations
  273. --disable-ssse3 disable SSSE3 optimizations
  274. --disable-sse4 disable SSE4 optimizations
  275. --disable-sse42 disable SSE4.2 optimizations
  276. --disable-avx disable AVX optimizations
  277. --disable-xop disable XOP optimizations
  278. --disable-fma3 disable FMA3 optimizations
  279. --disable-fma4 disable FMA4 optimizations
  280. --disable-avx2 disable AVX2 optimizations
  281. --disable-armv5te disable armv5te optimizations
  282. --disable-armv6 disable armv6 optimizations
  283. --disable-armv6t2 disable armv6t2 optimizations
  284. --disable-vfp disable VFP optimizations
  285. --disable-neon disable NEON optimizations
  286. --disable-inline-asm disable use of inline assembly
  287. --disable-yasm disable use of nasm/yasm assembly
  288. Developer options (useful when working on Libav itself):
  289. --disable-debug disable debugging symbols
  290. --enable-debug=LEVEL set the debug level [$debuglevel]
  291. --disable-optimizations disable compiler optimizations
  292. --enable-extra-warnings enable more compiler warnings
  293. --samples=PATH location of test samples for FATE, if not set use
  294. \$LIBAV_SAMPLES at make invocation time.
  295. --enable-neon-clobber-test check NEON registers for clobbering (should be
  296. used only for debugging purposes)
  297. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  298. should be used only for debugging purposes)
  299. --enable-random randomly enable/disable components
  300. --disable-random
  301. --enable-random=LIST randomly enable/disable specific components or
  302. --disable-random=LIST component groups. LIST is a comma-separated list
  303. of NAME[:PROB] entries where NAME is a component
  304. (group) and PROB the probability associated with
  305. NAME (default 0.5).
  306. --random-seed=VALUE seed value for --enable/disable-random
  307. --disable-valgrind-backtrace do not print a backtrace under Valgrind
  308. (only applies to --disable-optimizations builds)
  309. NOTE: Object files are built at the place where configure is launched.
  310. EOF
  311. exit 0
  312. }
  313. quotes='""'
  314. log(){
  315. echo "$@" >> $logfile
  316. }
  317. log_file(){
  318. log BEGIN $1
  319. pr -n -t $1 >> $logfile
  320. log END $1
  321. }
  322. echolog(){
  323. log "$@"
  324. echo "$@"
  325. }
  326. warn(){
  327. log "WARNING: $*"
  328. WARNINGS="${WARNINGS}WARNING: $*\n"
  329. }
  330. die(){
  331. echolog "$@"
  332. cat <<EOF
  333. If you think configure made a mistake, make sure you are using the latest
  334. version from Git. If the latest version fails, report the problem to the
  335. libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
  336. EOF
  337. if disabled logging; then
  338. cat <<EOF
  339. Rerun configure with logging enabled (do not use --disable-logging), and
  340. include the log this produces with your report.
  341. EOF
  342. else
  343. cat <<EOF
  344. Include the log file "$logfile" produced by configure as this will help
  345. solving the problem.
  346. EOF
  347. fi
  348. exit 1
  349. }
  350. # Avoid locale weirdness, besides we really just want to translate ASCII.
  351. toupper(){
  352. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  353. }
  354. tolower(){
  355. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  356. }
  357. c_escape(){
  358. echo "$*" | sed 's/["\\]/\\\0/g'
  359. }
  360. sh_quote(){
  361. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  362. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  363. echo "$v"
  364. }
  365. cleanws(){
  366. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  367. }
  368. filter(){
  369. pat=$1
  370. shift
  371. for v; do
  372. eval "case $v in $pat) echo $v ;; esac"
  373. done
  374. }
  375. filter_out(){
  376. pat=$1
  377. shift
  378. for v; do
  379. eval "case $v in $pat) ;; *) echo $v ;; esac"
  380. done
  381. }
  382. map(){
  383. m=$1
  384. shift
  385. for v; do eval $m; done
  386. }
  387. add_suffix(){
  388. suffix=$1
  389. shift
  390. for v; do echo ${v}${suffix}; done
  391. }
  392. set_all(){
  393. value=$1
  394. shift
  395. for var in $*; do
  396. eval $var=$value
  397. done
  398. }
  399. set_weak(){
  400. value=$1
  401. shift
  402. for var; do
  403. eval : \${$var:=$value}
  404. done
  405. }
  406. sanitize_var_name(){
  407. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  408. }
  409. set_safe(){
  410. var=$1
  411. shift
  412. eval $(sanitize_var_name "$var")='$*'
  413. }
  414. get_safe(){
  415. eval echo \$$(sanitize_var_name "$1")
  416. }
  417. pushvar(){
  418. for pvar in $*; do
  419. eval level=\${${pvar}_level:=0}
  420. eval ${pvar}_${level}="\$$pvar"
  421. eval ${pvar}_level=$(($level+1))
  422. done
  423. }
  424. popvar(){
  425. for pvar in $*; do
  426. eval level=\${${pvar}_level:-0}
  427. test $level = 0 && continue
  428. eval level=$(($level-1))
  429. eval $pvar="\${${pvar}_${level}}"
  430. eval ${pvar}_level=$level
  431. eval unset ${pvar}_${level}
  432. done
  433. }
  434. enable(){
  435. set_all yes $*
  436. }
  437. disable(){
  438. set_all no $*
  439. }
  440. enable_weak(){
  441. set_weak yes $*
  442. }
  443. disable_weak(){
  444. set_weak no $*
  445. }
  446. enable_safe(){
  447. for var; do
  448. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  449. done
  450. }
  451. disable_safe(){
  452. for var; do
  453. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  454. done
  455. }
  456. do_enable_deep(){
  457. for var; do
  458. enabled $var && continue
  459. eval sel="\$${var}_select"
  460. eval sgs="\$${var}_suggest"
  461. pushvar var sgs
  462. enable_deep $sel
  463. popvar sgs
  464. enable_deep_weak $sgs
  465. popvar var
  466. done
  467. }
  468. enable_deep(){
  469. do_enable_deep $*
  470. enable $*
  471. }
  472. enable_deep_weak(){
  473. for var; do
  474. disabled $var && continue
  475. pushvar var
  476. do_enable_deep $var
  477. popvar var
  478. enable_weak $var
  479. done
  480. }
  481. enabled(){
  482. test "${1#!}" = "$1" && op== || op=!=
  483. eval test "x\$${1#!}" $op "xyes"
  484. }
  485. disabled(){
  486. test "${1#!}" = "$1" && op== || op=!=
  487. eval test "x\$${1#!}" $op "xno"
  488. }
  489. enabled_all(){
  490. for opt; do
  491. enabled $opt || return 1
  492. done
  493. }
  494. disabled_all(){
  495. for opt; do
  496. disabled $opt || return 1
  497. done
  498. }
  499. enabled_any(){
  500. for opt; do
  501. enabled $opt && return 0
  502. done
  503. }
  504. disabled_any(){
  505. for opt; do
  506. disabled $opt && return 0
  507. done
  508. return 1
  509. }
  510. set_default(){
  511. for opt; do
  512. eval : \${$opt:=\$${opt}_default}
  513. done
  514. }
  515. is_in(){
  516. value=$1
  517. shift
  518. for var in $*; do
  519. [ $var = $value ] && return 0
  520. done
  521. return 1
  522. }
  523. do_check_deps(){
  524. for cfg; do
  525. cfg="${cfg#!}"
  526. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  527. disabled ${cfg}_checking && continue
  528. enable ${cfg}_checking
  529. append allopts $cfg
  530. eval dep_all="\$${cfg}_deps"
  531. eval dep_any="\$${cfg}_deps_any"
  532. eval dep_sel="\$${cfg}_select"
  533. eval dep_sgs="\$${cfg}_suggest"
  534. eval dep_ifa="\$${cfg}_if"
  535. eval dep_ifn="\$${cfg}_if_any"
  536. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  537. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  538. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  539. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  540. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  541. enabled_all $dep_all || disable $cfg
  542. enabled_any $dep_any || disable $cfg
  543. disabled_any $dep_sel && disable $cfg
  544. if enabled $cfg; then
  545. enable_deep $dep_sel
  546. enable_deep_weak $dep_sgs
  547. fi
  548. disable ${cfg}_checking
  549. done
  550. }
  551. check_deps(){
  552. unset allopts
  553. do_check_deps "$@"
  554. for cfg in $allopts; do
  555. enabled $cfg || continue
  556. eval dep_extralibs="\$${cfg}_extralibs"
  557. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  558. done
  559. }
  560. print_config(){
  561. pfx=$1
  562. files=$2
  563. shift 2
  564. map 'eval echo "$v \${$v:-no}"' "$@" |
  565. awk "BEGIN { split(\"$files\", files) }
  566. {
  567. c = \"$pfx\" toupper(\$1);
  568. v = \$2;
  569. sub(/yes/, 1, v);
  570. sub(/no/, 0, v);
  571. for (f in files) {
  572. file = files[f];
  573. if (file ~ /\\.h\$/) {
  574. printf(\"#define %s %d\\n\", c, v) >>file;
  575. } else if (file ~ /\\.asm\$/) {
  576. printf(\"%%define %s %d\\n\", c, v) >>file;
  577. } else if (file ~ /\\.mak\$/) {
  578. n = -v ? \"\" : \"!\";
  579. printf(\"%s%s=yes\\n\", n, c) >>file;
  580. }
  581. }
  582. }"
  583. }
  584. print_enabled(){
  585. suf=$1
  586. shift
  587. for v; do
  588. enabled $v && printf "%s\n" ${v%$suf};
  589. done
  590. }
  591. append(){
  592. var=$1
  593. shift
  594. eval "$var=\"\$$var $*\""
  595. }
  596. prepend(){
  597. var=$1
  598. shift
  599. eval "$var=\"$* \$$var\""
  600. }
  601. unique(){
  602. var=$1
  603. uniq_list=""
  604. for tok in $(eval echo \$$var); do
  605. uniq_list="$(filter_out $tok $uniq_list) $tok"
  606. done
  607. eval "$var=\"${uniq_list}\""
  608. }
  609. add_cppflags(){
  610. append CPPFLAGS "$@"
  611. }
  612. add_cflags(){
  613. append CFLAGS $($cflags_filter "$@")
  614. }
  615. add_asflags(){
  616. append ASFLAGS $($asflags_filter "$@")
  617. }
  618. add_ldflags(){
  619. append LDFLAGS $($ldflags_filter "$@")
  620. }
  621. add_ldexeflags(){
  622. append LDEXEFLAGS $($ldflags_filter "$@")
  623. }
  624. add_stripflags(){
  625. append STRIPFLAGS "$@"
  626. }
  627. add_extralibs(){
  628. prepend extralibs $($ldflags_filter "$@")
  629. }
  630. add_host_cppflags(){
  631. append host_cppflags "$@"
  632. }
  633. add_host_cflags(){
  634. append host_cflags $($host_cflags_filter "$@")
  635. }
  636. add_host_ldflags(){
  637. append host_ldflags $($host_ldflags_filter "$@")
  638. }
  639. add_compat(){
  640. append compat_objs $1
  641. shift
  642. map 'add_cppflags -D$v' "$@"
  643. }
  644. check_cmd(){
  645. log "$@"
  646. "$@" >> $logfile 2>&1
  647. }
  648. cc_o(){
  649. eval printf '%s\\n' $CC_O
  650. }
  651. cc_e(){
  652. eval printf '%s\\n' $CC_E
  653. }
  654. check_cc(){
  655. log check_cc "$@"
  656. cat > $TMPC
  657. log_file $TMPC
  658. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  659. }
  660. check_cpp(){
  661. log check_cpp "$@"
  662. cat > $TMPC
  663. log_file $TMPC
  664. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  665. }
  666. as_o(){
  667. eval printf '%s\\n' $AS_O
  668. }
  669. check_as(){
  670. log check_as "$@"
  671. cat > $TMPS
  672. log_file $TMPS
  673. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  674. }
  675. check_inline_asm(){
  676. log check_inline_asm "$@"
  677. name="$1"
  678. code="$2"
  679. shift 2
  680. disable $name
  681. check_cc "$@" <<EOF && enable $name
  682. void foo(void){ __asm__ volatile($code); }
  683. EOF
  684. }
  685. check_insn(){
  686. log check_insn "$@"
  687. check_inline_asm ${1}_inline "\"$2\""
  688. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  689. }
  690. check_yasm(){
  691. log check_yasm "$@"
  692. echo "$1" > $TMPS
  693. log_file $TMPS
  694. shift 1
  695. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  696. }
  697. ld_o(){
  698. eval printf '%s\\n' $LD_O
  699. }
  700. check_ld(){
  701. log check_ld "$@"
  702. flags=$(filter_out '-l*' "$@")
  703. libs=$(filter '-l*' "$@")
  704. check_cc $($cflags_filter $flags) || return
  705. flags=$($ldflags_filter $flags)
  706. libs=$($ldflags_filter $libs)
  707. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  708. }
  709. print_include(){
  710. hdr=$1
  711. test "${hdr%.h}" = "${hdr}" &&
  712. echo "#include $hdr" ||
  713. echo "#include <$hdr>"
  714. }
  715. check_code(){
  716. log check_code "$@"
  717. check=$1
  718. headers=$2
  719. code=$3
  720. shift 3
  721. {
  722. for hdr in $headers; do
  723. print_include $hdr
  724. done
  725. echo "int main(void) { $code; return 0; }"
  726. } | check_$check "$@"
  727. }
  728. check_cppflags(){
  729. log check_cppflags "$@"
  730. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  731. int x;
  732. EOF
  733. }
  734. test_cflags(){
  735. log test_cflags "$@"
  736. set -- $($cflags_filter "$@")
  737. check_cc "$@" <<EOF
  738. int x;
  739. EOF
  740. }
  741. check_cflags(){
  742. log check_cflags "$@"
  743. test_cflags "$@" && add_cflags "$@"
  744. }
  745. test_ldflags(){
  746. log test_ldflags "$@"
  747. check_ld "$@" <<EOF
  748. int main(void){ return 0; }
  749. EOF
  750. }
  751. check_ldflags(){
  752. log check_ldflags "$@"
  753. test_ldflags "$@" && add_ldflags "$@"
  754. }
  755. test_stripflags(){
  756. log test_stripflags "$@"
  757. # call check_cc to get a fresh TMPO
  758. check_cc <<EOF
  759. int main(void) { return 0; }
  760. EOF
  761. check_cmd $strip $STRIPFLAGS "$@" $TMPO
  762. }
  763. check_stripflags(){
  764. log check_stripflags "$@"
  765. test_stripflags "$@" && add_stripflags "$@"
  766. }
  767. check_header(){
  768. log check_header "$@"
  769. header=$1
  770. shift
  771. disable_safe $header
  772. check_cpp "$@" <<EOF && enable_safe $header
  773. #include <$header>
  774. int x;
  775. EOF
  776. }
  777. check_func(){
  778. log check_func "$@"
  779. func=$1
  780. shift
  781. disable $func
  782. check_ld "$@" <<EOF && enable $func
  783. extern int $func();
  784. int main(void){ $func(); }
  785. EOF
  786. }
  787. check_mathfunc(){
  788. log check_mathfunc "$@"
  789. func=$1
  790. narg=$2
  791. shift 2
  792. test $narg = 2 && args="f, g" || args="f"
  793. disable $func
  794. check_ld "$@" <<EOF && enable $func
  795. #include <math.h>
  796. float foo(float f, float g) { return $func($args); }
  797. int main(void){ return 0; }
  798. EOF
  799. }
  800. check_func_headers(){
  801. log check_func_headers "$@"
  802. headers=$1
  803. funcs=$2
  804. shift 2
  805. {
  806. for hdr in $headers; do
  807. print_include $hdr
  808. done
  809. for func in $funcs; do
  810. echo "long check_$func(void) { return (long) $func; }"
  811. done
  812. echo "int main(void) { return 0; }"
  813. } | check_ld "$@" && enable $funcs && enable_safe $headers
  814. }
  815. check_cpp_condition(){
  816. log check_cpp_condition "$@"
  817. header=$1
  818. condition=$2
  819. shift 2
  820. check_cpp "$@" <<EOF
  821. #include <$header>
  822. #if !($condition)
  823. #error "unsatisfied condition: $condition"
  824. #endif
  825. EOF
  826. }
  827. check_lib(){
  828. log check_lib "$@"
  829. header="$1"
  830. func="$2"
  831. shift 2
  832. check_header $header && check_func $func "$@" && add_extralibs "$@"
  833. }
  834. check_lib2(){
  835. log check_lib2 "$@"
  836. headers="$1"
  837. funcs="$2"
  838. shift 2
  839. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  840. }
  841. check_pkg_config(){
  842. log check_pkg_config "$@"
  843. pkg="$1"
  844. headers="$2"
  845. funcs="$3"
  846. shift 3
  847. check_cmd $pkg_config --exists --print-errors $pkg || return
  848. pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
  849. pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
  850. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  851. set_safe "${pkg}_cflags" $pkg_cflags &&
  852. set_safe "${pkg}_libs" $pkg_libs
  853. }
  854. check_exec(){
  855. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  856. }
  857. check_exec_crash(){
  858. code=$(cat)
  859. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  860. # are safe but may not be available everywhere. Thus we use
  861. # raise(SIGTERM) instead. The check is run in a subshell so we
  862. # can redirect the "Terminated" message from the shell. SIGBUS
  863. # is not defined by standard C so it is used conditionally.
  864. (check_exec "$@") >> $logfile 2>&1 <<EOF
  865. #include <signal.h>
  866. static void sighandler(int sig){
  867. raise(SIGTERM);
  868. }
  869. int foo(void){
  870. $code
  871. }
  872. int (*func_ptr)(void) = foo;
  873. int main(void){
  874. signal(SIGILL, sighandler);
  875. signal(SIGFPE, sighandler);
  876. signal(SIGSEGV, sighandler);
  877. #ifdef SIGBUS
  878. signal(SIGBUS, sighandler);
  879. #endif
  880. return func_ptr();
  881. }
  882. EOF
  883. }
  884. check_type(){
  885. log check_type "$@"
  886. headers=$1
  887. type=$2
  888. shift 2
  889. disable_safe "$type"
  890. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  891. }
  892. check_struct(){
  893. log check_struct "$@"
  894. headers=$1
  895. struct=$2
  896. member=$3
  897. shift 3
  898. disable_safe "${struct}_${member}"
  899. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  900. enable_safe "${struct}_${member}"
  901. }
  902. check_builtin(){
  903. log check_builtin "$@"
  904. name=$1
  905. headers=$2
  906. builtin=$3
  907. shift 3
  908. disable "$name"
  909. check_code ld "$headers" "$builtin" "$@" && enable "$name"
  910. }
  911. check_compile_assert(){
  912. log check_compile_assert "$@"
  913. name=$1
  914. headers=$2
  915. condition=$3
  916. shift 3
  917. disable "$name"
  918. check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
  919. }
  920. require(){
  921. name="$1"
  922. header="$2"
  923. func="$3"
  924. shift 3
  925. check_lib $header $func "$@" || die "ERROR: $name not found"
  926. }
  927. require2(){
  928. name="$1"
  929. headers="$2"
  930. func="$3"
  931. shift 3
  932. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  933. }
  934. require_pkg_config(){
  935. pkg="$1"
  936. check_pkg_config "$@" || die "ERROR: $pkg not found"
  937. add_cflags $(get_safe "${pkg}_cflags")
  938. add_extralibs $(get_safe "${pkg}_libs")
  939. }
  940. hostcc_e(){
  941. eval printf '%s\\n' $HOSTCC_E
  942. }
  943. hostcc_o(){
  944. eval printf '%s\\n' $HOSTCC_O
  945. }
  946. check_host_cc(){
  947. log check_host_cc "$@"
  948. cat > $TMPC
  949. log_file $TMPC
  950. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  951. }
  952. check_host_cpp(){
  953. log check_host_cpp "$@"
  954. cat > $TMPC
  955. log_file $TMPC
  956. check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
  957. }
  958. check_host_cppflags(){
  959. log check_host_cppflags "$@"
  960. check_host_cc "$@" <<EOF && append host_cppflags "$@"
  961. int x;
  962. EOF
  963. }
  964. check_host_cflags(){
  965. log check_host_cflags "$@"
  966. set -- $($host_cflags_filter "$@")
  967. check_host_cc "$@" <<EOF && append host_cflags "$@"
  968. int x;
  969. EOF
  970. }
  971. check_host_cpp_condition(){
  972. log check_host_cpp_condition "$@"
  973. header=$1
  974. condition=$2
  975. shift 2
  976. check_host_cpp "$@" <<EOF
  977. #include <$header>
  978. #if !($condition)
  979. #error "unsatisfied condition: $condition"
  980. #endif
  981. EOF
  982. }
  983. apply(){
  984. file=$1
  985. shift
  986. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  987. }
  988. cp_if_changed(){
  989. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  990. mkdir -p "$(dirname $2)"
  991. $cp_f "$1" "$2"
  992. }
  993. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  994. # system-dependent things.
  995. AVCODEC_COMPONENTS="
  996. bsfs
  997. decoders
  998. encoders
  999. hwaccels
  1000. parsers
  1001. "
  1002. AVDEVICE_COMPONENTS="
  1003. indevs
  1004. outdevs
  1005. "
  1006. AVFILTER_COMPONENTS="
  1007. filters
  1008. "
  1009. AVFORMAT_COMPONENTS="
  1010. demuxers
  1011. muxers
  1012. protocols
  1013. "
  1014. AVRESAMPLE_COMPONENTS=""
  1015. AVUTIL_COMPONENTS=""
  1016. COMPONENT_LIST="
  1017. $AVCODEC_COMPONENTS
  1018. $AVDEVICE_COMPONENTS
  1019. $AVFILTER_COMPONENTS
  1020. $AVFORMAT_COMPONENTS
  1021. $AVRESAMPLE_COMPONENTS
  1022. $AVUTIL_COMPONENTS
  1023. "
  1024. EXAMPLE_LIST="
  1025. avcodec_example
  1026. filter_audio_example
  1027. metadata_example
  1028. output_example
  1029. qsvdec_example
  1030. transcode_aac_example
  1031. "
  1032. EXTERNAL_LIBRARY_LIST="
  1033. avisynth
  1034. bzlib
  1035. frei0r
  1036. gnutls
  1037. libbs2b
  1038. libcdio
  1039. libdc1394
  1040. libdcadec
  1041. libfaac
  1042. libfdk_aac
  1043. libfontconfig
  1044. libfreetype
  1045. libgsm
  1046. libilbc
  1047. libkvazaar
  1048. libmfx
  1049. libmp3lame
  1050. libopencore_amrnb
  1051. libopencore_amrwb
  1052. libopencv
  1053. libopenh264
  1054. libopenjpeg
  1055. libopus
  1056. libpulse
  1057. librtmp
  1058. libschroedinger
  1059. libsnappy
  1060. libspeex
  1061. libtheora
  1062. libtwolame
  1063. libvo_aacenc
  1064. libvo_amrwbenc
  1065. libvorbis
  1066. libvpx
  1067. libwavpack
  1068. libwebp
  1069. libx264
  1070. libx265
  1071. libxavs
  1072. libxcb
  1073. libxcb_shm
  1074. libxcb_xfixes
  1075. libxvid
  1076. mmal
  1077. nvenc
  1078. openssl
  1079. x11grab
  1080. zlib
  1081. "
  1082. FEATURE_LIST="
  1083. gray
  1084. hardcoded_tables
  1085. runtime_cpudetect
  1086. safe_bitstream_reader
  1087. shared
  1088. small
  1089. sram
  1090. static
  1091. swscale_alpha
  1092. "
  1093. HWACCEL_LIST="
  1094. d3d11va
  1095. dxva2
  1096. vaapi
  1097. vda
  1098. vdpau
  1099. "
  1100. LIBRARY_LIST="
  1101. avcodec
  1102. avdevice
  1103. avfilter
  1104. avformat
  1105. avresample
  1106. avutil
  1107. swscale
  1108. "
  1109. LICENSE_LIST="
  1110. gpl
  1111. nonfree
  1112. version3
  1113. "
  1114. PROGRAM_LIST="
  1115. avconv
  1116. avplay
  1117. avprobe
  1118. "
  1119. SUBSYSTEM_LIST="
  1120. dct
  1121. doc
  1122. error_resilience
  1123. faan
  1124. fft
  1125. lsp
  1126. lzo
  1127. mdct
  1128. network
  1129. rdft
  1130. "
  1131. CONFIG_LIST="
  1132. $COMPONENT_LIST
  1133. $EXAMPLE_LIST
  1134. $EXTERNAL_LIBRARY_LIST
  1135. $FEATURE_LIST
  1136. $HWACCEL_LIST
  1137. $LICENSE_LIST
  1138. $LIBRARY_LIST
  1139. $PROGRAM_LIST
  1140. $SUBSYSTEM_LIST
  1141. memalign_hack
  1142. neon_clobber_test
  1143. pic
  1144. pod2man
  1145. texi2html
  1146. thumb
  1147. valgrind_backtrace
  1148. xmm_clobber_test
  1149. "
  1150. THREADS_LIST="
  1151. pthreads
  1152. w32threads
  1153. "
  1154. ATOMICS_LIST="
  1155. atomics_gcc
  1156. atomics_suncc
  1157. atomics_win32
  1158. "
  1159. ARCH_LIST="
  1160. aarch64
  1161. alpha
  1162. arm
  1163. avr32
  1164. avr32_ap
  1165. avr32_uc
  1166. bfin
  1167. ia64
  1168. m68k
  1169. mips
  1170. mips64
  1171. parisc
  1172. ppc
  1173. ppc64
  1174. s390
  1175. sh4
  1176. sparc
  1177. sparc64
  1178. tilegx
  1179. tilepro
  1180. tomi
  1181. x86
  1182. x86_32
  1183. x86_64
  1184. "
  1185. ARCH_EXT_LIST_ARM="
  1186. armv5te
  1187. armv6
  1188. armv6t2
  1189. armv8
  1190. neon
  1191. vfp
  1192. vfpv3
  1193. "
  1194. ARCH_EXT_LIST_X86_SIMD="
  1195. amd3dnow
  1196. amd3dnowext
  1197. avx
  1198. avx2
  1199. fma3
  1200. fma4
  1201. mmx
  1202. mmxext
  1203. sse
  1204. sse2
  1205. sse3
  1206. sse4
  1207. sse42
  1208. ssse3
  1209. xop
  1210. "
  1211. ARCH_EXT_LIST_PPC="
  1212. altivec
  1213. dcbzl
  1214. ldbrx
  1215. power8
  1216. ppc4xx
  1217. vsx
  1218. "
  1219. ARCH_EXT_LIST_X86="
  1220. $ARCH_EXT_LIST_X86_SIMD
  1221. cpunop
  1222. i686
  1223. "
  1224. ARCH_EXT_LIST_MIPS="
  1225. loongson
  1226. mips32r1
  1227. mips64r1
  1228. mips32r2
  1229. mips64r2
  1230. mips32r6
  1231. mips64r6
  1232. "
  1233. ARCH_EXT_LIST="
  1234. $ARCH_EXT_LIST_ARM
  1235. $ARCH_EXT_LIST_MIPS
  1236. $ARCH_EXT_LIST_PPC
  1237. $ARCH_EXT_LIST_X86
  1238. vis
  1239. "
  1240. ARCH_FEATURES="
  1241. aligned_stack
  1242. fast_64bit
  1243. fast_clz
  1244. fast_cmov
  1245. local_aligned_8
  1246. local_aligned_16
  1247. simd_align_16
  1248. "
  1249. BUILTIN_LIST="
  1250. atomic_cas_ptr
  1251. machine_rw_barrier
  1252. MemoryBarrier
  1253. mm_empty
  1254. rdtsc
  1255. sync_val_compare_and_swap
  1256. "
  1257. HAVE_LIST_CMDLINE="
  1258. inline_asm
  1259. symver
  1260. yasm
  1261. "
  1262. HAVE_LIST_PUB="
  1263. bigendian
  1264. fast_unaligned
  1265. "
  1266. HEADERS_LIST="
  1267. alsa_asoundlib_h
  1268. altivec_h
  1269. arpa_inet_h
  1270. cdio_paranoia_h
  1271. cdio_paranoia_paranoia_h
  1272. dev_bktr_ioctl_bt848_h
  1273. dev_bktr_ioctl_meteor_h
  1274. dev_ic_bt8xx_h
  1275. dev_video_bktr_ioctl_bt848_h
  1276. dev_video_meteor_ioctl_meteor_h
  1277. direct_h
  1278. dlfcn_h
  1279. d3d11_h
  1280. dxva_h
  1281. gsm_h
  1282. io_h
  1283. mach_mach_time_h
  1284. machine_ioctl_bt848_h
  1285. machine_ioctl_meteor_h
  1286. malloc_h
  1287. poll_h
  1288. sndio_h
  1289. soundcard_h
  1290. sys_mman_h
  1291. sys_param_h
  1292. sys_resource_h
  1293. sys_select_h
  1294. sys_soundcard_h
  1295. sys_time_h
  1296. sys_un_h
  1297. sys_videoio_h
  1298. unistd_h
  1299. valgrind_valgrind_h
  1300. windows_h
  1301. winsock2_h
  1302. "
  1303. INTRINSICS_LIST="
  1304. intrinsics_neon
  1305. "
  1306. MATH_FUNCS="
  1307. atanf
  1308. atan2f
  1309. cbrtf
  1310. cosf
  1311. exp2
  1312. exp2f
  1313. expf
  1314. isinf
  1315. isnan
  1316. ldexpf
  1317. llrint
  1318. llrintf
  1319. log2
  1320. log2f
  1321. log10f
  1322. lrint
  1323. lrintf
  1324. powf
  1325. rint
  1326. round
  1327. roundf
  1328. sinf
  1329. trunc
  1330. truncf
  1331. "
  1332. SYSTEM_FUNCS="
  1333. aligned_malloc
  1334. clock_gettime
  1335. closesocket
  1336. CommandLineToArgvW
  1337. CoTaskMemFree
  1338. CryptGenRandom
  1339. dlopen
  1340. fcntl
  1341. flt_lim
  1342. fork
  1343. getaddrinfo
  1344. gethrtime
  1345. getopt
  1346. GetProcessAffinityMask
  1347. GetProcessMemoryInfo
  1348. GetProcessTimes
  1349. getrusage
  1350. GetSystemTimeAsFileTime
  1351. gettimeofday
  1352. gmtime_r
  1353. inet_aton
  1354. isatty
  1355. jack_port_get_latency_range
  1356. LoadLibrary
  1357. localtime_r
  1358. mach_absolute_time
  1359. MapViewOfFile
  1360. memalign
  1361. mkstemp
  1362. mmap
  1363. mprotect
  1364. nanosleep
  1365. posix_memalign
  1366. sched_getaffinity
  1367. SetConsoleTextAttribute
  1368. setmode
  1369. setrlimit
  1370. Sleep
  1371. strerror_r
  1372. sysconf
  1373. sysctl
  1374. usleep
  1375. VirtualAlloc
  1376. "
  1377. TOOLCHAIN_FEATURES="
  1378. as_dn_directive
  1379. as_func
  1380. as_object_arch
  1381. asm_mod_q
  1382. attribute_may_alias
  1383. attribute_packed
  1384. ebp_available
  1385. ebx_available
  1386. gnu_as
  1387. ibm_asm
  1388. inline_asm_labels
  1389. pragma_deprecated
  1390. symver_asm_label
  1391. symver_gnu_asm
  1392. vfp_args
  1393. xform_asm
  1394. xmm_clobbers
  1395. "
  1396. TYPES_LIST="
  1397. CONDITION_VARIABLE_Ptr
  1398. socklen_t
  1399. struct_addrinfo
  1400. struct_group_source_req
  1401. struct_ip_mreq_source
  1402. struct_ipv6_mreq
  1403. struct_pollfd
  1404. struct_rusage_ru_maxrss
  1405. struct_sockaddr_in6
  1406. struct_sockaddr_sa_len
  1407. struct_sockaddr_storage
  1408. struct_v4l2_frmivalenum_discrete
  1409. "
  1410. HAVE_LIST="
  1411. $ARCH_EXT_LIST
  1412. $(add_suffix _external $ARCH_EXT_LIST)
  1413. $(add_suffix _inline $ARCH_EXT_LIST)
  1414. $ARCH_FEATURES
  1415. $ATOMICS_LIST
  1416. $BUILTIN_LIST
  1417. $HAVE_LIST_CMDLINE
  1418. $HAVE_LIST_PUB
  1419. $HEADERS_LIST
  1420. $INTRINSICS_LIST
  1421. $MATH_FUNCS
  1422. $SYSTEM_FUNCS
  1423. $THREADS_LIST
  1424. $TOOLCHAIN_FEATURES
  1425. $TYPES_LIST
  1426. atomics_native
  1427. dos_paths
  1428. dxva2_lib
  1429. libc_msvcrt
  1430. libdc1394_1
  1431. libdc1394_2
  1432. sdl
  1433. section_data_rel_ro
  1434. threads
  1435. vaapi_x11
  1436. vdpau_x11
  1437. xlib
  1438. "
  1439. # options emitted with CONFIG_ prefix but not available on the command line
  1440. CONFIG_EXTRA="
  1441. aandcttables
  1442. ac3dsp
  1443. audio_frame_queue
  1444. audiodsp
  1445. blockdsp
  1446. bswapdsp
  1447. cabac
  1448. dvprofile
  1449. faandct
  1450. faanidct
  1451. fdctdsp
  1452. flacdsp
  1453. fmtconvert
  1454. g722dsp
  1455. gcrypt
  1456. gmp
  1457. golomb
  1458. gplv3
  1459. h263dsp
  1460. h264chroma
  1461. h264dsp
  1462. h264pred
  1463. h264qpel
  1464. hpeldsp
  1465. huffman
  1466. huffyuvdsp
  1467. huffyuvencdsp
  1468. idctdsp
  1469. iirfilter
  1470. imdct15
  1471. intrax8
  1472. ividsp
  1473. jpegtables
  1474. libx262
  1475. lgplv3
  1476. lpc
  1477. lzf
  1478. me_cmp
  1479. mpeg_er
  1480. mpegaudio
  1481. mpegaudiodsp
  1482. mpegvideo
  1483. mpegvideoenc
  1484. mss34dsp
  1485. pixblockdsp
  1486. qpeldsp
  1487. qsv
  1488. qsvdec
  1489. qsvenc
  1490. rangecoder
  1491. riffdec
  1492. riffenc
  1493. rtpdec
  1494. rtpenc_chain
  1495. rv34dsp
  1496. sinewin
  1497. snappy
  1498. startcode
  1499. texturedsp
  1500. texturedspenc
  1501. tpeldsp
  1502. videodsp
  1503. vp3dsp
  1504. vp56dsp
  1505. vp8dsp
  1506. wma_freqs
  1507. wmv2dsp
  1508. "
  1509. CMDLINE_SELECT="
  1510. $ARCH_EXT_LIST
  1511. $CONFIG_LIST
  1512. $HAVE_LIST_CMDLINE
  1513. $THREADS_LIST
  1514. asm
  1515. cross_compile
  1516. debug
  1517. extra_warnings
  1518. logging
  1519. lto
  1520. optimizations
  1521. rpath
  1522. "
  1523. PATHS_LIST="
  1524. bindir
  1525. datadir
  1526. docdir
  1527. incdir
  1528. libdir
  1529. mandir
  1530. prefix
  1531. shlibdir
  1532. "
  1533. CMDLINE_SET="
  1534. $PATHS_LIST
  1535. ar
  1536. arch
  1537. as
  1538. build_suffix
  1539. cc
  1540. cpu
  1541. cross_prefix
  1542. custom_allocator
  1543. dep_cc
  1544. env
  1545. extra_version
  1546. host_cc
  1547. host_cflags
  1548. host_ld
  1549. host_ldflags
  1550. host_libs
  1551. host_os
  1552. ld
  1553. logfile
  1554. malloc_prefix
  1555. nm
  1556. optflags
  1557. pkg_config
  1558. pkg_config_flags
  1559. random_seed
  1560. samples
  1561. sysinclude
  1562. sysroot
  1563. target_exec
  1564. target_os
  1565. target_path
  1566. target_samples
  1567. toolchain
  1568. "
  1569. CMDLINE_APPEND="
  1570. extra_cflags
  1571. host_cppflags
  1572. "
  1573. # code dependency declarations
  1574. # architecture extensions
  1575. armv5te_deps="arm"
  1576. armv6_deps="arm"
  1577. armv6t2_deps="arm"
  1578. armv8_deps="aarch64"
  1579. neon_deps_any="aarch64 arm"
  1580. intrinsics_neon_deps="neon"
  1581. vfp_deps_any="aarch64 arm"
  1582. vfpv3_deps="vfp"
  1583. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1584. altivec_deps="ppc"
  1585. ppc4xx_deps="ppc"
  1586. vsx_deps="altivec"
  1587. power8_deps="vsx"
  1588. cpunop_deps="i686"
  1589. x86_64_select="i686"
  1590. x86_64_suggest="fast_cmov"
  1591. amd3dnow_deps="mmx"
  1592. amd3dnowext_deps="amd3dnow"
  1593. i686_deps="x86"
  1594. mmx_deps="x86"
  1595. mmxext_deps="mmx"
  1596. sse_deps="mmxext"
  1597. sse2_deps="sse"
  1598. sse3_deps="sse2"
  1599. ssse3_deps="sse3"
  1600. sse4_deps="ssse3"
  1601. sse42_deps="sse4"
  1602. avx_deps="sse42"
  1603. xop_deps="avx"
  1604. fma3_deps="avx"
  1605. fma4_deps="avx"
  1606. avx2_deps="avx"
  1607. mmx_external_deps="yasm"
  1608. mmx_inline_deps="inline_asm"
  1609. mmx_suggest="mmx_external mmx_inline"
  1610. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  1611. eval dep=\$${ext}_deps
  1612. eval ${ext}_external_deps='"${dep}_external"'
  1613. eval ${ext}_inline_deps='"${dep}_inline"'
  1614. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1615. done
  1616. aligned_stack_if_any="aarch64 ppc x86"
  1617. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1618. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  1619. fast_unaligned_if_any="aarch64 ppc x86"
  1620. simd_align_16_if_any="altivec neon sse"
  1621. # system capabilities
  1622. symver_if_any="symver_asm_label symver_gnu_asm"
  1623. valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
  1624. # threading support
  1625. atomics_gcc_if="sync_val_compare_and_swap"
  1626. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1627. atomics_win32_if="MemoryBarrier"
  1628. atomics_native_if_any="$ATOMICS_LIST"
  1629. w32threads_deps="atomics_native"
  1630. threads_if_any="$THREADS_LIST"
  1631. # subsystems
  1632. dct_select="rdft"
  1633. error_resilience_select="me_cmp"
  1634. faandct_deps="faan fdctdsp"
  1635. faanidct_deps="faan idctdsp"
  1636. intrax8_select="error_resilience"
  1637. mdct_select="fft"
  1638. rdft_select="fft"
  1639. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  1640. mpeg_er_select="error_resilience"
  1641. mpegaudio_select="mpegaudiodsp"
  1642. mpegaudiodsp_select="dct"
  1643. mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp videodsp"
  1644. mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
  1645. nvenc_deps_any="dlopen LoadLibrary"
  1646. nvenc_extralibs='$ldl'
  1647. qsvdec_select="qsv"
  1648. qsvenc_select="qsv"
  1649. # decoders / encoders
  1650. aac_decoder_select="imdct15 mdct sinewin"
  1651. aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
  1652. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1653. ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
  1654. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1655. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1656. adpcm_g722_decoder_select="g722dsp"
  1657. adpcm_g722_encoder_select="g722dsp"
  1658. aic_decoder_select="golomb idctdsp"
  1659. alac_encoder_select="lpc"
  1660. als_decoder_select="bswapdsp"
  1661. amrnb_decoder_select="lsp"
  1662. amrwb_decoder_select="lsp"
  1663. amv_decoder_select="sp5x_decoder"
  1664. ape_decoder_select="bswapdsp"
  1665. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  1666. asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1667. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  1668. asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1669. atrac1_decoder_select="mdct sinewin"
  1670. atrac3_decoder_select="mdct"
  1671. atrac3p_decoder_select="mdct sinewin"
  1672. bink_decoder_select="blockdsp hpeldsp"
  1673. binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
  1674. binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
  1675. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  1676. cllc_decoder_select="bswapdsp"
  1677. comfortnoise_encoder_select="lpc"
  1678. cook_decoder_select="audiodsp mdct sinewin"
  1679. cscd_decoder_select="lzo"
  1680. cscd_decoder_suggest="zlib"
  1681. dca_decoder_select="fmtconvert mdct"
  1682. dds_decoder_select="texturedsp"
  1683. dnxhd_decoder_select="blockdsp idctdsp"
  1684. dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  1685. dvvideo_decoder_select="dvprofile idctdsp"
  1686. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  1687. dxa_decoder_deps="zlib"
  1688. dxv_decoder_select="lzf texturedsp"
  1689. eac3_decoder_select="ac3_decoder"
  1690. eac3_encoder_select="ac3_encoder"
  1691. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  1692. eatgq_decoder_select="aandcttables idctdsp"
  1693. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder"
  1694. exr_decoder_deps="zlib"
  1695. ffv1_decoder_select="golomb rangecoder"
  1696. ffv1_encoder_select="rangecoder"
  1697. ffvhuff_decoder_select="huffyuv_decoder"
  1698. ffvhuff_encoder_select="huffyuv_encoder"
  1699. fic_decoder_select="golomb"
  1700. flac_decoder_select="flacdsp golomb"
  1701. flac_encoder_select="bswapdsp flacdsp golomb lpc"
  1702. flashsv_decoder_deps="zlib"
  1703. flashsv_encoder_deps="zlib"
  1704. flashsv2_decoder_deps="zlib"
  1705. flv_decoder_select="h263_decoder"
  1706. flv_encoder_select="h263_encoder"
  1707. fourxm_decoder_select="blockdsp bswapdsp"
  1708. fraps_decoder_select="bswapdsp huffman"
  1709. g2m_decoder_deps="zlib"
  1710. g2m_decoder_select="blockdsp idctdsp jpegtables"
  1711. h261_decoder_select="mpeg_er mpegvideo"
  1712. h261_encoder_select="aandcttables mpegvideoenc"
  1713. h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
  1714. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1715. h263i_decoder_select="h263_decoder"
  1716. h263p_encoder_select="h263_encoder"
  1717. h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
  1718. h264_decoder_suggest="error_resilience"
  1719. h264_nvenc_encoder_deps="nvenc"
  1720. h264_qsv_decoder_deps="libmfx"
  1721. h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
  1722. h264_qsv_encoder_deps="libmfx"
  1723. h264_qsv_encoder_select="qsvenc"
  1724. hap_decoder_select="snappy texturedsp"
  1725. hap_encoder_deps="libsnappy"
  1726. hap_encoder_select="texturedspenc"
  1727. hevc_decoder_select="bswapdsp cabac golomb videodsp"
  1728. hevc_nvenc_encoder_deps="nvenc"
  1729. hevc_qsv_encoder_deps="libmfx"
  1730. hevc_qsv_decoder_deps="libmfx"
  1731. hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
  1732. hevc_qsv_encoder_select="qsvenc"
  1733. huffyuv_decoder_select="bswapdsp huffyuvdsp"
  1734. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
  1735. iac_decoder_select="imc_decoder"
  1736. imc_decoder_select="bswapdsp fft mdct sinewin"
  1737. indeo3_decoder_select="hpeldsp"
  1738. indeo4_decoder_select="ividsp"
  1739. indeo5_decoder_select="ividsp"
  1740. interplay_video_decoder_select="hpeldsp"
  1741. jpegls_decoder_select="golomb mjpeg_decoder"
  1742. jpegls_encoder_select="golomb"
  1743. jv_decoder_select="blockdsp"
  1744. lagarith_decoder_select="huffyuvdsp"
  1745. ljpeg_encoder_select="aandcttables idctdsp jpegtables"
  1746. loco_decoder_select="golomb"
  1747. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  1748. metasound_decoder_select="lsp mdct sinewin"
  1749. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  1750. mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
  1751. mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
  1752. mjpegb_decoder_select="mjpeg_decoder"
  1753. mlp_decoder_select="mlp_parser"
  1754. motionpixels_decoder_select="bswapdsp"
  1755. mp1_decoder_select="mpegaudio"
  1756. mp1float_decoder_select="mpegaudio"
  1757. mp2_decoder_select="mpegaudio"
  1758. mp2float_decoder_select="mpegaudio"
  1759. mp3_decoder_select="mpegaudio"
  1760. mp3adu_decoder_select="mpegaudio"
  1761. mp3adufloat_decoder_select="mpegaudio"
  1762. mp3float_decoder_select="mpegaudio"
  1763. mp3on4_decoder_select="mpegaudio"
  1764. mp3on4float_decoder_select="mpegaudio"
  1765. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  1766. mpc8_decoder_select="mpegaudiodsp"
  1767. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1768. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1769. mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
  1770. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1771. mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
  1772. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1773. mpeg2_qsv_decoder_deps="libmfx"
  1774. mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser"
  1775. mpeg2_qsv_encoder_deps="libmfx"
  1776. mpeg2_qsv_encoder_select="qsvenc"
  1777. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1778. mpeg4_encoder_select="h263_encoder"
  1779. msa1_decoder_select="mss34dsp"
  1780. msmpeg4v1_decoder_select="h263_decoder"
  1781. msmpeg4v2_decoder_select="h263_decoder"
  1782. msmpeg4v2_encoder_select="h263_encoder"
  1783. msmpeg4v3_decoder_select="h263_decoder"
  1784. msmpeg4v3_encoder_select="h263_encoder"
  1785. mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder"
  1786. mts2_decoder_select="mss34dsp"
  1787. mxpeg_decoder_select="mjpeg_decoder"
  1788. nellymoser_decoder_select="mdct sinewin"
  1789. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1790. nuv_decoder_select="idctdsp lzo"
  1791. on2avc_decoder_select="mdct"
  1792. opus_decoder_deps="avresample"
  1793. opus_decoder_select="imdct15"
  1794. png_decoder_deps="zlib"
  1795. png_encoder_deps="zlib"
  1796. png_encoder_select="huffyuvencdsp"
  1797. prores_decoder_select="idctdsp"
  1798. prores_encoder_select="fdctdsp"
  1799. qcelp_decoder_select="lsp"
  1800. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1801. ra_144_encoder_select="audio_frame_queue lpc"
  1802. ralf_decoder_select="golomb"
  1803. rscc_decoder_deps="zlib"
  1804. rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1805. rv10_encoder_select="h263_encoder"
  1806. rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1807. rv20_encoder_select="h263_encoder"
  1808. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
  1809. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
  1810. screenpresso_decoder_deps="zlib"
  1811. shorten_decoder_select="golomb"
  1812. sipr_decoder_select="lsp"
  1813. sp5x_decoder_select="mjpeg_decoder"
  1814. svq1_decoder_select="hpeldsp"
  1815. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  1816. svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  1817. svq3_decoder_suggest="zlib"
  1818. tak_decoder_select="audiodsp"
  1819. tdsc_decoder_deps="zlib"
  1820. tdsc_decoder_select="mjpeg_decoder"
  1821. theora_decoder_select="vp3_decoder"
  1822. thp_decoder_select="mjpeg_decoder"
  1823. tiff_decoder_suggest="zlib"
  1824. tiff_encoder_suggest="zlib"
  1825. truehd_decoder_select="mlp_decoder"
  1826. truemotion2_decoder_select="bswapdsp"
  1827. truespeech_decoder_select="bswapdsp"
  1828. tscc_decoder_deps="zlib"
  1829. txd_decoder_select="texturedsp"
  1830. twinvq_decoder_select="mdct lsp sinewin"
  1831. utvideo_decoder_select="bswapdsp"
  1832. utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  1833. vble_decoder_select="huffyuvdsp"
  1834. vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp startcode"
  1835. vc1image_decoder_select="vc1_decoder"
  1836. vorbis_decoder_select="mdct"
  1837. vorbis_encoder_select="mdct"
  1838. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1839. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
  1840. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
  1841. vp6a_decoder_select="vp6_decoder"
  1842. vp6f_decoder_select="vp6_decoder"
  1843. vp7_decoder_select="h264pred videodsp vp8dsp"
  1844. vp8_decoder_select="h264pred videodsp vp8dsp"
  1845. vp9_decoder_select="videodsp"
  1846. webp_decoder_select="vp8_decoder"
  1847. wmapro_decoder_select="mdct sinewin wma_freqs"
  1848. wmav1_decoder_select="mdct sinewin wma_freqs"
  1849. wmav1_encoder_select="mdct sinewin wma_freqs"
  1850. wmav2_decoder_select="mdct sinewin wma_freqs"
  1851. wmav2_encoder_select="mdct sinewin wma_freqs"
  1852. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1853. wmv1_decoder_select="h263_decoder"
  1854. wmv1_encoder_select="h263_encoder"
  1855. wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp wmv2dsp"
  1856. wmv2_encoder_select="h263_encoder wmv2dsp"
  1857. wmv3_decoder_select="vc1_decoder"
  1858. wmv3image_decoder_select="wmv3_decoder"
  1859. zerocodec_decoder_deps="zlib"
  1860. zlib_decoder_deps="zlib"
  1861. zlib_encoder_deps="zlib"
  1862. zmbv_decoder_deps="zlib"
  1863. zmbv_encoder_deps="zlib"
  1864. # hardware accelerators
  1865. d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
  1866. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
  1867. vaapi_deps="va_va_h"
  1868. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1869. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1870. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1871. h263_vaapi_hwaccel_deps="vaapi"
  1872. h263_vaapi_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. libkvazaar_encoder_deps="libkvazaar"
  1944. libmp3lame_encoder_deps="libmp3lame"
  1945. libmp3lame_encoder_select="audio_frame_queue"
  1946. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1947. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1948. libopencore_amrnb_encoder_select="audio_frame_queue"
  1949. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1950. libopenh264_encoder_deps="libopenh264"
  1951. libopenjpeg_decoder_deps="libopenjpeg"
  1952. libopenjpeg_encoder_deps="libopenjpeg"
  1953. libopus_decoder_deps="libopus"
  1954. libopus_encoder_deps="libopus"
  1955. libopus_encoder_select="audio_frame_queue"
  1956. libschroedinger_decoder_deps="libschroedinger"
  1957. libschroedinger_encoder_deps="libschroedinger"
  1958. libspeex_decoder_deps="libspeex"
  1959. libspeex_encoder_deps="libspeex"
  1960. libspeex_encoder_select="audio_frame_queue"
  1961. libtheora_encoder_deps="libtheora"
  1962. libtwolame_encoder_deps="libtwolame"
  1963. libvo_aacenc_encoder_deps="libvo_aacenc"
  1964. libvo_aacenc_encoder_select="audio_frame_queue"
  1965. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1966. libvorbis_encoder_deps="libvorbis"
  1967. libvorbis_encoder_select="audio_frame_queue"
  1968. libvpx_vp8_decoder_deps="libvpx"
  1969. libvpx_vp8_encoder_deps="libvpx"
  1970. libvpx_vp9_decoder_deps="libvpx"
  1971. libvpx_vp9_encoder_deps="libvpx"
  1972. libwavpack_encoder_deps="libwavpack"
  1973. libwebp_encoder_deps="libwebp"
  1974. libx262_encoder_deps="libx262"
  1975. libx264_encoder_deps="libx264"
  1976. libx265_encoder_deps="libx265"
  1977. libxavs_encoder_deps="libxavs"
  1978. libxvid_encoder_deps="libxvid"
  1979. # demuxers / muxers
  1980. ac3_demuxer_select="ac3_parser"
  1981. asf_demuxer_select="riffdec"
  1982. asf_muxer_select="riffenc"
  1983. asf_stream_muxer_select="asf_muxer"
  1984. avi_demuxer_select="riffdec"
  1985. avi_muxer_select="riffenc"
  1986. avisynth_demuxer_deps="avisynth"
  1987. avisynth_demuxer_select="riffdec"
  1988. caf_demuxer_select="riffdec"
  1989. dash_muxer_select="mp4_muxer"
  1990. dirac_demuxer_select="dirac_parser"
  1991. dv_demuxer_select="dvprofile"
  1992. dv_muxer_select="dvprofile"
  1993. dxa_demuxer_select="riffdec"
  1994. eac3_demuxer_select="ac3_parser"
  1995. f4v_muxer_select="mov_muxer"
  1996. flac_demuxer_select="flac_parser"
  1997. hds_muxer_select="flv_muxer"
  1998. hls_muxer_select="mpegts_muxer"
  1999. ipod_muxer_select="mov_muxer"
  2000. ismv_muxer_select="mov_muxer"
  2001. matroska_audio_muxer_select="matroska_muxer"
  2002. matroska_demuxer_select="riffdec"
  2003. matroska_demuxer_suggest="bzlib lzo zlib"
  2004. matroska_muxer_select="riffenc"
  2005. mmf_muxer_select="riffenc"
  2006. mov_demuxer_select="riffdec"
  2007. mov_demuxer_suggest="zlib"
  2008. mov_muxer_select="riffenc rtpenc_chain"
  2009. mp3_demuxer_select="mpegaudio_parser"
  2010. mp4_muxer_select="mov_muxer"
  2011. mpegts_muxer_select="adts_muxer latm_muxer"
  2012. mpegtsraw_demuxer_select="mpegts_demuxer"
  2013. mxf_d10_muxer_select="mxf_muxer"
  2014. nut_muxer_select="riffenc"
  2015. nuv_demuxer_select="riffdec"
  2016. oga_muxer_select="ogg_muxer"
  2017. ogg_demuxer_select="golomb"
  2018. opus_muxer_select="ogg_muxer"
  2019. psp_muxer_select="mov_muxer"
  2020. rtp_demuxer_select="sdp_demuxer"
  2021. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol"
  2022. rtsp_demuxer_select="http_protocol rtpdec"
  2023. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2024. sap_demuxer_select="sdp_demuxer"
  2025. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2026. sdp_demuxer_select="rtpdec"
  2027. smoothstreaming_muxer_select="ismv_muxer"
  2028. spdif_muxer_select="aac_parser"
  2029. spx_muxer_select="ogg_muxer"
  2030. tak_demuxer_select="tak_parser"
  2031. tg2_muxer_select="mov_muxer"
  2032. tgp_muxer_select="mov_muxer"
  2033. w64_demuxer_select="wav_demuxer"
  2034. wav_demuxer_select="riffdec"
  2035. wav_muxer_select="riffenc"
  2036. webm_muxer_select="riffenc"
  2037. webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder libvpx_vp9_encoder"
  2038. wtv_demuxer_select="riffdec"
  2039. xmv_demuxer_select="riffdec"
  2040. xwma_demuxer_select="riffdec"
  2041. # indevs / outdevs
  2042. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  2043. alsa_outdev_deps="alsa_asoundlib_h"
  2044. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2045. dv1394_indev_deps="dv1394"
  2046. dv1394_indev_select="dv_demuxer"
  2047. fbdev_indev_deps="linux_fb_h"
  2048. jack_indev_deps="jack_jack_h pthreads"
  2049. libcdio_indev_deps="libcdio"
  2050. libdc1394_indev_deps="libdc1394"
  2051. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2052. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2053. pulse_indev_deps="libpulse"
  2054. sndio_indev_deps="sndio_h"
  2055. sndio_outdev_deps="sndio_h"
  2056. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2057. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2058. vfwcap_indev_extralibs="-lavicap32"
  2059. x11grab_indev_deps="x11grab"
  2060. x11grab_xcb_indev_deps="libxcb"
  2061. # protocols
  2062. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2063. ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
  2064. ffrtmpcrypt_protocol_select="tcp_protocol"
  2065. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2066. ffrtmphttp_protocol_select="http_protocol"
  2067. gopher_protocol_select="network"
  2068. http_protocol_select="tcp_protocol"
  2069. httpproxy_protocol_select="tcp_protocol"
  2070. https_protocol_select="tls_protocol"
  2071. icecast_protocol_select="http_protocol"
  2072. librtmp_protocol_deps="librtmp"
  2073. librtmpe_protocol_deps="librtmp"
  2074. librtmps_protocol_deps="librtmp"
  2075. librtmpt_protocol_deps="librtmp"
  2076. librtmpte_protocol_deps="librtmp"
  2077. mmsh_protocol_select="http_protocol"
  2078. mmst_protocol_select="network"
  2079. rtmp_protocol_deps="!librtmp_protocol"
  2080. rtmp_protocol_select="tcp_protocol"
  2081. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2082. rtmps_protocol_deps="!librtmp_protocol"
  2083. rtmps_protocol_select="tls_protocol"
  2084. rtmpt_protocol_select="ffrtmphttp_protocol"
  2085. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2086. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2087. rtp_protocol_select="udp_protocol"
  2088. sctp_protocol_deps="struct_sctp_event_subscribe"
  2089. sctp_protocol_select="network"
  2090. srtp_protocol_select="rtp_protocol"
  2091. tcp_protocol_select="network"
  2092. tls_gnutls_protocol_deps="gnutls"
  2093. tls_gnutls_protocol_select="tcp_protocol"
  2094. tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
  2095. tls_openssl_protocol_select="tcp_protocol"
  2096. tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"
  2097. udp_protocol_select="network"
  2098. unix_protocol_deps="sys_un_h"
  2099. unix_protocol_select="network"
  2100. # filters
  2101. blackframe_filter_deps="gpl"
  2102. boxblur_filter_deps="gpl"
  2103. bs2b_filter_deps="libbs2b"
  2104. cropdetect_filter_deps="gpl"
  2105. delogo_filter_deps="gpl"
  2106. drawtext_filter_deps="libfreetype"
  2107. frei0r_filter_deps="frei0r dlopen"
  2108. frei0r_filter_extralibs='$ldl'
  2109. frei0r_src_filter_deps="frei0r dlopen"
  2110. frei0r_src_filter_extralibs='$ldl'
  2111. hqdn3d_filter_deps="gpl"
  2112. interlace_filter_deps="gpl"
  2113. ocv_filter_deps="libopencv"
  2114. resample_filter_deps="avresample"
  2115. scale_filter_deps="swscale"
  2116. # examples
  2117. avcodec_example_deps="avcodec avutil"
  2118. filter_audio_example_deps="avfilter avutil"
  2119. metadata_example_deps="avformat avutil"
  2120. output_example_deps="avcodec avformat avutil swscale"
  2121. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
  2122. transcode_aac_example_deps="avcodec avformat avresample"
  2123. # libraries, in linking order
  2124. avcodec_deps="avutil"
  2125. avdevice_deps="avformat avcodec avutil"
  2126. avfilter_deps="avutil"
  2127. avformat_deps="avcodec avutil"
  2128. avresample_deps="avutil"
  2129. swscale_deps="avutil"
  2130. # programs
  2131. avconv_deps="avcodec avfilter avformat avresample swscale"
  2132. avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
  2133. fps_filter null_filter resample_filter scale_filter
  2134. setpts_filter trim_filter"
  2135. avplay_deps="avcodec avformat avresample swscale sdl"
  2136. avplay_libs='$sdl_libs'
  2137. avplay_select="rdft transpose_filter hflip_filter vflip_filter"
  2138. avprobe_deps="avcodec avformat"
  2139. # documentation
  2140. pod2man_deps="doc"
  2141. texi2html_deps="doc"
  2142. # default parameters
  2143. logfile="config.log"
  2144. # installation paths
  2145. prefix_default="/usr/local"
  2146. bindir_default='${prefix}/bin'
  2147. datadir_default='${prefix}/share/avconv'
  2148. docdir_default='${prefix}/share/doc/libav'
  2149. incdir_default='${prefix}/include'
  2150. libdir_default='${prefix}/lib'
  2151. mandir_default='${prefix}/share/man'
  2152. shlibdir_default="$libdir_default"
  2153. # toolchain
  2154. ar_default="ar"
  2155. cc_default="gcc"
  2156. host_cc_default="gcc"
  2157. cp_f="cp -f"
  2158. ln_s="ln -s -f"
  2159. nm_default="nm -g"
  2160. objformat="elf"
  2161. pkg_config_default=pkg-config
  2162. ranlib="ranlib"
  2163. strip="strip"
  2164. yasmexe="yasm"
  2165. # machine
  2166. arch_default=$(uname -m)
  2167. cpu="generic"
  2168. intrinsics="none"
  2169. # OS
  2170. target_os_default=$(tolower $(uname -s))
  2171. host_os=$target_os_default
  2172. # configurable options
  2173. enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
  2174. enable asm
  2175. enable debug
  2176. enable doc
  2177. enable faan faandct faanidct
  2178. enable optimizations
  2179. enable safe_bitstream_reader
  2180. enable static
  2181. enable swscale_alpha
  2182. enable valgrind_backtrace
  2183. # By default, enable only those hwaccels that have no external dependencies.
  2184. enable d3d11va dxva2 vda vdpau
  2185. # build settings
  2186. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2187. LIBPREF="lib"
  2188. LIBSUF=".a"
  2189. FULLNAME='$(NAME)$(BUILDSUF)'
  2190. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2191. SLIBPREF="lib"
  2192. SLIBSUF=".so"
  2193. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2194. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2195. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2196. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2197. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2198. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2199. asflags_filter=echo
  2200. cflags_filter=echo
  2201. ldflags_filter=echo
  2202. AS_C='-c'
  2203. AS_O='-o $@'
  2204. CC_C='-c'
  2205. CC_E='-E -o $@'
  2206. CC_O='-o $@'
  2207. LD_O='-o $@'
  2208. LD_LIB='-l%'
  2209. LD_PATH='-L'
  2210. HOSTCC_C='-c'
  2211. HOSTCC_E='-E -o $@'
  2212. HOSTCC_O='-o $@'
  2213. HOSTLD_O='-o $@'
  2214. host_libs='-lm'
  2215. host_cflags_filter=echo
  2216. host_ldflags_filter=echo
  2217. target_path='$(CURDIR)'
  2218. # since the object filename is not given with the -MM flag, the compiler
  2219. # is only able to print the basename, and we must add the path ourselves
  2220. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2221. DEPFLAGS='-MM'
  2222. # find source path
  2223. if test -f configure; then
  2224. source_path=.
  2225. else
  2226. source_path=$(cd $(dirname "$0"); pwd)
  2227. echo "$source_path" | grep -q '[[:blank:]]' &&
  2228. die "Out of tree builds are impossible with whitespace in source path."
  2229. test -e "$source_path/config.h" &&
  2230. die "Out of tree builds are impossible with config.h in source dir."
  2231. fi
  2232. for v in "$@"; do
  2233. r=${v#*=}
  2234. l=${v%"$r"}
  2235. r=$(sh_quote "$r")
  2236. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  2237. done
  2238. find_things(){
  2239. thing=$1
  2240. pattern=$2
  2241. file=$source_path/$3
  2242. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2243. }
  2244. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2245. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2246. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2247. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2248. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2249. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2250. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2251. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2252. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2253. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2254. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2255. ALL_COMPONENTS="
  2256. $BSF_LIST
  2257. $DECODER_LIST
  2258. $DEMUXER_LIST
  2259. $ENCODER_LIST
  2260. $FILTER_LIST
  2261. $HWACCEL_LIST
  2262. $INDEV_LIST
  2263. $MUXER_LIST
  2264. $OUTDEV_LIST
  2265. $PARSER_LIST
  2266. $PROTOCOL_LIST
  2267. "
  2268. for n in $COMPONENT_LIST; do
  2269. v=$(toupper ${n%s})_LIST
  2270. eval enable \$$v
  2271. eval ${n}_if_any="\$$v"
  2272. done
  2273. enable $ARCH_EXT_LIST
  2274. die_unknown(){
  2275. echo "Unknown option \"$1\"."
  2276. echo "See $0 --help for available options."
  2277. exit 1
  2278. }
  2279. print_3_columns() {
  2280. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2281. }
  2282. show_list() {
  2283. suffix=_$1
  2284. shift
  2285. echo $* | sed s/$suffix//g | print_3_columns
  2286. exit 0
  2287. }
  2288. rand_list(){
  2289. IFS=', '
  2290. set -- $*
  2291. unset IFS
  2292. for thing; do
  2293. comp=${thing%:*}
  2294. prob=${thing#$comp}
  2295. prob=${prob#:}
  2296. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2297. echo "prob ${prob:-0.5}"
  2298. printf '%s\n' $comp
  2299. done
  2300. }
  2301. do_random(){
  2302. action=$1
  2303. shift
  2304. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2305. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2306. }
  2307. for opt do
  2308. optval="${opt#*=}"
  2309. case "$opt" in
  2310. --extra-ldflags=*)
  2311. add_ldflags $optval
  2312. ;;
  2313. --extra-ldexeflags=*)
  2314. add_ldexeflags $optval
  2315. ;;
  2316. --extra-libs=*)
  2317. add_extralibs $optval
  2318. ;;
  2319. --disable-devices)
  2320. disable $INDEV_LIST $OUTDEV_LIST
  2321. ;;
  2322. --enable-debug=*)
  2323. debuglevel="$optval"
  2324. ;;
  2325. --disable-programs)
  2326. disable $PROGRAM_LIST
  2327. ;;
  2328. --disable-everything)
  2329. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2330. ;;
  2331. --disable-all)
  2332. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2333. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2334. ;;
  2335. --enable-random|--disable-random)
  2336. action=${opt%%-random}
  2337. do_random ${action#--} $COMPONENT_LIST
  2338. ;;
  2339. --enable-random=*|--disable-random=*)
  2340. action=${opt%%-random=*}
  2341. do_random ${action#--} $optval
  2342. ;;
  2343. --enable-*=*|--disable-*=*)
  2344. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2345. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2346. eval list=\$$(toupper $thing)_LIST
  2347. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2348. $action $(filter "$name" $list)
  2349. ;;
  2350. --enable-avserver|--disable-avserver*)
  2351. warn "avserver has been removed, the ${opt} option is only"\
  2352. "provided for compatibility and will be removed in the future"
  2353. ;;
  2354. --enable-?*|--disable-?*)
  2355. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2356. if is_in $option $COMPONENT_LIST; then
  2357. test $action = disable && action=unset
  2358. eval $action \$$(toupper ${option%s})_LIST
  2359. elif is_in $option $CMDLINE_SELECT; then
  2360. $action $option
  2361. else
  2362. die_unknown $opt
  2363. fi
  2364. ;;
  2365. --list-*)
  2366. NAME="${opt#--list-}"
  2367. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2368. NAME=${NAME%s}
  2369. eval show_list $NAME \$$(toupper $NAME)_LIST
  2370. ;;
  2371. --help|-h) show_help
  2372. ;;
  2373. *)
  2374. optname="${opt%%=*}"
  2375. optname="${optname#--}"
  2376. optname=$(echo "$optname" | sed 's/-/_/g')
  2377. if is_in $optname $CMDLINE_SET; then
  2378. eval $optname='$optval'
  2379. elif is_in $optname $CMDLINE_APPEND; then
  2380. append $optname "$optval"
  2381. else
  2382. die_unknown $opt
  2383. fi
  2384. ;;
  2385. esac
  2386. done
  2387. for e in $env; do
  2388. eval "export $e"
  2389. done
  2390. disabled logging && logfile=/dev/null
  2391. # Disable all the library-specific components if the library itself
  2392. # is disabled, see AVCODEC_LIST and following _LIST variables.
  2393. disable_components(){
  2394. disabled ${1} && disable $(
  2395. eval components="\$$(toupper ${1})_COMPONENTS"
  2396. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  2397. )
  2398. }
  2399. map 'disable_components $v' $LIBRARY_LIST
  2400. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  2401. set >> $logfile
  2402. case "$toolchain" in
  2403. clang-asan)
  2404. cc_default="clang"
  2405. add_cflags -fsanitize=address
  2406. add_ldflags -fsanitize=address
  2407. ;;
  2408. clang-tsan)
  2409. cc_default="clang"
  2410. add_cflags -fsanitize=thread -pie
  2411. add_ldflags -fsanitize=thread -pie
  2412. ;;
  2413. clang-usan)
  2414. cc_default="clang"
  2415. add_cflags -fsanitize=undefined -O1
  2416. add_ldflags -fsanitize=undefined
  2417. ;;
  2418. gcc-asan)
  2419. cc_default="gcc"
  2420. add_cflags -fsanitize=address
  2421. add_ldflags -fsanitize=address
  2422. ;;
  2423. gcc-tsan)
  2424. cc_default="gcc"
  2425. add_cflags -fsanitize=thread -pie -fPIC
  2426. add_ldflags -fsanitize=thread -pie -fPIC
  2427. ;;
  2428. gcc-usan)
  2429. cc_default="gcc"
  2430. add_cflags -fsanitize=undefined
  2431. add_ldflags -fsanitize=undefined
  2432. ;;
  2433. valgrind-massif)
  2434. target_exec_default="valgrind"
  2435. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2436. ;;
  2437. valgrind-memcheck)
  2438. target_exec_default="valgrind"
  2439. target_exec_args="--track-origins=yes --leak-check=full"
  2440. ;;
  2441. msvc)
  2442. # Check whether the current MSVC version needs the C99 converter.
  2443. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2444. # support enough of C99 to build libav. Default to the new
  2445. # behaviour if the regexp was unable to match anything, since this
  2446. # successfully parses the version number of existing supported
  2447. # versions that require the converter (MSVC 2010 and 2012).
  2448. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2449. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2450. cc_default="cl"
  2451. else
  2452. cc_default="c99wrap cl"
  2453. fi
  2454. ld_default="$source_path/compat/windows/mslink"
  2455. nm_default="dumpbin -symbols"
  2456. ar_default="lib"
  2457. case "$arch" in
  2458. arm*)
  2459. as_default="armasm"
  2460. ;;
  2461. esac
  2462. target_os_default="win32"
  2463. # Use a relative path for TMPDIR. This makes sure all the
  2464. # ffconf temp files are written with a relative path, avoiding
  2465. # issues with msys/win32 path conversion for MSVC parameters
  2466. # such as -Fo<file> or -out:<file>.
  2467. TMPDIR=.
  2468. ;;
  2469. icl)
  2470. cc_default="icl"
  2471. ld_default="xilink"
  2472. nm_default="dumpbin -symbols"
  2473. ar_default="xilib"
  2474. target_os_default="win32"
  2475. TMPDIR=.
  2476. ;;
  2477. gcov)
  2478. add_cflags -fprofile-arcs -ftest-coverage
  2479. add_ldflags -fprofile-arcs -ftest-coverage
  2480. ;;
  2481. hardened)
  2482. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2483. add_cflags -fno-strict-overflow -fstack-protector-all
  2484. add_ldflags -Wl,-z,relro -Wl,-z,now
  2485. ;;
  2486. ?*)
  2487. die "Unknown toolchain $toolchain"
  2488. ;;
  2489. esac
  2490. test -n "$cross_prefix" && enable cross_compile
  2491. if enabled cross_compile; then
  2492. test -n "$arch" && test -n "$target_os" ||
  2493. die "Must specify target arch and OS when cross-compiling"
  2494. fi
  2495. ar_default="${cross_prefix}${ar_default}"
  2496. cc_default="${cross_prefix}${cc_default}"
  2497. nm_default="${cross_prefix}${nm_default}"
  2498. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2499. ranlib="${cross_prefix}${ranlib}"
  2500. strip="${cross_prefix}${strip}"
  2501. sysinclude_default="${sysroot}/usr/include"
  2502. set_default arch cc pkg_config sysinclude target_exec target_os
  2503. enabled cross_compile || host_cc_default=$cc
  2504. set_default host_cc
  2505. if ! $pkg_config --version >/dev/null 2>&1; then
  2506. warn "$pkg_config not found, library detection may fail."
  2507. pkg_config=false
  2508. fi
  2509. exesuf() {
  2510. case $1 in
  2511. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2512. esac
  2513. }
  2514. EXESUF=$(exesuf $target_os)
  2515. HOSTEXESUF=$(exesuf $host_os)
  2516. # set temporary file name
  2517. : ${TMPDIR:=$TEMPDIR}
  2518. : ${TMPDIR:=$TMP}
  2519. : ${TMPDIR:=/tmp}
  2520. if ! check_cmd mktemp -u XXXXXX; then
  2521. # simple replacement for missing mktemp
  2522. # NOT SAFE FOR GENERAL USE
  2523. mktemp(){
  2524. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2525. }
  2526. fi
  2527. tmpfile(){
  2528. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2529. (set -C; exec > $tmp) 2>/dev/null ||
  2530. die "Unable to create temporary file in $TMPDIR."
  2531. append TMPFILES $tmp
  2532. eval $1=$tmp
  2533. }
  2534. trap 'rm -f -- $TMPFILES' EXIT
  2535. tmpfile TMPASM .asm
  2536. tmpfile TMPC .c
  2537. tmpfile TMPE $EXESUF
  2538. tmpfile TMPH .h
  2539. tmpfile TMPO .o
  2540. tmpfile TMPS .S
  2541. tmpfile TMPSH .sh
  2542. tmpfile TMPV .ver
  2543. unset -f mktemp
  2544. chmod +x $TMPE
  2545. # make sure we can execute files in $TMPDIR
  2546. cat > $TMPSH 2>> $logfile <<EOF
  2547. #! /bin/sh
  2548. EOF
  2549. chmod +x $TMPSH >> $logfile 2>&1
  2550. if ! $TMPSH >> $logfile 2>&1; then
  2551. cat <<EOF
  2552. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2553. variable to another directory and make sure that it is not mounted noexec.
  2554. EOF
  2555. die "Sanity test failed."
  2556. fi
  2557. armasm_flags(){
  2558. for flag; do
  2559. case $flag in
  2560. # Filter out MSVC cl.exe options from cflags that shouldn't
  2561. # be passed to gas-preprocessor
  2562. -M[TD]*) ;;
  2563. *) echo $flag ;;
  2564. esac
  2565. done
  2566. }
  2567. ccc_flags(){
  2568. for flag; do
  2569. case $flag in
  2570. -std=c99) echo -c99 ;;
  2571. -mcpu=*) echo -arch ${flag#*=} ;;
  2572. -mieee) echo -ieee ;;
  2573. -O*|-fast) echo $flag ;;
  2574. -fno-math-errno) echo -assume nomath_errno ;;
  2575. -g) echo -g3 ;;
  2576. -Wall) echo -msg_enable level2 ;;
  2577. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2578. -Wl,*) echo $flag ;;
  2579. -f*|-W*) ;;
  2580. *) echo $flag ;;
  2581. esac
  2582. done
  2583. }
  2584. cparser_flags(){
  2585. for flag; do
  2586. case $flag in
  2587. -Wno-switch) echo -Wno-switch-enum ;;
  2588. -Wno-format-zero-length) ;;
  2589. -Wdisabled-optimization) ;;
  2590. -Wno-pointer-sign) echo -Wno-other ;;
  2591. *) echo $flag ;;
  2592. esac
  2593. done
  2594. }
  2595. msvc_common_flags(){
  2596. for flag; do
  2597. case $flag in
  2598. # In addition to specifying certain flags under the compiler
  2599. # specific filters, they must be specified here as well or else the
  2600. # generic catch all at the bottom will print the original flag.
  2601. -Wall) ;;
  2602. -std=c99) ;;
  2603. # Common flags
  2604. -fomit-frame-pointer) ;;
  2605. -g) echo -Z7 ;;
  2606. -fno-math-errno) ;;
  2607. -fno-common) ;;
  2608. -fno-signed-zeros) ;;
  2609. -fPIC) ;;
  2610. -mthumb) ;;
  2611. -march=*) ;;
  2612. -lz) echo zlib.lib ;;
  2613. -lavifil32) echo vfw32.lib ;;
  2614. -lavicap32) echo vfw32.lib user32.lib ;;
  2615. -l*) echo ${flag#-l}.lib ;;
  2616. -L*) echo -libpath:${flag#-L} ;;
  2617. *) echo $flag ;;
  2618. esac
  2619. done
  2620. }
  2621. msvc_flags(){
  2622. msvc_common_flags "$@"
  2623. for flag; do
  2624. case $flag in
  2625. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2626. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2627. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2628. -wd4273 -wd4554 -wd4701 ;;
  2629. esac
  2630. done
  2631. }
  2632. icl_flags(){
  2633. msvc_common_flags "$@"
  2634. for flag; do
  2635. case $flag in
  2636. # Despite what Intel's documentation says -Wall, which is supported
  2637. # on Windows, does enable remarks so disable them here.
  2638. -Wall) echo $flag -Qdiag-disable:remark ;;
  2639. -std=c99) echo -Qstd=c99 ;;
  2640. esac
  2641. done
  2642. }
  2643. pgi_flags(){
  2644. for flag; do
  2645. case $flag in
  2646. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2647. -fomit-frame-pointer) echo -Mnoframe ;;
  2648. -g) echo -gopt ;;
  2649. *) echo $flag ;;
  2650. esac
  2651. done
  2652. }
  2653. suncc_flags(){
  2654. for flag; do
  2655. case $flag in
  2656. -march=*|-mcpu=*)
  2657. case "${flag#*=}" in
  2658. native) echo -xtarget=native ;;
  2659. v9|niagara) echo -xarch=sparc ;;
  2660. ultrasparc) echo -xarch=sparcvis ;;
  2661. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2662. i586|pentium) echo -xchip=pentium ;;
  2663. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2664. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2665. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2666. pentium4*) echo -xtarget=pentium4 ;;
  2667. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2668. *-sse3) echo -xarch=sse3 ;;
  2669. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2670. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2671. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2672. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2673. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2674. k8|opteron|athlon64|athlon-fx)
  2675. echo -xarch=sse2a ;;
  2676. athlon*) echo -xarch=pentium_proa ;;
  2677. esac
  2678. ;;
  2679. -std=c99) echo -xc99 ;;
  2680. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2681. -fPIC) echo -KPIC -xcode=pic32 ;;
  2682. -W*,*) echo $flag ;;
  2683. -f*-*|-W*|-mimpure-text) ;;
  2684. -shared) echo -G ;;
  2685. *) echo $flag ;;
  2686. esac
  2687. done
  2688. }
  2689. tms470_flags(){
  2690. for flag; do
  2691. case $flag in
  2692. -march=*|-mcpu=*)
  2693. case "${flag#*=}" in
  2694. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2695. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2696. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2697. armv6*|arm11*) echo -mv=6 ;;
  2698. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2699. echo -mv=5e ;;
  2700. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2701. esac
  2702. ;;
  2703. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2704. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2705. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2706. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2707. -msoft-float) echo --float_support=vfplib ;;
  2708. -O[0-3]|-mf=*) echo $flag ;;
  2709. -g) echo -g -mn ;;
  2710. -pds=*) echo $flag ;;
  2711. -D*|-I*) echo $flag ;;
  2712. --gcc|--abi=*) echo $flag ;;
  2713. -me) echo $flag ;;
  2714. esac
  2715. done
  2716. }
  2717. probe_cc(){
  2718. pfx=$1
  2719. _cc=$2
  2720. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2721. unset _ld_o _ldflags _ld_lib _ld_path
  2722. unset _depflags _DEPCMD _DEPFLAGS
  2723. _flags_filter=echo
  2724. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2725. _type=llvm_gcc
  2726. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  2727. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  2728. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2729. _cflags_speed='-O3'
  2730. _cflags_size='-Os'
  2731. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2732. _type=gcc
  2733. gcc_version=$($_cc --version | head -n1)
  2734. gcc_basever=$($_cc -dumpversion)
  2735. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2736. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2737. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2738. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2739. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2740. fi
  2741. _cflags_speed='-O3'
  2742. _cflags_size='-Os'
  2743. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2744. _type=icc
  2745. _ident=$($_cc --version | head -n1)
  2746. _depflags='-MMD'
  2747. _cflags_speed='-O3'
  2748. _cflags_size='-Os'
  2749. _cflags_noopt='-O1'
  2750. elif $_cc -v 2>&1 | grep -q xlc; then
  2751. _type=xlc
  2752. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2753. _cflags_speed='-O5'
  2754. _cflags_size='-O5 -qcompact'
  2755. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2756. _type=ccc
  2757. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2758. _DEPFLAGS='-M'
  2759. _cflags_speed='-fast'
  2760. _cflags_size='-O1'
  2761. _flags_filter=ccc_flags
  2762. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2763. test -d "$sysroot" || die "No valid sysroot specified."
  2764. _type=armcc
  2765. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  2766. armcc_conf="$PWD/armcc.conf"
  2767. $_cc --arm_linux_configure \
  2768. --arm_linux_config_file="$armcc_conf" \
  2769. --configure_sysroot="$sysroot" \
  2770. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2771. die "Error creating armcc configuration file."
  2772. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2773. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2774. as_default="${cross_prefix}gcc"
  2775. _depflags='-MMD'
  2776. _cflags_speed='-O3'
  2777. _cflags_size='-Os'
  2778. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2779. _type=tms470
  2780. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2781. _flags='--gcc --abi=eabi -me'
  2782. _cc_e='-ppl -fe=$@'
  2783. _cc_o='-fe=$@'
  2784. _depflags='-ppa -ppd=$(@:.o=.d)'
  2785. _cflags_speed='-O3 -mf=5'
  2786. _cflags_size='-O3 -mf=2'
  2787. _flags_filter=tms470_flags
  2788. elif $_cc -v 2>&1 | grep -q clang; then
  2789. _type=clang
  2790. _ident=$($_cc --version 2>/dev/null | head -n1)
  2791. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2792. _cflags_speed='-O3'
  2793. _cflags_size='-Os'
  2794. elif $_cc -V 2>&1 | grep -q Sun; then
  2795. _type=suncc
  2796. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2797. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2798. _DEPFLAGS='-xM1 -xc99'
  2799. _ldflags='-std=c99'
  2800. _cflags_speed='-O5'
  2801. _cflags_size='-O5 -xspace'
  2802. _flags_filter=suncc_flags
  2803. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2804. _type=pathscale
  2805. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2806. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2807. _cflags_speed='-O2'
  2808. _cflags_size='-Os'
  2809. _flags_filter='filter_out -Wdisabled-optimization'
  2810. elif $_cc -v 2>&1 | grep -q Open64; then
  2811. _type=open64
  2812. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2813. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2814. _cflags_speed='-O2'
  2815. _cflags_size='-Os'
  2816. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2817. elif $_cc -V 2>&1 | grep -q Portland; then
  2818. _type=pgi
  2819. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2820. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2821. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2822. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2823. _cflags_noopt="-O1"
  2824. _flags_filter=pgi_flags
  2825. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  2826. _type=armasm
  2827. _ident=$($_cc | head -n1)
  2828. # 4509: "This form of conditional instruction is deprecated"
  2829. _flags="-nologo -ignore 4509"
  2830. _flags_filter=armasm_flags
  2831. elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
  2832. _type=msvc
  2833. _ident=$($_cc 2>&1 | head -n1)
  2834. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2835. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2836. _cflags_speed="-O2"
  2837. _cflags_size="-O1"
  2838. if $_cc -nologo- 2>&1 | grep -q Linker; then
  2839. _ld_o='-out:$@'
  2840. else
  2841. _ld_o='-Fe$@'
  2842. fi
  2843. _cc_o='-Fo$@'
  2844. _cc_e='-P -Fi$@'
  2845. _flags_filter=msvc_flags
  2846. _ld_lib='lib%.a'
  2847. _ld_path='-libpath:'
  2848. _flags='-nologo'
  2849. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS'
  2850. elif $_cc 2>&1 | grep -q Intel; then
  2851. _type=icl
  2852. _ident=$($_cc 2>&1 | head -n1)
  2853. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2854. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2855. # versions (tested) as well.
  2856. _cflags_speed="-O2"
  2857. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2858. if $_cc 2>&1 | grep -q Linker; then
  2859. _ld_o='-out:$@'
  2860. else
  2861. _ld_o='-Fe$@'
  2862. fi
  2863. _cc_o='-Fo$@'
  2864. _cc_e='-P'
  2865. _flags_filter=icl_flags
  2866. _ld_lib='lib%.a'
  2867. _ld_path='-libpath:'
  2868. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2869. _flags='-nologo -Qdiag-error:4044,10157'
  2870. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2871. # with MSVC which enables it by default.
  2872. _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS'
  2873. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2874. _type=cparser
  2875. _ident=$($_cc --version | head -n1)
  2876. _depflags='-MMD'
  2877. _cflags_speed='-O4'
  2878. _cflags_size='-O2'
  2879. _flags_filter=cparser_flags
  2880. fi
  2881. eval ${pfx}_type=\$_type
  2882. eval ${pfx}_ident=\$_ident
  2883. }
  2884. set_ccvars(){
  2885. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2886. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2887. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2888. if [ -n "$_depflags" ]; then
  2889. eval ${1}_DEPFLAGS=\$_depflags
  2890. else
  2891. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2892. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2893. eval DEP${1}FLAGS=\$_flags
  2894. fi
  2895. }
  2896. probe_cc cc "$cc"
  2897. cflags_filter=$_flags_filter
  2898. cflags_speed=$_cflags_speed
  2899. cflags_size=$_cflags_size
  2900. cflags_noopt=$_cflags_noopt
  2901. add_cflags $_flags $_cflags
  2902. cc_ldflags=$_ldflags
  2903. set_ccvars CC
  2904. probe_cc hostcc "$host_cc"
  2905. host_cflags_filter=$_flags_filter
  2906. add_host_cflags $_flags $_cflags
  2907. set_ccvars HOSTCC
  2908. test -n "$cc_type" && enable $cc_type ||
  2909. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2910. : ${as_default:=$cc}
  2911. : ${dep_cc_default:=$cc}
  2912. : ${ld_default:=$cc}
  2913. : ${host_ld_default:=$host_cc}
  2914. set_default ar as dep_cc ld host_ld
  2915. probe_cc as "$as"
  2916. asflags_filter=$_flags_filter
  2917. add_asflags $_flags $_cflags
  2918. set_ccvars AS
  2919. probe_cc ld "$ld"
  2920. ldflags_filter=$_flags_filter
  2921. add_ldflags $_flags $_ldflags
  2922. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2923. LD_O=${_ld_o-$LD_O}
  2924. LD_LIB=${_ld_lib-$LD_LIB}
  2925. LD_PATH=${_ld_path-$LD_PATH}
  2926. probe_cc hostld "$host_ld"
  2927. host_ldflags_filter=$_flags_filter
  2928. add_host_ldflags $_flags $_ldflags
  2929. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2930. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2931. probe_cc depcc "$dep_cc"
  2932. CCDEP=${_DEPCMD:-$DEPCMD}
  2933. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2934. DEPCCFLAGS=$_flags
  2935. fi
  2936. if $ar 2>&1 | grep -q Microsoft; then
  2937. arflags="-nologo"
  2938. ar_o='-out:$@'
  2939. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2940. arflags="rq"
  2941. ar_o='$@'
  2942. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  2943. arflags='-Xany -r -c'
  2944. ar_o='$@'
  2945. else
  2946. arflags="rc"
  2947. ar_o='$@'
  2948. fi
  2949. add_cflags $extra_cflags
  2950. add_asflags $extra_cflags
  2951. if test -n "$sysroot"; then
  2952. case "$cc_type" in
  2953. gcc|llvm_gcc|clang)
  2954. add_cppflags --sysroot="$sysroot"
  2955. add_ldflags --sysroot="$sysroot"
  2956. ;;
  2957. tms470)
  2958. add_cppflags -I"$sysinclude"
  2959. add_ldflags --sysroot="$sysroot"
  2960. ;;
  2961. esac
  2962. fi
  2963. if test "$cpu" = host; then
  2964. enabled cross_compile &&
  2965. die "--cpu=host makes no sense when cross-compiling."
  2966. case "$cc_type" in
  2967. gcc|llvm_gcc)
  2968. check_native(){
  2969. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2970. sed -n "/cc1.*$1=/{
  2971. s/.*$1=\\([^ ]*\\).*/\\1/
  2972. p
  2973. q
  2974. }" $TMPE
  2975. }
  2976. cpu=$(check_native -march || check_native -mcpu)
  2977. ;;
  2978. esac
  2979. test "${cpu:-host}" = host &&
  2980. die "--cpu=host not supported with compiler $cc"
  2981. fi
  2982. # Deal with common $arch aliases
  2983. case "$arch" in
  2984. aarch64|arm64)
  2985. arch="aarch64"
  2986. ;;
  2987. arm*)
  2988. arch="arm"
  2989. ;;
  2990. mips*|IP*)
  2991. arch="mips"
  2992. ;;
  2993. parisc*|hppa*)
  2994. arch="parisc"
  2995. ;;
  2996. "Power Macintosh"|ppc*|powerpc*)
  2997. arch="ppc"
  2998. ;;
  2999. s390|s390x)
  3000. arch="s390"
  3001. ;;
  3002. sh4|sh)
  3003. arch="sh4"
  3004. ;;
  3005. sun4u|sparc*)
  3006. arch="sparc"
  3007. ;;
  3008. tilegx|tile-gx)
  3009. arch="tilegx"
  3010. ;;
  3011. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  3012. arch="x86"
  3013. ;;
  3014. esac
  3015. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3016. enable $arch
  3017. # Add processor-specific flags
  3018. if enabled aarch64; then
  3019. case $cpu in
  3020. armv*)
  3021. cpuflags="-march=$cpu"
  3022. ;;
  3023. *)
  3024. cpuflags="-mcpu=$cpu"
  3025. ;;
  3026. esac
  3027. elif enabled alpha; then
  3028. cpuflags="-mcpu=$cpu"
  3029. elif enabled arm; then
  3030. check_arm_arch() {
  3031. check_cpp_condition stddef.h \
  3032. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3033. $cpuflags
  3034. }
  3035. probe_arm_arch() {
  3036. if check_arm_arch 4; then echo armv4;
  3037. elif check_arm_arch 4T; then echo armv4t;
  3038. elif check_arm_arch 5; then echo armv5;
  3039. elif check_arm_arch 5E; then echo armv5e;
  3040. elif check_arm_arch 5T; then echo armv5t;
  3041. elif check_arm_arch 5TE; then echo armv5te;
  3042. elif check_arm_arch 5TEJ; then echo armv5te;
  3043. elif check_arm_arch 6; then echo armv6;
  3044. elif check_arm_arch 6J; then echo armv6j;
  3045. elif check_arm_arch 6K; then echo armv6k;
  3046. elif check_arm_arch 6Z; then echo armv6z;
  3047. elif check_arm_arch 6ZK; then echo armv6zk;
  3048. elif check_arm_arch 6T2; then echo armv6t2;
  3049. elif check_arm_arch 7; then echo armv7;
  3050. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3051. elif check_arm_arch 7S; then echo armv7-a;
  3052. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3053. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3054. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3055. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3056. fi
  3057. }
  3058. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3059. case $cpu in
  3060. armv*)
  3061. cpuflags="-march=$cpu"
  3062. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3063. ;;
  3064. *)
  3065. cpuflags="-mcpu=$cpu"
  3066. case $cpu in
  3067. cortex-a*) subarch=armv7a ;;
  3068. cortex-r*) subarch=armv7r ;;
  3069. cortex-m*) enable thumb; subarch=armv7m ;;
  3070. arm11*) subarch=armv6 ;;
  3071. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3072. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3073. *) subarch=$(probe_arm_arch) ;;
  3074. esac
  3075. ;;
  3076. esac
  3077. case "$subarch" in
  3078. armv5t*) enable fast_clz ;;
  3079. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3080. esac
  3081. elif enabled avr32; then
  3082. case $cpu in
  3083. ap7[02]0[0-2])
  3084. subarch="avr32_ap"
  3085. cpuflags="-mpart=$cpu"
  3086. ;;
  3087. ap)
  3088. subarch="avr32_ap"
  3089. cpuflags="-march=$cpu"
  3090. ;;
  3091. uc3[ab]*)
  3092. subarch="avr32_uc"
  3093. cpuflags="-mcpu=$cpu"
  3094. ;;
  3095. uc)
  3096. subarch="avr32_uc"
  3097. cpuflags="-march=$cpu"
  3098. ;;
  3099. esac
  3100. elif enabled bfin; then
  3101. cpuflags="-mcpu=$cpu"
  3102. elif enabled mips; then
  3103. cpuflags="-march=$cpu"
  3104. elif enabled ppc; then
  3105. disable ldbrx
  3106. case $(tolower $cpu) in
  3107. 601|ppc601|powerpc601)
  3108. cpuflags="-mcpu=601"
  3109. disable altivec
  3110. ;;
  3111. 603*|ppc603*|powerpc603*)
  3112. cpuflags="-mcpu=603"
  3113. disable altivec
  3114. ;;
  3115. 604*|ppc604*|powerpc604*)
  3116. cpuflags="-mcpu=604"
  3117. disable altivec
  3118. ;;
  3119. g3|75*|ppc75*|powerpc75*)
  3120. cpuflags="-mcpu=750"
  3121. disable altivec
  3122. ;;
  3123. g4|745*|ppc745*|powerpc745*)
  3124. cpuflags="-mcpu=7450"
  3125. disable vsx
  3126. ;;
  3127. 74*|ppc74*|powerpc74*)
  3128. cpuflags="-mcpu=7400"
  3129. disable vsx
  3130. ;;
  3131. g5|970|ppc970|powerpc970)
  3132. cpuflags="-mcpu=970"
  3133. disable vsx
  3134. ;;
  3135. power[3-6]*)
  3136. cpuflags="-mcpu=$cpu"
  3137. disable vsx
  3138. ;;
  3139. power[7-8]*)
  3140. cpuflags="-mcpu=$cpu"
  3141. enable ldbrx
  3142. ;;
  3143. cell)
  3144. cpuflags="-mcpu=cell"
  3145. enable ldbrx
  3146. disable vsx
  3147. ;;
  3148. e500mc)
  3149. cpuflags="-mcpu=e500mc"
  3150. disable altivec
  3151. ;;
  3152. e500v2)
  3153. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3154. disable altivec
  3155. disable dcbzl
  3156. ;;
  3157. e500)
  3158. cpuflags="-mcpu=8540 -mhard-float"
  3159. disable altivec
  3160. disable dcbzl
  3161. ;;
  3162. esac
  3163. elif enabled sparc; then
  3164. case $cpu in
  3165. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3166. cpuflags="-mcpu=$cpu"
  3167. ;;
  3168. ultrasparc*|niagara[234])
  3169. cpuflags="-mcpu=$cpu"
  3170. ;;
  3171. esac
  3172. elif enabled x86; then
  3173. case $cpu in
  3174. i[345]86|pentium)
  3175. cpuflags="-march=$cpu"
  3176. disable i686
  3177. disable mmx
  3178. ;;
  3179. # targets that do NOT support nopl and conditional mov (cmov)
  3180. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3181. cpuflags="-march=$cpu"
  3182. disable i686
  3183. ;;
  3184. # targets that do support nopl and conditional mov (cmov)
  3185. 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*)
  3186. cpuflags="-march=$cpu"
  3187. enable i686
  3188. enable fast_cmov
  3189. ;;
  3190. # targets that do support conditional mov but on which it's slow
  3191. pentium4|pentium4m|prescott|nocona)
  3192. cpuflags="-march=$cpu"
  3193. enable i686
  3194. disable fast_cmov
  3195. ;;
  3196. esac
  3197. fi
  3198. if [ "$cpu" != generic ]; then
  3199. add_cflags $cpuflags
  3200. add_asflags $cpuflags
  3201. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  3202. fi
  3203. # compiler sanity check
  3204. check_exec <<EOF
  3205. int main(void){ return 0; }
  3206. EOF
  3207. if test "$?" != 0; then
  3208. echo "$cc is unable to create an executable file."
  3209. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3210. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3211. echo "Only do this if you know what cross compiling means."
  3212. fi
  3213. die "C compiler test failed."
  3214. fi
  3215. add_cppflags -D_ISOC99_SOURCE
  3216. check_cflags -std=c99
  3217. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3218. #include <stdlib.h>
  3219. EOF
  3220. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3221. #include <stdlib.h>
  3222. EOF
  3223. add_host_cppflags -D_ISOC99_SOURCE
  3224. check_host_cflags -std=c99
  3225. check_host_cflags -Wall
  3226. check_host_cflags -O3
  3227. check_64bit(){
  3228. arch32=$1
  3229. arch64=$2
  3230. expr=$3
  3231. check_code cc "" "int test[2*($expr) - 1]" &&
  3232. subarch=$arch64 || subarch=$arch32
  3233. }
  3234. case "$arch" in
  3235. aarch64|alpha|ia64)
  3236. spic=$shared
  3237. ;;
  3238. mips)
  3239. check_64bit mips mips64 '_MIPS_SIM > 1'
  3240. spic=$shared
  3241. ;;
  3242. parisc)
  3243. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3244. spic=$shared
  3245. ;;
  3246. ppc)
  3247. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3248. spic=$shared
  3249. ;;
  3250. s390)
  3251. check_64bit s390 s390x 'sizeof(void *) > 4'
  3252. spic=$shared
  3253. ;;
  3254. sparc)
  3255. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3256. spic=$shared
  3257. ;;
  3258. x86)
  3259. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3260. if test "$subarch" = "x86_64"; then
  3261. spic=$shared
  3262. fi
  3263. ;;
  3264. esac
  3265. enable $subarch
  3266. enabled spic && enable_weak pic
  3267. # OS specific
  3268. case $target_os in
  3269. aix)
  3270. SHFLAGS=-shared
  3271. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3272. enabled shared && add_ldflags -Wl,-brtl
  3273. ;;
  3274. android)
  3275. disable symver
  3276. enable section_data_rel_ro
  3277. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3278. SLIB_INSTALL_LINKS=
  3279. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  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 inet_aton $network_extralibs
  3846. check_type netdb.h "struct addrinfo"
  3847. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3848. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3849. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3850. check_type poll.h "struct pollfd"
  3851. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3852. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3853. check_type netinet/in.h "struct sockaddr_in6"
  3854. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3855. check_type "sys/types.h sys/socket.h" socklen_t
  3856. # Prefer arpa/inet.h over winsock2
  3857. if check_header arpa/inet.h ; then
  3858. check_func closesocket
  3859. elif check_header winsock2.h ; then
  3860. check_func_headers winsock2.h closesocket -lws2 &&
  3861. network_extralibs="-lws2" ||
  3862. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3863. network_extralibs="-lws2_32"; } || disable winsock2_h network
  3864. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3865. check_type ws2tcpip.h socklen_t
  3866. check_type ws2tcpip.h "struct addrinfo"
  3867. check_type ws2tcpip.h "struct group_source_req"
  3868. check_type ws2tcpip.h "struct ip_mreq_source"
  3869. check_type ws2tcpip.h "struct ipv6_mreq"
  3870. check_type winsock2.h "struct pollfd"
  3871. check_struct winsock2.h "struct sockaddr" sa_len
  3872. check_type ws2tcpip.h "struct sockaddr_in6"
  3873. check_type ws2tcpip.h "struct sockaddr_storage"
  3874. else
  3875. disable network
  3876. fi
  3877. fi
  3878. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3879. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3880. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3881. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3882. case "$custom_allocator" in
  3883. jemalloc)
  3884. # jemalloc by default does not use a prefix
  3885. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  3886. ;;
  3887. tcmalloc)
  3888. require_pkg_config libtcmalloc gperftools/tcmalloc.h tc_malloc
  3889. malloc_prefix=tc_
  3890. ;;
  3891. esac
  3892. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3893. check_func ${malloc_prefix}memalign && enable memalign
  3894. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3895. check_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  3896. check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
  3897. check_func fcntl
  3898. check_func fork
  3899. check_func gethrtime
  3900. check_func getopt
  3901. check_func getrusage
  3902. check_func gettimeofday
  3903. check_func gmtime_r
  3904. check_func isatty
  3905. check_func localtime_r
  3906. check_func mach_absolute_time
  3907. check_func mkstemp
  3908. check_func mmap
  3909. check_func mprotect
  3910. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3911. check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt; }
  3912. check_func sched_getaffinity
  3913. check_func setrlimit
  3914. check_func strerror_r
  3915. check_func sysconf
  3916. check_func sysctl
  3917. check_func usleep
  3918. check_func_headers io.h setmode
  3919. check_func_headers stdlib.h getenv
  3920. check_func_headers windows.h CoTaskMemFree -lole32
  3921. check_func_headers windows.h GetProcessAffinityMask
  3922. check_func_headers windows.h GetProcessTimes
  3923. check_func_headers windows.h GetSystemTimeAsFileTime
  3924. check_func_headers windows.h LoadLibrary
  3925. check_func_headers windows.h MapViewOfFile
  3926. check_func_headers windows.h SetConsoleTextAttribute
  3927. check_func_headers windows.h Sleep
  3928. check_func_headers windows.h VirtualAlloc
  3929. check_struct windows.h "CONDITION_VARIABLE" Ptr
  3930. check_header direct.h
  3931. check_header dlfcn.h
  3932. check_header d3d11.h
  3933. check_header dxva.h
  3934. check_header dxva2api.h
  3935. check_header io.h
  3936. check_header mach/mach_time.h
  3937. check_header malloc.h
  3938. check_header poll.h
  3939. check_header sys/mman.h
  3940. check_header sys/param.h
  3941. check_header sys/resource.h
  3942. check_header sys/select.h
  3943. check_header sys/time.h
  3944. check_header sys/un.h
  3945. check_header unistd.h
  3946. check_header valgrind/valgrind.h
  3947. check_header vdpau/vdpau.h
  3948. check_header vdpau/vdpau_x11.h
  3949. check_header VideoDecodeAcceleration/VDADecoder.h
  3950. check_header windows.h
  3951. check_header X11/extensions/XvMClib.h
  3952. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3953. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3954. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3955. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3956. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  3957. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  3958. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  3959. if ! disabled w32threads && ! enabled pthreads; then
  3960. check_func_headers "windows.h process.h" _beginthreadex &&
  3961. enable w32threads || disable w32threads
  3962. fi
  3963. # check for some common methods of building with pthread support
  3964. # do this before the optional library checks as some of them require pthreads
  3965. if ! disabled pthreads && ! enabled w32threads; then
  3966. enable pthreads
  3967. if check_func pthread_join -pthread; then
  3968. add_cflags -pthread
  3969. add_extralibs -pthread
  3970. elif check_func pthread_join -pthreads; then
  3971. add_cflags -pthreads
  3972. add_extralibs -pthreads
  3973. elif check_func pthread_join -lpthreadGC2; then
  3974. add_extralibs -lpthreadGC2
  3975. elif check_lib pthread.h pthread_join -lpthread; then
  3976. :
  3977. elif ! check_func pthread_join; then
  3978. disable pthreads
  3979. fi
  3980. fi
  3981. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3982. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3983. check_lib math.h sin -lm && LIBM="-lm"
  3984. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3985. atan2f_args=2
  3986. ldexpf_args=2
  3987. powf_args=2
  3988. for func in $MATH_FUNCS; do
  3989. eval check_mathfunc $func \${${func}_args:-1}
  3990. done
  3991. # these are off by default, so fail if requested and not available
  3992. enabled avisynth && { check_lib2 "avisynth/avisynth_c.h windows.h" LoadLibrary ||
  3993. check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl ||
  3994. die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
  3995. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3996. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3997. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  3998. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  3999. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4000. enabled libfdk_aac && require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
  4001. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  4002. enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  4003. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  4004. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  4005. done || die "ERROR: libgsm not found"; }
  4006. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4007. enabled libkvazaar && require_pkg_config "kvazaar >= 0.7.1" kvazaar.h kvz_api_get
  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"