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.

4784 lines
140KB

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