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.

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