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.

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