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.

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