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.

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