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.

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