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.

2207 lines
57KB

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