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.

2249 lines
59KB

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