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.

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