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.

2127 lines
55KB

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