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.

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