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.

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