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.

3884 lines
113KB

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