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.

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