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.

2742 lines
79KB

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