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.

2189 lines
56KB

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