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.

2236 lines
58KB

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