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.

3729 lines
112KB

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