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.

3858 lines
113KB

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