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.

2112 lines
54KB

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