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.

3159 lines
89KB

  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.err]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-ffplay disable ffplay build
  76. --disable-ffprobe disable ffprobe build
  77. --disable-ffserver disable ffserver build
  78. --disable-avdevice disable libavdevice build
  79. --disable-avcodec disable libavcodec build
  80. --disable-avformat disable libavformat build
  81. --disable-swscale disable libswscale build
  82. --enable-postproc enable GPLed postprocessing support [no]
  83. --enable-avfilter video filter support [no]
  84. --enable-avfilter-lavf video filters dependent on avformat [no]
  85. --enable-beosthreads use BeOS threads [no]
  86. --enable-os2threads use OS/2 threads [no]
  87. --enable-pthreads use pthreads [no]
  88. --enable-w32threads use Win32 threads [no]
  89. --enable-x11grab enable X11 grabbing [no]
  90. --disable-network disable network support [no]
  91. --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
  92. --enable-gray enable full grayscale support (slower color)
  93. --disable-swscale-alpha disable alpha channel support in swscale
  94. --disable-fastdiv disable table-based division
  95. --enable-small optimize for size instead of speed
  96. --disable-aandct disable AAN DCT code
  97. --disable-dct disable DCT code
  98. --disable-fft disable FFT code
  99. --disable-golomb disable Golomb code
  100. --disable-lpc disable LPC code
  101. --disable-mdct disable MDCT code
  102. --disable-rdft disable RDFT code
  103. --disable-vaapi disable VAAPI code
  104. --disable-vdpau disable VDPAU code
  105. --disable-dxva2 disable DXVA2 code
  106. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  107. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  108. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  109. --enable-beos-netserver enable BeOS netserver
  110. --disable-everything disable all components listed below
  111. --disable-encoder=NAME disable encoder NAME
  112. --enable-encoder=NAME enable encoder NAME
  113. --disable-encoders disable all encoders
  114. --disable-decoder=NAME disable decoder NAME
  115. --enable-decoder=NAME enable decoder NAME
  116. --disable-decoders disable all decoders
  117. --disable-hwaccel=NAME disable hwaccel NAME
  118. --enable-hwaccel=NAME enable hwaccel NAME
  119. --disable-hwaccels disable all hwaccels
  120. --disable-muxer=NAME disable muxer NAME
  121. --enable-muxer=NAME enable muxer NAME
  122. --disable-muxers disable all muxers
  123. --disable-demuxer=NAME disable demuxer NAME
  124. --enable-demuxer=NAME enable demuxer NAME
  125. --disable-demuxers disable all demuxers
  126. --enable-parser=NAME enable parser NAME
  127. --disable-parser=NAME disable parser NAME
  128. --disable-parsers disable all parsers
  129. --enable-bsf=NAME enable bitstream filter NAME
  130. --disable-bsf=NAME disable bitstream filter NAME
  131. --disable-bsfs disable all bitstream filters
  132. --enable-protocol=NAME enable protocol NAME
  133. --disable-protocol=NAME disable protocol NAME
  134. --disable-protocols disable all protocols
  135. --disable-indev=NAME disable input device NAME
  136. --disable-outdev=NAME disable output device NAME
  137. --disable-indevs disable input devices
  138. --disable-outdevs disable output devices
  139. --disable-devices disable all devices
  140. --enable-filter=NAME enable filter NAME
  141. --disable-filter=NAME disable filter NAME
  142. --disable-filters disable all filters
  143. --list-decoders show all available decoders
  144. --list-encoders show all available encoders
  145. --list-hwaccels show all available hardware accelerators
  146. --list-muxers show all available muxers
  147. --list-demuxers show all available demuxers
  148. --list-parsers show all available parsers
  149. --list-protocols show all available protocols
  150. --list-bsfs show all available bitstream filters
  151. --list-indevs show all available input devices
  152. --list-outdevs show all available output devices
  153. --list-filters show all available filters
  154. External library support:
  155. --enable-avisynth enable reading of AVISynth script files [no]
  156. --enable-bzlib enable bzlib [autodetect]
  157. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  158. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  159. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  160. and libraw1394 [no]
  161. --enable-libdirac enable Dirac support via libdirac [no]
  162. --enable-libfaac enable FAAC support via libfaac [no]
  163. --enable-libfaad enable FAAD support via libfaad [no]
  164. --enable-libfaadbin open libfaad.so.0 at runtime [no]
  165. --enable-libgsm enable GSM support via libgsm [no]
  166. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  167. --enable-libnut enable NUT (de)muxing via libnut,
  168. native (de)muxer exists [no]
  169. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  170. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  171. --enable-libspeex enable Speex decoding via libspeex [no]
  172. --enable-libtheora enable Theora encoding via libtheora [no]
  173. --enable-libvorbis enable Vorbis encoding via libvorbis,
  174. native implementation exists [no]
  175. --enable-libx264 enable H.264 encoding via x264 [no]
  176. --enable-libxvid enable Xvid encoding via xvidcore,
  177. native MPEG-4/Xvid encoder exists [no]
  178. --enable-mlib enable Sun medialib [no]
  179. --enable-zlib enable zlib [autodetect]
  180. Advanced options (experts only):
  181. --source-path=PATH path to source code [$source_path]
  182. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  183. --enable-cross-compile assume a cross-compiler is used
  184. --sysroot=PATH root of cross-build tree
  185. --sysinclude=PATH location of cross-build system headers
  186. --target-os=OS compiler targets OS [$target_os]
  187. --target-exec=CMD command to run executables on target
  188. --target-path=DIR path to view of build directory on target
  189. --nm=NM use nm tool
  190. --as=AS use assembler AS [$as_default]
  191. --cc=CC use C compiler CC [$cc_default]
  192. --ld=LD use linker LD
  193. --host-cc=HOSTCC use host C compiler HOSTCC
  194. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  195. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  196. --host-libs=HLIBS use libs HLIBS when linking for host
  197. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  198. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  199. --extra-libs=ELIBS add ELIBS [$ELIBS]
  200. --extra-version=STRING version string suffix []
  201. --build-suffix=SUFFIX library name suffix []
  202. --arch=ARCH select architecture [$arch]
  203. --cpu=CPU select the minimum required CPU (affects
  204. instruction selection, may crash on older CPUs)
  205. --enable-powerpc-perf enable performance report on PPC
  206. (requires enabling PMC)
  207. --disable-asm disable all assembler optimizations
  208. --disable-altivec disable AltiVec optimizations
  209. --disable-amd3dnow disable 3DNow! optimizations
  210. --disable-amd3dnowext disable 3DNow! extended optimizations
  211. --disable-mmx disable MMX optimizations
  212. --disable-mmx2 disable MMX2 optimizations
  213. --disable-sse disable SSE optimizations
  214. --disable-ssse3 disable SSSE3 optimizations
  215. --disable-armv5te disable armv5te optimizations
  216. --disable-armv6 disable armv6 optimizations
  217. --disable-armv6t2 disable armv6t2 optimizations
  218. --disable-armvfp disable ARM VFP optimizations
  219. --disable-iwmmxt disable iwmmxt optimizations
  220. --disable-mmi disable MMI optimizations
  221. --disable-neon disable neon optimizations
  222. --disable-vis disable VIS optimizations
  223. --disable-yasm disable use of yasm assembler
  224. --enable-pic build position-independent code
  225. --malloc-prefix=PFX prefix malloc and related names with PFX
  226. --enable-sram allow use of on-chip SRAM
  227. Developer options (useful when working on FFmpeg itself):
  228. --disable-debug disable debugging symbols
  229. --enable-debug=LEVEL set the debug level [$debuglevel]
  230. --enable-gprof enable profiling with gprof [$gprof]
  231. --disable-optimizations disable compiler optimizations
  232. --enable-extra-warnings enable more compiler warnings
  233. --disable-stripping disable stripping of executables and shared libraries
  234. NOTE: Object files are built at the place where configure is launched.
  235. EOF
  236. exit 0
  237. }
  238. log(){
  239. echo "$@" >> $logfile
  240. }
  241. log_file(){
  242. log BEGIN $1
  243. pr -n -t $1 >> $logfile
  244. log END $1
  245. }
  246. echolog(){
  247. log "$@"
  248. echo "$@"
  249. }
  250. die(){
  251. echolog "$@"
  252. cat <<EOF
  253. If you think configure made a mistake, make sure you are using the latest
  254. version from SVN. If the latest version fails, report the problem to the
  255. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  256. EOF
  257. if disabled logging; then
  258. cat <<EOF
  259. Rerun configure with logging enabled (do not use --disable-logging), and
  260. include the log this produces with your report.
  261. EOF
  262. else
  263. cat <<EOF
  264. Include the log file "$logfile" produced by configure as this will help
  265. solving the problem.
  266. EOF
  267. fi
  268. exit 1
  269. }
  270. # Avoid locale weirdness, besides we really just want to translate ASCII.
  271. toupper(){
  272. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  273. }
  274. tolower(){
  275. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  276. }
  277. c_escape(){
  278. echo "$*" | sed 's/["\\]/\\\0/g'
  279. }
  280. sh_quote(){
  281. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  282. test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
  283. echo "$v"
  284. }
  285. filter(){
  286. pat=$1
  287. shift
  288. for v; do
  289. eval "case $v in $pat) echo $v ;; esac"
  290. done
  291. }
  292. map(){
  293. m=$1
  294. shift
  295. for _; do eval $m; done
  296. }
  297. set_all(){
  298. value=$1
  299. shift
  300. for var in $*; do
  301. eval $var=$value
  302. done
  303. }
  304. set_weak(){
  305. value=$1
  306. shift
  307. for var; do
  308. eval : \${$var:=$value}
  309. done
  310. }
  311. pushvar(){
  312. for var in $*; do
  313. eval level=\${${var}_level:=0}
  314. eval ${var}_${level}="\$$var"
  315. eval ${var}_level=$(($level+1))
  316. done
  317. }
  318. popvar(){
  319. for var in $*; do
  320. eval level=\${${var}_level:-0}
  321. test $level = 0 && continue
  322. eval level=$(($level-1))
  323. eval $var="\${${var}_${level}}"
  324. eval ${var}_level=$level
  325. eval unset ${var}_${level}
  326. done
  327. }
  328. enable(){
  329. set_all yes $*
  330. }
  331. disable(){
  332. set_all no $*
  333. }
  334. enable_weak(){
  335. set_weak yes $*
  336. }
  337. disable_weak(){
  338. set_weak no $*
  339. }
  340. enable_safe(){
  341. for var; do
  342. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  343. done
  344. }
  345. disable_safe(){
  346. for var; do
  347. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  348. done
  349. }
  350. do_enable_deep(){
  351. for var; do
  352. enabled $var && continue
  353. eval sel="\$${var}_select"
  354. eval sgs="\$${var}_suggest"
  355. pushvar var sgs
  356. enable_deep $sel
  357. popvar sgs
  358. enable_deep_weak $sgs
  359. popvar var
  360. done
  361. }
  362. enable_deep(){
  363. do_enable_deep $*
  364. enable $*
  365. }
  366. enable_deep_weak(){
  367. do_enable_deep $*
  368. enable_weak $*
  369. }
  370. enabled(){
  371. test "${1#!}" = "$1" && op== || op=!=
  372. eval test "x\$${1#!}" $op "xyes"
  373. }
  374. disabled(){
  375. test "${1#!}" = "$1" && op== || op=!=
  376. eval test "x\$${1#!}" $op "xno"
  377. }
  378. enabled_all(){
  379. for opt; do
  380. enabled $opt || return 1
  381. done
  382. }
  383. disabled_all(){
  384. for opt; do
  385. disabled $opt || return 1
  386. done
  387. }
  388. enabled_any(){
  389. for opt; do
  390. enabled $opt && return 0
  391. done
  392. }
  393. disabled_any(){
  394. for opt; do
  395. disabled $opt && return 0
  396. done
  397. return 1
  398. }
  399. set_default(){
  400. for opt; do
  401. eval : \${$opt:=\$${opt}_default}
  402. done
  403. }
  404. is_in(){
  405. value=$1
  406. shift
  407. for var in $*; do
  408. [ $var = $value ] && return 0
  409. done
  410. return 1
  411. }
  412. check_deps(){
  413. for cfg; do
  414. cfg="${cfg#!}"
  415. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  416. disabled ${cfg}_checking && continue
  417. enable ${cfg}_checking
  418. eval dep_all="\$${cfg}_deps"
  419. eval dep_any="\$${cfg}_deps_any"
  420. eval dep_sel="\$${cfg}_select"
  421. eval dep_sgs="\$${cfg}_suggest"
  422. eval dep_ifa="\$${cfg}_if"
  423. eval dep_ifn="\$${cfg}_if_any"
  424. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  425. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  426. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  427. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  428. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  429. enabled_all $dep_all || disable $cfg
  430. enabled_any $dep_any || disable $cfg
  431. disabled_any $dep_sel && disable $cfg
  432. if enabled $cfg; then
  433. eval dep_extralibs="\$${cfg}_extralibs"
  434. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  435. enable_deep $dep_sel
  436. enable_deep_weak $dep_sgs
  437. fi
  438. disable ${cfg}_checking
  439. done
  440. }
  441. print_config(){
  442. pfx=$1
  443. header=$2
  444. makefile=$3
  445. shift 3
  446. for cfg; do
  447. ucname="$(toupper $cfg)"
  448. if enabled $cfg; then
  449. echo "#define ${pfx}${ucname} 1" >> $header
  450. echo "${pfx}${ucname}=yes" >> $makefile
  451. else
  452. echo "#define ${pfx}${ucname} 0" >> $header
  453. echo "!${pfx}${ucname}=yes" >> $makefile
  454. fi
  455. done
  456. }
  457. flags_saved(){
  458. (: ${SAVE_CFLAGS?}) 2> /dev/null
  459. }
  460. save_flags(){
  461. flags_saved && return
  462. SAVE_CFLAGS="$CFLAGS"
  463. SAVE_LDFLAGS="$LDFLAGS"
  464. SAVE_extralibs="$extralibs"
  465. }
  466. restore_flags(){
  467. flags_saved || return
  468. CFLAGS="$SAVE_CFLAGS"
  469. LDFLAGS="$SAVE_LDFLAGS"
  470. extralibs="$SAVE_extralibs"
  471. unset SAVE_CFLAGS
  472. unset SAVE_LDFLAGS
  473. unset SAVE_extralibs
  474. }
  475. temp_cflags(){
  476. save_flags
  477. CFLAGS="$CFLAGS $*"
  478. }
  479. temp_ldflags(){
  480. save_flags
  481. LDFLAGS="$LDFLAGS $*"
  482. }
  483. temp_extralibs(){
  484. save_flags
  485. extralibs="$extralibs $*"
  486. }
  487. append(){
  488. var=$1
  489. shift
  490. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  491. eval "$var=\"\$$var $*\""
  492. }
  493. add_cppflags(){
  494. append CPPFLAGS $($filter_cppflags "$@")
  495. }
  496. add_cflags(){
  497. append CFLAGS $($filter_cflags "$@")
  498. }
  499. add_asflags(){
  500. append ASFLAGS $($filter_asflags "$@")
  501. }
  502. add_ldflags(){
  503. append LDFLAGS "$@"
  504. }
  505. add_extralibs(){
  506. append extralibs "$@"
  507. }
  508. check_cmd(){
  509. log "$@"
  510. "$@" >> $logfile 2>&1
  511. }
  512. check_cc(){
  513. log check_cc "$@"
  514. cat > $TMPC
  515. log_file $TMPC
  516. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  517. }
  518. check_cpp(){
  519. log check_cpp "$@"
  520. cat > $TMPC
  521. log_file $TMPC
  522. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  523. }
  524. check_as(){
  525. log check_as "$@"
  526. cat > $TMPC
  527. log_file $TMPC
  528. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  529. }
  530. check_asm(){
  531. log check_asm "$@"
  532. name="$1"
  533. code="$2"
  534. shift 2
  535. disable $name
  536. check_as "$@" <<EOF && enable $name
  537. void foo(void){ __asm__ volatile($code); }
  538. EOF
  539. }
  540. check_yasm(){
  541. log check_yasm "$@"
  542. echo "$1" > $TMPS
  543. log_file $TMPS
  544. shift 1
  545. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  546. }
  547. check_ld(){
  548. log check_ld "$@"
  549. flags=''
  550. libs=''
  551. for f; do
  552. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  553. done
  554. check_cc $($filter_cflags $flags) || return
  555. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  556. }
  557. check_cppflags(){
  558. log check_cppflags "$@"
  559. set -- $($filter_cppflags "$@")
  560. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  561. int x;
  562. EOF
  563. }
  564. check_cflags(){
  565. log check_cflags "$@"
  566. set -- $($filter_cflags "$@")
  567. check_cc "$@" <<EOF && append CFLAGS "$@"
  568. int x;
  569. EOF
  570. }
  571. test_ldflags(){
  572. log test_ldflags "$@"
  573. check_ld "$@" <<EOF
  574. int main(void){ return 0; }
  575. EOF
  576. }
  577. check_ldflags(){
  578. log check_ldflags "$@"
  579. test_ldflags "$@" && add_ldflags "$@"
  580. }
  581. check_header(){
  582. log check_header "$@"
  583. header=$1
  584. shift
  585. disable_safe $header
  586. check_cpp "$@" <<EOF && enable_safe $header
  587. #include <$header>
  588. int x;
  589. EOF
  590. }
  591. check_func(){
  592. log check_func "$@"
  593. func=$1
  594. shift
  595. disable $func
  596. check_ld "$@" <<EOF && enable $func
  597. extern int $func();
  598. int main(void){ $func(); }
  599. EOF
  600. }
  601. check_mathfunc(){
  602. log check_mathfunc "$@"
  603. func=$1
  604. shift
  605. disable $func
  606. check_ld "$@" <<EOF && enable $func
  607. #include <math.h>
  608. float foo(float f) { return $func(f); }
  609. int main(void){ return 0; }
  610. EOF
  611. }
  612. check_func_headers(){
  613. log check_func_headers "$@"
  614. headers=$1
  615. func=$2
  616. shift 2
  617. disable $func
  618. incs=""
  619. for hdr in $headers; do
  620. incs="$incs
  621. #include <$hdr>"
  622. done
  623. check_ld "$@" <<EOF && enable $func && enable_safe $headers
  624. $incs
  625. int main(int argc, char **argv){
  626. return (long) $func;
  627. }
  628. EOF
  629. }
  630. check_cpp_condition(){
  631. log check_cpp_condition "$@"
  632. header=$1
  633. condition=$2
  634. shift 2
  635. check_cpp $($filter_cppflags "$@") <<EOF
  636. #include <$header>
  637. #if !($condition)
  638. #error "unsatisfied condition: $condition"
  639. #endif
  640. EOF
  641. }
  642. check_lib(){
  643. log check_lib "$@"
  644. header="$1"
  645. func="$2"
  646. shift 2
  647. temp_extralibs "$@"
  648. check_header $header && check_func $func && add_extralibs "$@"
  649. err=$?
  650. restore_flags
  651. return $err
  652. }
  653. check_lib2(){
  654. log check_lib2 "$@"
  655. headers="$1"
  656. func="$2"
  657. shift 2
  658. check_func_headers "$headers" $func "$@" && add_extralibs "$@"
  659. }
  660. check_exec(){
  661. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  662. }
  663. check_exec_crash(){
  664. code=$(cat)
  665. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  666. # are safe but may not be available everywhere. Thus we use
  667. # raise(SIGTERM) instead. The check is run in a subshell so we
  668. # can redirect the "Terminated" message from the shell. SIGBUS
  669. # is not defined by standard C so it is used conditionally.
  670. (check_exec "$@") >> $logfile 2>&1 <<EOF
  671. #include <signal.h>
  672. static void sighandler(int sig){
  673. raise(SIGTERM);
  674. }
  675. int main(void){
  676. signal(SIGILL, sighandler);
  677. signal(SIGFPE, sighandler);
  678. signal(SIGSEGV, sighandler);
  679. #ifdef SIGBUS
  680. signal(SIGBUS, sighandler);
  681. #endif
  682. { $code }
  683. }
  684. EOF
  685. }
  686. check_type(){
  687. log check_type "$@"
  688. headers=$1
  689. type=$2
  690. shift 2
  691. disable_safe "$type"
  692. incs=""
  693. for hdr in $headers; do
  694. incs="$incs
  695. #include <$hdr>"
  696. done
  697. check_cc "$@" <<EOF && enable_safe "$type"
  698. $incs
  699. $type v;
  700. EOF
  701. }
  702. check_struct(){
  703. log check_type "$@"
  704. headers=$1
  705. struct=$2
  706. member=$3
  707. shift 3
  708. disable_safe "${struct}_${member}"
  709. incs=""
  710. for hdr in $headers; do
  711. incs="$incs
  712. #include <$hdr>"
  713. done
  714. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  715. $incs
  716. const void *p = &(($struct *)0)->$member;
  717. EOF
  718. }
  719. require(){
  720. name="$1"
  721. header="$2"
  722. func="$3"
  723. shift 3
  724. check_lib $header $func "$@" || die "ERROR: $name not found"
  725. }
  726. require2(){
  727. name="$1"
  728. headers="$2"
  729. func="$3"
  730. shift 3
  731. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  732. }
  733. check_foo_config(){
  734. cfg=$1
  735. pkg=$2
  736. header=$3
  737. func=$4
  738. shift 4
  739. disable $cfg
  740. check_cmd ${pkg}-config --version
  741. err=$?
  742. if test "$err" = 0; then
  743. temp_cflags $(${pkg}-config --cflags)
  744. temp_extralibs $(${pkg}-config --libs)
  745. check_lib "$@" $header $func && enable $cfg
  746. fi
  747. return $err
  748. }
  749. check_host_cc(){
  750. log check_host_cc "$@"
  751. cat > $TMPC
  752. log_file $TMPC
  753. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  754. }
  755. check_host_cflags(){
  756. log check_host_cflags "$@"
  757. check_host_cc "$@" <<EOF && append host_cflags "$@"
  758. int x;
  759. EOF
  760. }
  761. apply(){
  762. file=$1
  763. shift
  764. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  765. }
  766. cp_if_changed(){
  767. cmp -s "$1" "$2" &&
  768. echo "$2 is unchanged" ||
  769. cp -f "$1" "$2"
  770. }
  771. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  772. # system-dependent things.
  773. COMPONENT_LIST="
  774. bsfs
  775. decoders
  776. demuxers
  777. encoders
  778. filters
  779. hwaccels
  780. indevs
  781. muxers
  782. outdevs
  783. parsers
  784. protocols
  785. "
  786. CONFIG_LIST="
  787. $COMPONENT_LIST
  788. aandct
  789. avcodec
  790. avdevice
  791. avfilter
  792. avfilter_lavf
  793. avformat
  794. avisynth
  795. beos_netserver
  796. bzlib
  797. dct
  798. doc
  799. dwt
  800. dxva2
  801. fastdiv
  802. ffmpeg
  803. ffplay
  804. ffprobe
  805. ffserver
  806. fft
  807. golomb
  808. gpl
  809. gprof
  810. gray
  811. hardcoded_tables
  812. libdc1394
  813. libdirac
  814. libfaac
  815. libfaad
  816. libfaadbin
  817. libgsm
  818. libmp3lame
  819. libnut
  820. libopencore_amrnb
  821. libopencore_amrwb
  822. libopenjpeg
  823. libschroedinger
  824. libspeex
  825. libtheora
  826. libvorbis
  827. libx264
  828. libxvid
  829. lpc
  830. lsp
  831. mdct
  832. memalign_hack
  833. mlib
  834. mpegaudio_hp
  835. network
  836. nonfree
  837. pic
  838. postproc
  839. powerpc_perf
  840. rdft
  841. runtime_cpudetect
  842. shared
  843. small
  844. sram
  845. static
  846. swscale
  847. swscale_alpha
  848. vaapi
  849. vdpau
  850. version3
  851. x11grab
  852. zlib
  853. "
  854. THREADS_LIST='
  855. beosthreads
  856. os2threads
  857. pthreads
  858. w32threads
  859. '
  860. ARCH_LIST='
  861. alpha
  862. arm
  863. avr32
  864. avr32_ap
  865. avr32_uc
  866. bfin
  867. ia64
  868. m68k
  869. mips
  870. mips64
  871. parisc
  872. ppc
  873. ppc64
  874. s390
  875. sh4
  876. sparc
  877. sparc64
  878. tomi
  879. x86
  880. x86_32
  881. x86_64
  882. '
  883. ARCH_EXT_LIST='
  884. altivec
  885. amd3dnow
  886. amd3dnowext
  887. armv5te
  888. armv6
  889. armv6t2
  890. armvfp
  891. iwmmxt
  892. mmi
  893. mmx
  894. mmx2
  895. neon
  896. ppc4xx
  897. sse
  898. ssse3
  899. vis
  900. '
  901. HAVE_LIST_PUB='
  902. bigendian
  903. '
  904. HAVE_LIST="
  905. $ARCH_EXT_LIST
  906. $HAVE_LIST_PUB
  907. $THREADS_LIST
  908. alsa_asoundlib_h
  909. altivec_h
  910. arpa_inet_h
  911. attribute_may_alias
  912. attribute_packed
  913. bswap
  914. closesocket
  915. cmov
  916. conio_h
  917. dcbzl
  918. dev_bktr_ioctl_bt848_h
  919. dev_bktr_ioctl_meteor_h
  920. dev_ic_bt8xx_h
  921. dev_video_meteor_ioctl_meteor_h
  922. dev_video_bktr_ioctl_bt848_h
  923. dlfcn_h
  924. dlopen
  925. dos_paths
  926. ebp_available
  927. ebx_available
  928. exp2
  929. exp2f
  930. fast_64bit
  931. fast_clz
  932. fast_cmov
  933. fast_unaligned
  934. fork
  935. getaddrinfo
  936. gethrtime
  937. GetProcessMemoryInfo
  938. GetProcessTimes
  939. getrusage
  940. struct_rusage_ru_maxrss
  941. inet_aton
  942. inline_asm
  943. isatty
  944. ldbrx
  945. libdc1394_1
  946. libdc1394_2
  947. llrint
  948. local_aligned_16
  949. local_aligned_8
  950. log2
  951. log2f
  952. loongson
  953. lrint
  954. lrintf
  955. lzo1x_999_compress
  956. machine_ioctl_bt848_h
  957. machine_ioctl_meteor_h
  958. malloc_h
  959. memalign
  960. mkstemp
  961. pld
  962. posix_memalign
  963. round
  964. roundf
  965. sdl
  966. sdl_video_size
  967. setmode
  968. socklen_t
  969. soundcard_h
  970. poll_h
  971. setrlimit
  972. struct_addrinfo
  973. struct_ipv6_mreq
  974. struct_sockaddr_in6
  975. struct_sockaddr_sa_len
  976. struct_sockaddr_storage
  977. sys_mman_h
  978. sys_resource_h
  979. sys_select_h
  980. sys_soundcard_h
  981. sys_videoio_h
  982. ten_operands
  983. termios_h
  984. threads
  985. truncf
  986. vfp_args
  987. VirtualAlloc
  988. winsock2_h
  989. xform_asm
  990. yasm
  991. "
  992. # options emitted with CONFIG_ prefix but not available on command line
  993. CONFIG_EXTRA="
  994. avutil
  995. gplv3
  996. lgplv3
  997. "
  998. CMDLINE_SELECT="
  999. $ARCH_EXT_LIST
  1000. $CONFIG_LIST
  1001. $THREADS_LIST
  1002. asm
  1003. cross_compile
  1004. debug
  1005. extra_warnings
  1006. logging
  1007. optimizations
  1008. stripping
  1009. yasm
  1010. "
  1011. PATHS_LIST='
  1012. bindir
  1013. datadir
  1014. incdir
  1015. libdir
  1016. mandir
  1017. prefix
  1018. shlibdir
  1019. '
  1020. CMDLINE_SET="
  1021. $PATHS_LIST
  1022. arch
  1023. as
  1024. build_suffix
  1025. cc
  1026. cpu
  1027. cross_prefix
  1028. dep_cc
  1029. extra_version
  1030. host_cc
  1031. host_cflags
  1032. host_ldflags
  1033. host_libs
  1034. host_os
  1035. ld
  1036. logfile
  1037. malloc_prefix
  1038. nm
  1039. source_path
  1040. strip
  1041. sysinclude
  1042. sysroot
  1043. target_exec
  1044. target_os
  1045. target_path
  1046. "
  1047. CMDLINE_APPEND="
  1048. extra_cflags
  1049. "
  1050. # code dependency declarations
  1051. # architecture extensions
  1052. armv5te_deps="arm"
  1053. armv6_deps="arm"
  1054. armv6t2_deps="arm"
  1055. armvfp_deps="arm"
  1056. iwmmxt_deps="arm"
  1057. neon_deps="arm"
  1058. mmi_deps="mips"
  1059. altivec_deps="ppc"
  1060. ppc4xx_deps="ppc"
  1061. vis_deps="sparc"
  1062. x86_64_suggest="cmov fast_cmov"
  1063. amd3dnow_deps="mmx"
  1064. amd3dnowext_deps="amd3dnow"
  1065. mmx_deps="x86"
  1066. mmx2_deps="mmx"
  1067. sse_deps="mmx"
  1068. ssse3_deps="sse"
  1069. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1070. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1071. fast_unaligned_if_any="armv6 ppc x86"
  1072. need_memalign="altivec neon sse"
  1073. inline_asm_deps="!tms470"
  1074. # subsystems
  1075. mdct_select="fft"
  1076. rdft_select="fft"
  1077. # decoders / encoders / hardware accelerators
  1078. aac_decoder_select="mdct rdft aac_parser"
  1079. aac_encoder_select="mdct"
  1080. ac3_decoder_select="mdct ac3_parser"
  1081. alac_encoder_select="lpc"
  1082. amrnb_decoder_select="lsp"
  1083. atrac1_decoder_select="mdct"
  1084. atrac3_decoder_select="mdct"
  1085. binkaudio_dct_decoder_select="mdct rdft dct"
  1086. binkaudio_rdft_decoder_select="mdct rdft"
  1087. cavs_decoder_select="golomb"
  1088. cook_decoder_select="mdct"
  1089. cscd_decoder_suggest="zlib"
  1090. dca_decoder_select="mdct"
  1091. dnxhd_encoder_select="aandct"
  1092. dxa_decoder_select="zlib"
  1093. eac3_decoder_select="ac3_decoder"
  1094. eamad_decoder_select="aandct"
  1095. eatgq_decoder_select="aandct"
  1096. eatqi_decoder_select="aandct"
  1097. ffv1_decoder_select="golomb"
  1098. flac_decoder_select="golomb"
  1099. flac_encoder_select="golomb lpc"
  1100. flashsv_decoder_select="zlib"
  1101. flashsv_encoder_select="zlib"
  1102. flv_decoder_select="h263_decoder"
  1103. flv_encoder_select="h263_encoder"
  1104. h261_encoder_select="aandct"
  1105. h263_decoder_select="h263_parser"
  1106. h263_encoder_select="aandct"
  1107. h263_vaapi_hwaccel_deps="va_va_h"
  1108. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1109. h263i_decoder_select="h263_decoder"
  1110. h263p_encoder_select="h263_encoder"
  1111. h264_decoder_select="golomb"
  1112. h264_dxva2_hwaccel_deps="dxva2api_h"
  1113. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1114. h264_vaapi_hwaccel_deps="va_va_h"
  1115. h264_vaapi_hwaccel_select="vaapi"
  1116. h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1117. h264_vdpau_decoder_select="vdpau h264_decoder"
  1118. imc_decoder_select="fft mdct"
  1119. jpegls_decoder_select="golomb"
  1120. jpegls_encoder_select="golomb"
  1121. ljpeg_encoder_select="aandct"
  1122. loco_decoder_select="golomb"
  1123. mjpeg_encoder_select="aandct"
  1124. mlp_decoder_select="mlp_parser"
  1125. mpeg1video_encoder_select="aandct"
  1126. mpeg2video_encoder_select="aandct"
  1127. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1128. mpeg4_encoder_select="h263_encoder"
  1129. mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1130. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1131. mpeg1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1132. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1133. mpeg2_vaapi_hwaccel_deps="va_va_h"
  1134. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1135. mpeg4_vaapi_hwaccel_deps="va_va_h"
  1136. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1137. mpeg4_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1138. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1139. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1140. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1141. msmpeg4v1_decoder_select="h263_decoder"
  1142. msmpeg4v1_encoder_select="h263_encoder"
  1143. msmpeg4v2_decoder_select="h263_decoder"
  1144. msmpeg4v2_encoder_select="h263_encoder"
  1145. msmpeg4v3_decoder_select="h263_decoder"
  1146. msmpeg4v3_encoder_select="h263_encoder"
  1147. nellymoser_decoder_select="mdct"
  1148. nellymoser_encoder_select="mdct"
  1149. png_decoder_select="zlib"
  1150. png_encoder_select="zlib"
  1151. qcelp_decoder_select="lsp"
  1152. qdm2_decoder_select="mdct rdft"
  1153. rv10_decoder_select="h263_decoder"
  1154. rv10_encoder_select="h263_encoder"
  1155. rv20_decoder_select="h263_decoder"
  1156. rv20_encoder_select="h263_encoder"
  1157. rv30_decoder_select="golomb"
  1158. rv40_decoder_select="golomb"
  1159. shorten_decoder_select="golomb"
  1160. sipr_decoder_select="lsp"
  1161. snow_decoder_select="dwt"
  1162. snow_encoder_select="aandct dwt"
  1163. sonic_decoder_select="golomb"
  1164. sonic_encoder_select="golomb"
  1165. sonic_ls_encoder_select="golomb"
  1166. svq1_encoder_select="aandct"
  1167. svq3_decoder_select="golomb"
  1168. svq3_decoder_suggest="zlib"
  1169. theora_decoder_select="vp3_decoder"
  1170. tiff_decoder_suggest="zlib"
  1171. tiff_encoder_suggest="zlib"
  1172. truehd_decoder_select="mlp_decoder"
  1173. tscc_decoder_select="zlib"
  1174. twinvq_decoder_select="mdct lsp"
  1175. vc1_decoder_select="h263_decoder"
  1176. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1177. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1178. vc1_vaapi_hwaccel_deps="va_va_h"
  1179. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1180. vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1181. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1182. vorbis_decoder_select="mdct"
  1183. vorbis_encoder_select="mdct"
  1184. vp6a_decoder_select="vp6_decoder"
  1185. vp6f_decoder_select="vp6_decoder"
  1186. wmapro_decoder_select="mdct"
  1187. wmav1_decoder_select="mdct"
  1188. wmav1_encoder_select="mdct"
  1189. wmav2_decoder_select="mdct"
  1190. wmav2_encoder_select="mdct"
  1191. wmavoice_decoder_select="lsp"
  1192. wmv1_decoder_select="h263_decoder"
  1193. wmv1_encoder_select="h263_encoder"
  1194. wmv2_decoder_select="h263_decoder"
  1195. wmv2_encoder_select="h263_encoder"
  1196. wmv3_decoder_select="vc1_decoder"
  1197. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1198. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1199. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1200. zlib_decoder_select="zlib"
  1201. zlib_encoder_select="zlib"
  1202. zmbv_decoder_select="zlib"
  1203. zmbv_encoder_select="zlib"
  1204. # parsers
  1205. h264_parser_select="golomb"
  1206. # bitstream_filters
  1207. aac_adtstoasc_bsf_select="aac_parser"
  1208. # external libraries
  1209. libdirac_decoder_deps="libdirac !libschroedinger"
  1210. libdirac_encoder_deps="libdirac"
  1211. libfaac_encoder_deps="libfaac"
  1212. libfaad_decoder_deps="libfaad"
  1213. libfaadbin_decoder_extralibs='$ldl'
  1214. libgsm_decoder_deps="libgsm"
  1215. libgsm_encoder_deps="libgsm"
  1216. libgsm_ms_decoder_deps="libgsm"
  1217. libgsm_ms_encoder_deps="libgsm"
  1218. libmp3lame_encoder_deps="libmp3lame"
  1219. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1220. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1221. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1222. libopenjpeg_decoder_deps="libopenjpeg"
  1223. libschroedinger_decoder_deps="libschroedinger"
  1224. libschroedinger_encoder_deps="libschroedinger"
  1225. libspeex_decoder_deps="libspeex"
  1226. libtheora_encoder_deps="libtheora"
  1227. libvorbis_encoder_deps="libvorbis"
  1228. libx264_encoder_deps="libx264"
  1229. libxvid_encoder_deps="libxvid"
  1230. # demuxers / muxers
  1231. ac3_demuxer_deps="ac3_parser"
  1232. asf_stream_muxer_select="asf_muxer"
  1233. avisynth_demuxer_deps="avisynth"
  1234. dirac_demuxer_deps="dirac_parser"
  1235. eac3_demuxer_select="ac3_parser"
  1236. ipod_muxer_select="mov_muxer"
  1237. libnut_demuxer_deps="libnut"
  1238. libnut_muxer_deps="libnut"
  1239. matroska_audio_muxer_select="matroska_muxer"
  1240. matroska_demuxer_suggest="zlib bzlib"
  1241. mov_demuxer_suggest="zlib"
  1242. mp3_demuxer_deps="mpegaudio_parser"
  1243. mp4_muxer_select="mov_muxer"
  1244. mpegtsraw_demuxer_select="mpegts_demuxer"
  1245. mxf_d10_muxer_select="mxf_muxer"
  1246. ogg_demuxer_select="golomb"
  1247. psp_muxer_select="mov_muxer"
  1248. rtsp_demuxer_deps="sdp_demuxer"
  1249. rtsp_muxer_deps="sdp_demuxer"
  1250. rtsp_muxer_select="rtp_muxer"
  1251. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1252. sdp_demuxer_select="asf_demuxer rm_demuxer"
  1253. spdif_muxer_select="aac_parser"
  1254. tg2_muxer_select="mov_muxer"
  1255. tgp_muxer_select="mov_muxer"
  1256. w64_demuxer_deps="wav_demuxer"
  1257. # indevs / outdevs
  1258. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1259. alsa_indev_extralibs="-lasound"
  1260. alsa_outdev_deps="alsa_asoundlib_h"
  1261. alsa_outdev_extralibs="-lasound"
  1262. audio_beos_indev_deps="audio_beos"
  1263. audio_beos_indev_extralibs="-lmedia -lbe"
  1264. audio_beos_outdev_deps="audio_beos"
  1265. audio_beos_outdev_extralibs="-lmedia -lbe"
  1266. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1267. dv1394_indev_deps="dv1394 dv_demuxer"
  1268. jack_indev_deps="jack_jack_h"
  1269. jack_indev_extralibs="-ljack"
  1270. libdc1394_indev_deps="libdc1394"
  1271. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1272. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1273. v4l_indev_deps="linux_videodev_h"
  1274. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1275. vfwcap_indev_deps="capCreateCaptureWindow"
  1276. vfwcap_indev_extralibs="-lavicap32"
  1277. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1278. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1279. # protocols
  1280. gopher_protocol_deps="network"
  1281. http_protocol_deps="network"
  1282. http_protocol_select="tcp_protocol"
  1283. rtmp_protocol_deps="tcp_protocol"
  1284. rtp_protocol_deps="udp_protocol"
  1285. tcp_protocol_deps="network"
  1286. udp_protocol_deps="network"
  1287. # filters
  1288. movie_filter_deps="avfilter_lavf"
  1289. avfilter_lavf_deps="avformat"
  1290. # libraries
  1291. avdevice_deps="avcodec avformat"
  1292. avformat_deps="avcodec"
  1293. # programs
  1294. ffmpeg_deps="avcodec avformat swscale"
  1295. ffplay_deps="avcodec avformat swscale sdl"
  1296. ffplay_select="rdft"
  1297. ffprobe_deps="avcodec avformat"
  1298. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1299. ffserver_extralibs='$ldl'
  1300. doc_deps="texi2html"
  1301. # default parameters
  1302. logfile="config.err"
  1303. # installation paths
  1304. prefix_default="/usr/local"
  1305. bindir_default='${prefix}/bin'
  1306. datadir_default='${prefix}/share/ffmpeg'
  1307. incdir_default='${prefix}/include'
  1308. libdir_default='${prefix}/lib'
  1309. mandir_default='${prefix}/share/man'
  1310. shlibdir_default="$libdir_default"
  1311. # toolchain
  1312. ar="ar"
  1313. cc_default="gcc"
  1314. cc_version=\"unknown\"
  1315. host_cc_default="gcc"
  1316. ln_s="ln -sf"
  1317. nm_default="nm"
  1318. objformat="elf"
  1319. ranlib="ranlib"
  1320. strip_default="strip"
  1321. yasmexe="yasm"
  1322. nm_opts='-g'
  1323. # machine
  1324. arch_default=$(uname -m)
  1325. cpu="generic"
  1326. # OS
  1327. target_os_default=$(tolower $(uname -s))
  1328. host_os=$target_os_default
  1329. # configurable options
  1330. enable avcodec
  1331. enable avdevice
  1332. enable avformat
  1333. enable avutil
  1334. enable asm
  1335. enable debug
  1336. enable doc
  1337. enable fastdiv
  1338. enable ffmpeg
  1339. enable ffplay
  1340. enable ffprobe
  1341. enable ffserver
  1342. enable mpegaudio_hp
  1343. enable network
  1344. enable optimizations
  1345. enable protocols
  1346. enable static
  1347. enable stripping
  1348. enable swscale
  1349. enable swscale_alpha
  1350. # build settings
  1351. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1352. FFSERVERLDFLAGS=-Wl,-E
  1353. LIBPREF="lib"
  1354. LIBSUF=".a"
  1355. FULLNAME='$(NAME)$(BUILDSUF)'
  1356. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1357. SLIBPREF="lib"
  1358. SLIBSUF=".so"
  1359. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1360. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1361. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1362. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1363. CC_O='-o $@'
  1364. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1365. host_libs='-lm'
  1366. target_path='$(CURDIR)'
  1367. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1368. # full relative path for objects in subdirectories for non-recursive Make.
  1369. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1370. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1371. # find source path
  1372. source_path="$(dirname "$0")"
  1373. enable source_path_used
  1374. if test -f configure; then
  1375. source_path="$(pwd)"
  1376. disable source_path_used
  1377. else
  1378. source_path="$(cd "$source_path"; pwd)"
  1379. echo "$source_path" | grep -q '[[:blank:]]' &&
  1380. die "Out of tree builds are impossible with whitespace in source path."
  1381. test -e "$source_path/config.h" &&
  1382. die "Out of tree builds are impossible with config.h in source dir."
  1383. fi
  1384. for v in "$@"; do
  1385. r=${v#*=}
  1386. l=${v%"$r"}
  1387. r=$(sh_quote "$r")
  1388. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1389. done
  1390. find_things(){
  1391. thing=$1
  1392. pattern=$2
  1393. file=$source_path/$3
  1394. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1395. }
  1396. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1397. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1398. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1399. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1400. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1401. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1402. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1403. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1404. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1405. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1406. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1407. enable $ARCH_EXT_LIST \
  1408. $DECODER_LIST \
  1409. $ENCODER_LIST \
  1410. $HWACCEL_LIST \
  1411. $PARSER_LIST \
  1412. $BSF_LIST \
  1413. $DEMUXER_LIST \
  1414. $MUXER_LIST \
  1415. $FILTER_LIST \
  1416. $PROTOCOL_LIST \
  1417. $INDEV_LIST \
  1418. $OUTDEV_LIST \
  1419. die_unknown(){
  1420. echo "Unknown option \"$1\"."
  1421. echo "See $0 --help for available options."
  1422. exit 1
  1423. }
  1424. show_list() {
  1425. suffix=_$1
  1426. shift
  1427. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1428. exit 0
  1429. }
  1430. for opt do
  1431. optval="${opt#*=}"
  1432. case "$opt" in
  1433. --extra-ldflags=*) add_ldflags $optval
  1434. ;;
  1435. --extra-libs=*) add_extralibs $optval
  1436. ;;
  1437. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1438. ;;
  1439. --enable-debug=*) debuglevel="$optval"
  1440. ;;
  1441. --disable-everything)
  1442. map 'eval disable \${$(toupper ${_%s})_LIST}' $COMPONENT_LIST
  1443. ;;
  1444. --enable-*=*|--disable-*=*)
  1445. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1446. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1447. eval list=\$$(toupper $thing)_LIST
  1448. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1449. $action $(filter "$name" $list)
  1450. ;;
  1451. --enable-?*|--disable-?*)
  1452. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1453. if is_in $option $COMPONENT_LIST; then
  1454. test $action = disable && action=unset
  1455. eval $action \$$(toupper ${option%s})_LIST
  1456. elif is_in $option $CMDLINE_SELECT; then
  1457. $action $option
  1458. else
  1459. die_unknown $opt
  1460. fi
  1461. ;;
  1462. --list-*)
  1463. NAME="${opt#--list-}"
  1464. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1465. NAME=${NAME%s}
  1466. eval show_list $NAME \$$(toupper $NAME)_LIST
  1467. ;;
  1468. --help|-h) show_help
  1469. ;;
  1470. *)
  1471. optname="${opt%%=*}"
  1472. optname="${optname#--}"
  1473. optname=$(echo "$optname" | sed 's/-/_/g')
  1474. if is_in $optname $CMDLINE_SET; then
  1475. eval $optname='$optval'
  1476. elif is_in $optname $CMDLINE_APPEND; then
  1477. append $optname "$optval"
  1478. else
  1479. die_unknown $opt
  1480. fi
  1481. ;;
  1482. esac
  1483. done
  1484. disabled logging && logfile=/dev/null
  1485. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1486. set >> $logfile
  1487. test -n "$cross_prefix" && enable cross_compile
  1488. if enabled cross_compile; then
  1489. test -n "$arch" && test -n "$target_os" ||
  1490. die "Must specify target arch and OS when cross-compiling"
  1491. fi
  1492. set_default arch target_os
  1493. ar="${cross_prefix}${ar}"
  1494. cc_default="${cross_prefix}${cc_default}"
  1495. nm_default="${cross_prefix}${nm_default}"
  1496. ranlib="${cross_prefix}${ranlib}"
  1497. strip_default="${cross_prefix}${strip_default}"
  1498. sysinclude_default="${sysroot}/usr/include"
  1499. set_default cc nm strip sysinclude
  1500. enabled cross_compile || host_cc_default=$cc
  1501. set_default host_cc
  1502. exesuf() {
  1503. case $1 in
  1504. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1505. esac
  1506. }
  1507. EXESUF=$(exesuf $target_os)
  1508. HOSTEXESUF=$(exesuf $host_os)
  1509. # set temporary file name
  1510. : ${TMPDIR:=$TEMPDIR}
  1511. : ${TMPDIR:=$TMP}
  1512. : ${TMPDIR:=/tmp}
  1513. if ! check_cmd type mktemp; then
  1514. # simple replacement for missing mktemp
  1515. # NOT SAFE FOR GENERAL USE
  1516. mktemp(){
  1517. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1518. }
  1519. fi
  1520. tmpfile(){
  1521. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1522. (set -C; exec > $tmp) 2>/dev/null ||
  1523. die "Unable to create temporary file in $TMPDIR."
  1524. append TMPFILES $tmp
  1525. eval $1=$tmp
  1526. }
  1527. trap 'rm -f -- $TMPFILES' EXIT
  1528. trap exit HUP INT TERM
  1529. tmpfile TMPC .c
  1530. tmpfile TMPE $EXESUF
  1531. tmpfile TMPH .h
  1532. tmpfile TMPO .o
  1533. tmpfile TMPS .S
  1534. tmpfile TMPV .ver
  1535. tmpfile TMPSH .sh
  1536. unset -f mktemp
  1537. # make sure we can execute files in $TMPDIR
  1538. cat > $TMPSH 2>> $logfile <<EOF
  1539. #! /bin/sh
  1540. EOF
  1541. chmod +x $TMPSH >> $logfile 2>&1
  1542. if ! $TMPSH >> $logfile 2>&1; then
  1543. cat <<EOF
  1544. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1545. variable to another directory and make sure that it is not mounted noexec.
  1546. EOF
  1547. die "Sanity test failed."
  1548. fi
  1549. filter_cflags=echo
  1550. filter_cppflags=echo
  1551. filter_asflags=echo
  1552. if $cc -v 2>&1 | grep -qi ^gcc; then
  1553. cc_type=gcc
  1554. cc_version=__VERSION__
  1555. if ! $cc -dumpversion | grep -q '^2\.'; then
  1556. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1557. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1558. fi
  1559. speed_cflags='-O3'
  1560. size_cflags='-Os'
  1561. elif $cc --version 2>/dev/null | grep -q Intel; then
  1562. cc_type=icc
  1563. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1564. CC_DEPFLAGS='-MMD'
  1565. AS_DEPFLAGS='-MMD'
  1566. speed_cflags='-O3'
  1567. size_cflags='-Os'
  1568. elif $cc -v 2>&1 | grep -q xlc; then
  1569. cc_type=xlc
  1570. cc_version="AV_STRINGIFY(__IBMC__)"
  1571. speed_cflags='-O5'
  1572. size_cflags='-O5 -qcompact'
  1573. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1574. cc_type=ccc
  1575. cc_version="AV_STRINGIFY(__DECC_VER)"
  1576. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1577. debuglevel=3
  1578. add_ldflags -Wl,-z,now # calls to libots crash without this
  1579. speed_cflags='-fast'
  1580. size_cflags='-O1'
  1581. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1582. test -d "$sysroot" || die "No valid sysroot specified."
  1583. cc_type=armcc
  1584. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1585. armcc_conf="$PWD/armcc.conf"
  1586. $cc --arm_linux_configure \
  1587. --arm_linux_config_file="$armcc_conf" \
  1588. --configure_sysroot="$sysroot" \
  1589. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1590. die "Error creating armcc configuration file."
  1591. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1592. as_default="${cross_prefix}gcc"
  1593. CC_DEPFLAGS='-MMD'
  1594. AS_DEPFLAGS='-MMD'
  1595. speed_cflags='-O3'
  1596. size_cflags='-Os'
  1597. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1598. cc_type=tms470
  1599. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1600. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1601. CC_O='-fr=$(@D)'
  1602. as_default="${cross_prefix}gcc"
  1603. ld_default="${cross_prefix}gcc"
  1604. TMPO=$(basename $TMPC .c).o
  1605. append TMPFILES $TMPO
  1606. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1607. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1608. AS_DEPFLAGS='-MMD'
  1609. speed_cflags='-O3 -mf=5'
  1610. size_cflags='-O3 -mf=2'
  1611. filter_cflags=tms470_flags
  1612. tms470_flags(){
  1613. for flag; do
  1614. case $flag in
  1615. -march=*|-mcpu=*)
  1616. case "${flag#*=}" in
  1617. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1618. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1619. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1620. armv6*|arm11*) echo -mv=6 ;;
  1621. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1622. echo -mv=5e ;;
  1623. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1624. esac
  1625. ;;
  1626. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1627. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1628. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1629. -msoft-float) echo --float_support=vfplib ;;
  1630. -O[0-3]|-mf=*) echo $flag ;;
  1631. -g) echo -g -mn ;;
  1632. -pds=*) echo $flag ;;
  1633. esac
  1634. done
  1635. }
  1636. elif $cc -v 2>&1 | grep -q clang; then
  1637. cc_type=clang
  1638. cc_version=__VERSION__
  1639. CC_DEPFLAGS='-MMD'
  1640. AS_DEPFLAGS='-MMD'
  1641. speed_cflags='-O3'
  1642. size_cflags='-Os'
  1643. elif $cc -V 2>&1 | grep -q Sun; then
  1644. cc_type=suncc
  1645. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1646. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1647. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1648. speed_cflags='-O5'
  1649. size_cflags='-O5 -xspace'
  1650. filter_cflags=suncc_flags
  1651. suncc_flags(){
  1652. for flag; do
  1653. case $flag in
  1654. -march=*|-mcpu=*)
  1655. case "${flag#*=}" in
  1656. native) echo -xtarget=native ;;
  1657. v9) echo -xarch=sparc ;;
  1658. ultrasparc) echo -xarch=sparcvis ;;
  1659. ultrasparc3|niagara*) echo -xarch=sparcvis2 ;;
  1660. i586|pentium) echo -xchip=pentium ;;
  1661. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1662. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1663. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1664. pentium4*) echo -xtarget=pentium4 ;;
  1665. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1666. *-sse3) echo -xarch=sse3 ;;
  1667. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1668. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1669. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1670. k8|opteron|athlon64|athlon-fx)
  1671. echo -xarch=sse2a ;;
  1672. athlon*) echo -xarch=pentium_proa ;;
  1673. esac
  1674. ;;
  1675. -std=c99) echo -xc99 ;;
  1676. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1677. -fPIC) echo -KPIC -xcode=pic32 ;;
  1678. -W*,*) echo $flag ;;
  1679. -f*-*|-W*) ;;
  1680. *) echo $flag ;;
  1681. esac
  1682. done
  1683. }
  1684. fi
  1685. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1686. : ${as_default:=$cc}
  1687. : ${dep_cc_default:=$cc}
  1688. : ${ld_default:=$cc}
  1689. set_default as dep_cc ld
  1690. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1691. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1692. add_cflags $extra_cflags
  1693. add_asflags $extra_cflags
  1694. if test -n "$sysroot"; then
  1695. case "$cc_type" in
  1696. gcc)
  1697. add_cppflags --sysroot="$sysroot"
  1698. add_ldflags --sysroot="$sysroot"
  1699. ;;
  1700. tms470)
  1701. add_cppflags -I"$sysinclude"
  1702. add_ldflags --sysroot="$sysroot"
  1703. ;;
  1704. clang)
  1705. add_cppflags -isysroot "$sysroot"
  1706. add_ldflags -isysroot "$sysroot"
  1707. ;;
  1708. esac
  1709. fi
  1710. if test "$cpu" = host; then
  1711. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1712. case "$cc_type" in
  1713. gcc)
  1714. check_native(){
  1715. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1716. sed -n "/$1=/{
  1717. s/.*$1=\\([^ ]*\\).*/\\1/
  1718. p
  1719. q
  1720. }" $TMPE
  1721. }
  1722. cpu=$(check_native -march || check_native -mcpu)
  1723. ;;
  1724. esac
  1725. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1726. fi
  1727. # Deal with common $arch aliases
  1728. case "$arch" in
  1729. arm*)
  1730. arch="arm"
  1731. ;;
  1732. mips|mipsel|IP*)
  1733. arch="mips"
  1734. ;;
  1735. mips64*)
  1736. arch="mips"
  1737. subarch="mips64"
  1738. ;;
  1739. parisc|hppa)
  1740. arch="parisc"
  1741. ;;
  1742. parisc64|hppa64)
  1743. arch="parisc"
  1744. subarch="parisc64"
  1745. ;;
  1746. "Power Macintosh"|ppc|powerpc)
  1747. arch="ppc"
  1748. ;;
  1749. ppc64|powerpc64)
  1750. arch="ppc"
  1751. subarch="ppc64"
  1752. ;;
  1753. s390|s390x)
  1754. arch="s390"
  1755. ;;
  1756. sh4|sh)
  1757. arch="sh4"
  1758. ;;
  1759. sun4u|sparc64)
  1760. arch="sparc"
  1761. subarch="sparc64"
  1762. ;;
  1763. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1764. arch="x86"
  1765. ;;
  1766. esac
  1767. is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
  1768. enable $arch
  1769. # Add processor-specific flags
  1770. if test "$cpu" = generic; then
  1771. : do nothing
  1772. elif enabled ppc; then
  1773. case $(tolower $cpu) in
  1774. 601|ppc601|powerpc601)
  1775. cpuflags="-mcpu=601"
  1776. disable altivec
  1777. ;;
  1778. 603*|ppc603*|powerpc603*)
  1779. cpuflags="-mcpu=603"
  1780. disable altivec
  1781. ;;
  1782. 604*|ppc604*|powerpc604*)
  1783. cpuflags="-mcpu=604"
  1784. disable altivec
  1785. ;;
  1786. g3|75*|ppc75*|powerpc75*)
  1787. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1788. disable altivec
  1789. ;;
  1790. g4|745*|ppc745*|powerpc745*)
  1791. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1792. ;;
  1793. 74*|ppc74*|powerpc74*)
  1794. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1795. ;;
  1796. g5|970|ppc970|powerpc970|power4*)
  1797. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1798. ;;
  1799. cell)
  1800. cpuflags="-mcpu=cell"
  1801. enable ldbrx
  1802. ;;
  1803. e500v2)
  1804. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1805. disable altivec
  1806. ;;
  1807. e500)
  1808. cpuflags="-mcpu=8540 -mhard-float"
  1809. disable altivec
  1810. ;;
  1811. esac
  1812. elif enabled x86; then
  1813. case $cpu in
  1814. i[345]86|pentium)
  1815. cpuflags="-march=$cpu"
  1816. disable mmx
  1817. ;;
  1818. # targets that do NOT support conditional mov (cmov)
  1819. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1820. cpuflags="-march=$cpu"
  1821. disable cmov
  1822. ;;
  1823. # targets that do support conditional mov (cmov)
  1824. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
  1825. cpuflags="-march=$cpu"
  1826. enable cmov
  1827. enable fast_cmov
  1828. ;;
  1829. # targets that do support conditional mov but on which it's slow
  1830. pentium4|pentium4m|prescott|nocona)
  1831. cpuflags="-march=$cpu"
  1832. enable cmov
  1833. disable fast_cmov
  1834. ;;
  1835. esac
  1836. elif enabled sparc; then
  1837. case $cpu in
  1838. sparc64)
  1839. cpuflags="-mcpu=v9"
  1840. ;;
  1841. esac
  1842. elif enabled arm; then
  1843. case $cpu in
  1844. armv*)
  1845. cpuflags="-march=$cpu"
  1846. ;;
  1847. *)
  1848. cpuflags="-mcpu=$cpu"
  1849. ;;
  1850. esac
  1851. elif enabled alpha; then
  1852. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1853. elif enabled bfin; then
  1854. cpuflags="-mcpu=$cpu"
  1855. elif enabled mips; then
  1856. cpuflags="-march=$cpu"
  1857. elif enabled avr32; then
  1858. case $cpu in
  1859. ap7[02]0[0-2])
  1860. subarch="avr32_ap"
  1861. cpuflags="-mpart=$cpu"
  1862. ;;
  1863. ap)
  1864. subarch="avr32_ap"
  1865. cpuflags="-march=$cpu"
  1866. ;;
  1867. uc3[ab]*)
  1868. subarch="avr32_uc"
  1869. cpuflags="-mcpu=$cpu"
  1870. ;;
  1871. uc)
  1872. subarch="avr32_uc"
  1873. cpuflags="-march=$cpu"
  1874. ;;
  1875. esac
  1876. fi
  1877. add_cflags $cpuflags
  1878. add_asflags $cpuflags
  1879. # compiler sanity check
  1880. check_exec <<EOF
  1881. int main(void){ return 0; }
  1882. EOF
  1883. if test "$?" != 0; then
  1884. echo "$cc is unable to create an executable file."
  1885. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1886. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1887. echo "Only do this if you know what cross compiling means."
  1888. fi
  1889. die "C compiler test failed."
  1890. fi
  1891. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1892. check_cflags -std=c99
  1893. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1894. #include <stdlib.h>
  1895. EOF
  1896. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1897. #include <stdlib.h>
  1898. EOF
  1899. check_host_cflags -std=c99
  1900. case "$arch" in
  1901. alpha|ia64|mips|parisc|sparc)
  1902. spic=$shared
  1903. ;;
  1904. x86)
  1905. subarch="x86_32"
  1906. check_cc <<EOF && subarch="x86_64"
  1907. int test[(int)sizeof(char*) - 7];
  1908. EOF
  1909. if test "$subarch" = "x86_64"; then
  1910. spic=$shared
  1911. fi
  1912. ;;
  1913. esac
  1914. enable $subarch
  1915. enabled spic && enable pic
  1916. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  1917. # OS specific
  1918. case $target_os in
  1919. beos|haiku|zeta)
  1920. prefix_default="$HOME/config"
  1921. # 3 gcc releases known for BeOS, each with ugly bugs
  1922. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1923. case "$gcc_version" in
  1924. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1925. disable mmx
  1926. ;;
  1927. *20010315*) echo "BeBits gcc"
  1928. add_cflags -fno-expensive-optimizations
  1929. ;;
  1930. esac
  1931. SHFLAGS=-nostart
  1932. # enable BeOS things
  1933. enable audio_beos
  1934. # no need for libm, but the inet stuff
  1935. # Check for BONE
  1936. # XXX: actually should check for NOT net_server
  1937. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1938. network_extralibs="-lbind -lsocket"
  1939. else
  1940. enable beos_netserver
  1941. network_extralibs="-lnet"
  1942. fi ;;
  1943. sunos)
  1944. FFSERVERLDFLAGS=""
  1945. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1946. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1947. network_extralibs="-lsocket -lnsl"
  1948. add_cppflags -D__EXTENSIONS__
  1949. nm_opts='-P -g'
  1950. ;;
  1951. netbsd)
  1952. oss_indev_extralibs="-lossaudio"
  1953. oss_outdev_extralibs="-lossaudio"
  1954. add_cppflags -D_XOPEN_SOURCE=600
  1955. ;;
  1956. openbsd)
  1957. enable malloc_aligned
  1958. # On OpenBSD 4.5. the compiler does not use PIC unless
  1959. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1960. # however the generated executable will not do anything
  1961. # (simply quits with exit-code 1, no crash, no output).
  1962. # Thus explicitly enable PIC here.
  1963. enable pic
  1964. SHFLAGS='-shared'
  1965. oss_indev_extralibs="-lossaudio"
  1966. oss_outdev_extralibs="-lossaudio"
  1967. ;;
  1968. freebsd|dragonfly)
  1969. enable malloc_aligned
  1970. ;;
  1971. bsd/os)
  1972. osextralibs="-lpoll -lgnugetopt"
  1973. strip="strip -d"
  1974. ;;
  1975. darwin)
  1976. enable malloc_aligned
  1977. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1978. strip="strip -x"
  1979. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1980. SLIBSUF=".dylib"
  1981. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1982. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1983. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1984. objformat="macho"
  1985. enabled x86_64 && objformat="macho64"
  1986. enabled_any pic shared ||
  1987. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1988. ;;
  1989. mingw32*)
  1990. if test $target_os = "mingw32ce"; then
  1991. disable network
  1992. else
  1993. target_os=mingw32
  1994. fi
  1995. LIBTARGET=i386
  1996. if enabled x86_64; then
  1997. enable malloc_aligned
  1998. LIBTARGET=x64
  1999. elif enabled arm; then
  2000. LIBTARGET=arm
  2001. fi
  2002. shlibdir_default="$bindir_default"
  2003. disable ffserver
  2004. SLIBPREF=""
  2005. SLIBSUF=".dll"
  2006. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2007. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2008. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2009. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2010. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2011. install -d "$(LIBDIR)"; \
  2012. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2013. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2014. 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'
  2015. objformat="win32"
  2016. enable dos_paths
  2017. check_cflags -fno-common
  2018. if ! enabled x86_64; then
  2019. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2020. die "ERROR: MinGW runtime version must be >= 3.15."
  2021. enabled_any avisynth vfwcap_indev &&
  2022. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  2023. die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
  2024. fi
  2025. ;;
  2026. cygwin*)
  2027. target_os=cygwin
  2028. shlibdir_default="$bindir_default"
  2029. SLIBPREF="cyg"
  2030. SLIBSUF=".dll"
  2031. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2032. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2033. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2034. objformat="win32"
  2035. enable dos_paths
  2036. check_cflags -fno-common
  2037. ;;
  2038. *-dos|freedos|opendos)
  2039. disable ffplay ffserver
  2040. disable $INDEV_LIST $OUTDEV_LIST
  2041. network_extralibs="-lsocket"
  2042. objformat="coff"
  2043. enable dos_paths
  2044. ;;
  2045. linux)
  2046. enable dv1394
  2047. ;;
  2048. irix*)
  2049. target_os=irix
  2050. ranlib="echo ignoring ranlib"
  2051. ;;
  2052. os/2*)
  2053. strip="lxlite"
  2054. ln_s="cp -f"
  2055. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  2056. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2057. FFSERVERLDFLAGS=""
  2058. LIBSUF="_s.a"
  2059. SLIBPREF=""
  2060. SLIBSUF=".dll"
  2061. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2062. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2063. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2064. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2065. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2066. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2067. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2068. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2069. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2070. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2071. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2072. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2073. enable dos_paths
  2074. ;;
  2075. gnu/kfreebsd)
  2076. ;;
  2077. gnu)
  2078. ;;
  2079. none)
  2080. ;;
  2081. *)
  2082. die "Unknown OS '$target_os'."
  2083. ;;
  2084. esac
  2085. set_default $PATHS_LIST
  2086. add_extralibs $osextralibs
  2087. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  2088. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  2089. # we need to build at least one lib type
  2090. if ! enabled_any static shared; then
  2091. cat <<EOF
  2092. At least one library type must be built.
  2093. Specify --enable-static to build the static libraries or --enable-shared to
  2094. build the shared libraries as well. To only build the shared libraries specify
  2095. --disable-static in addition to --enable-shared.
  2096. EOF
  2097. exit 1;
  2098. fi
  2099. disabled static && LIBNAME=""
  2100. if enabled_any libfaad libfaadbin ; then
  2101. if check_header faad.h; then
  2102. check_cc <<EOF
  2103. #include <faad.h>
  2104. #ifndef FAAD2_VERSION
  2105. ok faad1
  2106. #endif
  2107. int main(void) { return 0; }
  2108. EOF
  2109. test $? = 0 && enable libfaad2
  2110. else
  2111. die "FAAD test failed."
  2112. fi
  2113. fi
  2114. die_license_disabled() {
  2115. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2116. }
  2117. die_license_disabled gpl libfaad2
  2118. die_license_disabled gpl libx264
  2119. die_license_disabled gpl libxvid
  2120. die_license_disabled gpl postproc
  2121. die_license_disabled gpl x11grab
  2122. die_license_disabled nonfree libfaac
  2123. die_license_disabled version3 libopencore_amrnb
  2124. die_license_disabled version3 libopencore_amrwb
  2125. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2126. check_deps $ARCH_EXT_LIST
  2127. disabled optimizations || check_cflags -fomit-frame-pointer
  2128. enable_pic() {
  2129. enable pic
  2130. add_cppflags -DPIC
  2131. add_cflags -fPIC
  2132. add_asflags -fPIC
  2133. }
  2134. enabled pic && enable_pic
  2135. check_cc <<EOF || die "Symbol mangling check failed."
  2136. int ff_extern;
  2137. EOF
  2138. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2139. extern_prefix=${sym%%ff_extern*}
  2140. check_cc <<EOF && enable inline_asm
  2141. void foo(void) { __asm__ volatile ("" ::); }
  2142. EOF
  2143. _restrict=
  2144. for restrict_keyword in restrict __restrict__ __restrict; do
  2145. check_cc <<EOF && _restrict=$restrict_keyword && break
  2146. void foo(char * $restrict_keyword p);
  2147. EOF
  2148. done
  2149. check_cc <<EOF && enable attribute_packed
  2150. struct { int x; } __attribute__((packed)) x;
  2151. EOF
  2152. check_cc <<EOF && enable attribute_may_alias
  2153. union { int x; } __attribute__((may_alias)) x;
  2154. EOF
  2155. check_cc <<EOF || die "endian test failed"
  2156. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2157. EOF
  2158. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2159. if enabled alpha; then
  2160. check_cflags -mieee
  2161. elif enabled arm; then
  2162. check_cflags -marm
  2163. check_ld <<EOF && enable vfp_args
  2164. __asm__ (".eabi_attribute 28, 1");
  2165. int main(void) { return 0; }
  2166. EOF
  2167. # We have to check if pld is a nop and disable it.
  2168. check_asm pld '"pld [r0]"'
  2169. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2170. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2171. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2172. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2173. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2174. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2175. enabled_all armv6t2 shared !pic && enable_pic
  2176. elif enabled ia64; then
  2177. # HACK: currently fails to build if .bss is > 4MB and shared libs are built
  2178. enabled shared && enable_weak hardcoded_tables
  2179. elif enabled mips; then
  2180. check_asm loongson '"dmult.g $1, $2, $3"'
  2181. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2182. elif enabled ppc; then
  2183. enable local_aligned_8 local_aligned_16
  2184. check_asm dcbzl '"dcbzl 0, 1"'
  2185. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2186. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2187. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2188. if enabled altivec; then
  2189. check_cflags -maltivec -mabi=altivec &&
  2190. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2191. check_cflags -faltivec
  2192. # check if our compiler supports Motorola AltiVec C API
  2193. check_cc <<EOF || disable altivec
  2194. $inc_altivec_h
  2195. int main(void) {
  2196. vector signed int v1, v2, v3;
  2197. v1 = vec_add(v2,v3);
  2198. return 0;
  2199. }
  2200. EOF
  2201. # check if our compiler supports braces for vector declarations
  2202. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2203. $inc_altivec_h
  2204. int main (void) { (vector int) {1}; return 0; }
  2205. EOF
  2206. fi
  2207. elif enabled sparc; then
  2208. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2209. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2210. elif enabled x86; then
  2211. enable local_aligned_8 local_aligned_16
  2212. # check whether EBP is available on x86
  2213. # As 'i' is stored on the stack, this program will crash
  2214. # if the base pointer is used to access it because the
  2215. # base pointer is cleared in the inline assembly code.
  2216. check_exec_crash <<EOF && enable ebp_available
  2217. volatile int i=0;
  2218. __asm__ volatile (
  2219. "xorl %%ebp, %%ebp"
  2220. ::: "%ebp");
  2221. return i;
  2222. EOF
  2223. # check whether EBX is available on x86
  2224. check_asm ebx_available '""::"b"(0)' &&
  2225. check_asm ebx_available '"":::"%ebx"'
  2226. # check whether more than 10 operands are supported
  2227. check_cc <<EOF && enable ten_operands
  2228. int main(void) {
  2229. int x=0;
  2230. __asm__ volatile(
  2231. ""
  2232. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2233. );
  2234. return 0;
  2235. }
  2236. EOF
  2237. # check whether binutils is new enough to compile SSSE3/MMX2
  2238. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2239. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2240. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2241. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2242. enabled x86_64 && append YASMFLAGS "-m amd64"
  2243. enabled pic && append YASMFLAGS "-DPIC"
  2244. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2245. case "$objformat" in
  2246. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2247. esac
  2248. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  2249. case "$cpu" in
  2250. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2251. disable fast_clz
  2252. ;;
  2253. esac
  2254. fi
  2255. if check_func dlopen; then
  2256. ldl=
  2257. elif check_func dlopen -ldl; then
  2258. ldl=-ldl
  2259. fi
  2260. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2261. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2262. check_func fork
  2263. check_func getaddrinfo $network_extralibs
  2264. check_func gethrtime
  2265. check_func getrusage
  2266. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2267. check_func inet_aton $network_extralibs
  2268. check_func isatty
  2269. check_func ${malloc_prefix}memalign && enable memalign
  2270. check_func mkstemp
  2271. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2272. check_func setrlimit
  2273. check_func_headers io.h setmode
  2274. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2275. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2276. check_func_headers windows.h GetProcessTimes
  2277. check_func_headers windows.h VirtualAlloc
  2278. check_header conio.h
  2279. check_header dlfcn.h
  2280. check_header dxva2api.h
  2281. check_header malloc.h
  2282. check_header poll.h
  2283. check_header sys/mman.h
  2284. check_header sys/resource.h
  2285. check_header sys/select.h
  2286. check_header termios.h
  2287. check_header vdpau/vdpau.h
  2288. check_header vdpau/vdpau_x11.h
  2289. check_header X11/extensions/XvMClib.h
  2290. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2291. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2292. enabled_any $need_memalign ; then
  2293. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2294. fi
  2295. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2296. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2297. # check for some common methods of building with pthread support
  2298. # do this before the optional library checks as some of them require pthreads
  2299. if enabled pthreads; then
  2300. if check_func pthread_create; then
  2301. :
  2302. elif check_func pthread_create -pthread; then
  2303. add_cflags -pthread
  2304. add_extralibs -pthread
  2305. elif check_func pthread_create -pthreads; then
  2306. add_cflags -pthreads
  2307. add_extralibs -pthreads
  2308. elif check_func pthread_create -lpthreadGC2; then
  2309. add_extralibs -lpthreadGC2
  2310. elif ! check_lib pthread.h pthread_create -lpthread; then
  2311. die "ERROR: can't find pthreads library"
  2312. fi
  2313. fi
  2314. for thread in $THREADS_LIST; do
  2315. if enabled $thread; then
  2316. test -n "$thread_type" &&
  2317. die "ERROR: Only one thread type must be selected." ||
  2318. thread_type="$thread"
  2319. fi
  2320. done
  2321. check_lib math.h sin -lm
  2322. check_lib va/va.h vaInitialize -lva
  2323. check_mathfunc exp2
  2324. check_mathfunc exp2f
  2325. check_mathfunc llrint
  2326. check_mathfunc log2
  2327. check_mathfunc log2f
  2328. check_mathfunc lrint
  2329. check_mathfunc lrintf
  2330. check_mathfunc round
  2331. check_mathfunc roundf
  2332. check_mathfunc truncf
  2333. # these are off by default, so fail if requested and not available
  2334. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2335. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2336. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2337. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2338. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2339. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2340. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2341. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2342. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2343. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2344. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2345. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2346. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2347. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2348. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2349. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2350. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2351. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2352. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2353. die "ERROR: libx264 version must be >= 0.83."; }
  2354. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2355. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2356. # libdc1394 check
  2357. if enabled libdc1394; then
  2358. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2359. enable libdc1394_2; } ||
  2360. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2361. enable libdc1394_1; } ||
  2362. die "ERROR: No version of libdc1394 found "
  2363. fi
  2364. SDL_CONFIG="${cross_prefix}sdl-config"
  2365. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2366. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2367. sdl_libs=$("${SDL_CONFIG}" --libs)
  2368. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2369. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2370. enable sdl &&
  2371. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2372. fi
  2373. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2374. if enabled network; then
  2375. check_type "sys/types.h sys/socket.h" socklen_t
  2376. check_type netdb.h "struct addrinfo"
  2377. check_type netinet/in.h "struct ipv6_mreq"
  2378. check_type netinet/in.h "struct sockaddr_in6"
  2379. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2380. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2381. # Prefer arpa/inet.h over winsock2
  2382. if check_header arpa/inet.h ; then
  2383. check_func closesocket
  2384. elif check_header winsock2.h ; then
  2385. check_func_headers winsock2.h closesocket -lws2 && \
  2386. network_extralibs="-lws2" || \
  2387. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2388. network_extralibs="-lws2_32"; }
  2389. check_type ws2tcpip.h socklen_t
  2390. check_type ws2tcpip.h "struct addrinfo"
  2391. check_type ws2tcpip.h "struct ipv6_mreq"
  2392. check_type ws2tcpip.h "struct sockaddr_in6"
  2393. check_type ws2tcpip.h "struct sockaddr_storage"
  2394. check_struct winsock2.h "struct sockaddr" sa_len
  2395. else
  2396. disable network
  2397. fi
  2398. fi
  2399. check_header linux/videodev.h
  2400. check_header linux/videodev2.h
  2401. check_header sys/videoio.h
  2402. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2403. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2404. { check_header dev/bktr/ioctl_meteor.h &&
  2405. check_header dev/bktr/ioctl_bt848.h; } ||
  2406. { check_header machine/ioctl_meteor.h &&
  2407. check_header machine/ioctl_bt848.h; } ||
  2408. { check_header dev/video/meteor/ioctl_meteor.h &&
  2409. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2410. check_header dev/ic/bt8xx.h
  2411. check_header sys/soundcard.h
  2412. check_header soundcard.h
  2413. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2414. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2415. enabled x11grab &&
  2416. check_header X11/Xlib.h &&
  2417. check_header X11/extensions/XShm.h &&
  2418. check_header X11/extensions/Xfixes.h &&
  2419. check_func XOpenDisplay -lX11 &&
  2420. check_func XShmCreateImage -lX11 -lXext &&
  2421. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2422. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2423. check_cpp_condition \
  2424. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2425. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2426. disable vdpau; }
  2427. fi
  2428. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2429. # add some useful compiler flags if supported
  2430. check_cflags -Wdeclaration-after-statement
  2431. check_cflags -Wall
  2432. check_cflags -Wno-switch
  2433. check_cflags -Wdisabled-optimization
  2434. check_cflags -Wpointer-arith
  2435. check_cflags -Wredundant-decls
  2436. check_cflags -Wno-pointer-sign
  2437. check_cflags -Wcast-qual
  2438. check_cflags -Wwrite-strings
  2439. check_cflags -Wtype-limits
  2440. check_cflags -Wundef
  2441. check_cflags -Wmissing-prototypes
  2442. enabled extra_warnings && check_cflags -Winline
  2443. # add some linker flags
  2444. check_ldflags -Wl,--warn-common
  2445. check_ldflags -Wl,--as-needed
  2446. check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  2447. check_ldflags -Wl,-Bsymbolic
  2448. echo "X{};" > $TMPV
  2449. test_ldflags -Wl,--version-script,$TMPV &&
  2450. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2451. if enabled small; then
  2452. add_cflags $size_cflags
  2453. optimizations="small"
  2454. elif enabled optimizations; then
  2455. add_cflags $speed_cflags
  2456. fi
  2457. check_cflags -fno-math-errno
  2458. check_cflags -fno-signed-zeros
  2459. if enabled icc; then
  2460. # Just warnings, no remarks
  2461. check_cflags -w1
  2462. # -wd: Disable following warnings
  2463. # 144, 167, 556: -Wno-pointer-sign
  2464. # 10006: ignoring unknown option -fno-signed-zeros
  2465. # 10156: ignoring option '-W'; no argument required
  2466. check_cflags -wd144,167,556,10006,10156
  2467. # 11030: Warning unknown option --as-needed
  2468. # 10156: ignoring option '-export'; no argument required
  2469. check_ldflags -wd10156,11030
  2470. # Allow to compile with optimizations
  2471. check_ldflags -march=$cpu
  2472. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2473. enable ebp_available
  2474. elif enabled ccc; then
  2475. # disable some annoying warnings
  2476. add_cflags -msg_disable cvtu32to64
  2477. add_cflags -msg_disable embedcomment
  2478. add_cflags -msg_disable needconstext
  2479. add_cflags -msg_disable nomainieee
  2480. add_cflags -msg_disable ptrmismatch1
  2481. add_cflags -msg_disable unreachcode
  2482. elif enabled gcc; then
  2483. check_cflags -fno-tree-vectorize
  2484. check_cflags -Werror=implicit
  2485. check_cflags -Werror=missing-prototypes
  2486. elif enabled clang; then
  2487. check_cflags -Qunused-arguments
  2488. elif enabled armcc; then
  2489. # 2523: use of inline assembler is deprecated
  2490. add_cflags -Wrvct,--diag_suppress=2523
  2491. add_cflags -Wrvct,--diag_suppress=1207
  2492. elif enabled tms470; then
  2493. add_cflags -pds=824 -pds=837
  2494. fi
  2495. if enabled gprof; then
  2496. add_cflags -p
  2497. add_ldflags -p
  2498. fi
  2499. # Find out if the .align argument is a power of two or not.
  2500. check_asm asmalign_pot '".align 3"'
  2501. enabled_any $DECODER_LIST && enable decoders
  2502. enabled_any $ENCODER_LIST && enable encoders
  2503. enabled_any $HWACCEL_LIST && enable hwaccels
  2504. enabled_any $BSF_LIST && enable bsfs
  2505. enabled_any $DEMUXER_LIST && enable demuxers
  2506. enabled_any $MUXER_LIST && enable muxers
  2507. enabled_any $FILTER_LIST && enable filters
  2508. enabled_any $INDEV_LIST && enable indevs
  2509. enabled_any $OUTDEV_LIST && enable outdevs
  2510. enabled_any $PROTOCOL_LIST && enable protocols
  2511. enabled_any $THREADS_LIST && enable threads
  2512. check_deps $CONFIG_LIST \
  2513. $CONFIG_EXTRA \
  2514. $HAVE_LIST \
  2515. $DECODER_LIST \
  2516. $ENCODER_LIST \
  2517. $HWACCEL_LIST \
  2518. $PARSER_LIST \
  2519. $BSF_LIST \
  2520. $DEMUXER_LIST \
  2521. $MUXER_LIST \
  2522. $FILTER_LIST \
  2523. $INDEV_LIST \
  2524. $OUTDEV_LIST \
  2525. $PROTOCOL_LIST \
  2526. enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
  2527. echo "install prefix $prefix"
  2528. echo "source path $source_path"
  2529. echo "C compiler $cc"
  2530. echo ".align is power-of-two $asmalign_pot"
  2531. echo "ARCH $arch ($cpu)"
  2532. if test "$build_suffix" != ""; then
  2533. echo "build suffix $build_suffix"
  2534. fi
  2535. if test "$extra_version" != ""; then
  2536. echo "version string suffix $extra_version"
  2537. fi
  2538. echo "big-endian ${bigendian-no}"
  2539. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2540. if enabled x86; then
  2541. echo "yasm ${yasm-no}"
  2542. echo "MMX enabled ${mmx-no}"
  2543. echo "MMX2 enabled ${mmx2-no}"
  2544. echo "3DNow! enabled ${amd3dnow-no}"
  2545. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2546. echo "SSE enabled ${sse-no}"
  2547. echo "SSSE3 enabled ${ssse3-no}"
  2548. echo "CMOV enabled ${cmov-no}"
  2549. echo "CMOV is fast ${fast_cmov-no}"
  2550. echo "EBX available ${ebx_available-no}"
  2551. echo "EBP available ${ebp_available-no}"
  2552. echo "10 operands supported ${ten_operands-no}"
  2553. fi
  2554. if enabled arm; then
  2555. echo "ARMv5TE enabled ${armv5te-no}"
  2556. echo "ARMv6 enabled ${armv6-no}"
  2557. echo "ARMv6T2 enabled ${armv6t2-no}"
  2558. echo "ARM VFP enabled ${armvfp-no}"
  2559. echo "IWMMXT enabled ${iwmmxt-no}"
  2560. echo "NEON enabled ${neon-no}"
  2561. fi
  2562. if enabled mips; then
  2563. echo "MMI enabled ${mmi-no}"
  2564. fi
  2565. if enabled ppc; then
  2566. echo "AltiVec enabled ${altivec-no}"
  2567. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2568. echo "dcbzl available ${dcbzl-no}"
  2569. echo "performance report ${powerpc_perf-no}"
  2570. fi
  2571. if enabled sparc; then
  2572. echo "VIS enabled ${vis-no}"
  2573. fi
  2574. echo "gprof enabled ${gprof-no}"
  2575. echo "debug symbols ${debug-no}"
  2576. echo "strip symbols ${stripping-no}"
  2577. echo "optimizations ${optimizations-no}"
  2578. echo "static ${static-no}"
  2579. echo "shared ${shared-no}"
  2580. echo "postprocessing support ${postproc-no}"
  2581. echo "new filter support ${avfilter-no}"
  2582. echo "filters using lavformat ${avfilter_lavf-no}"
  2583. echo "network support ${network-no}"
  2584. echo "threading support ${thread_type-no}"
  2585. echo "SDL support ${sdl-no}"
  2586. echo "Sun medialib support ${mlib-no}"
  2587. echo "AVISynth enabled ${avisynth-no}"
  2588. echo "libdc1394 support ${libdc1394-no}"
  2589. echo "libdirac enabled ${libdirac-no}"
  2590. echo "libfaac enabled ${libfaac-no}"
  2591. echo "libfaad enabled ${libfaad-no}"
  2592. echo "libfaad dlopened ${libfaadbin-no}"
  2593. echo "libgsm enabled ${libgsm-no}"
  2594. echo "libmp3lame enabled ${libmp3lame-no}"
  2595. echo "libnut enabled ${libnut-no}"
  2596. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2597. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2598. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2599. echo "libschroedinger enabled ${libschroedinger-no}"
  2600. echo "libspeex enabled ${libspeex-no}"
  2601. echo "libtheora enabled ${libtheora-no}"
  2602. echo "libvorbis enabled ${libvorbis-no}"
  2603. echo "libx264 enabled ${libx264-no}"
  2604. echo "libxvid enabled ${libxvid-no}"
  2605. echo "zlib enabled ${zlib-no}"
  2606. echo "bzlib enabled ${bzlib-no}"
  2607. echo
  2608. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2609. echo "Enabled ${type}s:"
  2610. eval list=\$$(toupper $type)_LIST
  2611. for part in $list; do
  2612. enabled $part && echo ${part%_*}
  2613. done | sort | pr -3 -t
  2614. echo
  2615. done
  2616. license="LGPL version 2.1 or later"
  2617. if enabled nonfree; then
  2618. license="nonfree and unredistributable"
  2619. elif enabled gplv3; then
  2620. license="GPL version 3 or later"
  2621. elif enabled lgplv3; then
  2622. license="LGPL version 3 or later"
  2623. elif enabled gpl; then
  2624. license="GPL version 2 or later"
  2625. fi
  2626. echo "License: $license"
  2627. echo "Creating config.mak and config.h..."
  2628. # build tree in object directory if source path is different from current one
  2629. if enabled source_path_used; then
  2630. DIRS="
  2631. doc
  2632. libavcodec
  2633. libavcodec/$arch
  2634. libavdevice
  2635. libavfilter
  2636. libavformat
  2637. libavutil
  2638. libavutil/$arch
  2639. libpostproc
  2640. libswscale
  2641. libswscale/$arch
  2642. tests
  2643. tools
  2644. "
  2645. FILES="
  2646. Makefile
  2647. common.mak
  2648. subdir.mak
  2649. doc/texi2pod.pl
  2650. libavcodec/Makefile
  2651. libavdevice/Makefile
  2652. libavfilter/Makefile
  2653. libavformat/Makefile
  2654. libavutil/Makefile
  2655. libpostproc/Makefile
  2656. libswscale/Makefile
  2657. "
  2658. map 'mkdir -p $_' $DIRS;
  2659. map '$ln_s "$source_path/$_" $_' $FILES
  2660. fi
  2661. enabled stripping || strip="echo skipping strip"
  2662. cat > config.mak <<EOF
  2663. # Automatically generated by configure - do not modify!
  2664. ifndef FFMPEG_CONFIG_MAK
  2665. FFMPEG_CONFIG_MAK=1
  2666. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2667. prefix=$prefix
  2668. LIBDIR=\$(DESTDIR)$libdir
  2669. SHLIBDIR=\$(DESTDIR)$shlibdir
  2670. INCDIR=\$(DESTDIR)$incdir
  2671. BINDIR=\$(DESTDIR)$bindir
  2672. DATADIR=\$(DESTDIR)$datadir
  2673. MANDIR=\$(DESTDIR)$mandir
  2674. SRC_PATH="$source_path"
  2675. SRC_PATH_BARE=$source_path
  2676. BUILD_ROOT="$PWD"
  2677. ARCH=$arch
  2678. CC=$cc
  2679. AS=$as
  2680. LD=$ld
  2681. DEPCC=$dep_cc
  2682. YASM=$yasmexe
  2683. YASMDEP=$yasmexe
  2684. AR=$ar
  2685. RANLIB=$ranlib
  2686. CP=cp -p
  2687. LN_S=$ln_s
  2688. STRIP=$strip
  2689. CPPFLAGS=$CPPFLAGS
  2690. CFLAGS=$CFLAGS
  2691. ASFLAGS=$ASFLAGS
  2692. CC_O=$CC_O
  2693. LDFLAGS=$LDFLAGS
  2694. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2695. SHFLAGS=$SHFLAGS
  2696. YASMFLAGS=$YASMFLAGS
  2697. BUILDSUF=$build_suffix
  2698. FULLNAME=$FULLNAME
  2699. LIBPREF=$LIBPREF
  2700. LIBSUF=$LIBSUF
  2701. LIBNAME=$LIBNAME
  2702. SLIBPREF=$SLIBPREF
  2703. SLIBSUF=$SLIBSUF
  2704. EXESUF=$EXESUF
  2705. EXTRA_VERSION=$extra_version
  2706. DEPFLAGS=$DEPFLAGS
  2707. CCDEP=$CCDEP
  2708. ASDEP=$ASDEP
  2709. CC_DEPFLAGS=$CC_DEPFLAGS
  2710. AS_DEPFLAGS=$AS_DEPFLAGS
  2711. HOSTCC=$host_cc
  2712. HOSTCFLAGS=$host_cflags
  2713. HOSTEXESUF=$HOSTEXESUF
  2714. HOSTLDFLAGS=$host_ldflags
  2715. HOSTLIBS=$host_libs
  2716. TARGET_EXEC=$target_exec
  2717. TARGET_PATH=$target_path
  2718. SDL_LIBS=$sdl_libs
  2719. SDL_CFLAGS=$sdl_cflags
  2720. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2721. EXTRALIBS=$extralibs
  2722. INSTALL=install
  2723. LIBTARGET=${LIBTARGET}
  2724. SLIBNAME=${SLIBNAME}
  2725. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2726. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2727. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2728. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2729. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2730. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2731. EOF
  2732. get_version(){
  2733. name=$1
  2734. file=$source_path/$2
  2735. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2736. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2737. lcname=$(tolower $name)
  2738. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2739. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2740. }
  2741. get_version LIBSWSCALE libswscale/swscale.h
  2742. get_version LIBPOSTPROC libpostproc/postprocess.h
  2743. get_version LIBAVCODEC libavcodec/avcodec.h
  2744. get_version LIBAVDEVICE libavdevice/avdevice.h
  2745. get_version LIBAVFORMAT libavformat/avformat.h
  2746. get_version LIBAVUTIL libavutil/avutil.h
  2747. get_version LIBAVFILTER libavfilter/avfilter.h
  2748. enabled asmalign_pot || align_shift="1 <<"
  2749. cat > $TMPH <<EOF
  2750. /* Automatically generated by configure - do not modify! */
  2751. #ifndef FFMPEG_CONFIG_H
  2752. #define FFMPEG_CONFIG_H
  2753. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2754. #define FFMPEG_LICENSE "$(c_escape $license)"
  2755. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2756. #define CC_TYPE "$cc_type"
  2757. #define CC_VERSION $cc_version
  2758. #define restrict $_restrict
  2759. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2760. #define EXTERN_PREFIX "${extern_prefix}"
  2761. #define EXTERN_ASM ${extern_prefix}
  2762. EOF
  2763. test -n "$malloc_prefix" &&
  2764. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2765. if enabled small || disabled optimizations; then
  2766. echo "#undef av_always_inline" >> $TMPH
  2767. echo "#define av_always_inline" >> $TMPH
  2768. fi
  2769. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2770. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2771. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2772. $CONFIG_EXTRA \
  2773. $DECODER_LIST \
  2774. $ENCODER_LIST \
  2775. $HWACCEL_LIST \
  2776. $PARSER_LIST \
  2777. $BSF_LIST \
  2778. $DEMUXER_LIST \
  2779. $MUXER_LIST \
  2780. $FILTER_LIST \
  2781. $PROTOCOL_LIST \
  2782. $INDEV_LIST \
  2783. $OUTDEV_LIST \
  2784. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2785. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2786. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2787. cp_if_changed $TMPH config.h
  2788. cat > $TMPH <<EOF
  2789. /* Generated by ffconf */
  2790. #ifndef AVUTIL_AVCONFIG_H
  2791. #define AVUTIL_AVCONFIG_H
  2792. EOF
  2793. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2794. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2795. cp_if_changed $TMPH libavutil/avconfig.h
  2796. # build pkg-config files
  2797. pkgconfig_generate(){
  2798. name=$1
  2799. shortname=${name#lib}${build_suffix}
  2800. comment=$2
  2801. version=$3
  2802. libs=$4
  2803. requires=$5
  2804. cat <<EOF > $name/$name.pc
  2805. prefix=$prefix
  2806. exec_prefix=\${prefix}
  2807. libdir=$libdir
  2808. includedir=$incdir
  2809. Name: $name
  2810. Description: $comment
  2811. Version: $version
  2812. Requires: $(enabled shared || echo $requires)
  2813. Requires.private: $(enabled shared && echo $requires)
  2814. Conflicts:
  2815. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2816. Libs.private: $(enabled shared && echo $libs)
  2817. Cflags: -I\${includedir}
  2818. EOF
  2819. cat <<EOF > $name/$name-uninstalled.pc
  2820. prefix=
  2821. exec_prefix=
  2822. libdir=\${pcfiledir}
  2823. includedir=${source_path}
  2824. Name: $name
  2825. Description: $comment
  2826. Version: $version
  2827. Requires: $requires
  2828. Conflicts:
  2829. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2830. Cflags: -I\${includedir}
  2831. EOF
  2832. }
  2833. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2834. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2835. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2836. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2837. enabled avfilter &&
  2838. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2839. enabled postproc &&
  2840. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2841. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"