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.

2779 lines
80KB

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