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.

4832 lines
142KB

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