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.

3770 lines
114KB

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