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.

2272 lines
59KB

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