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.

2299 lines
60KB

  1. #!/bin/sh
  2. #
  3. # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. # make sure we are running under a compatible shell
  6. unset foo
  7. (: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
  8. if test "$?" != 0; then
  9. if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
  10. FFMPEG_CONFIGURE_EXEC=1
  11. export FFMPEG_CONFIGURE_EXEC
  12. exec bash "$0" "$@"
  13. exec ksh "$0" "$@"
  14. exec /usr/xpg4/bin/sh "$0" "$@"
  15. fi
  16. echo "No compatible shell script interpreter found."
  17. exit 1
  18. fi
  19. show_help(){
  20. echo "Usage: configure [options]"
  21. echo "Options: [defaults in brackets after descriptions]"
  22. echo
  23. echo "Standard options:"
  24. echo " --help print this message"
  25. echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]"
  26. echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
  27. echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
  28. echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
  29. echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
  30. echo " --mandir=DIR install man page in DIR [PREFIX/man]"
  31. echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]"
  32. echo " --enable-libogg enable Ogg support via libogg [default=no]"
  33. echo " --enable-vorbis enable Vorbis support via libvorbis [default=no]"
  34. echo " --enable-faad enable FAAD support via libfaad [default=no]"
  35. echo " --enable-faadbin build FAAD support with runtime linking [default=no]"
  36. echo " --enable-faac enable FAAC support via libfaac [default=no]"
  37. echo " --enable-libgsm enable GSM support via libgsm [default=no]"
  38. echo " --enable-xvid enable XviD support via xvidcore [default=no]"
  39. echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
  40. echo " --enable-mingw32 enable MinGW native/cross Windows compile"
  41. echo " --enable-mingwce enable MinGW native/cross WinCE compile"
  42. echo " --enable-a52 enable GPLed A52 support [default=no]"
  43. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  44. echo " --enable-dts enable GPLed DTS support [default=no]"
  45. echo " --enable-pp enable GPLed postprocessing support [default=no]"
  46. echo " --enable-static build static libraries [default=yes]"
  47. echo " --disable-static do not build static libraries [default=no]"
  48. echo " --enable-shared build shared libraries [default=no]"
  49. echo " --disable-shared do not build shared libraries [default=yes]"
  50. echo " --enable-amr_nb enable amr_nb float audio codec"
  51. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  52. echo " --enable-amr_wb enable amr_wb float audio codec"
  53. echo " --enable-amr_if2 enable amr_wb IF2 audio codec"
  54. echo " --enable-sunmlib use Sun medialib [default=no]"
  55. echo " --enable-pthreads use pthreads [default=no]"
  56. echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
  57. echo " and libraw1394 [default=no]"
  58. echo " --enable-swscaler software scaler support [default=no]"
  59. echo " --enable-gpl allow use of GPL code, the resulting libav*"
  60. echo " and ffmpeg will be under GPL [default=no]"
  61. echo ""
  62. echo "Advanced options (experts only):"
  63. echo " --source-path=PATH path to source code [$source_path]"
  64. echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
  65. echo " --cross-compile assume a cross-compiler is used"
  66. echo " --cc=CC use C compiler CC [$cc]"
  67. echo " --make=MAKE use specified make [$make]"
  68. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  69. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  70. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  71. echo " --build-suffix=SUFFIX suffix for application specific build []"
  72. echo " --cpu=CPU force cpu to CPU [$cpu]"
  73. echo " --tune=CPU tune code for a particular CPU"
  74. echo " (may fail or perform badly on other CPUs)"
  75. echo " --powerpc-perf-enable enable performance report on PPC"
  76. echo " (requires enabling PMC)"
  77. echo " --disable-mmx disable MMX usage"
  78. echo " --disable-iwmmxt disable iwmmxt usage"
  79. echo " --disable-altivec disable AltiVec usage"
  80. echo " --disable-audio-oss disable OSS audio support [default=no]"
  81. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  82. echo " --disable-v4l disable video4linux grabbing [default=no]"
  83. echo " --disable-v4l2 disable video4linux2 grabbing [default=no]"
  84. echo " --disable-bktr disable bktr video grabbing [default=no]"
  85. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  86. echo " --disable-network disable network support [default=no]"
  87. echo " --disable-ipv6 disable ipv6 support [default=no]"
  88. echo " --disable-zlib disable zlib [default=no]"
  89. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  90. echo " --disable-vhook disable video hooking support"
  91. echo " --enable-gprof enable profiling with gprof [$gprof]"
  92. echo " --disable-debug disable debugging symbols"
  93. echo " --disable-opts disable compiler optimizations"
  94. echo " --disable-mpegaudio-hp faster (but less accurate)"
  95. echo " MPEG audio decoding [default=no]"
  96. echo " --disable-protocols disable I/O protocols support [default=no]"
  97. echo " --disable-ffserver disable ffserver build"
  98. echo " --disable-ffplay disable ffplay build"
  99. echo " --enable-small optimize for size instead of speed"
  100. echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
  101. echo " --disable-strip disable stripping of executables and shared libraries"
  102. echo " --disable-encoder=NAME disables encoder NAME"
  103. echo " --enable-encoder=NAME enables encoder NAME"
  104. echo " --disable-decoder=NAME disables decoder NAME"
  105. echo " --enable-decoder=NAME enables decoder NAME"
  106. echo " --disable-encoders disables all encoders"
  107. echo " --disable-decoders disables all decoders"
  108. echo " --disable-muxer=NAME disables muxer NAME"
  109. echo " --enable-muxer=NAME enables muxer NAME"
  110. echo " --disable-muxers disables all muxers"
  111. echo " --disable-demuxer=NAME disables demuxer NAME"
  112. echo " --enable-demuxer=NAME enables demuxer NAME"
  113. echo " --disable-demuxers disables all demuxers"
  114. echo " --enable-parser=NAME enables parser NAME"
  115. echo " --disable-parser=NAME disables parser NAME"
  116. echo " --disable-parsers disables all parsers"
  117. echo ""
  118. echo "NOTE: Object files are built at the place where configure is launched."
  119. exit 1
  120. }
  121. log(){
  122. echo "$@" >>$logfile
  123. }
  124. log_file(){
  125. log BEGIN $1
  126. cat -n $1 >>$logfile
  127. log END $1
  128. }
  129. echolog(){
  130. log "$@"
  131. echo "$@"
  132. }
  133. die(){
  134. echolog "$@"
  135. cat <<EOF
  136. If you think configure made a mistake, make sure you are using the latest
  137. version from SVN. If the latest version fails, report the problem to the
  138. ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  139. EOF
  140. if enabled logging; then
  141. cat <<EOF
  142. Include the log file "$logfile" produced by configure as this will help
  143. solving the problem.
  144. EOF
  145. else
  146. cat <<EOF
  147. Rerun configure with logging enabled (do not use --log=no), and include the
  148. log this produces with your report.
  149. EOF
  150. fi
  151. rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
  152. exit 1
  153. }
  154. enabled(){
  155. eval test "\$$1" = "yes"
  156. }
  157. flags_saved(){
  158. (: ${SAVE_CFLAGS?}) 2>/dev/null
  159. }
  160. save_flags(){
  161. flags_saved && return
  162. SAVE_CFLAGS="$CFLAGS"
  163. SAVE_LDFLAGS="$LDFLAGS"
  164. SAVE_extralibs="$extralibs"
  165. }
  166. restore_flags(){
  167. CFLAGS="$SAVE_CFLAGS"
  168. LDFLAGS="$SAVE_LDFLAGS"
  169. extralibs="$SAVE_extralibs"
  170. unset SAVE_CFLAGS
  171. unset SAVE_LDFLAGS
  172. unset SAVE_extralibs
  173. }
  174. temp_cflags(){
  175. save_flags
  176. CFLAGS="$CFLAGS $*"
  177. }
  178. temp_ldflags(){
  179. save_flags
  180. LDFLAGS="$LDFLAGS $*"
  181. }
  182. temp_extralibs(){
  183. save_flags
  184. extralibs="$extralibs $*"
  185. }
  186. append(){
  187. var=$1
  188. shift
  189. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  190. eval "$var=\"\$$var $*\""
  191. }
  192. add_cflags(){
  193. append CFLAGS "$@"
  194. }
  195. add_ldflags(){
  196. append LDFLAGS "$@"
  197. }
  198. add_extralibs(){
  199. append extralibs "$@"
  200. }
  201. check_cmd(){
  202. log "$@"
  203. "$@" >>$logfile 2>&1
  204. }
  205. check_cc(){
  206. log check_cc "$@"
  207. cat >$TMPC
  208. log_file $TMPC
  209. check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
  210. }
  211. check_cpp(){
  212. log check_cpp "$@"
  213. cat >$TMPC
  214. log_file $TMPC
  215. check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
  216. }
  217. check_ld(){
  218. log check_ld "$@"
  219. check_cc || return
  220. check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
  221. }
  222. check_cflags(){
  223. log check_cflags "$@"
  224. check_cc "$@" <<EOF && add_cflags "$@"
  225. int x;
  226. EOF
  227. }
  228. check_ldflags(){
  229. log check_ldflags "$@"
  230. check_ld "$@" <<EOF && add_ldflags "$@"
  231. int main(){
  232. return 0;
  233. }
  234. EOF
  235. }
  236. check_header(){
  237. log check_header "$@"
  238. header=$1
  239. shift
  240. check_cpp "$@" <<EOF
  241. #include <$header>
  242. int x;
  243. EOF
  244. }
  245. check_func(){
  246. log check_func "$@"
  247. func=$1
  248. shift
  249. check_ld "$@" <<EOF
  250. extern int $func();
  251. int main(){
  252. $func();
  253. }
  254. EOF
  255. }
  256. check_lib(){
  257. log check_lib "$@"
  258. header="$1"
  259. func="$2"
  260. shift 2
  261. temp_extralibs "$@"
  262. check_header $header && check_func $func && add_extralibs "$@"
  263. err=$?
  264. restore_flags
  265. return $err
  266. }
  267. check_exec(){
  268. check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
  269. }
  270. require(){
  271. name="$1"
  272. header="$2"
  273. func="$3"
  274. shift 3
  275. check_lib $header $func "$@" || die "ERROR: $name not found"
  276. }
  277. filter_out(){
  278. pattern="$1"
  279. shift
  280. echo "$@" | sed "s%\\<$pattern\\>%%g"
  281. }
  282. # set temporary file name
  283. if test ! -z "$TMPDIR" ; then
  284. TMPDIR1="${TMPDIR}"
  285. elif test ! -z "$TEMPDIR" ; then
  286. TMPDIR1="${TEMPDIR}"
  287. else
  288. TMPDIR1="/tmp"
  289. fi
  290. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  291. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  292. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  293. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  294. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  295. # default parameters
  296. logging="yes"
  297. logfile="config.err"
  298. PREFIX="/usr/local"
  299. libdir='${PREFIX}/lib'
  300. shlibdir="$libdir"
  301. incdir='${PREFIX}/include/ffmpeg'
  302. mandir='${PREFIX}/man'
  303. bindir='${PREFIX}/bin'
  304. cross_prefix=""
  305. cross_compile="no"
  306. cc="gcc"
  307. ar="ar"
  308. ranlib="ranlib"
  309. make="make"
  310. strip="strip"
  311. cpu=`uname -m`
  312. tune="generic"
  313. powerpc_perf="no"
  314. mmx="default"
  315. iwmmxt="default"
  316. altivec="default"
  317. mmi="default"
  318. case "$cpu" in
  319. i386|i486|i586|i686|i86pc|BePC)
  320. cpu="x86"
  321. ;;
  322. x86_64|amd64)
  323. cpu="x86"
  324. canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
  325. if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
  326. if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
  327. cpu="x86_64"
  328. fi
  329. fi
  330. ;;
  331. # armv4l is a subset of armv5tel
  332. armv4l|armv5tel)
  333. cpu="armv4l"
  334. ;;
  335. alpha)
  336. cpu="alpha"
  337. ;;
  338. "Power Macintosh"|ppc|ppc64|powerpc)
  339. cpu="powerpc"
  340. ;;
  341. mips|mipsel|IP*)
  342. cpu="mips"
  343. ;;
  344. sun4u|sparc64)
  345. cpu="sparc64"
  346. ;;
  347. sparc)
  348. cpu="sparc"
  349. ;;
  350. sh4)
  351. cpu="sh4"
  352. ;;
  353. parisc|parisc64)
  354. cpu="parisc"
  355. ;;
  356. s390|s390x)
  357. cpu="s390"
  358. ;;
  359. m68k)
  360. cpu="m68k"
  361. ;;
  362. ia64)
  363. cpu="ia64"
  364. ;;
  365. bfin)
  366. cpu="bfin"
  367. ;;
  368. *)
  369. cpu="unknown"
  370. ;;
  371. esac
  372. gprof="no"
  373. v4l="yes"
  374. v4l2="yes"
  375. bktr="no"
  376. audio_oss="yes"
  377. audio_beos="no"
  378. dv1394="yes"
  379. dc1394="no"
  380. network="yes"
  381. ipv6="yes"
  382. zlib="yes"
  383. libgsm="no"
  384. mp3lame="no"
  385. libogg="no"
  386. vorbis="no"
  387. faad="no"
  388. faadbin="no"
  389. faac="no"
  390. xvid="no"
  391. x264="no"
  392. a52="no"
  393. a52bin="no"
  394. dts="no"
  395. pp="no"
  396. mingw32="no"
  397. mingwce="no"
  398. os2="no"
  399. lstatic="yes"
  400. lshared="no"
  401. optimize="yes"
  402. debug="yes"
  403. dostrip="yes"
  404. installstrip="-s"
  405. extralibs="-lm"
  406. simpleidct="yes"
  407. bigendian="no"
  408. inttypes="yes"
  409. emu_fast_int="no"
  410. vhook="default"
  411. dlfcn="no"
  412. dlopen="no"
  413. mpegaudio_hp="yes"
  414. SHFLAGS='-shared -Wl,-soname,$@'
  415. VHOOKSHFLAGS="$SHFLAGS"
  416. netserver="no"
  417. need_inet_aton="no"
  418. protocols="yes"
  419. ffserver="yes"
  420. ffplay="yes"
  421. LIBOBJFLAGS=""
  422. FFLDFLAGS=-Wl,--warn-common
  423. FFSERVERLDFLAGS=-Wl,-E
  424. LDCONFIG="ldconfig"
  425. LIBPREF="lib"
  426. LIBSUF=".a"
  427. LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
  428. SLIBPREF="lib"
  429. SLIBSUF=".so"
  430. SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
  431. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  432. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  433. EXESUF=""
  434. BUILDSUF=""
  435. amr_nb="no"
  436. amr_wb="no"
  437. amr_nb_fixed="no"
  438. amr_if2="no"
  439. sunmlib="no"
  440. pthreads="no"
  441. swscaler="no"
  442. gpl="no"
  443. memalignhack="no"
  444. asmalign_pot="unknown"
  445. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
  446. # OS specific
  447. targetos=`uname -s`
  448. case $targetos in
  449. BeOS)
  450. PREFIX="/boot/home/config"
  451. # helps building libavcodec
  452. add_cflags "-DPIC -fomit-frame-pointer"
  453. # 3 gcc releases known for BeOS, each with ugly bugs
  454. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  455. case "$gcc_version" in
  456. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  457. mmx="no"
  458. ;;
  459. *20010315*) echo "BeBits gcc"
  460. add_cflags "-fno-expensive-optimizations"
  461. ;;
  462. esac
  463. SHFLAGS=-nostart
  464. # disable Linux things
  465. audio_oss="no"
  466. v4l="no"
  467. v4l2="no"
  468. dv1394="no"
  469. # enable BeOS things
  470. audio_beos="yes"
  471. # no need for libm, but the inet stuff
  472. # Check for BONE
  473. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  474. extralibs="-lbind -lsocket"
  475. else
  476. netserver="yes"
  477. need_inet_aton="yes"
  478. extralibs="-lnet"
  479. fi ;;
  480. SunOS)
  481. v4l="no"
  482. v4l2="no"
  483. audio_oss="no"
  484. dv1394="no"
  485. make="gmake"
  486. FFLDFLAGS=""
  487. FFSERVERLDFLAGS=""
  488. SHFLAGS="-shared -Wl,-h,\$@"
  489. need_inet_aton="yes"
  490. add_extralibs "-lsocket -lnsl"
  491. ;;
  492. NetBSD)
  493. v4l="no"
  494. v4l2="no"
  495. bktr="yes"
  496. audio_oss="yes"
  497. dv1394="no"
  498. make="gmake"
  499. add_extralibs "-lossaudio"
  500. ;;
  501. OpenBSD)
  502. v4l="no"
  503. v4l2="no"
  504. bktr="yes"
  505. audio_oss="yes"
  506. dv1394="no"
  507. make="gmake"
  508. LIBOBJFLAGS="\$(PIC)"
  509. LDCONFIG="ldconfig -m \$(shlibdir)"
  510. add_extralibs "-lossaudio"
  511. ;;
  512. FreeBSD)
  513. v4l="no"
  514. v4l2="no"
  515. bktr="yes"
  516. audio_oss="yes"
  517. dv1394="no"
  518. make="gmake"
  519. add_cflags "-pthread"
  520. ;;
  521. GNU/kFreeBSD)
  522. v4l="no"
  523. v4l2="no"
  524. bktr="yes"
  525. audio_oss="yes"
  526. dv1394="no"
  527. add_cflags "-pthread"
  528. ;;
  529. BSD/OS)
  530. v4l="no"
  531. v4l2="no"
  532. bktr="yes"
  533. audio_oss="yes"
  534. dv1394="no"
  535. extralibs="-lpoll -lgnugetopt -lm"
  536. make="gmake"
  537. strip="strip -d"
  538. installstrip=""
  539. ;;
  540. Darwin)
  541. cc="cc"
  542. v4l="no"
  543. v4l2="no"
  544. audio_oss="no"
  545. dv1394="no"
  546. SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
  547. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
  548. extralibs=""
  549. strip="strip -x"
  550. installstrip=""
  551. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  552. SLIBSUF=".dylib"
  553. SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
  554. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
  555. FFSERVERLDFLAGS=-Wl,-bind_at_load
  556. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
  557. ;;
  558. MINGW32*)
  559. # Note: the rest of the mingw32 config is done afterwards as mingw32
  560. # can be forced on the command line for Linux cross compilation.
  561. mingw32="yes"
  562. ;;
  563. CYGWIN*)
  564. targetos=CYGWIN
  565. shlibdir='${PREFIX}/bin'
  566. v4l="no"
  567. v4l2="no"
  568. audio_oss="yes"
  569. dv1394="no"
  570. vhook="no"
  571. extralibs=""
  572. EXESUF=".exe"
  573. SLIBPREF="cyg"
  574. SLIBSUF=".dll"
  575. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  576. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  577. SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
  578. ;;
  579. Linux)
  580. ;;
  581. IRIX*)
  582. targetos=IRIX
  583. ranlib="echo ignoring ranlib"
  584. v4l="no"
  585. v4l2="no"
  586. audio_oss="no"
  587. make="gmake"
  588. ;;
  589. OS/2)
  590. TMPE=$TMPE".exe"
  591. ar="emxomfar -p128"
  592. ranlib="echo ignoring ranlib"
  593. strip="echo ignoring strip"
  594. add_cflags "-Zomf"
  595. FFLDFLAGS="-Zomf -Zstack 16384 -s"
  596. SHFLAGS="-Zdll -Zomf"
  597. FFSERVERLDFLAGS=""
  598. LIBPREF=""
  599. LIBSUF=".lib"
  600. SLIBPREF=""
  601. SLIBSUF=".dll"
  602. EXESUF=".exe"
  603. extralibs=""
  604. pkg_requires=""
  605. v4l="no"
  606. v4l2="no"
  607. audio_oss="no"
  608. dv1394="no"
  609. ffserver="no"
  610. vhook="no"
  611. os2="yes"
  612. ;;
  613. *)
  614. targetos="${targetos}-UNKNOWN"
  615. ;;
  616. esac
  617. # find source path
  618. source_path="`dirname $0`"
  619. source_path_used="yes"
  620. if test -z "$source_path" -o "$source_path" = "." ; then
  621. source_path=`pwd`
  622. source_path_used="no"
  623. else
  624. source_path="`cd \"$source_path\"; pwd`"
  625. fi
  626. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  627. show_help
  628. fi
  629. FFMPEG_CONFIGURATION=" "
  630. for opt do
  631. FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
  632. done
  633. ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
  634. DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
  635. PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
  636. MUXER_LIST=`grep 'av_register_output_format(&[a-z]' $source_path/libavformat/allformats.c | sed 's/.*&\(.*\)).*/\1/'`
  637. DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' $source_path/libavformat/allformats.c | sed 's/.*&\(.*\)).*/\1/'`
  638. for opt do
  639. optval="${opt#*=}"
  640. case "$opt" in
  641. --log)
  642. ;;
  643. --log=*) logging="$optval"
  644. ;;
  645. --prefix=*) PREFIX="$optval"; force_prefix=yes
  646. ;;
  647. --libdir=*) libdir="$optval"; force_libdir=yes
  648. ;;
  649. --shlibdir=*) shlibdir="$optval"
  650. ;;
  651. --incdir=*) incdir="$optval"
  652. ;;
  653. --mandir=*) mandir="$optval"
  654. ;;
  655. --source-path=*) source_path="$optval"
  656. ;;
  657. --cross-prefix=*) cross_prefix="$optval"
  658. ;;
  659. --cross-compile) cross_compile=yes
  660. ;;
  661. --cc=*) cc="$optval"
  662. ;;
  663. --make=*) make="$optval"
  664. ;;
  665. --extra-cflags=*) add_cflags "$optval"
  666. ;;
  667. --extra-ldflags=*) EXTRALDFLAGS="$optval"
  668. ;;
  669. --extra-libs=*) extralibs="$optval"
  670. ;;
  671. --build-suffix=*) BUILDSUF="$optval"
  672. ;;
  673. --cpu=*) cpu="$optval"
  674. ;;
  675. --tune=*) tune="$optval"
  676. ;;
  677. --powerpc-perf-enable) powerpc_perf="yes"
  678. ;;
  679. --disable-mmx) mmx="no"
  680. ;;
  681. --disable-iwmmxt) iwmmxt="no"
  682. ;;
  683. --disable-altivec) altivec="no"
  684. ;;
  685. --enable-gprof) gprof="yes"
  686. ;;
  687. --disable-v4l) v4l="no"
  688. ;;
  689. --disable-v4l2) v4l2="no"
  690. ;;
  691. --disable-bktr) bktr="no"
  692. ;;
  693. --disable-audio-oss) audio_oss="no"
  694. ;;
  695. --disable-audio-beos) audio_beos="no"
  696. ;;
  697. --disable-dv1394) dv1394="no"
  698. ;;
  699. --disable-network) network="no"; ffserver="no"
  700. ;;
  701. --disable-ipv6) ipv6="no";
  702. ;;
  703. --disable-zlib) zlib="no"
  704. ;;
  705. --enable-a52) a52="yes"
  706. ;;
  707. --enable-a52bin) a52bin="yes"
  708. ;;
  709. --enable-dts) dts="yes"
  710. ;;
  711. --enable-pp) pp="yes"
  712. ;;
  713. --enable-libgsm) libgsm="yes"
  714. ;;
  715. --enable-mp3lame) mp3lame="yes"
  716. ;;
  717. --enable-libogg) libogg="yes"
  718. pkg_requires="$pkg_requires ogg >= 1.1"
  719. ;;
  720. --enable-vorbis) vorbis="yes"
  721. pkg_requires="$pkg_requires vorbis vorbisenc"
  722. ;;
  723. --enable-faad) faad="yes"
  724. ;;
  725. --enable-faadbin) faadbin="yes"
  726. ;;
  727. --enable-faac) faac="yes"
  728. ;;
  729. --enable-xvid) xvid="yes"
  730. ;;
  731. --enable-x264) x264="yes"
  732. ;;
  733. --enable-dc1394) dc1394="yes"
  734. pkg_requires="$pkg_requires libraw1394"
  735. ;;
  736. --disable-vhook) vhook="no"
  737. ;;
  738. --disable-simple_idct) simpleidct="no"
  739. ;;
  740. --enable-mingw32) mingw32="yes"
  741. ;;
  742. --enable-mingwce) mingwce="yes"
  743. ;;
  744. --enable-static) lstatic="yes"
  745. ;;
  746. --disable-static) lstatic="no"
  747. ;;
  748. --enable-shared) lshared="yes"
  749. ;;
  750. --disable-shared) lshared="no"
  751. ;;
  752. --disable-debug) debug="no"
  753. ;;
  754. --disable-opts) optimize="no"
  755. ;;
  756. --disable-mpegaudio-hp) mpegaudio_hp="no"
  757. ;;
  758. --disable-protocols) protocols="no"; network="no"; ffserver="no"
  759. ;;
  760. --disable-ffserver) ffserver="no"
  761. ;;
  762. --disable-ffplay) ffplay="no"
  763. ;;
  764. --enable-small) optimize="small"
  765. ;;
  766. --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
  767. ;;
  768. --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
  769. ;;
  770. --enable-amr_wb) amr="yes"; amr_wb="yes"
  771. ;;
  772. --enable-amr_if2) amr="yes"; amr_if2="yes"
  773. ;;
  774. --enable-sunmlib) sunmlib="yes"
  775. ;;
  776. --enable-pthreads) pthreads="yes"
  777. ;;
  778. --enable-swscaler) swscaler="yes"
  779. ;;
  780. --enable-gpl) gpl="yes"
  781. ;;
  782. --enable-memalign-hack) memalignhack="yes"
  783. ;;
  784. --disable-strip) dostrip="no"
  785. ;;
  786. --enable-encoder=*) ENCODER_LIST="$ENCODER_LIST ${optval}_encoder"
  787. ;;
  788. --enable-decoder=*) DECODER_LIST="$DECODER_LIST ${optval}_decoder"
  789. ;;
  790. --disable-encoder=*) ENCODER_LIST="`filter_out ${optval}_encoder $ENCODER_LIST`"
  791. ;;
  792. --disable-decoder=*) DECODER_LIST="`filter_out ${optval}_decoder $DECODER_LIST`"
  793. ;;
  794. --disable-encoders) ENCODER_LIST=""
  795. ;;
  796. --disable-decoders) DECODER_LIST=""
  797. ;;
  798. --enable-muxer=*) MUXER_LIST="$MUXER_LIST ${optval}_muxer"
  799. ;;
  800. --disable-muxer=*) MUXER_LIST="`filter_out ${optval}_muxer $MUXER_LIST`"
  801. ;;
  802. --disable-muxers) MUXER_LIST=""; ffserver="no"
  803. ;;
  804. --enable-demuxer=*) DEMUXER_LIST="$DEMUXER_LIST ${optval}_demuxer"
  805. ;;
  806. --disable-demuxer=*) DEMUXER_LIST="`filter_out ${optval}_demuxer $DEMUXER_LIST`"
  807. ;;
  808. --disable-demuxers) DEMUXER_LIST=""
  809. ;;
  810. --enable-parser=*) PARSER_LIST="$PARSER_LIST ${optval}_parser"
  811. ;;
  812. --disable-parser=*) PARSER_LIST="`filter_out ${optval}_parser $PARSER_LIST`"
  813. ;;
  814. --disable-parsers) PARSER_LIST=""
  815. ;;
  816. --help) show_help
  817. ;;
  818. *)
  819. echo "Unknown option \"$opt\"."
  820. echo "See $0 --help for available options."
  821. exit 1
  822. ;;
  823. esac
  824. done
  825. if test "$logging" != no; then
  826. test "$logging" = yes || logfile="$logging"
  827. echo "# $0 $@" >$logfile
  828. set >>$logfile
  829. else
  830. logfile=/dev/null
  831. fi
  832. if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
  833. if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
  834. cat <<EOF
  835. You can only build one library type at once on MinGW.
  836. Specify --disable-static --enable-shared to only build
  837. the shared libraries. To build only the static libraries
  838. you do not need to pass additional options.
  839. EOF
  840. exit 1
  841. fi
  842. v4l="no"
  843. v4l2="no"
  844. bktr="no"
  845. audio_oss="no"
  846. dv1394="no"
  847. dc1394="no"
  848. ffserver="no"
  849. network="no"
  850. if test "$mingwce" = "yes"; then
  851. protocols="no"
  852. fi
  853. SLIBPREF=""
  854. SLIBSUF=".dll"
  855. EXESUF=".exe"
  856. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  857. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  858. SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
  859. FFLDFLAGS="-Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
  860. if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
  861. if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
  862. shlibdir='${PREFIX}'
  863. fi
  864. # Combine FFLDFLAGS, EXTRALDFLAGS and the LDFLAGS environment variable.
  865. LDFLAGS="$FFLDFLAGS $EXTRALDFLAGS $LDFLAGS"
  866. test -n "$cross_prefix" && cross_compile=yes
  867. cc="${cross_prefix}${cc}"
  868. ar="${cross_prefix}${ar}"
  869. ranlib="${cross_prefix}${ranlib}"
  870. strip="${cross_prefix}${strip}"
  871. # we need to build at least one lib type
  872. if test "$lstatic" = "no" && test "$lshared" = "no" ; then
  873. cat <<EOF
  874. At least one library type must be built.
  875. Specify --enable-static to build the static libraries or --enable-shared to
  876. build the shared libraries as well. To only build the shared libraries specify
  877. --disable-static in addition to --enable-shared.
  878. EOF
  879. exit 1;
  880. fi
  881. if test "$vorbis" = "yes" ; then
  882. if test "$libogg" = "no"; then
  883. echo "libogg must be enabled to enable Vorbis."
  884. fail="yes"
  885. vorbis="no"
  886. fi
  887. fi
  888. if test "$gpl" != "yes"; then
  889. if test "$pp" != "no"; then
  890. echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
  891. fail="yes"
  892. fi
  893. if test "$a52" != "no" -o "$a52bin" != "no"; then
  894. echo "liba52 is under GPL and --enable-gpl is not specified."
  895. fail="yes"
  896. fi
  897. if test "$xvid" != "no"; then
  898. echo "libxvidcore is under GPL and --enable-gpl is not specified."
  899. fail="yes"
  900. fi
  901. if test "$x264" != "no"; then
  902. echo "x264 is under GPL and --enable-gpl is not specified."
  903. fail="yes"
  904. fi
  905. if test "$dts" != "no"; then
  906. echo "libdts is under GPL and --enable-gpl is not specified."
  907. fail="yes"
  908. fi
  909. if test "$faad" != "no" -o "$faadbin" != "no"; then
  910. if check_header faad.h; then
  911. check_cc << EOF
  912. #include <faad.h>
  913. #ifndef FAAD2_VERSION
  914. ok faad1
  915. #endif
  916. int main( void ) { return 0; }
  917. EOF
  918. if test $? = 0 ; then
  919. echo "FAAD2 is under GPL and --enable-gpl is not specified."
  920. fail="yes"
  921. fi
  922. else
  923. faad="no"
  924. faadbin="no"
  925. echo "FAAD test failed."
  926. fi
  927. fi
  928. if test "$swscaler" != "no"; then
  929. echo "The software scaler is under GPL and --enable-gpl is not specified."
  930. fail="yes"
  931. fi
  932. if test "$fail" = "yes"; then
  933. exit 1
  934. fi
  935. fi
  936. # compute MMX state
  937. if test $mmx = "default"; then
  938. if test $cpu = "x86" -o $cpu = "x86_64"; then
  939. mmx="yes"
  940. else
  941. mmx="no"
  942. fi
  943. fi
  944. # check iwmmxt support
  945. if test $iwmmxt = "default" -a $cpu = "armv4l"; then
  946. iwmmxt=no
  947. check_cc <<EOF && iwmmxt=yes
  948. int main(void) {
  949. __asm__ __volatile__ ("wunpckelub wr6, wr4");
  950. }
  951. EOF
  952. fi
  953. #Darwin CC versions
  954. needmdynamicnopic="no"
  955. if test $targetos = Darwin; then
  956. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  957. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  958. else
  959. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  960. case "$gcc_version" in
  961. *2.95*)
  962. add_cflags "-no-cpp-precomp -pipe"
  963. ;;
  964. *[34].*)
  965. add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
  966. if test "$lshared" = no; then
  967. needmdynamicnopic="yes"
  968. fi
  969. ;;
  970. *)
  971. add_cflags "-no-cpp-precomp -pipe"
  972. if test "$lshared" = no; then
  973. needmdynamicnopic="yes"
  974. fi
  975. ;;
  976. esac
  977. fi
  978. if test $optimize != "no"; then
  979. add_cflags "-fomit-frame-pointer"
  980. fi
  981. fi
  982. # Can only do AltiVec on PowerPC
  983. if test $altivec = "default"; then
  984. if test $cpu = "powerpc"; then
  985. altivec="yes"
  986. else
  987. altivec="no"
  988. fi
  989. fi
  990. # Add processor-specific flags
  991. TUNECPU="generic"
  992. POWERPCMODE="32bits"
  993. if test $tune != "generic"; then
  994. case $tune in
  995. 601|ppc601|PowerPC601)
  996. add_cflags "-mcpu=601"
  997. if test $altivec = "yes"; then
  998. echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
  999. fi
  1000. TUNECPU=ppc601
  1001. ;;
  1002. 603*|ppc603*|PowerPC603*)
  1003. add_cflags "-mcpu=603"
  1004. if test $altivec = "yes"; then
  1005. echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
  1006. fi
  1007. TUNECPU=ppc603
  1008. ;;
  1009. 604*|ppc604*|PowerPC604*)
  1010. add_cflags "-mcpu=604"
  1011. if test $altivec = "yes"; then
  1012. echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
  1013. fi
  1014. TUNECPU=ppc604
  1015. ;;
  1016. G3|g3|75*|ppc75*|PowerPC75*)
  1017. add_cflags "-mcpu=750 -mtune=750 -mpowerpc-gfxopt"
  1018. if test $altivec = "yes"; then
  1019. echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
  1020. fi
  1021. TUNECPU=ppc750
  1022. ;;
  1023. G4|g4|745*|ppc745*|PowerPC745*)
  1024. add_cflags "-mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
  1025. if test $altivec = "no"; then
  1026. echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
  1027. fi
  1028. TUNECPU=ppc7450
  1029. ;;
  1030. 74*|ppc74*|PowerPC74*)
  1031. add_cflags "-mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
  1032. if test $altivec = "no"; then
  1033. echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
  1034. fi
  1035. TUNECPU=ppc7400
  1036. ;;
  1037. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1038. add_cflags "-mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
  1039. if test $altivec = "no"; then
  1040. echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
  1041. fi
  1042. TUNECPU=ppc970
  1043. POWERPCMODE="64bits"
  1044. ;;
  1045. i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6|k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6|winchip2|c3|nocona|athlon64|k8|opteron|athlon-fx)
  1046. add_cflags "-march=$tune"
  1047. ;;
  1048. sparc64)
  1049. add_cflags "-mcpu=v9 -mtune=v9"
  1050. ;;
  1051. *)
  1052. echo "WARNING: Unknown CPU \"$tune\", ignored."
  1053. ;;
  1054. esac
  1055. fi
  1056. # compiler sanity check
  1057. check_exec <<EOF
  1058. int main(){
  1059. return 0;
  1060. }
  1061. EOF
  1062. if test "$?" != 0; then
  1063. echo "$cc is unable to create an executable file."
  1064. if test -z "$cross_prefix" -a "$cross_compile" = no; then
  1065. echo "If $cc is a cross-compiler, use the --cross-compile option."
  1066. fi
  1067. die "C compiler test failed."
  1068. fi
  1069. # check for SIMD availability
  1070. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1071. if test $cpu = "powerpc"; then
  1072. if test $altivec = "yes"; then
  1073. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  1074. add_cflags "-faltivec"
  1075. else
  1076. add_cflags "-maltivec -mabi=altivec"
  1077. fi
  1078. fi
  1079. fi
  1080. check_header altivec.h && _altivec_h=yes || _altivec_h=no
  1081. # check if our compiler supports Motorola AltiVec C API
  1082. if test $altivec = "yes"; then
  1083. if test $_altivec_h = "yes"; then
  1084. inc_altivec_h="#include <altivec.h>"
  1085. else
  1086. inc_altivec_h=
  1087. fi
  1088. check_cc <<EOF || altivec=no
  1089. $inc_altivec_h
  1090. int main(void) {
  1091. vector signed int v1, v2, v3;
  1092. v1 = vec_add(v2,v3);
  1093. return 0;
  1094. }
  1095. EOF
  1096. fi
  1097. # mmi only available on mips
  1098. if test $mmi = "default"; then
  1099. if test $cpu = "mips"; then
  1100. mmi="yes"
  1101. else
  1102. mmi="no"
  1103. fi
  1104. fi
  1105. # check if our compiler supports mmi
  1106. enabled mmi && check_cc <<EOF || mmi="no"
  1107. int main(void) {
  1108. __asm__ ("lq \$2, 0(\$2)");
  1109. return 0;
  1110. }
  1111. EOF
  1112. # test gcc version to see if vector builtins can be used
  1113. # currently only used on i386 for MMX builtins
  1114. check_cc -msse <<EOF && builtin_vector=yes || builtin_vector=no
  1115. #include <xmmintrin.h>
  1116. int main(void) {
  1117. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  1118. return 0;
  1119. #else
  1120. #error no vector builtins
  1121. #endif
  1122. }
  1123. EOF
  1124. # test for mm3dnow.h
  1125. test "$cpu" = "x86_64" && march=k8 || march=athlon
  1126. check_cc -march=$march <<EOF && mm3dnow=yes || mm3dnow=no
  1127. #include <mm3dnow.h>
  1128. int main(void) {
  1129. __m64 b1;
  1130. b1 = _m_pswapd(b1);
  1131. _m_femms();
  1132. return 0;
  1133. }
  1134. EOF
  1135. # ---
  1136. # big/little-endian test
  1137. if test "$cross_compile" = "no"; then
  1138. check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
  1139. #include <inttypes.h>
  1140. int main(int argc, char ** argv){
  1141. volatile uint32_t i=0x01234567;
  1142. return (*((uint8_t*)(&i))) == 0x67;
  1143. }
  1144. EOF
  1145. else
  1146. # programs cannot be launched if cross compiling, so make a static guess
  1147. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  1148. bigendian="yes"
  1149. fi
  1150. fi
  1151. # ---
  1152. # *inttypes.h* test
  1153. check_header inttypes.h || inttypes=no
  1154. # ---
  1155. # *int_fast* test
  1156. check_cc <<EOF || emu_fast_int=yes
  1157. #include <inttypes.h>
  1158. int main(int argc, char ** argv){
  1159. volatile uint_fast64_t i=0x01234567;
  1160. return 0;
  1161. }
  1162. EOF
  1163. # ---
  1164. # check availability of some header files
  1165. _memalign=no
  1166. _malloc_h=no
  1167. if check_header malloc.h; then
  1168. _malloc_h=yes
  1169. _memalign=yes
  1170. check_func memalign || _memalign="no"
  1171. fi
  1172. if test "$_memalign" = "no" -a "$mmx" = "yes" -a \
  1173. "$memalignhack" != "yes" -a "$targetos" != "Darwin" -a \
  1174. "$targetos" != "FreeBSD" ; then
  1175. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1176. fi
  1177. check_func localtime_r && localtime_r=yes || localtime_r=no
  1178. enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
  1179. # check for some common methods of building with pthread support
  1180. # do this before the optional library checks as some of them require pthreads
  1181. if enabled pthreads; then
  1182. { check_cflags -pthread && check_ldflags -pthread; } ||
  1183. { check_cflags -pthreads && check_ldflags -pthreads; } ||
  1184. check_lib pthread.h pthread_create -lpthread ||
  1185. check_func pthread_create ||
  1186. die "ERROR: can't find pthreads library"
  1187. fi
  1188. # these are off by default, so fail if requested and not available
  1189. enabled dts && require libdts dts.h dts_init -ldts
  1190. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1191. enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
  1192. enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
  1193. enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
  1194. enabled xvid && require XviD xvid.h xvid_global -lxvidcore
  1195. enabled x264 && require x264 x264.h x264_encoder_open -lx264
  1196. enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
  1197. enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1198. # Ugh, faac uses stdcall calling convention on win32 so we can't use
  1199. # the generic test functions
  1200. if enabled faac; then
  1201. save_flags
  1202. temp_extralibs -lfaac
  1203. check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
  1204. #include <stdint.h>
  1205. #include <faac.h>
  1206. int main(){
  1207. char *id, *cpr;
  1208. faacEncGetVersion(&id, &cpr);
  1209. return 0;
  1210. }
  1211. EOF
  1212. restore_flags
  1213. fi
  1214. # Ugh, recent faad2 versions have renamed all functions and #define the
  1215. # old names in faad.h. Generic tests won't work.
  1216. if enabled faad; then
  1217. save_flags
  1218. temp_extralibs -lfaad
  1219. check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
  1220. #include <faad.h>
  1221. int main(){
  1222. faacDecOpen();
  1223. return 0;
  1224. }
  1225. EOF
  1226. restore_flags
  1227. fi
  1228. # test for lrintf in math.h
  1229. check_exec <<EOF && have_lrintf=yes || have_lrintf=no
  1230. #define _ISOC9X_SOURCE 1
  1231. #include <math.h>
  1232. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  1233. EOF
  1234. _restrict=
  1235. for restrict_keyword in restrict __restrict__ __restrict; do
  1236. check_cc <<EOF && _restrict=$restrict_keyword && break
  1237. void foo(char * $restrict_keyword p);
  1238. EOF
  1239. done
  1240. # dlopen/dlfcn.h probing
  1241. check_header dlfcn.h && dlfcn=yes
  1242. temp_extralibs -ldl
  1243. if check_func dlopen; then
  1244. dlopen=yes
  1245. ldl=-ldl
  1246. fi
  1247. restore_flags
  1248. if check_func dlopen; then
  1249. dlopen=yes
  1250. ldl=
  1251. fi
  1252. if test "$vhook" = "default"; then
  1253. vhook="$dlopen"
  1254. fi
  1255. if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
  1256. add_extralibs $ldl
  1257. fi
  1258. if enabled vhook; then
  1259. check_ldflags -rdynamic
  1260. check_ldflags -export-dynamic
  1261. fi
  1262. ##########################################
  1263. # imlib check
  1264. temp_extralibs -lImlib2
  1265. check_ld <<EOF && imlib2=yes || imlib2=no
  1266. #include <X11/Xlib.h>
  1267. #include <Imlib2.h>
  1268. int main( void ) { return (int) imlib_load_font("foo"); }
  1269. EOF
  1270. restore_flags
  1271. ##########################################
  1272. # FreeType check
  1273. freetype2=no
  1274. if test "x$targetos" != "xBeOS"; then
  1275. if (freetype-config --version) >/dev/null 2>&1 ; then
  1276. temp_cflags `freetype-config --cflags`
  1277. temp_extralibs `freetype-config --libs`
  1278. check_ld <<EOF && freetype2=yes
  1279. #include <ft2build.h>
  1280. int main( void ) { return (int) FT_Init_FreeType(0); }
  1281. EOF
  1282. restore_flags
  1283. fi
  1284. fi
  1285. ##########################################
  1286. # SDL check
  1287. sdl_too_old=no
  1288. sdl=no
  1289. SDL_CONFIG="${cross_prefix}sdl-config"
  1290. if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
  1291. temp_cflags `"${SDL_CONFIG}" --cflags`
  1292. temp_extralibs `"${SDL_CONFIG}" --libs`
  1293. check_ld <<EOF
  1294. #include <SDL.h>
  1295. #undef main /* We don't want SDL to override our main() */
  1296. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  1297. EOF
  1298. if test $? = 0; then
  1299. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1300. if test "$_sdlversion" -lt 121 ; then
  1301. sdl_too_old=yes
  1302. else
  1303. sdl=yes
  1304. check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
  1305. #include <SDL.h>
  1306. int main(void){
  1307. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1308. int w = vi->current_w;
  1309. return 0;
  1310. }
  1311. EOF
  1312. fi
  1313. fi
  1314. restore_flags
  1315. fi
  1316. enabled sdl || ffplay=no
  1317. ##########################################
  1318. # texi2html check
  1319. texi2html=no
  1320. if (texi2html -version) >/dev/null 2>&1; then
  1321. texi2html=yes
  1322. fi
  1323. ##########################################
  1324. # IPv6 check
  1325. enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
  1326. #include <sys/types.h>
  1327. #include <sys/socket.h>
  1328. #include <netinet/in.h>
  1329. #include <netdb.h>
  1330. int main( void ) {
  1331. struct sockaddr_storage saddr;
  1332. struct ipv6_mreq mreq6;
  1333. getaddrinfo(0,0,0,0);
  1334. getnameinfo(0,0,0,0,0,0,0);
  1335. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1336. }
  1337. EOF
  1338. # check for video4linux2 --- V4L2_PIX_FMT_YUV420
  1339. enabled v4l2 && check_cc <<EOF || v4l2="no"
  1340. #include <sys/time.h>
  1341. #include <asm/types.h>
  1342. #include <linux/videodev2.h>
  1343. int dummy = V4L2_PIX_FMT_YUV420;
  1344. struct v4l2_buffer dummy1;
  1345. EOF
  1346. enabled debug && add_cflags -g
  1347. # add some useful compiler flags if supported
  1348. check_cflags -Wdeclaration-after-statement
  1349. check_cflags -Wall
  1350. check_cflags -Wno-switch
  1351. # add some linker flags
  1352. check_ldflags '-Wl,--as-needed' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavformat' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  1353. # not all compilers support -Os
  1354. test "$optimize" = "small" && check_cflags -Os
  1355. if enabled optimize; then
  1356. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1357. add_cflags "-O5"
  1358. add_ldflags "-O5"
  1359. else
  1360. add_cflags "-O3"
  1361. fi
  1362. fi
  1363. # PIC flags for shared library objects where they are needed
  1364. if test "$lshared" = "yes" ; then
  1365. # LIBOBJFLAGS may have already been set in the OS configuration
  1366. if test -z "$LIBOBJFLAGS" ; then
  1367. case "$cpu" in
  1368. x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
  1369. esac
  1370. fi
  1371. fi
  1372. if test "$gprof" = "yes" ; then
  1373. add_cflags "-p"
  1374. add_ldflags "-p"
  1375. fi
  1376. # find if .align arg is power-of-two or not
  1377. if test $asmalign_pot = "unknown"; then
  1378. asmalign_pot="no"
  1379. echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
  1380. fi
  1381. echo "install prefix $PREFIX"
  1382. echo "source path $source_path"
  1383. echo "C compiler $cc"
  1384. echo "make $make"
  1385. echo "CPU $cpu ($tune)"
  1386. if test "$BUILDSUF" != ""; then
  1387. echo "build suffix $BUILDSUF"
  1388. fi
  1389. echo "big-endian $bigendian"
  1390. echo "inttypes.h $inttypes"
  1391. echo "broken inttypes.h $emu_fast_int"
  1392. if test $cpu = "x86" -o $cpu = "x86_64"; then
  1393. echo "MMX enabled $mmx"
  1394. echo "Vector Builtins $builtin_vector"
  1395. echo "3DNow! Builtins $mm3dnow"
  1396. fi
  1397. if test $cpu = "armv4l"; then
  1398. echo "IWMMXT enabled $iwmmxt"
  1399. fi
  1400. if test $cpu = "mips"; then
  1401. echo "MMI enabled $mmi"
  1402. fi
  1403. if test $cpu = "powerpc"; then
  1404. echo "AltiVec enabled $altivec"
  1405. fi
  1406. echo "gprof enabled $gprof"
  1407. echo "zlib enabled $zlib"
  1408. echo "libgsm enabled $libgsm"
  1409. echo "mp3lame enabled $mp3lame"
  1410. echo "libogg enabled $libogg"
  1411. echo "Vorbis enabled $vorbis"
  1412. echo "FAAD enabled $faad"
  1413. echo "faadbin enabled $faadbin"
  1414. echo "FAAC enabled $faac"
  1415. echo "XviD enabled $xvid"
  1416. echo "x264 enabled $x264"
  1417. echo "a52 support $a52"
  1418. echo "a52 dlopened $a52bin"
  1419. echo "DTS support $dts"
  1420. echo "pp support $pp"
  1421. echo "Software Scaler enabled $swscaler"
  1422. echo "debug symbols $debug"
  1423. echo "strip symbols $dostrip"
  1424. echo "optimize $optimize"
  1425. echo "static $lstatic"
  1426. echo "shared $lshared"
  1427. echo "video hooking $vhook"
  1428. echo "SDL support $sdl"
  1429. if test $sdl_too_old = "yes"; then
  1430. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1431. fi
  1432. if test "$vhook" = "yes"; then
  1433. echo "Imlib2 support $imlib2"
  1434. echo "FreeType support $freetype2"
  1435. fi
  1436. echo "Sun medialib support" $sunmlib
  1437. echo "pthreads support" $pthreads
  1438. echo "AMR-NB float support" $amr_nb
  1439. echo "AMR-NB fixed support" $amr_nb_fixed
  1440. echo "AMR-WB float support" $amr_wb
  1441. echo "AMR-WB IF2 support" $amr_if2
  1442. echo "network support $network"
  1443. if test "$network" = "yes" ; then
  1444. echo "IPv6 support $ipv6"
  1445. fi
  1446. echo ".align is power-of-two" $asmalign_pot
  1447. if test "$gpl" = "no" ; then
  1448. echo "License: LGPL"
  1449. else
  1450. echo "License: GPL"
  1451. fi
  1452. echo "Creating config.mak and config.h..."
  1453. date >> config.log
  1454. echo " $0 $FFMPEG_CONFIGURATION" >> config.log
  1455. echo "# Automatically generated by configure - do not modify!" > config.mak
  1456. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1457. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1458. echo "PREFIX=$PREFIX" >> config.mak
  1459. echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
  1460. echo "libdir=\$(DESTDIR)$libdir" >> config.mak
  1461. echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
  1462. echo "incdir=\$(DESTDIR)$incdir" >> config.mak
  1463. echo "bindir=\$(DESTDIR)$bindir" >> config.mak
  1464. echo "mandir=\$(DESTDIR)$mandir" >> config.mak
  1465. echo "MAKE=$make" >> config.mak
  1466. echo "CC=$cc" >> config.mak
  1467. echo "AR=$ar" >> config.mak
  1468. echo "RANLIB=$ranlib" >> config.mak
  1469. if test "$dostrip" = "yes" ; then
  1470. echo "STRIP=$strip" >> config.mak
  1471. echo "INSTALLSTRIP=$installstrip" >> config.mak
  1472. else
  1473. echo "STRIP=echo ignoring strip" >> config.mak
  1474. echo "INSTALLSTRIP=" >> config.mak
  1475. fi
  1476. VHOOKCFLAGS="-fPIC $CFLAGS"
  1477. test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
  1478. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1479. echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
  1480. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1481. echo "LDCONFIG=$LDCONFIG" >> config.mak
  1482. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1483. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1484. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  1485. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1486. echo "BUILD_STATIC=$lstatic" >> config.mak
  1487. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1488. echo "LIBPREF=$LIBPREF" >> config.mak
  1489. echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
  1490. if test "$lstatic" = "yes" ; then
  1491. echo "LIB=$LIB" >> config.mak
  1492. else # Some Make complain if this variable does not exist.
  1493. echo "LIB=" >> config.mak
  1494. fi
  1495. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1496. echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
  1497. echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
  1498. echo "TARGET_OS=$targetos" >> config.mak
  1499. if test "$cpu" = "x86" ; then
  1500. echo "TARGET_ARCH_X86=yes" >> config.mak
  1501. echo "#define ARCH_X86 1" >> $TMPH
  1502. elif test "$cpu" = "x86_64" ; then
  1503. echo "TARGET_ARCH_X86_64=yes" >> config.mak
  1504. echo "#define ARCH_X86_64 1" >> $TMPH
  1505. elif test "$cpu" = "armv4l" ; then
  1506. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  1507. echo "#define ARCH_ARMV4L 1" >> $TMPH
  1508. elif test "$cpu" = "alpha" ; then
  1509. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  1510. echo "#define ARCH_ALPHA 1" >> $TMPH
  1511. elif test "$cpu" = "sparc64" ; then
  1512. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  1513. echo "#define ARCH_SPARC64 1" >> $TMPH
  1514. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1515. echo "#define ARCH_SPARC 1" >> $TMPH
  1516. elif test "$cpu" = "sparc" ; then
  1517. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1518. echo "#define ARCH_SPARC 1" >> $TMPH
  1519. elif test "$cpu" = "powerpc" ; then
  1520. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  1521. echo "#define ARCH_POWERPC 1" >> $TMPH
  1522. if test $POWERPCMODE = "32bits"; then
  1523. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  1524. else
  1525. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1526. fi
  1527. if test "$powerpc_perf" = "yes"; then
  1528. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1529. fi
  1530. elif test "$cpu" = "mips" ; then
  1531. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1532. echo "#define ARCH_MIPS 1" >> $TMPH
  1533. elif test "$cpu" = "sh4" ; then
  1534. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1535. echo "#define ARCH_SH4 1" >> $TMPH
  1536. elif test "$cpu" = "parisc" ; then
  1537. echo "TARGET_ARCH_PARISC=yes" >> config.mak
  1538. echo "#define ARCH_PARISC 1" >> $TMPH
  1539. elif test "$cpu" = "s390" ; then
  1540. echo "TARGET_ARCH_S390=yes" >> config.mak
  1541. echo "#define ARCH_S390 1" >> $TMPH
  1542. elif test "$cpu" = "m68k" ; then
  1543. echo "TARGET_ARCH_M68K=yes" >> config.mak
  1544. echo "#define ARCH_M68K 1" >> $TMPH
  1545. elif test "$cpu" = "ia64" ; then
  1546. echo "TARGET_ARCH_IA64=yes" >> config.mak
  1547. echo "#define ARCH_IA64 1" >> $TMPH
  1548. elif test "$cpu" = "bfin" ; then
  1549. echo "TARGET_ARCH_BFIN=yes" >> config.mak
  1550. echo "#define ARCH_BFIN 1" >> $TMPH
  1551. fi
  1552. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1553. if test "$bigendian" = "yes" ; then
  1554. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1555. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1556. fi
  1557. if test "$inttypes" != "yes" ; then
  1558. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1559. fi
  1560. if test "$emu_fast_int" = "yes" ; then
  1561. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1562. fi
  1563. if test "$mmx" = "yes" ; then
  1564. echo "TARGET_MMX=yes" >> config.mak
  1565. echo "#define HAVE_MMX 1" >> $TMPH
  1566. echo "#define __CPU__ 586" >> $TMPH
  1567. fi
  1568. if test "$builtin_vector" = "yes" ; then
  1569. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1570. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1571. fi
  1572. if test "$mm3dnow" = "yes" ; then
  1573. echo "TARGET_BUILTIN_3DNOW=yes" >> config.mak
  1574. echo "#define HAVE_MM3DNOW 1" >> $TMPH
  1575. fi
  1576. if test "$iwmmxt" = "yes" ; then
  1577. echo "TARGET_IWMMXT=yes" >> config.mak
  1578. echo "#define HAVE_IWMMXT 1" >> $TMPH
  1579. fi
  1580. if test "$mmi" = "yes" ; then
  1581. echo "TARGET_MMI=yes" >> config.mak
  1582. echo "#define HAVE_MMI 1" >> $TMPH
  1583. fi
  1584. if test "$altivec" = "yes" ; then
  1585. echo "TARGET_ALTIVEC=yes" >> config.mak
  1586. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1587. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1588. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1589. if test "$_altivec_h" = "yes" ; then
  1590. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1591. else
  1592. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1593. fi
  1594. fi
  1595. if test "$gprof" = "yes" ; then
  1596. echo "#define HAVE_GPROF 1" >> $TMPH
  1597. fi
  1598. if test "$localtime_r" = "yes" ; then
  1599. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1600. fi
  1601. if test "$imlib2" = "yes" ; then
  1602. echo "HAVE_IMLIB2=yes" >> config.mak
  1603. fi
  1604. if test "$freetype2" = "yes" ; then
  1605. echo "HAVE_FREETYPE2=yes" >> config.mak
  1606. fi
  1607. if test "$sunmlib" = "yes" ; then
  1608. echo "HAVE_MLIB=yes" >> config.mak
  1609. echo "#define HAVE_MLIB 1" >> $TMPH
  1610. fi
  1611. if test "$pthreads" = "yes" ; then
  1612. echo "HAVE_PTHREADS=yes" >> config.mak
  1613. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1614. echo "#define HAVE_THREADS 1" >> $TMPH
  1615. fi
  1616. if test "$sdl" = "yes" ; then
  1617. echo "CONFIG_SDL=yes" >> config.mak
  1618. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1619. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1620. if test "$sdl_video_size" = "yes"; then
  1621. echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
  1622. fi
  1623. fi
  1624. if test "$texi2html" = "yes"; then
  1625. echo "BUILD_DOC=yes" >> config.mak
  1626. fi
  1627. if test "$have_lrintf" = "yes" ; then
  1628. echo "#define HAVE_LRINTF 1" >> $TMPH
  1629. fi
  1630. if test "$vhook" = "yes" ; then
  1631. echo "BUILD_VHOOK=yes" >> config.mak
  1632. echo "#define HAVE_VHOOK 1" >> $TMPH
  1633. fi
  1634. sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
  1635. pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
  1636. lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
  1637. lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
  1638. lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
  1639. if test "$lshared" = "yes" ; then
  1640. echo "#define BUILD_SHARED_AV 1" >> $TMPH
  1641. echo "BUILD_SHARED=yes" >> config.mak
  1642. echo "PIC=-fPIC -DPIC" >> config.mak
  1643. echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
  1644. echo "SPPVERSION=$lavc_version" >> config.mak
  1645. echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
  1646. echo "LAVCVERSION=$lavc_version" >> config.mak
  1647. echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
  1648. echo "LAVFVERSION=$lavf_version" >> config.mak
  1649. echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
  1650. echo "LAVUVERSION=$lavu_version" >> config.mak
  1651. echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
  1652. echo "SWSVERSION=$sws_version" >> config.mak
  1653. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1654. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1655. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1656. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1657. fi
  1658. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1659. echo "EXTRALIBS=$extralibs" >> config.mak
  1660. # If you do not want to use encoders, disable them.
  1661. if echo "$ENCODER_LIST" | grep -q encoder; then
  1662. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1663. echo "CONFIG_ENCODERS=yes" >> config.mak
  1664. fi
  1665. # If you do not want to use decoders, disable them.
  1666. if echo "$DECODER_LIST" | grep -q decoder; then
  1667. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1668. echo "CONFIG_DECODERS=yes" >> config.mak
  1669. fi
  1670. # muxers
  1671. if echo "$MUXER_LIST" | grep -q muxer; then
  1672. echo "#define CONFIG_MUXERS 1" >> $TMPH
  1673. echo "CONFIG_MUXERS=yes" >> config.mak
  1674. fi
  1675. # demuxers
  1676. if echo "$DEMUXER_LIST" | grep -q demuxer; then
  1677. echo "#define CONFIG_DEMUXERS 1" >> $TMPH
  1678. echo "CONFIG_DEMUXERS=yes" >> config.mak
  1679. fi
  1680. # AC3
  1681. if test "$a52" = "yes" ; then
  1682. echo "#define CONFIG_AC3 1" >> $TMPH
  1683. echo "CONFIG_AC3=yes" >> config.mak
  1684. if test "$a52bin" = "yes" ; then
  1685. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1686. echo "CONFIG_A52BIN=yes" >> config.mak
  1687. fi
  1688. fi
  1689. # DTS
  1690. if test "$dts" = "yes" ; then
  1691. echo "#define CONFIG_DTS 1" >> $TMPH
  1692. echo "CONFIG_DTS=yes" >> config.mak
  1693. fi
  1694. # PP
  1695. if test "$pp" = "yes" ; then
  1696. echo "#define CONFIG_PP 1" >> $TMPH
  1697. echo "CONFIG_PP=yes" >> config.mak
  1698. fi
  1699. if test "$swscaler" = "yes" ; then
  1700. echo "#define CONFIG_SWSCALER 1" >> $TMPH
  1701. echo "CONFIG_SWSCALER=yes" >> config.mak
  1702. fi
  1703. # MPEG audio high precision mode
  1704. if test "$mpegaudio_hp" = "yes" ; then
  1705. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1706. fi
  1707. if test "$v4l" = "yes" ; then
  1708. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1709. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1710. fi
  1711. if test "$v4l2" = "yes" ; then
  1712. echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
  1713. echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
  1714. fi
  1715. if test "$bktr" = "yes" ; then
  1716. echo "#define CONFIG_BKTR 1" >> $TMPH
  1717. echo "CONFIG_BKTR=yes" >> config.mak
  1718. fi
  1719. if test "$dv1394" = "yes" ; then
  1720. echo "#define CONFIG_DV1394 1" >> $TMPH
  1721. echo "CONFIG_DV1394=yes" >> config.mak
  1722. fi
  1723. if test "$dc1394" = "yes" ; then
  1724. echo "#define CONFIG_DC1394 1" >> $TMPH
  1725. echo "CONFIG_DC1394=yes" >> config.mak
  1726. fi
  1727. if test "$dlopen" = "yes" ; then
  1728. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1729. fi
  1730. if test "$dlfcn" = "yes" ; then
  1731. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1732. fi
  1733. if test "$audio_oss" = "yes" ; then
  1734. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1735. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1736. fi
  1737. if test "$audio_beos" = "yes" ; then
  1738. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1739. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1740. fi
  1741. if test "$network" = "yes" ; then
  1742. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1743. echo "CONFIG_NETWORK=yes" >> config.mak
  1744. fi
  1745. if test "$ipv6" = "yes" ; then
  1746. echo "#define CONFIG_IPV6 1" >> $TMPH
  1747. fi
  1748. if test "$zlib" = "yes" ; then
  1749. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1750. echo "CONFIG_ZLIB=yes" >> config.mak
  1751. fi
  1752. if test "$libgsm" = "yes" ; then
  1753. echo "#define CONFIG_LIBGSM 1" >> $TMPH
  1754. echo "CONFIG_LIBGSM=yes" >> config.mak
  1755. fi
  1756. if test "$mp3lame" = "yes" ; then
  1757. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1758. echo "CONFIG_MP3LAME=yes" >> config.mak
  1759. fi
  1760. if test "$libogg" = "yes" ; then
  1761. echo "#define CONFIG_LIBOGG 1" >> $TMPH
  1762. echo "CONFIG_LIBOGG=yes" >> config.mak
  1763. fi
  1764. if test "$vorbis" = "yes" ; then
  1765. echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
  1766. echo "CONFIG_LIBVORBIS=yes" >> config.mak
  1767. fi
  1768. if test "$faad" = "yes" ; then
  1769. echo "#define CONFIG_FAAD 1" >> $TMPH
  1770. echo "CONFIG_FAAD=yes" >> config.mak
  1771. fi
  1772. if test "$faadbin" = "yes" ; then
  1773. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1774. echo "CONFIG_FAADBIN=yes" >> config.mak
  1775. fi
  1776. if test "$faac" = "yes" ; then
  1777. echo "#define CONFIG_FAAC 1" >> $TMPH
  1778. echo "CONFIG_FAAC=yes" >> config.mak
  1779. fi
  1780. if test "$xvid" = "yes" ; then
  1781. echo "#define CONFIG_XVID 1" >> $TMPH
  1782. echo "CONFIG_XVID=yes" >> config.mak
  1783. fi
  1784. if test "$x264" = "yes" ; then
  1785. echo "#define CONFIG_X264 1" >> $TMPH
  1786. echo "CONFIG_X264=yes" >> config.mak
  1787. fi
  1788. if test "$mingw32" = "yes" ; then
  1789. echo "CONFIG_MINGW=yes" >> config.mak
  1790. echo "HAVE_W32THREADS=yes" >> config.mak
  1791. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1792. echo "#define HAVE_THREADS 1" >> $TMPH
  1793. echo "#ifndef __MINGW32__" >> $TMPH
  1794. echo "#define __MINGW32__ 1" >> $TMPH
  1795. echo "#endif" >> $TMPH
  1796. fi
  1797. if test "$mingwce" = "yes" ; then
  1798. echo "CONFIG_MINGW=yes" >> config.mak
  1799. echo "#define CONFIG_WINCE 1" >> $TMPH
  1800. echo "CONFIG_WINCE=yes" >> config.mak
  1801. echo "#ifndef __MINGW32__" >> $TMPH
  1802. echo "#define __MINGW32__ 1" >> $TMPH
  1803. echo "#endif" >> $TMPH
  1804. fi
  1805. if test "$os2" = "yes" ; then
  1806. echo "#define CONFIG_OS2 1" >> $TMPH
  1807. echo "CONFIG_OS2=yes" >> config.mak
  1808. echo "HAVE_OS2THREADS=yes" >> config.mak
  1809. echo "#define HAVE_OS2THREADS 1" >> $TMPH
  1810. echo "#define HAVE_THREADS 1" >> $TMPH
  1811. fi
  1812. if test "$targetos" = "SunOS" ; then
  1813. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1814. fi
  1815. if test "$targetos" = "BeOS" ; then
  1816. echo "HAVE_BEOSTHREADS=yes" >> config.mak
  1817. echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
  1818. echo "#define HAVE_THREADS 1" >> $TMPH
  1819. fi
  1820. if test "$targetos" = "Darwin"; then
  1821. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1822. echo "CONFIG_DARWIN=yes" >> config.mak
  1823. fi
  1824. if test "$_malloc_h" = "yes" ; then
  1825. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1826. else
  1827. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1828. fi
  1829. if test "$_memalign" = "yes" ; then
  1830. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1831. else
  1832. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1833. fi
  1834. if test "$memalignhack" = "yes" ; then
  1835. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1836. fi
  1837. if test "$netserver" = "yes" ; then
  1838. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1839. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1840. fi
  1841. if test "$need_inet_aton" = "yes" ; then
  1842. echo "NEED_INET_ATON=yes" >> config.mak
  1843. fi
  1844. if test "$simpleidct" = "yes" ; then
  1845. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1846. fi
  1847. if test "$protocols" = "yes" ; then
  1848. echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
  1849. echo "CONFIG_PROTOCOLS=yes" >> config.mak
  1850. fi
  1851. if test "$ffserver" = "yes" ; then
  1852. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1853. echo "CONFIG_FFSERVER=yes" >> config.mak
  1854. fi
  1855. if test "$ffplay" = "yes" ; then
  1856. echo "CONFIG_FFPLAY=yes" >> config.mak
  1857. fi
  1858. if test "$gpl" = "yes" ; then
  1859. echo "#define CONFIG_GPL 1" >> $TMPH
  1860. echo "CONFIG_GPL=yes" >> config.mak
  1861. fi
  1862. echo "#define restrict $_restrict" >> $TMPH
  1863. if test "$optimize" = "small"; then
  1864. echo "#define always_inline" >> $TMPH
  1865. echo "#define CONFIG_SMALL 1" >> $TMPH
  1866. fi
  1867. # build tree in object directory if source path is different from current one
  1868. if test "$source_path_used" = "yes" ; then
  1869. DIRS="\
  1870. doc \
  1871. libavformat \
  1872. libavcodec \
  1873. libavcodec/alpha \
  1874. libavcodec/armv4l \
  1875. libavcodec/i386 \
  1876. libavcodec/sparc \
  1877. libavcodec/mlib \
  1878. libavcodec/ppc \
  1879. libavcodec/liba52 \
  1880. libpostproc \
  1881. libavutil \
  1882. libswscale \
  1883. tests \
  1884. vhook \
  1885. "
  1886. FILES="\
  1887. Makefile \
  1888. libavformat/Makefile \
  1889. libavcodec/Makefile \
  1890. libpostproc/Makefile \
  1891. libavutil/Makefile \
  1892. libswscale/Makefile \
  1893. tests/Makefile \
  1894. vhook/Makefile \
  1895. doc/Makefile \
  1896. doc/texi2pod.pl \
  1897. "
  1898. for dir in $DIRS ; do
  1899. mkdir -p $dir
  1900. done
  1901. for f in $FILES ; do
  1902. ln -sf "$source_path/$f" $f
  1903. done
  1904. fi
  1905. echo "SRC_PATH=$source_path" >> config.mak
  1906. echo "BUILD_ROOT=$PWD" >> config.mak
  1907. if test "$amr" = "yes" ; then
  1908. echo "#define CONFIG_AMR 1" >> $TMPH
  1909. echo "CONFIG_AMR=yes" >> config.mak
  1910. fi
  1911. if test "$amr_wb" = "yes" ; then
  1912. echo "#define CONFIG_AMR_WB 1" >> $TMPH
  1913. echo "CONFIG_AMR_WB=yes" >> config.mak
  1914. echo
  1915. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1916. echo "V5.1.0 from "
  1917. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1918. echo "and extracted the source to libavcodec/amrwb_float"
  1919. fi
  1920. if test "$amr_nb" = "yes" ; then
  1921. echo "#define CONFIG_AMR_NB 1" >> $TMPH
  1922. echo "CONFIG_AMR_NB=yes" >> config.mak
  1923. echo
  1924. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1925. echo "REL-5 V5.1.0 from "
  1926. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
  1927. echo "and extracted the source to libavcodec/amr_float"
  1928. echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
  1929. fi
  1930. if test "$amr_nb_fixed" = "yes" ; then
  1931. echo "#define CONFIG_AMR_NB_FIXED 1" >> $TMPH
  1932. echo "CONFIG_AMR_NB_FIXED=yes" >> config.mak
  1933. echo
  1934. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1935. echo "REL-5 version 5.1.0 from "
  1936. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
  1937. echo "and extracted src to libavcodec/amr"
  1938. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1939. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1940. fi
  1941. if test "$amr_if2" = "yes" ; then
  1942. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1943. fi
  1944. # Apparently it's not possible to portably echo a backslash.
  1945. if test "$asmalign_pot" = "yes" ; then
  1946. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
  1947. else
  1948. printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
  1949. fi
  1950. for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
  1951. echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
  1952. echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
  1953. done
  1954. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  1955. diff $TMPH config.h >/dev/null 2>&1
  1956. if test "$?" != "0" ; then
  1957. mv -f $TMPH config.h
  1958. else
  1959. echo "config.h is unchanged"
  1960. fi
  1961. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
  1962. # build pkg-config files libav*.pc and libpostproc.pc
  1963. # libavutil.pc
  1964. cat <<EOF >libavutil.pc
  1965. prefix=$PREFIX
  1966. exec_prefix=\${prefix}
  1967. libdir=\${exec_prefix}/lib
  1968. includedir=\${prefix}/include
  1969. Name: libavutil
  1970. Description: FFmpeg utility library
  1971. Version: $lavu_version
  1972. Requires:
  1973. Conflicts:
  1974. Libs: -L\${libdir} -lavutil
  1975. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  1976. EOF
  1977. cat <<EOF >libavutil-uninstalled.pc
  1978. prefix=
  1979. exec_prefix=
  1980. libdir=\${pcfiledir}/libavutil
  1981. includedir=\${pcfiledir}/libavutil
  1982. Name: libavutil
  1983. Description: FFmpeg utility library
  1984. Version: $lavu_version
  1985. Requires:
  1986. Conflicts:
  1987. Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
  1988. Cflags: -I\${includedir}
  1989. EOF
  1990. # libavcodec.pc
  1991. cat <<EOF >libavcodec.pc
  1992. prefix=$PREFIX
  1993. exec_prefix=\${prefix}
  1994. libdir=\${exec_prefix}/lib
  1995. includedir=\${prefix}/include
  1996. Name: libavcodec
  1997. Description: FFmpeg codec library
  1998. Version: $lavc_version
  1999. Requires: $pkg_requires libavutil = $lavu_version
  2000. Conflicts:
  2001. Libs: -L\${libdir} -lavcodec $extralibs
  2002. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  2003. EOF
  2004. cat <<EOF >libavcodec-uninstalled.pc
  2005. prefix=
  2006. exec_prefix=
  2007. libdir=\${pcfiledir}/libavcodec
  2008. includedir=\${pcfiledir}/libavcodec
  2009. Name: libavcodec
  2010. Description: FFmpeg codec library
  2011. Version: $lavc_version
  2012. Requires: $pkg_requires libavutil = $lavu_version
  2013. Conflicts:
  2014. Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
  2015. Cflags: -I\${includedir}
  2016. EOF
  2017. # libavformat.pc
  2018. cat <<EOF >libavformat.pc
  2019. prefix=$PREFIX
  2020. exec_prefix=\${prefix}
  2021. libdir=\${exec_prefix}/lib
  2022. includedir=\${prefix}/include
  2023. Name: libavformat
  2024. Description: FFmpeg container format library
  2025. Version: $lavf_version
  2026. Requires: $pkg_requires libavcodec = $lavc_version
  2027. Conflicts:
  2028. Libs: -L\${libdir} -lavformat $extralibs
  2029. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  2030. EOF
  2031. cat <<EOF >libavformat-uninstalled.pc
  2032. prefix=
  2033. exec_prefix=
  2034. libdir=\${pcfiledir}/libavformat
  2035. includedir=\${pcfiledir}/libavformat
  2036. Name: libavformat
  2037. Description: FFmpeg container format library
  2038. Version: $lavf_version
  2039. Requires: $pkg_requires libavcodec = $lavc_version
  2040. Conflicts:
  2041. Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
  2042. Cflags: -I\${includedir}
  2043. EOF
  2044. # libpostproc.pc
  2045. cat <<EOF >libpostproc.pc
  2046. prefix=$PREFIX
  2047. exec_prefix=\${prefix}
  2048. libdir=\${exec_prefix}/lib
  2049. includedir=\${prefix}/include
  2050. Name: libpostproc
  2051. Description: FFmpeg post processing library
  2052. Version: $lavc_version
  2053. Requires:
  2054. Conflicts:
  2055. Libs: -L\${libdir} -lpostproc
  2056. Cflags: -I\${includedir} -I\${includedir}/postproc
  2057. EOF
  2058. cat <<EOF >libpostproc-uninstalled.pc
  2059. prefix=
  2060. exec_prefix=
  2061. libdir=\${pcfiledir}/libpostproc
  2062. includedir=\${pcfiledir}/libpostproc
  2063. Name: libpostproc
  2064. Description: FFmpeg post processing library
  2065. Version: $lavc_version
  2066. Requires:
  2067. Conflicts:
  2068. Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
  2069. Cflags: -I\${includedir}
  2070. EOF
  2071. # libswscale.pc
  2072. cat <<EOF >libswscale.pc
  2073. prefix=$PREFIX
  2074. exec_prefix=\${prefix}
  2075. libdir=\${exec_prefix}/lib
  2076. includedir=\${prefix}/include
  2077. Name: libswscale
  2078. Description: FFmpeg image rescaling library
  2079. Version: $sws_version
  2080. Requires: $pkg_requires libavutil = $lavu_version
  2081. Conflicts:
  2082. Libs: -L\${libdir} -lswscale
  2083. Cflags: -I\${includedir} -I\${includedir}/swscale
  2084. EOF
  2085. cat <<EOF >libswscale-uninstalled.pc
  2086. prefix=
  2087. exec_prefix=
  2088. libdir=\${pcfiledir}/libswscale
  2089. includedir=\${pcfiledir}/libswscale
  2090. Name: libswscale
  2091. Description: FFmpeg image rescaling library
  2092. Version: $sws_version
  2093. Requires: $pkg_requires libavutil = $lavu_version
  2094. Conflicts:
  2095. Libs: \${libdir}/${LIBPREF}swscale${LIBSUF}
  2096. Cflags: -I\${includedir}
  2097. EOF