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.

4825 lines
142KB

  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. startcode
  1416. tpeldsp
  1417. videodsp
  1418. vp3dsp
  1419. "
  1420. CMDLINE_SELECT="
  1421. $ARCH_EXT_LIST
  1422. $CONFIG_LIST
  1423. $HAVE_LIST_CMDLINE
  1424. $THREADS_LIST
  1425. asm
  1426. cross_compile
  1427. debug
  1428. extra_warnings
  1429. logging
  1430. lto
  1431. optimizations
  1432. "
  1433. PATHS_LIST="
  1434. bindir
  1435. datadir
  1436. docdir
  1437. incdir
  1438. libdir
  1439. mandir
  1440. prefix
  1441. shlibdir
  1442. "
  1443. CMDLINE_SET="
  1444. $PATHS_LIST
  1445. ar
  1446. arch
  1447. as
  1448. build_suffix
  1449. cc
  1450. cpu
  1451. cross_prefix
  1452. dep_cc
  1453. extra_version
  1454. host_cc
  1455. host_cflags
  1456. host_ld
  1457. host_ldflags
  1458. host_libs
  1459. host_os
  1460. ld
  1461. logfile
  1462. malloc_prefix
  1463. nm
  1464. optflags
  1465. pkg_config
  1466. pkg_config_flags
  1467. random_seed
  1468. samples
  1469. sysinclude
  1470. sysroot
  1471. target_exec
  1472. target_os
  1473. target_path
  1474. target_samples
  1475. toolchain
  1476. "
  1477. CMDLINE_APPEND="
  1478. extra_cflags
  1479. host_cppflags
  1480. "
  1481. # code dependency declarations
  1482. # architecture extensions
  1483. armv5te_deps="arm"
  1484. armv6_deps="arm"
  1485. armv6t2_deps="arm"
  1486. armv8_deps="aarch64"
  1487. neon_deps_any="aarch64 arm"
  1488. intrinsics_neon_deps="neon"
  1489. vfp_deps_any="aarch64 arm"
  1490. vfpv3_deps="vfp"
  1491. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1492. altivec_deps="ppc"
  1493. ppc4xx_deps="ppc"
  1494. cpunop_deps="i686"
  1495. x86_64_select="i686"
  1496. x86_64_suggest="fast_cmov"
  1497. amd3dnow_deps="mmx"
  1498. amd3dnowext_deps="amd3dnow"
  1499. i686_deps="x86"
  1500. mmx_deps="x86"
  1501. mmxext_deps="mmx"
  1502. sse_deps="mmxext"
  1503. sse2_deps="sse"
  1504. sse3_deps="sse2"
  1505. ssse3_deps="sse3"
  1506. sse4_deps="ssse3"
  1507. sse42_deps="sse4"
  1508. avx_deps="sse42"
  1509. xop_deps="avx"
  1510. fma3_deps="avx"
  1511. fma4_deps="avx"
  1512. avx2_deps="avx"
  1513. mmx_external_deps="yasm"
  1514. mmx_inline_deps="inline_asm"
  1515. mmx_suggest="mmx_external mmx_inline"
  1516. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  1517. eval dep=\$${ext}_deps
  1518. eval ${ext}_external_deps='"${dep}_external"'
  1519. eval ${ext}_inline_deps='"${dep}_inline"'
  1520. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1521. done
  1522. aligned_stack_if_any="aarch64 ppc x86"
  1523. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1524. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  1525. fast_unaligned_if_any="aarch64 ppc x86"
  1526. simd_align_16_if_any="altivec neon sse"
  1527. # system capabilities
  1528. log2_deps="!libc_msvcrt"
  1529. symver_if_any="symver_asm_label symver_gnu_asm"
  1530. # threading support
  1531. atomics_gcc_if="sync_val_compare_and_swap"
  1532. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1533. atomics_win32_if="MemoryBarrier"
  1534. atomics_native_if_any="$ATOMICS_LIST"
  1535. w32threads_deps="atomics_native"
  1536. threads_if_any="$THREADS_LIST"
  1537. # subsystems
  1538. dct_select="rdft"
  1539. error_resilience_select="me_cmp"
  1540. intrax8_select="error_resilience"
  1541. mdct_select="fft"
  1542. rdft_select="fft"
  1543. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  1544. mpeg_er_select="error_resilience"
  1545. mpegaudio_select="mpegaudiodsp"
  1546. mpegaudiodsp_select="dct"
  1547. mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp videodsp"
  1548. mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
  1549. # decoders / encoders
  1550. aac_decoder_select="mdct sinewin"
  1551. aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
  1552. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1553. ac3_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
  1554. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1555. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1556. aic_decoder_select="golomb idctdsp"
  1557. alac_encoder_select="lpc"
  1558. als_decoder_select="bswapdsp"
  1559. amrnb_decoder_select="lsp"
  1560. amrwb_decoder_select="lsp"
  1561. amv_decoder_select="sp5x_decoder"
  1562. ape_decoder_select="bswapdsp"
  1563. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  1564. asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1565. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  1566. asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1567. atrac1_decoder_select="mdct sinewin"
  1568. atrac3_decoder_select="mdct"
  1569. atrac3p_decoder_select="mdct sinewin"
  1570. bink_decoder_select="blockdsp hpeldsp"
  1571. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1572. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1573. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  1574. cllc_decoder_select="bswapdsp"
  1575. comfortnoise_encoder_select="lpc"
  1576. cook_decoder_select="audiodsp mdct sinewin"
  1577. cscd_decoder_select="lzo"
  1578. cscd_decoder_suggest="zlib"
  1579. dca_decoder_select="mdct"
  1580. dnxhd_decoder_select="blockdsp idctdsp"
  1581. dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  1582. dvvideo_decoder_select="dvprofile idctdsp"
  1583. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  1584. dxa_decoder_deps="zlib"
  1585. eac3_decoder_select="ac3_decoder"
  1586. eac3_encoder_select="ac3_encoder"
  1587. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  1588. eatgq_decoder_select="aandcttables idctdsp"
  1589. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder"
  1590. exr_decoder_deps="zlib"
  1591. ffv1_decoder_select="golomb rangecoder"
  1592. ffv1_encoder_select="rangecoder"
  1593. ffvhuff_decoder_select="huffyuv_decoder"
  1594. ffvhuff_encoder_select="huffyuv_encoder"
  1595. fic_decoder_select="golomb"
  1596. flac_decoder_select="golomb"
  1597. flac_encoder_select="bswapdsp golomb lpc"
  1598. flashsv_decoder_deps="zlib"
  1599. flashsv_encoder_deps="zlib"
  1600. flashsv2_decoder_deps="zlib"
  1601. flv_decoder_select="h263_decoder"
  1602. flv_encoder_select="h263_encoder"
  1603. fourxm_decoder_select="blockdsp bswapdsp"
  1604. fraps_decoder_select="bswapdsp huffman"
  1605. g2m_decoder_deps="zlib"
  1606. g2m_decoder_select="blockdsp idctdsp"
  1607. h261_decoder_select="mpeg_er mpegvideo"
  1608. h261_encoder_select="aandcttables mpegvideoenc"
  1609. h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
  1610. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1611. h263i_decoder_select="h263_decoder"
  1612. h263p_encoder_select="h263_encoder"
  1613. h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
  1614. h264_decoder_suggest="error_resilience"
  1615. hevc_decoder_select="bswapdsp cabac golomb videodsp"
  1616. huffyuv_decoder_select="bswapdsp huffyuvdsp"
  1617. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
  1618. iac_decoder_select="imc_decoder"
  1619. imc_decoder_select="bswapdsp fft mdct sinewin"
  1620. indeo3_decoder_select="hpeldsp"
  1621. interplay_video_decoder_select="hpeldsp"
  1622. jpegls_decoder_select="golomb mjpeg_decoder"
  1623. jpegls_encoder_select="golomb"
  1624. jv_decoder_select="blockdsp"
  1625. lagarith_decoder_select="huffyuvdsp"
  1626. ljpeg_encoder_select="aandcttables idctdsp"
  1627. loco_decoder_select="golomb"
  1628. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  1629. metasound_decoder_select="lsp mdct sinewin"
  1630. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  1631. mjpeg_decoder_select="blockdsp hpeldsp idctdsp"
  1632. mjpeg_encoder_select="aandcttables mpegvideoenc"
  1633. mjpegb_decoder_select="mjpeg_decoder"
  1634. mlp_decoder_select="mlp_parser"
  1635. motionpixels_decoder_select="bswapdsp"
  1636. mp1_decoder_select="mpegaudio"
  1637. mp1float_decoder_select="mpegaudio"
  1638. mp2_decoder_select="mpegaudio"
  1639. mp2float_decoder_select="mpegaudio"
  1640. mp3_decoder_select="mpegaudio"
  1641. mp3adu_decoder_select="mpegaudio"
  1642. mp3adufloat_decoder_select="mpegaudio"
  1643. mp3float_decoder_select="mpegaudio"
  1644. mp3on4_decoder_select="mpegaudio"
  1645. mp3on4float_decoder_select="mpegaudio"
  1646. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  1647. mpc8_decoder_select="mpegaudiodsp"
  1648. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1649. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1650. mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
  1651. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1652. mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
  1653. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1654. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1655. mpeg4_encoder_select="h263_encoder"
  1656. msmpeg4v1_decoder_select="h263_decoder"
  1657. msmpeg4v2_decoder_select="h263_decoder"
  1658. msmpeg4v2_encoder_select="h263_encoder"
  1659. msmpeg4v3_decoder_select="h263_decoder"
  1660. msmpeg4v3_encoder_select="h263_encoder"
  1661. mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder"
  1662. mxpeg_decoder_select="mjpeg_decoder"
  1663. nellymoser_decoder_select="mdct sinewin"
  1664. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1665. nuv_decoder_select="idctdsp lzo"
  1666. on2avc_decoder_select="mdct"
  1667. opus_decoder_deps="avresample"
  1668. png_decoder_deps="zlib"
  1669. png_encoder_deps="zlib"
  1670. png_encoder_select="huffyuvencdsp"
  1671. prores_decoder_select="idctdsp"
  1672. prores_encoder_select="fdctdsp"
  1673. qcelp_decoder_select="lsp"
  1674. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1675. ra_144_encoder_select="audio_frame_queue lpc"
  1676. ralf_decoder_select="golomb"
  1677. rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1678. rv10_encoder_select="h263_encoder"
  1679. rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1680. rv20_encoder_select="h263_encoder"
  1681. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  1682. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  1683. shorten_decoder_select="golomb"
  1684. sipr_decoder_select="lsp"
  1685. sp5x_decoder_select="mjpeg_decoder"
  1686. svq1_decoder_select="hpeldsp"
  1687. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  1688. svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  1689. svq3_decoder_suggest="zlib"
  1690. tak_decoder_select="audiodsp"
  1691. theora_decoder_select="vp3_decoder"
  1692. thp_decoder_select="mjpeg_decoder"
  1693. tiff_decoder_suggest="zlib"
  1694. tiff_encoder_suggest="zlib"
  1695. truehd_decoder_select="mlp_decoder"
  1696. truemotion2_decoder_select="bswapdsp"
  1697. truespeech_decoder_select="bswapdsp"
  1698. tscc_decoder_deps="zlib"
  1699. twinvq_decoder_select="mdct lsp sinewin"
  1700. utvideo_decoder_select="bswapdsp"
  1701. utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  1702. vble_decoder_select="huffyuvdsp"
  1703. vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp startcode"
  1704. vc1image_decoder_select="vc1_decoder"
  1705. vorbis_decoder_select="mdct"
  1706. vorbis_encoder_select="mdct"
  1707. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1708. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1709. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1710. vp6a_decoder_select="vp6_decoder"
  1711. vp6f_decoder_select="vp6_decoder"
  1712. vp7_decoder_select="h264pred videodsp"
  1713. vp8_decoder_select="h264pred videodsp"
  1714. vp9_decoder_select="videodsp"
  1715. webp_decoder_select="vp8_decoder"
  1716. wmapro_decoder_select="mdct sinewin"
  1717. wmav1_decoder_select="mdct sinewin"
  1718. wmav1_encoder_select="mdct sinewin"
  1719. wmav2_decoder_select="mdct sinewin"
  1720. wmav2_encoder_select="mdct sinewin"
  1721. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1722. wmv1_decoder_select="h263_decoder"
  1723. wmv1_encoder_select="h263_encoder"
  1724. wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp"
  1725. wmv2_encoder_select="h263_encoder"
  1726. wmv3_decoder_select="vc1_decoder"
  1727. wmv3image_decoder_select="wmv3_decoder"
  1728. zerocodec_decoder_deps="zlib"
  1729. zlib_decoder_deps="zlib"
  1730. zlib_encoder_deps="zlib"
  1731. zmbv_decoder_deps="zlib"
  1732. zmbv_encoder_deps="zlib"
  1733. # hardware accelerators
  1734. dxva2_deps="dxva2api_h"
  1735. vaapi_deps="va_va_h"
  1736. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1737. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1738. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1739. h263_vaapi_hwaccel_deps="vaapi"
  1740. h263_vaapi_hwaccel_select="h263_decoder"
  1741. h263_vdpau_hwaccel_deps="vdpau"
  1742. h263_vdpau_hwaccel_select="h263_decoder"
  1743. h264_dxva2_hwaccel_deps="dxva2"
  1744. h264_dxva2_hwaccel_select="h264_decoder"
  1745. h264_vaapi_hwaccel_deps="vaapi"
  1746. h264_vaapi_hwaccel_select="h264_decoder"
  1747. h264_vda_hwaccel_deps="vda"
  1748. h264_vda_hwaccel_select="h264_decoder"
  1749. h264_vda_old_hwaccel_deps="vda"
  1750. h264_vda_old_hwaccel_select="h264_decoder"
  1751. h264_vdpau_hwaccel_deps="vdpau"
  1752. h264_vdpau_hwaccel_select="h264_decoder"
  1753. mpeg1_vdpau_hwaccel_deps="vdpau"
  1754. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1755. mpeg2_dxva2_hwaccel_deps="dxva2"
  1756. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1757. mpeg2_vaapi_hwaccel_deps="vaapi"
  1758. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1759. mpeg2_vdpau_hwaccel_deps="vdpau"
  1760. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1761. mpeg4_vaapi_hwaccel_deps="vaapi"
  1762. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1763. mpeg4_vdpau_hwaccel_deps="vdpau"
  1764. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1765. vc1_dxva2_hwaccel_deps="dxva2"
  1766. vc1_dxva2_hwaccel_select="vc1_decoder"
  1767. vc1_vaapi_hwaccel_deps="vaapi"
  1768. vc1_vaapi_hwaccel_select="vc1_decoder"
  1769. vc1_vdpau_hwaccel_deps="vdpau"
  1770. vc1_vdpau_hwaccel_select="vc1_decoder"
  1771. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1772. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1773. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1774. # parsers
  1775. h264_parser_select="h264_decoder"
  1776. mpegvideo_parser_select="mpegvideo"
  1777. mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
  1778. vc1_parser_select="mpegvideo startcode"
  1779. # external libraries
  1780. libfaac_encoder_deps="libfaac"
  1781. libfaac_encoder_select="audio_frame_queue"
  1782. libfdk_aac_decoder_deps="libfdk_aac"
  1783. libfdk_aac_encoder_deps="libfdk_aac"
  1784. libfdk_aac_encoder_select="audio_frame_queue"
  1785. libgsm_decoder_deps="libgsm"
  1786. libgsm_encoder_deps="libgsm"
  1787. libgsm_ms_decoder_deps="libgsm"
  1788. libgsm_ms_encoder_deps="libgsm"
  1789. libilbc_decoder_deps="libilbc"
  1790. libilbc_encoder_deps="libilbc"
  1791. libmp3lame_encoder_deps="libmp3lame"
  1792. libmp3lame_encoder_select="audio_frame_queue"
  1793. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1794. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1795. libopencore_amrnb_encoder_select="audio_frame_queue"
  1796. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1797. libopenjpeg_decoder_deps="libopenjpeg"
  1798. libopenjpeg_encoder_deps="libopenjpeg"
  1799. libopus_decoder_deps="libopus"
  1800. libopus_encoder_deps="libopus"
  1801. libopus_encoder_select="audio_frame_queue"
  1802. libschroedinger_decoder_deps="libschroedinger"
  1803. libschroedinger_encoder_deps="libschroedinger"
  1804. libspeex_decoder_deps="libspeex"
  1805. libspeex_encoder_deps="libspeex"
  1806. libspeex_encoder_select="audio_frame_queue"
  1807. libtheora_encoder_deps="libtheora"
  1808. libtwolame_encoder_deps="libtwolame"
  1809. libvo_aacenc_encoder_deps="libvo_aacenc"
  1810. libvo_aacenc_encoder_select="audio_frame_queue"
  1811. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1812. libvorbis_encoder_deps="libvorbis"
  1813. libvorbis_encoder_select="audio_frame_queue"
  1814. libvpx_vp8_decoder_deps="libvpx"
  1815. libvpx_vp8_encoder_deps="libvpx"
  1816. libvpx_vp9_decoder_deps="libvpx"
  1817. libvpx_vp9_encoder_deps="libvpx"
  1818. libwavpack_encoder_deps="libwavpack"
  1819. libwebp_encoder_deps="libwebp"
  1820. libx264_encoder_deps="libx264"
  1821. libx265_encoder_deps="libx265"
  1822. libxavs_encoder_deps="libxavs"
  1823. libxvid_encoder_deps="libxvid"
  1824. # demuxers / muxers
  1825. ac3_demuxer_select="ac3_parser"
  1826. asf_demuxer_select="riffdec"
  1827. asf_muxer_select="riffenc"
  1828. asf_stream_muxer_select="asf_muxer"
  1829. avi_demuxer_select="riffdec"
  1830. avi_muxer_select="riffenc"
  1831. avisynth_demuxer_deps="avisynth"
  1832. avisynth_demuxer_select="riffdec"
  1833. caf_demuxer_select="riffdec"
  1834. dirac_demuxer_select="dirac_parser"
  1835. dv_demuxer_select="dvprofile"
  1836. dv_muxer_select="dvprofile"
  1837. dxa_demuxer_select="riffdec"
  1838. eac3_demuxer_select="ac3_parser"
  1839. f4v_muxer_select="mov_muxer"
  1840. flac_demuxer_select="flac_parser"
  1841. hds_muxer_select="flv_muxer"
  1842. hls_muxer_select="mpegts_muxer"
  1843. ipod_muxer_select="mov_muxer"
  1844. ismv_muxer_select="mov_muxer"
  1845. matroska_audio_muxer_select="matroska_muxer"
  1846. matroska_demuxer_select="riffdec"
  1847. matroska_demuxer_suggest="bzlib lzo zlib"
  1848. matroska_muxer_select="riffenc"
  1849. mmf_muxer_select="riffenc"
  1850. mov_demuxer_select="riffdec"
  1851. mov_demuxer_suggest="zlib"
  1852. mov_muxer_select="riffenc rtpenc_chain"
  1853. mp3_demuxer_select="mpegaudio_parser"
  1854. mp4_muxer_select="mov_muxer"
  1855. mpegts_muxer_select="adts_muxer latm_muxer"
  1856. mpegtsraw_demuxer_select="mpegts_demuxer"
  1857. mxf_d10_muxer_select="mxf_muxer"
  1858. nut_muxer_select="riffenc"
  1859. nuv_demuxer_select="riffdec"
  1860. ogg_demuxer_select="golomb"
  1861. psp_muxer_select="mov_muxer"
  1862. rtp_demuxer_select="sdp_demuxer"
  1863. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1864. rtsp_demuxer_select="http_protocol rtpdec"
  1865. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1866. sap_demuxer_select="sdp_demuxer"
  1867. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1868. sdp_demuxer_select="rtpdec"
  1869. smoothstreaming_muxer_select="ismv_muxer"
  1870. spdif_muxer_select="aac_parser"
  1871. tak_demuxer_select="tak_parser"
  1872. tg2_muxer_select="mov_muxer"
  1873. tgp_muxer_select="mov_muxer"
  1874. w64_demuxer_select="wav_demuxer"
  1875. wav_demuxer_select="riffdec"
  1876. wav_muxer_select="riffenc"
  1877. webm_muxer_select="riffenc"
  1878. wtv_demuxer_select="riffdec"
  1879. xmv_demuxer_select="riffdec"
  1880. xwma_demuxer_select="riffdec"
  1881. # indevs / outdevs
  1882. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1883. alsa_outdev_deps="alsa_asoundlib_h"
  1884. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1885. dv1394_indev_deps="dv1394"
  1886. dv1394_indev_select="dv_demuxer"
  1887. fbdev_indev_deps="linux_fb_h"
  1888. jack_indev_deps="jack_jack_h pthreads"
  1889. libcdio_indev_deps="libcdio"
  1890. libdc1394_indev_deps="libdc1394"
  1891. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1892. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1893. pulse_indev_deps="libpulse"
  1894. sndio_indev_deps="sndio_h"
  1895. sndio_outdev_deps="sndio_h"
  1896. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1897. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1898. vfwcap_indev_extralibs="-lavicap32"
  1899. x11grab_indev_deps="x11grab XShmCreateImage"
  1900. # protocols
  1901. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1902. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1903. ffrtmpcrypt_protocol_select="tcp_protocol"
  1904. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1905. ffrtmphttp_protocol_select="http_protocol"
  1906. gopher_protocol_select="network"
  1907. http_protocol_select="tcp_protocol"
  1908. httpproxy_protocol_select="tcp_protocol"
  1909. https_protocol_select="tls_protocol"
  1910. icecast_protocol_select="http_protocol"
  1911. librtmp_protocol_deps="librtmp"
  1912. librtmpe_protocol_deps="librtmp"
  1913. librtmps_protocol_deps="librtmp"
  1914. librtmpt_protocol_deps="librtmp"
  1915. librtmpte_protocol_deps="librtmp"
  1916. mmsh_protocol_select="http_protocol"
  1917. mmst_protocol_select="network"
  1918. rtmp_protocol_deps="!librtmp_protocol"
  1919. rtmp_protocol_select="tcp_protocol"
  1920. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1921. rtmps_protocol_deps="!librtmp_protocol"
  1922. rtmps_protocol_select="tls_protocol"
  1923. rtmpt_protocol_select="ffrtmphttp_protocol"
  1924. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1925. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1926. rtp_protocol_select="udp_protocol"
  1927. sctp_protocol_deps="struct_sctp_event_subscribe"
  1928. sctp_protocol_select="network"
  1929. srtp_protocol_select="rtp_protocol"
  1930. tcp_protocol_select="network"
  1931. tls_protocol_deps_any="openssl gnutls"
  1932. tls_protocol_select="tcp_protocol"
  1933. udp_protocol_select="network"
  1934. unix_protocol_deps="sys_un_h"
  1935. unix_protocol_select="network"
  1936. # filters
  1937. blackframe_filter_deps="gpl"
  1938. boxblur_filter_deps="gpl"
  1939. bs2b_filter_deps="libbs2b"
  1940. cropdetect_filter_deps="gpl"
  1941. delogo_filter_deps="gpl"
  1942. drawtext_filter_deps="libfreetype"
  1943. frei0r_filter_deps="frei0r dlopen"
  1944. frei0r_filter_extralibs='$ldl'
  1945. frei0r_src_filter_deps="frei0r dlopen"
  1946. frei0r_src_filter_extralibs='$ldl'
  1947. hqdn3d_filter_deps="gpl"
  1948. interlace_filter_deps="gpl"
  1949. ocv_filter_deps="libopencv"
  1950. resample_filter_deps="avresample"
  1951. scale_filter_deps="swscale"
  1952. # examples
  1953. avcodec_example_deps="avcodec avutil"
  1954. filter_audio_example_deps="avfilter avutil"
  1955. metadata_example_deps="avformat avutil"
  1956. output_example_deps="avcodec avformat avutil swscale"
  1957. transcode_aac_example_deps="avcodec avformat avresample"
  1958. # libraries, in linking order
  1959. avcodec_deps="avutil"
  1960. avdevice_deps="avformat avcodec avutil"
  1961. avfilter_deps="avutil"
  1962. avformat_deps="avcodec avutil"
  1963. avresample_deps="avutil"
  1964. swscale_deps="avutil"
  1965. # programs
  1966. avconv_deps="avcodec avfilter avformat avresample swscale"
  1967. avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
  1968. fps_filter null_filter resample_filter scale_filter
  1969. setpts_filter trim_filter"
  1970. avplay_deps="avcodec avformat avresample swscale sdl"
  1971. avplay_libs='$sdl_libs'
  1972. avplay_select="rdft"
  1973. avprobe_deps="avcodec avformat"
  1974. # documentation
  1975. pod2man_deps="doc"
  1976. texi2html_deps="doc"
  1977. # default parameters
  1978. logfile="config.log"
  1979. # installation paths
  1980. prefix_default="/usr/local"
  1981. bindir_default='${prefix}/bin'
  1982. datadir_default='${prefix}/share/avconv'
  1983. docdir_default='${prefix}/share/doc/libav'
  1984. incdir_default='${prefix}/include'
  1985. libdir_default='${prefix}/lib'
  1986. mandir_default='${prefix}/share/man'
  1987. shlibdir_default="$libdir_default"
  1988. # toolchain
  1989. ar_default="ar"
  1990. cc_default="gcc"
  1991. host_cc_default="gcc"
  1992. cp_f="cp -f"
  1993. ln_s="ln -s -f"
  1994. nm_default="nm -g"
  1995. objformat="elf"
  1996. pkg_config_default=pkg-config
  1997. ranlib="ranlib"
  1998. strip="strip"
  1999. yasmexe="yasm"
  2000. # machine
  2001. arch_default=$(uname -m)
  2002. cpu="generic"
  2003. intrinsics="none"
  2004. # OS
  2005. target_os_default=$(tolower $(uname -s))
  2006. host_os=$target_os_default
  2007. # configurable options
  2008. enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
  2009. enable asm
  2010. enable debug
  2011. enable doc
  2012. enable optimizations
  2013. enable safe_bitstream_reader
  2014. enable static
  2015. enable swscale_alpha
  2016. # By default, enable only those hwaccels that have no external dependencies.
  2017. enable dxva2 vdpau
  2018. # build settings
  2019. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2020. LIBPREF="lib"
  2021. LIBSUF=".a"
  2022. FULLNAME='$(NAME)$(BUILDSUF)'
  2023. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2024. SLIBPREF="lib"
  2025. SLIBSUF=".so"
  2026. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2027. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2028. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2029. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2030. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2031. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2032. asflags_filter=echo
  2033. cflags_filter=echo
  2034. ldflags_filter=echo
  2035. AS_C='-c'
  2036. AS_O='-o $@'
  2037. CC_C='-c'
  2038. CC_E='-E -o $@'
  2039. CC_O='-o $@'
  2040. LD_O='-o $@'
  2041. LD_LIB='-l%'
  2042. LD_PATH='-L'
  2043. HOSTCC_C='-c'
  2044. HOSTCC_E='-E -o $@'
  2045. HOSTCC_O='-o $@'
  2046. HOSTLD_O='-o $@'
  2047. host_libs='-lm'
  2048. host_cflags_filter=echo
  2049. host_ldflags_filter=echo
  2050. target_path='$(CURDIR)'
  2051. # since the object filename is not given with the -MM flag, the compiler
  2052. # is only able to print the basename, and we must add the path ourselves
  2053. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2054. DEPFLAGS='-MM'
  2055. # find source path
  2056. if test -f configure; then
  2057. source_path=.
  2058. else
  2059. source_path=$(cd $(dirname "$0"); pwd)
  2060. echo "$source_path" | grep -q '[[:blank:]]' &&
  2061. die "Out of tree builds are impossible with whitespace in source path."
  2062. test -e "$source_path/config.h" &&
  2063. die "Out of tree builds are impossible with config.h in source dir."
  2064. fi
  2065. for v in "$@"; do
  2066. r=${v#*=}
  2067. l=${v%"$r"}
  2068. r=$(sh_quote "$r")
  2069. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  2070. done
  2071. find_things(){
  2072. thing=$1
  2073. pattern=$2
  2074. file=$source_path/$3
  2075. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2076. }
  2077. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2078. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2079. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2080. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2081. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2082. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2083. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2084. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2085. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2086. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2087. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2088. ALL_COMPONENTS="
  2089. $BSF_LIST
  2090. $DECODER_LIST
  2091. $DEMUXER_LIST
  2092. $ENCODER_LIST
  2093. $FILTER_LIST
  2094. $HWACCEL_LIST
  2095. $INDEV_LIST
  2096. $MUXER_LIST
  2097. $OUTDEV_LIST
  2098. $PARSER_LIST
  2099. $PROTOCOL_LIST
  2100. "
  2101. for n in $COMPONENT_LIST; do
  2102. v=$(toupper ${n%s})_LIST
  2103. eval enable \$$v
  2104. eval ${n}_if_any="\$$v"
  2105. done
  2106. enable $ARCH_EXT_LIST
  2107. die_unknown(){
  2108. echo "Unknown option \"$1\"."
  2109. echo "See $0 --help for available options."
  2110. exit 1
  2111. }
  2112. print_3_columns() {
  2113. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2114. }
  2115. show_list() {
  2116. suffix=_$1
  2117. shift
  2118. echo $* | sed s/$suffix//g | print_3_columns
  2119. exit 0
  2120. }
  2121. rand_list(){
  2122. IFS=', '
  2123. set -- $*
  2124. unset IFS
  2125. for thing; do
  2126. comp=${thing%:*}
  2127. prob=${thing#$comp}
  2128. prob=${prob#:}
  2129. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2130. echo "prob ${prob:-0.5}"
  2131. printf '%s\n' $comp
  2132. done
  2133. }
  2134. do_random(){
  2135. action=$1
  2136. shift
  2137. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2138. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2139. }
  2140. for opt do
  2141. optval="${opt#*=}"
  2142. case "$opt" in
  2143. --extra-ldflags=*)
  2144. add_ldflags $optval
  2145. ;;
  2146. --extra-ldexeflags=*)
  2147. add_ldexeflags $optval
  2148. ;;
  2149. --extra-libs=*)
  2150. add_extralibs $optval
  2151. ;;
  2152. --disable-devices)
  2153. disable $INDEV_LIST $OUTDEV_LIST
  2154. ;;
  2155. --enable-debug=*)
  2156. debuglevel="$optval"
  2157. ;;
  2158. --disable-programs)
  2159. disable $PROGRAM_LIST
  2160. ;;
  2161. --disable-everything)
  2162. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2163. ;;
  2164. --disable-all)
  2165. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2166. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2167. ;;
  2168. --enable-random|--disable-random)
  2169. action=${opt%%-random}
  2170. do_random ${action#--} $COMPONENT_LIST
  2171. ;;
  2172. --enable-random=*|--disable-random=*)
  2173. action=${opt%%-random=*}
  2174. do_random ${action#--} $optval
  2175. ;;
  2176. --enable-*=*|--disable-*=*)
  2177. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2178. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2179. eval list=\$$(toupper $thing)_LIST
  2180. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2181. $action $(filter "$name" $list)
  2182. ;;
  2183. --enable-avserver|--disable-avserver*)
  2184. warn "avserver has been removed, the ${opt} option is only"\
  2185. "provided for compatibility and will be removed in the future"
  2186. ;;
  2187. --enable-?*|--disable-?*)
  2188. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2189. if is_in $option $COMPONENT_LIST; then
  2190. test $action = disable && action=unset
  2191. eval $action \$$(toupper ${option%s})_LIST
  2192. elif is_in $option $CMDLINE_SELECT; then
  2193. $action $option
  2194. else
  2195. die_unknown $opt
  2196. fi
  2197. ;;
  2198. --list-*)
  2199. NAME="${opt#--list-}"
  2200. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2201. NAME=${NAME%s}
  2202. eval show_list $NAME \$$(toupper $NAME)_LIST
  2203. ;;
  2204. --help|-h) show_help
  2205. ;;
  2206. *)
  2207. optname="${opt%%=*}"
  2208. optname="${optname#--}"
  2209. optname=$(echo "$optname" | sed 's/-/_/g')
  2210. if is_in $optname $CMDLINE_SET; then
  2211. eval $optname='$optval'
  2212. elif is_in $optname $CMDLINE_APPEND; then
  2213. append $optname "$optval"
  2214. else
  2215. die_unknown $opt
  2216. fi
  2217. ;;
  2218. esac
  2219. done
  2220. disabled logging && logfile=/dev/null
  2221. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  2222. set >> $logfile
  2223. test -n "$cross_prefix" && enable cross_compile
  2224. if enabled cross_compile; then
  2225. test -n "$arch" && test -n "$target_os" ||
  2226. die "Must specify target arch and OS when cross-compiling"
  2227. fi
  2228. ar_default="${cross_prefix}${ar_default}"
  2229. cc_default="${cross_prefix}${cc_default}"
  2230. nm_default="${cross_prefix}${nm_default}"
  2231. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2232. ranlib="${cross_prefix}${ranlib}"
  2233. strip="${cross_prefix}${strip}"
  2234. sysinclude_default="${sysroot}/usr/include"
  2235. case "$toolchain" in
  2236. clang-asan)
  2237. cc_default="clang"
  2238. add_cflags -fsanitize=address
  2239. add_ldflags -fsanitize=address
  2240. ;;
  2241. clang-tsan)
  2242. cc_default="clang"
  2243. add_cflags -fsanitize=thread -pie
  2244. add_ldflags -fsanitize=thread -pie
  2245. ;;
  2246. clang-usan)
  2247. cc_default="clang"
  2248. add_cflags -fsanitize=undefined -O1
  2249. add_ldflags -fsanitize=undefined
  2250. ;;
  2251. gcc-asan)
  2252. cc_default="gcc"
  2253. add_cflags -fsanitize=address
  2254. add_ldflags -fsanitize=address
  2255. ;;
  2256. gcc-tsan)
  2257. cc_default="gcc"
  2258. add_cflags -fsanitize=thread -pie -fPIC
  2259. add_ldflags -fsanitize=thread -pie -fPIC
  2260. ;;
  2261. gcc-usan)
  2262. cc_default="gcc"
  2263. add_cflags -fsanitize=undefined
  2264. add_ldflags -fsanitize=undefined
  2265. ;;
  2266. valgrind-massif)
  2267. target_exec_default="valgrind"
  2268. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2269. ;;
  2270. valgrind-memcheck)
  2271. target_exec_default="valgrind"
  2272. target_exec_args="--track-origins=yes --leak-check=full"
  2273. ;;
  2274. msvc)
  2275. # Check whether the current MSVC version needs the C99 converter.
  2276. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2277. # support enough of C99 to build libav. Default to the new
  2278. # behaviour if the regexp was unable to match anything, since this
  2279. # successfully parses the version number of existing supported
  2280. # versions that require the converter (MSVC 2010 and 2012).
  2281. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2282. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2283. cc_default="cl"
  2284. else
  2285. cc_default="c99wrap cl"
  2286. fi
  2287. ld_default="link"
  2288. nm_default="dumpbin -symbols"
  2289. ar_default="lib"
  2290. target_os_default="win32"
  2291. # Use a relative path for TMPDIR. This makes sure all the
  2292. # ffconf temp files are written with a relative path, avoiding
  2293. # issues with msys/win32 path conversion for MSVC parameters
  2294. # such as -Fo<file> or -out:<file>.
  2295. TMPDIR=.
  2296. ;;
  2297. icl)
  2298. cc_default="icl"
  2299. ld_default="xilink"
  2300. nm_default="dumpbin -symbols"
  2301. ar_default="xilib"
  2302. target_os_default="win32"
  2303. TMPDIR=.
  2304. ;;
  2305. gcov)
  2306. add_cflags -fprofile-arcs -ftest-coverage
  2307. add_ldflags -fprofile-arcs -ftest-coverage
  2308. ;;
  2309. hardened)
  2310. add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
  2311. add_ldflags -Wl,-z,relro -Wl,-z,now
  2312. ;;
  2313. ?*)
  2314. die "Unknown toolchain $toolchain"
  2315. ;;
  2316. esac
  2317. set_default arch cc pkg_config sysinclude target_exec target_os
  2318. enabled cross_compile || host_cc_default=$cc
  2319. set_default host_cc
  2320. if ! $pkg_config --version >/dev/null 2>&1; then
  2321. warn "$pkg_config not found, library detection may fail."
  2322. pkg_config=false
  2323. fi
  2324. exesuf() {
  2325. case $1 in
  2326. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2327. esac
  2328. }
  2329. EXESUF=$(exesuf $target_os)
  2330. HOSTEXESUF=$(exesuf $host_os)
  2331. # set temporary file name
  2332. : ${TMPDIR:=$TEMPDIR}
  2333. : ${TMPDIR:=$TMP}
  2334. : ${TMPDIR:=/tmp}
  2335. if ! check_cmd mktemp -u XXXXXX; then
  2336. # simple replacement for missing mktemp
  2337. # NOT SAFE FOR GENERAL USE
  2338. mktemp(){
  2339. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2340. }
  2341. fi
  2342. tmpfile(){
  2343. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2344. (set -C; exec > $tmp) 2>/dev/null ||
  2345. die "Unable to create temporary file in $TMPDIR."
  2346. append TMPFILES $tmp
  2347. eval $1=$tmp
  2348. }
  2349. trap 'rm -f -- $TMPFILES' EXIT
  2350. tmpfile TMPASM .asm
  2351. tmpfile TMPC .c
  2352. tmpfile TMPE $EXESUF
  2353. tmpfile TMPH .h
  2354. tmpfile TMPO .o
  2355. tmpfile TMPS .S
  2356. tmpfile TMPSH .sh
  2357. tmpfile TMPV .ver
  2358. unset -f mktemp
  2359. chmod +x $TMPE
  2360. # make sure we can execute files in $TMPDIR
  2361. cat > $TMPSH 2>> $logfile <<EOF
  2362. #! /bin/sh
  2363. EOF
  2364. chmod +x $TMPSH >> $logfile 2>&1
  2365. if ! $TMPSH >> $logfile 2>&1; then
  2366. cat <<EOF
  2367. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2368. variable to another directory and make sure that it is not mounted noexec.
  2369. EOF
  2370. die "Sanity test failed."
  2371. fi
  2372. armasm_flags(){
  2373. for flag; do
  2374. case $flag in
  2375. # Filter out MSVC cl.exe options from cflags that shouldn't
  2376. # be passed to gas-preprocessor
  2377. -M[TD]*) ;;
  2378. *) echo $flag ;;
  2379. esac
  2380. done
  2381. }
  2382. ccc_flags(){
  2383. for flag; do
  2384. case $flag in
  2385. -std=c99) echo -c99 ;;
  2386. -mcpu=*) echo -arch ${flag#*=} ;;
  2387. -mieee) echo -ieee ;;
  2388. -O*|-fast) echo $flag ;;
  2389. -fno-math-errno) echo -assume nomath_errno ;;
  2390. -g) echo -g3 ;;
  2391. -Wall) echo -msg_enable level2 ;;
  2392. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2393. -Wl,*) echo $flag ;;
  2394. -f*|-W*) ;;
  2395. *) echo $flag ;;
  2396. esac
  2397. done
  2398. }
  2399. cparser_flags(){
  2400. for flag; do
  2401. case $flag in
  2402. -Wno-switch) echo -Wno-switch-enum ;;
  2403. -Wno-format-zero-length) ;;
  2404. -Wdisabled-optimization) ;;
  2405. -Wno-pointer-sign) echo -Wno-other ;;
  2406. *) echo $flag ;;
  2407. esac
  2408. done
  2409. }
  2410. msvc_common_flags(){
  2411. for flag; do
  2412. case $flag in
  2413. # In addition to specifying certain flags under the compiler
  2414. # specific filters, they must be specified here as well or else the
  2415. # generic catch all at the bottom will print the original flag.
  2416. -Wall) ;;
  2417. -std=c99) ;;
  2418. # Common flags
  2419. -fomit-frame-pointer) ;;
  2420. -g) echo -Z7 ;;
  2421. -fno-math-errno) ;;
  2422. -fno-common) ;;
  2423. -fno-signed-zeros) ;;
  2424. -fPIC) ;;
  2425. -mthumb) ;;
  2426. -march=*) ;;
  2427. -lz) echo zlib.lib ;;
  2428. -lavifil32) echo vfw32.lib ;;
  2429. -lavicap32) echo vfw32.lib user32.lib ;;
  2430. -l*) echo ${flag#-l}.lib ;;
  2431. *) echo $flag ;;
  2432. esac
  2433. done
  2434. }
  2435. msvc_flags(){
  2436. msvc_common_flags "$@"
  2437. for flag; do
  2438. case $flag in
  2439. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2440. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2441. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2442. -wd4273 ;;
  2443. esac
  2444. done
  2445. }
  2446. icl_flags(){
  2447. msvc_common_flags "$@"
  2448. for flag; do
  2449. case $flag in
  2450. # Despite what Intel's documentation says -Wall, which is supported
  2451. # on Windows, does enable remarks so disable them here.
  2452. -Wall) echo $flag -Qdiag-disable:remark ;;
  2453. -std=c99) echo -Qstd=c99 ;;
  2454. esac
  2455. done
  2456. }
  2457. pgi_flags(){
  2458. for flag; do
  2459. case $flag in
  2460. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2461. -fomit-frame-pointer) echo -Mnoframe ;;
  2462. -g) echo -gopt ;;
  2463. *) echo $flag ;;
  2464. esac
  2465. done
  2466. }
  2467. suncc_flags(){
  2468. for flag; do
  2469. case $flag in
  2470. -march=*|-mcpu=*)
  2471. case "${flag#*=}" in
  2472. native) echo -xtarget=native ;;
  2473. v9|niagara) echo -xarch=sparc ;;
  2474. ultrasparc) echo -xarch=sparcvis ;;
  2475. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2476. i586|pentium) echo -xchip=pentium ;;
  2477. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2478. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2479. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2480. pentium4*) echo -xtarget=pentium4 ;;
  2481. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2482. *-sse3) echo -xarch=sse3 ;;
  2483. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2484. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2485. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2486. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2487. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2488. k8|opteron|athlon64|athlon-fx)
  2489. echo -xarch=sse2a ;;
  2490. athlon*) echo -xarch=pentium_proa ;;
  2491. esac
  2492. ;;
  2493. -std=c99) echo -xc99 ;;
  2494. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2495. -fPIC) echo -KPIC -xcode=pic32 ;;
  2496. -W*,*) echo $flag ;;
  2497. -f*-*|-W*|-mimpure-text) ;;
  2498. -shared) echo -G ;;
  2499. *) echo $flag ;;
  2500. esac
  2501. done
  2502. }
  2503. tms470_flags(){
  2504. for flag; do
  2505. case $flag in
  2506. -march=*|-mcpu=*)
  2507. case "${flag#*=}" in
  2508. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2509. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2510. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2511. armv6*|arm11*) echo -mv=6 ;;
  2512. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2513. echo -mv=5e ;;
  2514. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2515. esac
  2516. ;;
  2517. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2518. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2519. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2520. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2521. -msoft-float) echo --float_support=vfplib ;;
  2522. -O[0-3]|-mf=*) echo $flag ;;
  2523. -g) echo -g -mn ;;
  2524. -pds=*) echo $flag ;;
  2525. -D*|-I*) echo $flag ;;
  2526. --gcc|--abi=*) echo $flag ;;
  2527. -me) echo $flag ;;
  2528. esac
  2529. done
  2530. }
  2531. probe_cc(){
  2532. pfx=$1
  2533. _cc=$2
  2534. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2535. unset _ld_o _ldflags _ld_lib _ld_path
  2536. unset _depflags _DEPCMD _DEPFLAGS
  2537. _flags_filter=echo
  2538. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2539. _type=llvm_gcc
  2540. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2541. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2542. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2543. _cflags_speed='-O3'
  2544. _cflags_size='-Os'
  2545. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2546. _type=gcc
  2547. gcc_version=$($_cc --version | head -n1)
  2548. gcc_basever=$($_cc -dumpversion)
  2549. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2550. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2551. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2552. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2553. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2554. fi
  2555. _cflags_speed='-O3'
  2556. _cflags_size='-Os'
  2557. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2558. _type=icc
  2559. _ident=$($_cc --version | head -n1)
  2560. _depflags='-MMD'
  2561. _cflags_speed='-O3'
  2562. _cflags_size='-Os'
  2563. _cflags_noopt='-O1'
  2564. elif $_cc -v 2>&1 | grep -q xlc; then
  2565. _type=xlc
  2566. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2567. _cflags_speed='-O5'
  2568. _cflags_size='-O5 -qcompact'
  2569. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2570. _type=ccc
  2571. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2572. _DEPFLAGS='-M'
  2573. _cflags_speed='-fast'
  2574. _cflags_size='-O1'
  2575. _flags_filter=ccc_flags
  2576. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2577. test -d "$sysroot" || die "No valid sysroot specified."
  2578. _type=armcc
  2579. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  2580. armcc_conf="$PWD/armcc.conf"
  2581. $_cc --arm_linux_configure \
  2582. --arm_linux_config_file="$armcc_conf" \
  2583. --configure_sysroot="$sysroot" \
  2584. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2585. die "Error creating armcc configuration file."
  2586. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2587. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2588. as_default="${cross_prefix}gcc"
  2589. _depflags='-MMD'
  2590. _cflags_speed='-O3'
  2591. _cflags_size='-Os'
  2592. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2593. _type=tms470
  2594. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2595. _flags='--gcc --abi=eabi -me'
  2596. _cc_e='-ppl -fe=$@'
  2597. _cc_o='-fe=$@'
  2598. _depflags='-ppa -ppd=$(@:.o=.d)'
  2599. _cflags_speed='-O3 -mf=5'
  2600. _cflags_size='-O3 -mf=2'
  2601. _flags_filter=tms470_flags
  2602. elif $_cc -v 2>&1 | grep -q clang; then
  2603. _type=clang
  2604. _ident=$($_cc --version | head -n1)
  2605. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2606. _cflags_speed='-O3'
  2607. _cflags_size='-Os'
  2608. elif $_cc -V 2>&1 | grep -q Sun; then
  2609. _type=suncc
  2610. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2611. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2612. _DEPFLAGS='-xM1 -xc99'
  2613. _ldflags='-std=c99'
  2614. _cflags_speed='-O5'
  2615. _cflags_size='-O5 -xspace'
  2616. _flags_filter=suncc_flags
  2617. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2618. _type=pathscale
  2619. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2620. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2621. _cflags_speed='-O2'
  2622. _cflags_size='-Os'
  2623. _flags_filter='filter_out -Wdisabled-optimization'
  2624. elif $_cc -v 2>&1 | grep -q Open64; then
  2625. _type=open64
  2626. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2627. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2628. _cflags_speed='-O2'
  2629. _cflags_size='-Os'
  2630. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2631. elif $_cc -V 2>&1 | grep -q Portland; then
  2632. _type=pgi
  2633. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2634. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2635. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2636. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2637. _cflags_noopt="-O1"
  2638. _flags_filter=pgi_flags
  2639. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  2640. _type=armasm
  2641. _ident=$($_cc | head -n1)
  2642. # 4509: "This form of conditional instruction is deprecated"
  2643. _flags="-nologo -ignore 4509"
  2644. _flags_filter=armasm_flags
  2645. elif $_cc 2>&1 | grep -q Microsoft; then
  2646. _type=msvc
  2647. _ident=$($cc 2>&1 | head -n1)
  2648. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2649. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2650. _cflags_speed="-O2"
  2651. _cflags_size="-O1"
  2652. if $_cc 2>&1 | grep -q Linker; then
  2653. _ld_o='-out:$@'
  2654. else
  2655. _ld_o='-Fe$@'
  2656. fi
  2657. _cc_o='-Fo$@'
  2658. _cc_e='-P -Fi$@'
  2659. _flags_filter=msvc_flags
  2660. _ld_lib='lib%.a'
  2661. _ld_path='-libpath:'
  2662. _flags='-nologo'
  2663. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2664. if [ $pfx = hostcc ]; then
  2665. append _cflags -Dsnprintf=_snprintf
  2666. fi
  2667. elif $_cc 2>&1 | grep -q Intel; then
  2668. _type=icl
  2669. _ident=$($cc 2>&1 | head -n1)
  2670. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2671. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2672. # versions (tested) as well.
  2673. _cflags_speed="-O2"
  2674. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2675. if $_cc 2>&1 | grep -q Linker; then
  2676. _ld_o='-out:$@'
  2677. else
  2678. _ld_o='-Fe$@'
  2679. fi
  2680. _cc_o='-Fo$@'
  2681. _cc_e='-P'
  2682. _flags_filter=icl_flags
  2683. _ld_lib='lib%.a'
  2684. _ld_path='-libpath:'
  2685. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2686. _flags='-nologo -Qdiag-error:4044,10157'
  2687. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2688. # with MSVC which enables it by default.
  2689. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2690. if [ $pfx = hostcc ]; then
  2691. append _cflags -Dsnprintf=_snprintf
  2692. fi
  2693. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2694. _type=cparser
  2695. _ident=$($_cc --version | head -n1)
  2696. _depflags='-MMD'
  2697. _cflags_speed='-O4'
  2698. _cflags_size='-O2'
  2699. _flags_filter=cparser_flags
  2700. fi
  2701. eval ${pfx}_type=\$_type
  2702. eval ${pfx}_ident=\$_ident
  2703. }
  2704. set_ccvars(){
  2705. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2706. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2707. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2708. if [ -n "$_depflags" ]; then
  2709. eval ${1}_DEPFLAGS=\$_depflags
  2710. else
  2711. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2712. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2713. eval DEP${1}FLAGS=\$_flags
  2714. fi
  2715. }
  2716. probe_cc cc "$cc"
  2717. cflags_filter=$_flags_filter
  2718. cflags_speed=$_cflags_speed
  2719. cflags_size=$_cflags_size
  2720. cflags_noopt=$_cflags_noopt
  2721. add_cflags $_flags $_cflags
  2722. cc_ldflags=$_ldflags
  2723. set_ccvars CC
  2724. probe_cc hostcc "$host_cc"
  2725. host_cflags_filter=$_flags_filter
  2726. add_host_cflags $_flags $_cflags
  2727. set_ccvars HOSTCC
  2728. test -n "$cc_type" && enable $cc_type ||
  2729. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2730. : ${as_default:=$cc}
  2731. : ${dep_cc_default:=$cc}
  2732. : ${ld_default:=$cc}
  2733. : ${host_ld_default:=$host_cc}
  2734. set_default ar as dep_cc ld host_ld
  2735. probe_cc as "$as"
  2736. asflags_filter=$_flags_filter
  2737. add_asflags $_flags $_cflags
  2738. set_ccvars AS
  2739. probe_cc ld "$ld"
  2740. ldflags_filter=$_flags_filter
  2741. add_ldflags $_flags $_ldflags
  2742. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2743. LD_O=${_ld_o-$LD_O}
  2744. LD_LIB=${_ld_lib-$LD_LIB}
  2745. LD_PATH=${_ld_path-$LD_PATH}
  2746. probe_cc hostld "$host_ld"
  2747. host_ldflags_filter=$_flags_filter
  2748. add_host_ldflags $_flags $_ldflags
  2749. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2750. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2751. probe_cc depcc "$dep_cc"
  2752. CCDEP=${_DEPCMD:-$DEPCMD}
  2753. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2754. DEPCCFLAGS=$_flags
  2755. fi
  2756. if $ar 2>&1 | grep -q Microsoft; then
  2757. arflags="-nologo"
  2758. ar_o='-out:$@'
  2759. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2760. arflags="rq"
  2761. ar_o='$@'
  2762. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  2763. arflags='-Xany -r -c'
  2764. ar_o='$@'
  2765. else
  2766. arflags="rc"
  2767. ar_o='$@'
  2768. fi
  2769. add_cflags $extra_cflags
  2770. add_asflags $extra_cflags
  2771. if test -n "$sysroot"; then
  2772. case "$cc_type" in
  2773. gcc|llvm_gcc|clang)
  2774. add_cppflags --sysroot="$sysroot"
  2775. add_ldflags --sysroot="$sysroot"
  2776. ;;
  2777. tms470)
  2778. add_cppflags -I"$sysinclude"
  2779. add_ldflags --sysroot="$sysroot"
  2780. ;;
  2781. esac
  2782. fi
  2783. if test "$cpu" = host; then
  2784. enabled cross_compile &&
  2785. die "--cpu=host makes no sense when cross-compiling."
  2786. case "$cc_type" in
  2787. gcc|llvm_gcc)
  2788. check_native(){
  2789. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2790. sed -n "/cc1.*$1=/{
  2791. s/.*$1=\\([^ ]*\\).*/\\1/
  2792. p
  2793. q
  2794. }" $TMPE
  2795. }
  2796. cpu=$(check_native -march || check_native -mcpu)
  2797. ;;
  2798. esac
  2799. test "${cpu:-host}" = host &&
  2800. die "--cpu=host not supported with compiler $cc"
  2801. fi
  2802. # Deal with common $arch aliases
  2803. case "$arch" in
  2804. aarch64|arm64)
  2805. arch="aarch64"
  2806. ;;
  2807. arm*)
  2808. arch="arm"
  2809. ;;
  2810. mips*|IP*)
  2811. arch="mips"
  2812. ;;
  2813. parisc*|hppa*)
  2814. arch="parisc"
  2815. ;;
  2816. "Power Macintosh"|ppc*|powerpc*)
  2817. arch="ppc"
  2818. ;;
  2819. s390|s390x)
  2820. arch="s390"
  2821. ;;
  2822. sh4|sh)
  2823. arch="sh4"
  2824. ;;
  2825. sun4u|sparc*)
  2826. arch="sparc"
  2827. ;;
  2828. tilegx|tile-gx)
  2829. arch="tilegx"
  2830. ;;
  2831. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2832. arch="x86"
  2833. ;;
  2834. esac
  2835. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2836. enable $arch
  2837. # Add processor-specific flags
  2838. if enabled aarch64; then
  2839. case $cpu in
  2840. armv*)
  2841. cpuflags="-march=$cpu"
  2842. ;;
  2843. *)
  2844. cpuflags="-mcpu=$cpu"
  2845. ;;
  2846. esac
  2847. elif enabled alpha; then
  2848. cpuflags="-mcpu=$cpu"
  2849. elif enabled arm; then
  2850. check_arm_arch() {
  2851. check_cpp_condition stddef.h \
  2852. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2853. $cpuflags
  2854. }
  2855. probe_arm_arch() {
  2856. if check_arm_arch 4; then echo armv4;
  2857. elif check_arm_arch 4T; then echo armv4t;
  2858. elif check_arm_arch 5; then echo armv5;
  2859. elif check_arm_arch 5E; then echo armv5e;
  2860. elif check_arm_arch 5T; then echo armv5t;
  2861. elif check_arm_arch 5TE; then echo armv5te;
  2862. elif check_arm_arch 5TEJ; then echo armv5te;
  2863. elif check_arm_arch 6; then echo armv6;
  2864. elif check_arm_arch 6J; then echo armv6j;
  2865. elif check_arm_arch 6K; then echo armv6k;
  2866. elif check_arm_arch 6Z; then echo armv6z;
  2867. elif check_arm_arch 6ZK; then echo armv6zk;
  2868. elif check_arm_arch 6T2; then echo armv6t2;
  2869. elif check_arm_arch 7; then echo armv7;
  2870. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2871. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2872. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2873. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2874. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2875. fi
  2876. }
  2877. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2878. case $cpu in
  2879. armv*)
  2880. cpuflags="-march=$cpu"
  2881. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2882. ;;
  2883. *)
  2884. cpuflags="-mcpu=$cpu"
  2885. case $cpu in
  2886. cortex-a*) subarch=armv7a ;;
  2887. cortex-r*) subarch=armv7r ;;
  2888. cortex-m*) enable thumb; subarch=armv7m ;;
  2889. arm11*) subarch=armv6 ;;
  2890. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2891. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2892. *) subarch=$(probe_arm_arch) ;;
  2893. esac
  2894. ;;
  2895. esac
  2896. case "$subarch" in
  2897. armv5t*) enable fast_clz ;;
  2898. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2899. esac
  2900. elif enabled avr32; then
  2901. case $cpu in
  2902. ap7[02]0[0-2])
  2903. subarch="avr32_ap"
  2904. cpuflags="-mpart=$cpu"
  2905. ;;
  2906. ap)
  2907. subarch="avr32_ap"
  2908. cpuflags="-march=$cpu"
  2909. ;;
  2910. uc3[ab]*)
  2911. subarch="avr32_uc"
  2912. cpuflags="-mcpu=$cpu"
  2913. ;;
  2914. uc)
  2915. subarch="avr32_uc"
  2916. cpuflags="-march=$cpu"
  2917. ;;
  2918. esac
  2919. elif enabled bfin; then
  2920. cpuflags="-mcpu=$cpu"
  2921. elif enabled mips; then
  2922. cpuflags="-march=$cpu"
  2923. elif enabled ppc; then
  2924. disable ldbrx
  2925. case $(tolower $cpu) in
  2926. 601|ppc601|powerpc601)
  2927. cpuflags="-mcpu=601"
  2928. disable altivec
  2929. ;;
  2930. 603*|ppc603*|powerpc603*)
  2931. cpuflags="-mcpu=603"
  2932. disable altivec
  2933. ;;
  2934. 604*|ppc604*|powerpc604*)
  2935. cpuflags="-mcpu=604"
  2936. disable altivec
  2937. ;;
  2938. g3|75*|ppc75*|powerpc75*)
  2939. cpuflags="-mcpu=750"
  2940. disable altivec
  2941. ;;
  2942. g4|745*|ppc745*|powerpc745*)
  2943. cpuflags="-mcpu=7450"
  2944. ;;
  2945. 74*|ppc74*|powerpc74*)
  2946. cpuflags="-mcpu=7400"
  2947. ;;
  2948. g5|970|ppc970|powerpc970)
  2949. cpuflags="-mcpu=970"
  2950. ;;
  2951. power[3-7]*)
  2952. cpuflags="-mcpu=$cpu"
  2953. ;;
  2954. cell)
  2955. cpuflags="-mcpu=cell"
  2956. enable ldbrx
  2957. ;;
  2958. e500mc)
  2959. cpuflags="-mcpu=e500mc"
  2960. disable altivec
  2961. ;;
  2962. e500v2)
  2963. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2964. disable altivec
  2965. disable dcbzl
  2966. ;;
  2967. e500)
  2968. cpuflags="-mcpu=8540 -mhard-float"
  2969. disable altivec
  2970. disable dcbzl
  2971. ;;
  2972. esac
  2973. elif enabled sparc; then
  2974. case $cpu in
  2975. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2976. cpuflags="-mcpu=$cpu"
  2977. ;;
  2978. ultrasparc*|niagara[234])
  2979. cpuflags="-mcpu=$cpu"
  2980. ;;
  2981. esac
  2982. elif enabled x86; then
  2983. case $cpu in
  2984. i[345]86|pentium)
  2985. cpuflags="-march=$cpu"
  2986. disable mmx
  2987. ;;
  2988. # targets that do NOT support nopl and conditional mov (cmov)
  2989. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2990. cpuflags="-march=$cpu"
  2991. disable i686
  2992. ;;
  2993. # targets that do support nopl and conditional mov (cmov)
  2994. 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*)
  2995. cpuflags="-march=$cpu"
  2996. enable i686
  2997. enable fast_cmov
  2998. ;;
  2999. # targets that do support conditional mov but on which it's slow
  3000. pentium4|pentium4m|prescott|nocona)
  3001. cpuflags="-march=$cpu"
  3002. enable i686
  3003. disable fast_cmov
  3004. ;;
  3005. esac
  3006. fi
  3007. if [ "$cpu" != generic ]; then
  3008. add_cflags $cpuflags
  3009. add_asflags $cpuflags
  3010. fi
  3011. # compiler sanity check
  3012. check_exec <<EOF
  3013. int main(void){ return 0; }
  3014. EOF
  3015. if test "$?" != 0; then
  3016. echo "$cc is unable to create an executable file."
  3017. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3018. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3019. echo "Only do this if you know what cross compiling means."
  3020. fi
  3021. die "C compiler test failed."
  3022. fi
  3023. add_cppflags -D_ISOC99_SOURCE
  3024. check_cflags -std=c99
  3025. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3026. #include <stdlib.h>
  3027. EOF
  3028. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3029. #include <stdlib.h>
  3030. EOF
  3031. add_host_cppflags -D_ISOC99_SOURCE
  3032. check_host_cflags -std=c99
  3033. check_host_cflags -Wall
  3034. check_host_cflags -O3
  3035. check_64bit(){
  3036. arch32=$1
  3037. arch64=$2
  3038. expr=$3
  3039. check_code cc "" "int test[2*($expr) - 1]" &&
  3040. subarch=$arch64 || subarch=$arch32
  3041. }
  3042. case "$arch" in
  3043. aarch64|alpha|ia64)
  3044. spic=$shared
  3045. ;;
  3046. mips)
  3047. check_64bit mips mips64 '_MIPS_SIM > 1'
  3048. spic=$shared
  3049. ;;
  3050. parisc)
  3051. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3052. spic=$shared
  3053. ;;
  3054. ppc)
  3055. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3056. spic=$shared
  3057. ;;
  3058. s390)
  3059. check_64bit s390 s390x 'sizeof(void *) > 4'
  3060. spic=$shared
  3061. ;;
  3062. sparc)
  3063. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3064. spic=$shared
  3065. ;;
  3066. x86)
  3067. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3068. if test "$subarch" = "x86_64"; then
  3069. spic=$shared
  3070. fi
  3071. ;;
  3072. esac
  3073. enable $subarch
  3074. enabled spic && enable_weak pic
  3075. # OS specific
  3076. case $target_os in
  3077. aix)
  3078. SHFLAGS=-shared
  3079. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3080. enabled shared && add_ldflags -Wl,-brtl
  3081. ;;
  3082. android)
  3083. disable symver
  3084. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3085. SLIB_INSTALL_LINKS=
  3086. # soname not set on purpose
  3087. SHFLAGS=-shared
  3088. ;;
  3089. haiku)
  3090. prefix_default="/boot/common"
  3091. network_extralibs="-lnetwork"
  3092. host_libs=
  3093. ;;
  3094. sunos)
  3095. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3096. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3097. network_extralibs="-lsocket -lnsl"
  3098. # When using suncc to build, the Solaris linker will mark
  3099. # an executable with each instruction set encountered by
  3100. # the Solaris assembler. As our libraries contain their own
  3101. # guards for processor-specific code, instead suppress
  3102. # generation of the HWCAPS ELF section on Solaris x86 only.
  3103. enabled_all suncc x86 &&
  3104. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3105. add_ldflags -Wl,-M,mapfile
  3106. nm_default='nm -P -g'
  3107. ;;
  3108. netbsd)
  3109. disable symver
  3110. oss_indev_extralibs="-lossaudio"
  3111. oss_outdev_extralibs="-lossaudio"
  3112. ;;
  3113. openbsd|bitrig)
  3114. disable symver
  3115. SHFLAGS='-shared'
  3116. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3117. SLIB_INSTALL_LINKS=
  3118. oss_indev_extralibs="-lossaudio"
  3119. oss_outdev_extralibs="-lossaudio"
  3120. ;;
  3121. dragonfly)
  3122. disable symver
  3123. ;;
  3124. freebsd)
  3125. ;;
  3126. bsd/os)
  3127. add_extralibs -lpoll -lgnugetopt
  3128. ;;
  3129. darwin)
  3130. enabled ppc && add_asflags -force_cpusubtype_ALL
  3131. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3132. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3133. add_ldflags -Wl,-dynamic,-search_paths_first
  3134. SLIBSUF=".dylib"
  3135. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3136. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3137. objformat="macho"
  3138. enabled x86_64 && objformat="macho64"
  3139. enabled_any pic shared ||
  3140. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3141. ;;
  3142. mingw32*)
  3143. if test $target_os = "mingw32ce"; then
  3144. disable network
  3145. else
  3146. target_os=mingw32
  3147. fi
  3148. LIBTARGET=i386
  3149. if enabled x86_64; then
  3150. LIBTARGET="i386:x86-64"
  3151. elif enabled arm; then
  3152. LIBTARGET=arm-wince
  3153. fi
  3154. check_ldflags -Wl,--nxcompat
  3155. check_ldflags -Wl,--dynamicbase
  3156. shlibdir_default="$bindir_default"
  3157. SLIBPREF=""
  3158. SLIBSUF=".dll"
  3159. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3160. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3161. 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)'
  3162. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3163. SLIB_INSTALL_LINKS=
  3164. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3165. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3166. 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'
  3167. objformat="win32"
  3168. dlltool="${cross_prefix}dlltool"
  3169. ranlib=:
  3170. enable dos_paths
  3171. ;;
  3172. win32|win64)
  3173. disable symver
  3174. if enabled shared; then
  3175. # Link to the import library instead of the normal static library
  3176. # for shared libs.
  3177. LD_LIB='%.lib'
  3178. # Cannot build both shared and static libs with MSVC or icl.
  3179. disable static
  3180. fi
  3181. shlibdir_default="$bindir_default"
  3182. SLIBPREF=""
  3183. SLIBSUF=".dll"
  3184. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3185. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3186. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3187. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3188. SLIB_INSTALL_LINKS=
  3189. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3190. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3191. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3192. objformat="win32"
  3193. ranlib=:
  3194. enable dos_paths
  3195. ;;
  3196. cygwin*)
  3197. target_os=cygwin
  3198. shlibdir_default="$bindir_default"
  3199. SLIBPREF="cyg"
  3200. SLIBSUF=".dll"
  3201. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3202. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3203. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3204. SLIB_INSTALL_LINKS=
  3205. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3206. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3207. objformat="win32"
  3208. enable dos_paths
  3209. ;;
  3210. *-dos|freedos|opendos)
  3211. network_extralibs="-lsocket"
  3212. objformat="coff"
  3213. enable dos_paths
  3214. add_cppflags -U__STRICT_ANSI__
  3215. ;;
  3216. linux)
  3217. enable dv1394
  3218. ;;
  3219. irix*)
  3220. target_os=irix
  3221. ranlib="echo ignoring ranlib"
  3222. ;;
  3223. os/2*)
  3224. ln_s="cp -f"
  3225. objformat="aout"
  3226. add_cppflags -D_GNU_SOURCE
  3227. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3228. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3229. LIBSUF="_s.a"
  3230. SLIBPREF=""
  3231. SLIBSUF=".dll"
  3232. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3233. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3234. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3235. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3236. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3237. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3238. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3239. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3240. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3241. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3242. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3243. enable dos_paths
  3244. ;;
  3245. gnu/kfreebsd)
  3246. add_cppflags -D_BSD_SOURCE
  3247. ;;
  3248. gnu)
  3249. ;;
  3250. qnx)
  3251. add_cppflags -D_QNX_SOURCE
  3252. network_extralibs="-lsocket"
  3253. ;;
  3254. symbian)
  3255. SLIBSUF=".dll"
  3256. enable dos_paths
  3257. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3258. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3259. add_ldflags -Wl,--target1-abs,--no-undefined \
  3260. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3261. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3262. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3263. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3264. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3265. ;;
  3266. osf1)
  3267. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3268. ;;
  3269. minix)
  3270. ;;
  3271. plan9)
  3272. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3273. -D_REENTRANT_SOURCE \
  3274. -D_RESEARCH_SOURCE \
  3275. -DFD_SETSIZE=96 \
  3276. -DHAVE_SOCK_OPTS
  3277. add_compat strtod.o strtod=avpriv_strtod
  3278. network_extralibs='-lbsd'
  3279. exeobjs=compat/plan9/main.o
  3280. cp_f='cp'
  3281. ;;
  3282. none)
  3283. ;;
  3284. *)
  3285. die "Unknown OS '$target_os'."
  3286. ;;
  3287. esac
  3288. # determine libc flavour
  3289. probe_libc(){
  3290. pfx=$1
  3291. pfx_no_=${pfx%_}
  3292. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3293. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3294. eval ${pfx}libc_type=uclibc
  3295. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3296. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3297. eval ${pfx}libc_type=glibc
  3298. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3299. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3300. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3301. eval ${pfx}libc_type=newlib
  3302. add_${pfx}cppflags -U__STRICT_ANSI__
  3303. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3304. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3305. eval ${pfx}libc_type=mingw64
  3306. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3307. eval test \$${pfx_no_}cc_type = "gcc" &&
  3308. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3309. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3310. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3311. eval ${pfx}libc_type=mingw32
  3312. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3313. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3314. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3315. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3316. eval test \$${pfx_no_}cc_type = "gcc" &&
  3317. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3318. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3319. eval ${pfx}libc_type=msvcrt
  3320. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3321. # 0x601 by default unless something else is set by the user.
  3322. # This can easily lead to us detecting functions only present
  3323. # in such new versions and producing binaries requiring windows 7.0.
  3324. # Therefore explicitly set the default to XP unless the user has
  3325. # set something else on the command line.
  3326. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3327. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3328. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3329. eval ${pfx}libc_type=klibc
  3330. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3331. eval ${pfx}libc_type=bionic
  3332. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3333. eval ${pfx}libc_type=solaris
  3334. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3335. fi
  3336. }
  3337. probe_libc
  3338. test -n "$libc_type" && enable libc_$libc_type
  3339. probe_libc host_
  3340. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3341. case $libc_type in
  3342. bionic)
  3343. add_compat strtod.o strtod=avpriv_strtod
  3344. ;;
  3345. msvcrt)
  3346. add_compat strtod.o strtod=avpriv_strtod
  3347. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3348. _snprintf=avpriv_snprintf \
  3349. vsnprintf=avpriv_vsnprintf
  3350. ;;
  3351. esac
  3352. # hacks for compiler/libc/os combinations
  3353. if enabled_all tms470 libc_glibc; then
  3354. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3355. add_cppflags -D__USER_LABEL_PREFIX__=
  3356. add_cppflags -D__builtin_memset=memset
  3357. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3358. add_cflags -pds=48 # incompatible redefinition of macro
  3359. fi
  3360. if enabled_all ccc libc_glibc; then
  3361. add_ldflags -Wl,-z,now # calls to libots crash without this
  3362. fi
  3363. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3364. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3365. esc(){
  3366. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3367. }
  3368. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  3369. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3370. set_default $PATHS_LIST
  3371. set_default nm
  3372. # we need to build at least one lib type
  3373. if ! enabled_any static shared; then
  3374. cat <<EOF
  3375. At least one library type must be built.
  3376. Specify --enable-static to build the static libraries or --enable-shared to
  3377. build the shared libraries as well. To only build the shared libraries specify
  3378. --disable-static in addition to --enable-shared.
  3379. EOF
  3380. exit 1;
  3381. fi
  3382. die_license_disabled() {
  3383. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3384. }
  3385. die_license_disabled gpl libcdio
  3386. die_license_disabled gpl libx264
  3387. die_license_disabled gpl libx265
  3388. die_license_disabled gpl libxavs
  3389. die_license_disabled gpl libxvid
  3390. die_license_disabled gpl x11grab
  3391. die_license_disabled nonfree libfaac
  3392. die_license_disabled nonfree libfdk_aac
  3393. die_license_disabled nonfree openssl
  3394. die_license_disabled version3 libopencore_amrnb
  3395. die_license_disabled version3 libopencore_amrwb
  3396. die_license_disabled version3 libvo_aacenc
  3397. die_license_disabled version3 libvo_amrwbenc
  3398. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3399. disabled optimizations || check_cflags -fomit-frame-pointer
  3400. enable_weak_pic() {
  3401. disabled pic && return
  3402. enable pic
  3403. add_cppflags -DPIC
  3404. case "$target_os" in
  3405. mingw*|cygwin*)
  3406. ;;
  3407. *)
  3408. add_cflags -fPIC
  3409. ;;
  3410. esac
  3411. add_asflags -fPIC
  3412. }
  3413. enabled pic && enable_weak_pic
  3414. check_cc <<EOF || die "Symbol mangling check failed."
  3415. int ff_extern;
  3416. EOF
  3417. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3418. extern_prefix=${sym%%ff_extern*}
  3419. check_cc <<EOF && enable_weak inline_asm
  3420. void foo(void) { __asm__ volatile ("" ::); }
  3421. EOF
  3422. _restrict=
  3423. for restrict_keyword in restrict __restrict__ __restrict; do
  3424. check_cc <<EOF && _restrict=$restrict_keyword && break
  3425. void foo(char * $restrict_keyword p);
  3426. EOF
  3427. done
  3428. check_cc <<EOF && enable pragma_deprecated
  3429. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3430. EOF
  3431. check_cc <<EOF && enable attribute_packed
  3432. struct { int x; } __attribute__((packed)) x;
  3433. EOF
  3434. check_cc <<EOF && enable attribute_may_alias
  3435. union { int x; } __attribute__((may_alias)) x;
  3436. EOF
  3437. check_cc <<EOF || die "endian test failed"
  3438. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3439. EOF
  3440. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3441. check_gas() {
  3442. log "check_gas using '$as' as AS"
  3443. # :vararg is used on aarch64, arm and ppc altivec
  3444. check_as <<EOF || return 1
  3445. .macro m n, y:vararg=0
  3446. \n: .int \y
  3447. .endm
  3448. m x
  3449. EOF
  3450. # .altmacro is only used in arm asm
  3451. ! enabled arm || check_as <<EOF || return 1
  3452. .altmacro
  3453. EOF
  3454. enable gnu_as
  3455. return 0
  3456. }
  3457. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3458. nogas=:
  3459. enabled_any arm aarch64 && nogas=die
  3460. enabled_all ppc altivec && nogas=warn
  3461. as_noop=-v
  3462. case $as_type in
  3463. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3464. gcc) gaspp_as_type=gas ;;
  3465. *) gaspp_as_type=$as_type ;;
  3466. esac
  3467. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3468. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3469. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3470. if ! check_gas ; then
  3471. as=${gas:=$as}
  3472. check_gas || \
  3473. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3474. fi
  3475. check_as <<EOF && enable as_func
  3476. .func test
  3477. .endfunc
  3478. EOF
  3479. fi
  3480. check_inline_asm inline_asm_labels '"1:\n"'
  3481. if enabled aarch64; then
  3482. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3483. # internal assembler in clang 3.3 does not support this instruction
  3484. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3485. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3486. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3487. elif enabled alpha; then
  3488. check_cflags -mieee
  3489. elif enabled arm; then
  3490. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3491. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3492. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3493. enable vfp_args
  3494. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3495. case "${cross_prefix:-$cc}" in
  3496. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3497. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3498. __asm__ (".eabi_attribute 28, 1");
  3499. int main(void) { return 0; }
  3500. EOF
  3501. esac
  3502. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3503. fi
  3504. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3505. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3506. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3507. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3508. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3509. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3510. [ $target_os = linux ] || [ $target_os = android ] ||
  3511. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3512. $ARCH_EXT_LIST_ARM
  3513. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3514. check_as <<EOF && enable as_dn_directive
  3515. ra .dn d0.i16
  3516. .unreq ra
  3517. EOF
  3518. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3519. elif enabled mips; then
  3520. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3521. elif enabled parisc; then
  3522. if enabled gcc; then
  3523. case $($cc -dumpversion) in
  3524. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3525. esac
  3526. fi
  3527. elif enabled ppc; then
  3528. enable local_aligned_8 local_aligned_16
  3529. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3530. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3531. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3532. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3533. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3534. if enabled altivec; then
  3535. check_cflags -maltivec -mabi=altivec &&
  3536. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3537. check_cflags -faltivec
  3538. # check if our compiler supports Motorola AltiVec C API
  3539. check_cc <<EOF || disable altivec
  3540. $inc_altivec_h
  3541. int main(void) {
  3542. vector signed int v1 = (vector signed int) { 0 };
  3543. vector signed int v2 = (vector signed int) { 1 };
  3544. v1 = vec_add(v1, v2);
  3545. return 0;
  3546. }
  3547. EOF
  3548. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3549. fi
  3550. elif enabled x86; then
  3551. check_builtin rdtsc intrin.h "__rdtsc()"
  3552. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3553. enable local_aligned_8 local_aligned_16
  3554. # check whether EBP is available on x86
  3555. # As 'i' is stored on the stack, this program will crash
  3556. # if the base pointer is used to access it because the
  3557. # base pointer is cleared in the inline assembly code.
  3558. check_exec_crash <<EOF && enable ebp_available
  3559. volatile int i=0;
  3560. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3561. return i;
  3562. EOF
  3563. # check whether EBX is available on x86
  3564. check_inline_asm ebx_available '""::"b"(0)' &&
  3565. check_inline_asm ebx_available '"":::"%ebx"'
  3566. # check whether xmm clobbers are supported
  3567. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3568. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3569. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3570. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3571. if ! disabled_any asm mmx yasm; then
  3572. if check_cmd $yasmexe --version; then
  3573. enabled x86_64 && yasm_extra="-m amd64"
  3574. yasm_debug="-g dwarf2"
  3575. elif check_cmd nasm -v; then
  3576. yasmexe=nasm
  3577. yasm_debug="-g -F dwarf"
  3578. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3579. fi
  3580. YASMFLAGS="-f $objformat $yasm_extra"
  3581. enabled pic && append YASMFLAGS "-DPIC"
  3582. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3583. case "$objformat" in
  3584. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3585. esac
  3586. check_yasm "movbe ecx, [5]" && enable yasm ||
  3587. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3588. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  3589. check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
  3590. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3591. check_yasm "CPU amdnop" || disable cpunop
  3592. fi
  3593. case "$cpu" in
  3594. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3595. disable fast_clz
  3596. ;;
  3597. esac
  3598. fi
  3599. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  3600. check_ldflags -Wl,--as-needed
  3601. if check_func dlopen; then
  3602. ldl=
  3603. elif check_func dlopen -ldl; then
  3604. ldl=-ldl
  3605. fi
  3606. if ! disabled network; then
  3607. check_func getaddrinfo $network_extralibs
  3608. check_func getservbyport $network_extralibs
  3609. check_func inet_aton $network_extralibs
  3610. check_type netdb.h "struct addrinfo"
  3611. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3612. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3613. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3614. check_type poll.h "struct pollfd"
  3615. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3616. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3617. check_type netinet/in.h "struct sockaddr_in6"
  3618. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3619. check_type "sys/types.h sys/socket.h" socklen_t
  3620. # Prefer arpa/inet.h over winsock2
  3621. if check_header arpa/inet.h ; then
  3622. check_func closesocket
  3623. elif check_header winsock2.h ; then
  3624. check_func_headers winsock2.h closesocket -lws2 &&
  3625. network_extralibs="-lws2" ||
  3626. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3627. network_extralibs="-lws2_32"; } || disable winsock2_h network
  3628. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3629. check_type ws2tcpip.h socklen_t
  3630. check_type ws2tcpip.h "struct addrinfo"
  3631. check_type ws2tcpip.h "struct group_source_req"
  3632. check_type ws2tcpip.h "struct ip_mreq_source"
  3633. check_type ws2tcpip.h "struct ipv6_mreq"
  3634. check_type winsock2.h "struct pollfd"
  3635. check_struct winsock2.h "struct sockaddr" sa_len
  3636. check_type ws2tcpip.h "struct sockaddr_in6"
  3637. check_type ws2tcpip.h "struct sockaddr_storage"
  3638. else
  3639. disable network
  3640. fi
  3641. fi
  3642. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3643. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3644. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3645. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3646. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3647. check_func ${malloc_prefix}memalign && enable memalign
  3648. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3649. check_func fcntl
  3650. check_func fork
  3651. check_func gethrtime
  3652. check_func getopt
  3653. check_func getrusage
  3654. check_func gettimeofday
  3655. check_func isatty
  3656. check_func localtime_r
  3657. check_func mach_absolute_time
  3658. check_func mkstemp
  3659. check_func mmap
  3660. check_func mprotect
  3661. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3662. check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt; }
  3663. check_func sched_getaffinity
  3664. check_func setrlimit
  3665. check_func strerror_r
  3666. check_func strptime
  3667. check_func sysconf
  3668. check_func sysctl
  3669. check_func usleep
  3670. check_func_headers io.h setmode
  3671. check_func_headers stdlib.h getenv
  3672. check_func_headers windows.h CoTaskMemFree -lole32
  3673. check_func_headers windows.h GetProcessAffinityMask
  3674. check_func_headers windows.h GetProcessTimes
  3675. check_func_headers windows.h GetSystemTimeAsFileTime
  3676. check_func_headers windows.h MapViewOfFile
  3677. check_func_headers windows.h SetConsoleTextAttribute
  3678. check_func_headers windows.h Sleep
  3679. check_func_headers windows.h VirtualAlloc
  3680. check_header direct.h
  3681. check_header dlfcn.h
  3682. check_header dxva.h
  3683. check_header dxva2api.h
  3684. check_header io.h
  3685. check_header mach/mach_time.h
  3686. check_header malloc.h
  3687. check_header poll.h
  3688. check_header sys/mman.h
  3689. check_header sys/param.h
  3690. check_header sys/resource.h
  3691. check_header sys/select.h
  3692. check_header sys/time.h
  3693. check_header sys/un.h
  3694. check_header unistd.h
  3695. check_header vdpau/vdpau.h
  3696. check_header vdpau/vdpau_x11.h
  3697. check_header VideoDecodeAcceleration/VDADecoder.h
  3698. check_header windows.h
  3699. check_header X11/extensions/XvMClib.h
  3700. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3701. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3702. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3703. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3704. if ! disabled w32threads && ! enabled pthreads; then
  3705. check_func_headers "windows.h process.h" _beginthreadex &&
  3706. enable w32threads || disable w32threads
  3707. fi
  3708. # check for some common methods of building with pthread support
  3709. # do this before the optional library checks as some of them require pthreads
  3710. if ! disabled pthreads && ! enabled w32threads; then
  3711. enable pthreads
  3712. if check_func pthread_join -pthread; then
  3713. add_cflags -pthread
  3714. add_extralibs -pthread
  3715. elif check_func pthread_join -pthreads; then
  3716. add_cflags -pthreads
  3717. add_extralibs -pthreads
  3718. elif check_func pthread_join -lpthreadGC2; then
  3719. add_extralibs -lpthreadGC2
  3720. elif check_lib pthread.h pthread_join -lpthread; then
  3721. :
  3722. elif ! check_func pthread_join; then
  3723. disable pthreads
  3724. fi
  3725. fi
  3726. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3727. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3728. check_lib math.h sin -lm && LIBM="-lm"
  3729. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3730. atan2f_args=2
  3731. ldexpf_args=2
  3732. powf_args=2
  3733. for func in $MATH_FUNCS; do
  3734. eval check_mathfunc $func \${${func}_args:-1}
  3735. done
  3736. # these are off by default, so fail if requested and not available
  3737. enabled avisynth && { { check_header "avisynth/avisynth_c.h" && check_lib2 "windows.h" LoadLibrary; } ||
  3738. { check_header "avxsynth/avxsynth_c.h" && check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3739. die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
  3740. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3741. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3742. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  3743. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3744. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3745. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3746. enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  3747. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3748. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3749. done || die "ERROR: libgsm not found"; }
  3750. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3751. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3752. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3753. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3754. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  3755. enabled libopenjpeg && { { check_header openjpeg.h && check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC; } ||
  3756. { require_pkg_config libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; } }
  3757. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3758. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3759. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3760. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3761. enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
  3762. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3763. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  3764. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3765. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3766. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3767. enabled libvpx && {
  3768. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3769. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3770. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  3771. die "ERROR: libvpx encoder version must be >=0.9.6"; }
  3772. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3773. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3774. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  3775. enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
  3776. enabled libx264 && require_pkg_config x264 "stdint.h x264.h" x264_encoder_encode &&
  3777. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3778. die "ERROR: libx264 version must be >= 0.118."; }
  3779. enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
  3780. { check_cpp_condition x265.h "X265_BUILD >= 17" ||
  3781. die "ERROR: libx265 version must be >= 17."; }
  3782. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3783. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3784. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3785. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3786. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3787. die "ERROR: openssl not found"; }
  3788. if enabled gnutls; then
  3789. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3790. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3791. fi
  3792. # libdc1394 check
  3793. if enabled libdc1394; then
  3794. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3795. enable libdc1394_2; } ||
  3796. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3797. enable libdc1394_1; } ||
  3798. die "ERROR: No version of libdc1394 found "
  3799. fi
  3800. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3801. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3802. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3803. enable sdl
  3804. fi
  3805. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3806. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3807. check_header linux/fb.h
  3808. check_header linux/videodev2.h
  3809. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3810. check_header sys/videoio.h
  3811. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3812. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3813. # w32api 3.12 had it defined wrong
  3814. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3815. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3816. { check_header dev/bktr/ioctl_meteor.h &&
  3817. check_header dev/bktr/ioctl_bt848.h; } ||
  3818. { check_header machine/ioctl_meteor.h &&
  3819. check_header machine/ioctl_bt848.h; } ||
  3820. { check_header dev/video/meteor/ioctl_meteor.h &&
  3821. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3822. check_header dev/ic/bt8xx.h
  3823. check_header sndio.h
  3824. check_header sys/soundcard.h
  3825. check_header soundcard.h
  3826. enabled_any alsa_indev alsa_outdev &&
  3827. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3828. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3829. check_func jack_port_get_latency_range -ljack
  3830. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3831. if enabled libcdio; then
  3832. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  3833. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
  3834. fi
  3835. check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  3836. enabled x11grab &&
  3837. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3838. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
  3839. { enabled xlib || die "ERROR: Xlib not found"; }
  3840. enabled vdpau &&
  3841. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3842. disable vdpau
  3843. enabled vdpau && enabled xlib &&
  3844. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  3845. prepend avconv_libs $($ldflags_filter "-lvdpau") &&
  3846. enable vdpau_x11
  3847. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3848. # add some useful compiler flags if supported
  3849. check_cflags -Wdeclaration-after-statement
  3850. check_cflags -Wall
  3851. check_cflags -Wdisabled-optimization
  3852. check_cflags -Wpointer-arith
  3853. check_cflags -Wredundant-decls
  3854. check_cflags -Wcast-qual
  3855. check_cflags -Wwrite-strings
  3856. check_cflags -Wtype-limits
  3857. check_cflags -Wundef
  3858. check_cflags -Wmissing-prototypes
  3859. check_cflags -Wstrict-prototypes
  3860. enabled extra_warnings && check_cflags -Winline
  3861. check_disable_warning(){
  3862. warning_flag=-W${1#-Wno-}
  3863. test_cflags $warning_flag && add_cflags $1
  3864. }
  3865. check_disable_warning -Wno-parentheses
  3866. check_disable_warning -Wno-switch
  3867. check_disable_warning -Wno-format-zero-length
  3868. check_disable_warning -Wno-pointer-sign
  3869. # add some linker flags
  3870. check_ldflags -Wl,--warn-common
  3871. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3872. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3873. # add some strip flags
  3874. # -wN '..@*' is more selective than -x, but not available everywhere.
  3875. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  3876. enabled neon_clobber_test &&
  3877. check_ldflags -Wl,--wrap,avcodec_open2 \
  3878. -Wl,--wrap,avcodec_decode_audio4 \
  3879. -Wl,--wrap,avcodec_decode_video2 \
  3880. -Wl,--wrap,avcodec_decode_subtitle2 \
  3881. -Wl,--wrap,avcodec_encode_audio2 \
  3882. -Wl,--wrap,avcodec_encode_video2 \
  3883. -Wl,--wrap,avcodec_encode_subtitle \
  3884. -Wl,--wrap,avresample_convert ||
  3885. disable neon_clobber_test
  3886. enabled xmm_clobber_test &&
  3887. check_ldflags -Wl,--wrap,avcodec_open2 \
  3888. -Wl,--wrap,avcodec_decode_audio4 \
  3889. -Wl,--wrap,avcodec_decode_video2 \
  3890. -Wl,--wrap,avcodec_decode_subtitle2 \
  3891. -Wl,--wrap,avcodec_encode_audio2 \
  3892. -Wl,--wrap,avcodec_encode_video2 \
  3893. -Wl,--wrap,avcodec_encode_subtitle \
  3894. -Wl,--wrap,avresample_convert \
  3895. -Wl,--wrap,sws_scale ||
  3896. disable xmm_clobber_test
  3897. echo "X{};" > $TMPV
  3898. if test_ldflags -Wl,--version-script,$TMPV; then
  3899. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3900. check_cc <<EOF && enable symver_asm_label
  3901. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3902. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3903. EOF
  3904. check_cc <<EOF && enable symver_gnu_asm
  3905. __asm__(".symver ff_foo,av_foo@VERSION");
  3906. void ff_foo(void) {}
  3907. EOF
  3908. fi
  3909. if [ -z "$optflags" ]; then
  3910. if enabled small; then
  3911. optflags=$cflags_size
  3912. elif enabled optimizations; then
  3913. optflags=$cflags_speed
  3914. else
  3915. optflags=$cflags_noopt
  3916. fi
  3917. fi
  3918. check_optflags(){
  3919. check_cflags "$@"
  3920. enabled lto && check_ldflags "$@"
  3921. }
  3922. if enabled lto; then
  3923. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3924. check_cflags -flto
  3925. check_ldflags -flto $cpuflags
  3926. fi
  3927. check_optflags $optflags
  3928. check_optflags -fno-math-errno
  3929. check_optflags -fno-signed-zeros
  3930. if enabled icc; then
  3931. # Just warnings, no remarks
  3932. check_cflags -w1
  3933. # -wd: Disable following warnings
  3934. # 144, 167, 556: -Wno-pointer-sign
  3935. # 1292: attribute "foo" ignored
  3936. # 1419: external declaration in primary source file
  3937. # 10006: ignoring unknown option -fno-signed-zeros
  3938. # 10148: ignoring unknown option -Wno-parentheses
  3939. # 10156: ignoring option '-W'; no argument required
  3940. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3941. # 11030: Warning unknown option --as-needed
  3942. # 10156: ignoring option '-export'; no argument required
  3943. check_ldflags -wd10156,11030
  3944. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3945. enable ebp_available
  3946. if enabled x86_32; then
  3947. icc_version=$($cc -dumpversion)
  3948. test ${icc_version%%.*} -ge 11 &&
  3949. check_cflags -falign-stack=maintain-16-byte ||
  3950. disable aligned_stack
  3951. fi
  3952. elif enabled ccc; then
  3953. # disable some annoying warnings
  3954. add_cflags -msg_disable bitnotint
  3955. add_cflags -msg_disable mixfuncvoid
  3956. add_cflags -msg_disable nonstandcast
  3957. add_cflags -msg_disable unsupieee
  3958. elif enabled gcc; then
  3959. check_optflags -fno-tree-vectorize
  3960. check_cflags -Werror=implicit-function-declaration
  3961. check_cflags -Werror=missing-prototypes
  3962. check_cflags -Werror=return-type
  3963. check_cflags -Werror=declaration-after-statement
  3964. check_cflags -Werror=vla
  3965. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  3966. elif enabled llvm_gcc; then
  3967. check_cflags -mllvm -stack-alignment=16
  3968. elif enabled clang; then
  3969. check_cflags -mllvm -stack-alignment=16
  3970. check_cflags -Qunused-arguments
  3971. check_cflags -Werror=implicit-function-declaration
  3972. check_cflags -Werror=missing-prototypes
  3973. check_cflags -Werror=return-type
  3974. elif enabled cparser; then
  3975. add_cflags -Wno-missing-variable-declarations
  3976. add_cflags -Wno-empty-statement
  3977. elif enabled armcc; then
  3978. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  3979. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  3980. # 2523: use of inline assembly is deprecated
  3981. add_cflags -W${armcc_opt},--diag_suppress=2523
  3982. add_cflags -W${armcc_opt},--diag_suppress=1207
  3983. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3984. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3985. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3986. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3987. elif enabled tms470; then
  3988. add_cflags -pds=824 -pds=837
  3989. disable inline_asm
  3990. elif enabled pathscale; then
  3991. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3992. elif enabled_any msvc icl; then
  3993. enabled x86_32 && disable aligned_stack
  3994. enabled_all x86_32 debug && add_cflags -Oy-
  3995. enabled debug && add_ldflags -debug
  3996. enable pragma_deprecated
  3997. if enabled icl; then
  3998. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  3999. # (correctly) on icl 13.x.
  4000. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4001. add_cflags -Qansi-alias
  4002. # icl will pass the inline asm tests but inline asm is currently
  4003. # not supported (build will fail)
  4004. disable inline_asm
  4005. fi
  4006. fi
  4007. case $as_type in
  4008. clang)
  4009. add_asflags -Qunused-arguments
  4010. ;;
  4011. esac
  4012. case $ld_type in
  4013. clang)
  4014. check_ldflags -Qunused-arguments
  4015. ;;
  4016. esac
  4017. case $target_os in
  4018. osf1)
  4019. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4020. ;;
  4021. plan9)
  4022. add_cppflags -Dmain=plan9_main
  4023. ;;
  4024. esac
  4025. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4026. check_deps $CONFIG_LIST \
  4027. $CONFIG_EXTRA \
  4028. $HAVE_LIST \
  4029. $ALL_COMPONENTS \
  4030. enabled_all dxva2 CoTaskMemFree &&
  4031. prepend avconv_libs $($ldflags_filter "-lole32") &&
  4032. enable dxva2_lib
  4033. ! enabled_any memalign posix_memalign aligned_malloc &&
  4034. enabled $simd_align_16 && enable memalign_hack
  4035. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4036. for thread in $THREADS_LIST; do
  4037. if enabled $thread; then
  4038. test -n "$thread_type" &&
  4039. die "ERROR: Only one thread type must be selected." ||
  4040. thread_type="$thread"
  4041. fi
  4042. done
  4043. enabled zlib && add_cppflags -DZLIB_CONST
  4044. # conditional library dependencies, in linking order
  4045. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4046. enabled resample_filter && prepend avfilter_deps "avresample"
  4047. enabled scale_filter && prepend avfilter_deps "swscale"
  4048. enabled opus_decoder && prepend avcodec_deps "avresample"
  4049. expand_deps(){
  4050. lib_deps=${1}_deps
  4051. eval "deps=\$$lib_deps"
  4052. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4053. unique $lib_deps
  4054. }
  4055. map 'expand_deps $v' $LIBRARY_LIST
  4056. echo "install prefix $prefix"
  4057. echo "source path $source_path"
  4058. echo "C compiler $cc"
  4059. echo "C library $libc_type"
  4060. if test "$host_cc" != "$cc"; then
  4061. echo "host C compiler $host_cc"
  4062. echo "host C library $host_libc_type"
  4063. fi
  4064. echo "ARCH $arch ($cpu)"
  4065. if test "$build_suffix" != ""; then
  4066. echo "build suffix $build_suffix"
  4067. fi
  4068. if test "$extra_version" != ""; then
  4069. echo "version string suffix $extra_version"
  4070. fi
  4071. echo "big-endian ${bigendian-no}"
  4072. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4073. if enabled x86; then
  4074. echo "${yasmexe} ${yasm-no}"
  4075. echo "MMX enabled ${mmx-no}"
  4076. echo "MMXEXT enabled ${mmxext-no}"
  4077. echo "3DNow! enabled ${amd3dnow-no}"
  4078. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4079. echo "SSE enabled ${sse-no}"
  4080. echo "SSSE3 enabled ${ssse3-no}"
  4081. echo "AVX enabled ${avx-no}"
  4082. echo "XOP enabled ${xop-no}"
  4083. echo "FMA3 enabled ${fma3-no}"
  4084. echo "FMA4 enabled ${fma4-no}"
  4085. echo "i686 features enabled ${i686-no}"
  4086. echo "CMOV is fast ${fast_cmov-no}"
  4087. echo "EBX available ${ebx_available-no}"
  4088. echo "EBP available ${ebp_available-no}"
  4089. fi
  4090. if enabled aarch64; then
  4091. echo "NEON enabled ${neon-no}"
  4092. echo "VFP enabled ${vfp-no}"
  4093. fi
  4094. if enabled arm; then
  4095. echo "ARMv5TE enabled ${armv5te-no}"
  4096. echo "ARMv6 enabled ${armv6-no}"
  4097. echo "ARMv6T2 enabled ${armv6t2-no}"
  4098. echo "VFP enabled ${vfp-no}"
  4099. echo "NEON enabled ${neon-no}"
  4100. fi
  4101. if enabled ppc; then
  4102. echo "AltiVec enabled ${altivec-no}"
  4103. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4104. echo "dcbzl available ${dcbzl-no}"
  4105. fi
  4106. echo "debug symbols ${debug-no}"
  4107. echo "optimize for size ${small-no}"
  4108. echo "optimizations ${optimizations-no}"
  4109. echo "static ${static-no}"
  4110. echo "shared ${shared-no}"
  4111. echo "new filter support ${avfilter-no}"
  4112. echo "network support ${network-no}"
  4113. echo "threading support ${thread_type-no}"
  4114. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4115. echo "SDL support ${sdl-no}"
  4116. test -n "$random_seed" &&
  4117. echo "random seed ${random_seed}"
  4118. echo
  4119. echo "External libraries:"
  4120. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4121. echo
  4122. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4123. echo "Enabled ${type}s:"
  4124. eval list=\$$(toupper $type)_LIST
  4125. print_enabled '_*' $list | print_3_columns
  4126. echo
  4127. done
  4128. license="LGPL version 2.1 or later"
  4129. if enabled nonfree; then
  4130. license="nonfree and unredistributable"
  4131. elif enabled gplv3; then
  4132. license="GPL version 3 or later"
  4133. elif enabled lgplv3; then
  4134. license="LGPL version 3 or later"
  4135. elif enabled gpl; then
  4136. license="GPL version 2 or later"
  4137. fi
  4138. echo "License: $license"
  4139. echo "Creating config.mak and config.h..."
  4140. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4141. config_files="$TMPH config.mak"
  4142. cat > config.mak <<EOF
  4143. # Automatically generated by configure - do not modify!
  4144. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4145. prefix=$prefix
  4146. LIBDIR=\$(DESTDIR)$libdir
  4147. SHLIBDIR=\$(DESTDIR)$shlibdir
  4148. INCDIR=\$(DESTDIR)$incdir
  4149. BINDIR=\$(DESTDIR)$bindir
  4150. DATADIR=\$(DESTDIR)$datadir
  4151. DOCDIR=\$(DESTDIR)$docdir
  4152. MANDIR=\$(DESTDIR)$mandir
  4153. SRC_PATH=$source_path
  4154. CC_IDENT=$cc_ident
  4155. ARCH=$arch
  4156. INTRINSICS=$intrinsics
  4157. CC=$cc
  4158. AS=$as
  4159. LD=$ld
  4160. DEPCC=$dep_cc
  4161. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4162. DEPAS=$as
  4163. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4164. YASM=$yasmexe
  4165. DEPYASM=$yasmexe
  4166. AR=$ar
  4167. ARFLAGS=$arflags
  4168. AR_O=$ar_o
  4169. RANLIB=$ranlib
  4170. STRIP=$strip
  4171. LN_S=$ln_s
  4172. CPPFLAGS=$CPPFLAGS
  4173. CFLAGS=$CFLAGS
  4174. ASFLAGS=$ASFLAGS
  4175. AS_C=$AS_C
  4176. AS_O=$AS_O
  4177. CC_C=$CC_C
  4178. CC_E=$CC_E
  4179. CC_O=$CC_O
  4180. LD_O=$LD_O
  4181. LD_LIB=$LD_LIB
  4182. LD_PATH=$LD_PATH
  4183. DLLTOOL=$dlltool
  4184. LDFLAGS=$LDFLAGS
  4185. LDEXEFLAGS=$LDEXEFLAGS
  4186. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4187. STRIPFLAGS=$STRIPFLAGS
  4188. YASMFLAGS=$YASMFLAGS
  4189. BUILDSUF=$build_suffix
  4190. FULLNAME=$FULLNAME
  4191. LIBPREF=$LIBPREF
  4192. LIBSUF=$LIBSUF
  4193. LIBNAME=$LIBNAME
  4194. SLIBPREF=$SLIBPREF
  4195. SLIBSUF=$SLIBSUF
  4196. EXESUF=$EXESUF
  4197. EXTRA_VERSION=$extra_version
  4198. CCDEP=$CCDEP
  4199. CCDEP_FLAGS=$CCDEP_FLAGS
  4200. ASDEP=$ASDEP
  4201. ASDEP_FLAGS=$ASDEP_FLAGS
  4202. CC_DEPFLAGS=$CC_DEPFLAGS
  4203. AS_DEPFLAGS=$AS_DEPFLAGS
  4204. HOSTCC=$host_cc
  4205. HOSTLD=$host_ld
  4206. HOSTCFLAGS=$host_cflags
  4207. HOSTCPPFLAGS=$host_cppflags
  4208. HOSTEXESUF=$HOSTEXESUF
  4209. HOSTLDFLAGS=$host_ldflags
  4210. HOSTLIBS=$host_libs
  4211. DEPHOSTCC=$host_cc
  4212. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4213. HOSTCCDEP=$HOSTCCDEP
  4214. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4215. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4216. HOSTCC_C=$HOSTCC_C
  4217. HOSTCC_O=$HOSTCC_O
  4218. HOSTLD_O=$HOSTLD_O
  4219. TARGET_EXEC=$target_exec $target_exec_args
  4220. TARGET_PATH=$target_path
  4221. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4222. CFLAGS-avplay=$sdl_cflags
  4223. ZLIB=$($ldflags_filter -lz)
  4224. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4225. EXTRALIBS=$extralibs
  4226. COMPAT_OBJS=$compat_objs
  4227. EXEOBJS=$exeobjs
  4228. INSTALL=install
  4229. LIBTARGET=${LIBTARGET}
  4230. SLIBNAME=${SLIBNAME}
  4231. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4232. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4233. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4234. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4235. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4236. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4237. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4238. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4239. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4240. EOF
  4241. get_version(){
  4242. lcname=lib${1}
  4243. name=$(toupper $lcname)
  4244. file=$source_path/$lcname/version.h
  4245. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4246. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4247. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4248. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4249. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4250. }
  4251. map 'get_version $v' $LIBRARY_LIST
  4252. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
  4253. print_program_libs(){
  4254. eval "program_libs=\$${1}_libs"
  4255. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  4256. }
  4257. map 'print_program_libs $v' $PROGRAM_LIST
  4258. cat > $TMPH <<EOF
  4259. /* Automatically generated by configure - do not modify! */
  4260. #ifndef LIBAV_CONFIG_H
  4261. #define LIBAV_CONFIG_H
  4262. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4263. #define LIBAV_LICENSE "$(c_escape $license)"
  4264. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4265. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4266. #define restrict $_restrict
  4267. #define EXTERN_PREFIX "${extern_prefix}"
  4268. #define EXTERN_ASM ${extern_prefix}
  4269. #define SLIBSUF "$SLIBSUF"
  4270. EOF
  4271. test -n "$malloc_prefix" &&
  4272. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4273. if enabled yasm; then
  4274. append config_files $TMPASM
  4275. printf '' >$TMPASM
  4276. fi
  4277. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4278. print_config ARCH_ "$config_files" $ARCH_LIST
  4279. print_config HAVE_ "$config_files" $HAVE_LIST
  4280. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4281. $CONFIG_EXTRA \
  4282. $ALL_COMPONENTS \
  4283. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4284. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4285. cp_if_changed $TMPH config.h
  4286. touch .config
  4287. enabled yasm && cp_if_changed $TMPASM config.asm
  4288. cat > $TMPH <<EOF
  4289. /* Generated by ffconf */
  4290. #ifndef AVUTIL_AVCONFIG_H
  4291. #define AVUTIL_AVCONFIG_H
  4292. EOF
  4293. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4294. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4295. cp_if_changed $TMPH libavutil/avconfig.h
  4296. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4297. # build pkg-config files
  4298. lib_version(){
  4299. eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
  4300. }
  4301. pkgconfig_generate(){
  4302. name=$1
  4303. shortname=${name#lib}${build_suffix}
  4304. comment=$2
  4305. version=$3
  4306. libs=$4
  4307. requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
  4308. requires=${requires%, }
  4309. enabled ${name#lib} || return 0
  4310. mkdir -p $name
  4311. cat <<EOF > $name/$name.pc
  4312. prefix=$prefix
  4313. exec_prefix=\${prefix}
  4314. libdir=$libdir
  4315. includedir=$incdir
  4316. Name: $name
  4317. Description: $comment
  4318. Version: $version
  4319. Requires: $(enabled shared || echo $requires)
  4320. Requires.private: $(enabled shared && echo $requires)
  4321. Conflicts:
  4322. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4323. Libs.private: $(enabled shared && echo $libs)
  4324. Cflags: -I\${includedir}
  4325. EOF
  4326. cat <<EOF > $name/$name-uninstalled.pc
  4327. prefix=
  4328. exec_prefix=
  4329. libdir=\${pcfiledir}
  4330. includedir=${source_path}
  4331. Name: $name
  4332. Description: $comment
  4333. Version: $version
  4334. Requires: $requires
  4335. Conflicts:
  4336. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  4337. Cflags: -I\${includedir}
  4338. EOF
  4339. }
  4340. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4341. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  4342. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
  4343. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
  4344. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  4345. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM"
  4346. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"