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.

2817 lines
81KB

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