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.

3825 lines
112KB

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