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.

4041 lines
118KB

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