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.

2286 lines
60KB

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