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.

2831 lines
81KB

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