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.

4016 lines
117KB

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