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.

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