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.

2852 lines
82KB

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