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.

1604 lines
39KB

  1. #!/bin/sh
  2. #
  3. # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  6. cat << EOF
  7. Usage: configure [options]
  8. Options: [defaults in brackets after descriptions]
  9. EOF
  10. echo "Standard options:"
  11. echo " --help print this message"
  12. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  13. echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
  14. echo " --mandir=DIR man documentation 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-xvid enable xvid support via xvidcore [default=no]"
  23. echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
  24. echo " --enable-mingw32 enable mingw32 native/cross windows compile"
  25. echo " --enable-a52 enable GPL'ed A52 support [default=no]"
  26. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  27. echo " --enable-dts enable GPL'ed DTS support [default=no]"
  28. echo " --enable-pp enable GPL'ed post processing support [default=no]"
  29. echo " --enable-shared-pp use libpostproc.so [default=no]"
  30. echo " --enable-shared build shared libraries [default=no]"
  31. echo " --enable-amr_nb enable amr_nb float audio codec"
  32. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  33. echo " --enable-amr_wb enable amr_wb float audio codec"
  34. echo " --enable-sunmlib use Sun medialib [default=no]"
  35. echo " --enable-pthreads use pthreads [default=no]"
  36. echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]"
  37. echo " --enable-gpl allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
  38. echo ""
  39. echo "Advanced options (experts only):"
  40. echo " --source-path=PATH path of source code [$source_path]"
  41. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  42. echo " --cc=CC use C compiler CC [$cc]"
  43. echo " --make=MAKE use specified make [$make]"
  44. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  45. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  46. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  47. echo " --cpu=CPU force cpu to CPU [$cpu]"
  48. echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
  49. echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
  50. echo " --disable-mmx disable mmx usage"
  51. echo " --disable-altivec disable AltiVec usage"
  52. echo " --disable-audio-oss disable OSS audio support [default=no]"
  53. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  54. echo " --disable-v4l disable video4linux grabbing [default=no]"
  55. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  56. echo " --disable-network disable network support [default=no]"
  57. echo " --disable-zlib disable zlib [default=no]"
  58. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  59. echo " --disable-vhook disable video hooking support"
  60. echo " --enable-gprof enable profiling with gprof [$gprof]"
  61. echo " --disable-debug disable debugging symbols"
  62. echo " --disable-opts disable compiler optimizations"
  63. echo " --disable-mpegaudio-hp faster (but less accurate)"
  64. echo " mpegaudio decoding [default=no]"
  65. echo " --disable-ffserver disable ffserver build"
  66. echo " --disable-ffplay disable ffplay build"
  67. echo " --enable-small optimize for size instead of speed"
  68. echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
  69. echo " --disable-strip disable stripping of executables and shared libraries"
  70. echo " --enable-codec=codec enables codec"
  71. echo " --disable-codec=codec disables codec"
  72. echo " --disable-encoders disables all encoders"
  73. echo ""
  74. echo "NOTE: The object files are build at the place where configure is launched"
  75. exit 1
  76. fi
  77. # set temporary file name
  78. if test ! -z "$TMPDIR" ; then
  79. TMPDIR1="${TMPDIR}"
  80. elif test ! -z "$TEMPDIR" ; then
  81. TMPDIR1="${TEMPDIR}"
  82. else
  83. TMPDIR1="/tmp"
  84. fi
  85. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  86. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  87. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  88. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  89. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  90. # default parameters
  91. prefix="/usr/local"
  92. libdir=""
  93. mandir=""
  94. bindir=""
  95. cross_prefix=""
  96. cc="gcc"
  97. ar="ar"
  98. ranlib="ranlib"
  99. make="make"
  100. strip="strip"
  101. cpu=`uname -m`
  102. tune="generic"
  103. powerpc_perf="no"
  104. mmx="default"
  105. altivec="default"
  106. mmi="default"
  107. case "$cpu" in
  108. i386|i486|i586|i686|i86pc|BePC)
  109. cpu="x86"
  110. ;;
  111. x86_64)
  112. if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
  113. -z "`echo $CFLAGS | grep -- -m32`" ]; then
  114. cpu="x86_64"
  115. else
  116. cpu="x86"
  117. fi
  118. ;;
  119. # armv4l is a subset of armv5tel
  120. armv4l|armv5tel)
  121. cpu="armv4l"
  122. ;;
  123. alpha)
  124. cpu="alpha"
  125. ;;
  126. "Power Macintosh"|ppc)
  127. cpu="powerpc"
  128. ;;
  129. mips)
  130. cpu="mips"
  131. ;;
  132. sun4u|sparc64)
  133. cpu="sparc64"
  134. ;;
  135. sparc)
  136. cpu="sparc"
  137. ;;
  138. sh4)
  139. cpu="sh4"
  140. ;;
  141. *)
  142. cpu="unknown"
  143. ;;
  144. esac
  145. gprof="no"
  146. v4l="yes"
  147. audio_oss="yes"
  148. audio_beos="no"
  149. dv1394="yes"
  150. dc1394="no"
  151. network="yes"
  152. zlib="yes"
  153. mp3lame="no"
  154. libogg="no"
  155. vorbis="no"
  156. theora="no"
  157. faad="no"
  158. faadbin="no"
  159. faac="no"
  160. xvid="no"
  161. x264="no"
  162. a52="no"
  163. a52bin="no"
  164. dts="no"
  165. pp="no"
  166. shared_pp="no"
  167. mingw32="no"
  168. cygwin="no"
  169. os2="no"
  170. lshared="no"
  171. optimize="yes"
  172. debug="yes"
  173. dostrip="yes"
  174. extralibs="-lm"
  175. simpleidct="yes"
  176. bigendian="no"
  177. inttypes="yes"
  178. emu_fast_int="no"
  179. vhook="default"
  180. dlfcn="no"
  181. dlopen="no"
  182. mpegaudio_hp="yes"
  183. SHFLAGS=-shared
  184. netserver="no"
  185. need_inet_aton="no"
  186. ffserver="yes"
  187. ffplay="yes"
  188. LDFLAGS=-Wl,--warn-common
  189. FFSLDFLAGS=-Wl,-E
  190. LIBPREF="lib"
  191. LIBSUF=".a"
  192. SLIBPREF="lib"
  193. SLIBSUF=".so"
  194. EXESUF=""
  195. amr_nb="no"
  196. amr_wb="no"
  197. amr_nb_fixed="no"
  198. amr_if2="no"
  199. sunmlib="no"
  200. pthreads="no"
  201. gpl="no"
  202. memalignhack="no"
  203. # OS specific
  204. targetos=`uname -s`
  205. case $targetos in
  206. BeOS)
  207. prefix="/boot/home/config"
  208. # helps building libavcodec
  209. CFLAGS="-DPIC -fomit-frame-pointer"
  210. # 3 gcc releases known for BeOS, each with ugly bugs
  211. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  212. case "$gcc_version" in
  213. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  214. mmx="no"
  215. ;;
  216. *20010315*) echo "BeBits gcc"
  217. CFLAGS="$CFLAGS -fno-expensive-optimizations"
  218. ;;
  219. esac
  220. SHFLAGS=-nostart
  221. # disable linux things
  222. audio_oss="no"
  223. v4l="no"
  224. dv1394="no"
  225. # enable beos things
  226. audio_beos="yes"
  227. # no need for libm, but the inet stuff
  228. # Check for BONE
  229. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  230. extralibs="-lbind -lsocket"
  231. else
  232. netserver="yes"
  233. need_inet_aton="yes"
  234. extralibs="-lnet"
  235. fi ;;
  236. SunOS)
  237. v4l="no"
  238. audio_oss="no"
  239. dv1394="no"
  240. make="gmake"
  241. LDFLAGS=""
  242. FFSLDFLAGS=""
  243. need_inet_aton="yes"
  244. extralibs="$extralibs -lsocket -lnsl"
  245. ;;
  246. NetBSD)
  247. v4l="no"
  248. audio_oss="yes"
  249. dv1394="no"
  250. make="gmake"
  251. LDFLAGS="$LDFLAGS -export-dynamic"
  252. case `uname -r` in
  253. 2.*) extralibs="-lossaudio"
  254. ;;
  255. esac
  256. ;;
  257. FreeBSD)
  258. v4l="no"
  259. audio_oss="yes"
  260. dv1394="no"
  261. make="gmake"
  262. CFLAGS="-pthread"
  263. LDFLAGS="$LDFLAGS -export-dynamic -pthread"
  264. ;;
  265. BSD/OS)
  266. v4l="no"
  267. audio_oss="yes"
  268. dv1394="no"
  269. extralibs="-lpoll -lgnugetopt -lm"
  270. make="gmake"
  271. ;;
  272. Darwin)
  273. cc="cc"
  274. v4l="no"
  275. audio_oss="no"
  276. dv1394="no"
  277. ffserver="no"
  278. SHFLAGS="-dynamiclib"
  279. extralibs=""
  280. darwin="yes"
  281. strip="strip -x"
  282. LDFLAGS="-Wl,-d,-search_paths_first"
  283. FFSLDFLAGS=-Wl,-bind_at_load
  284. ;;
  285. MINGW32*)
  286. # Note: the rest of the mingw32 config is done afterwards as mingw32
  287. # can be forced on command line for linux cross compilation
  288. mingw32="yes"
  289. ;;
  290. CYGWIN*)
  291. v4l="no"
  292. audio_oss="yes"
  293. dv1394="no"
  294. ffserver="no"
  295. extralibs=""
  296. cygwin="yes"
  297. EXESUF=".exe"
  298. test -f /usr/include/inttypes.h || \
  299. test -f /usr/local/include/inttypes.h || \
  300. echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
  301. "/usr/local/include/inttypes.h !!!"
  302. ;;
  303. Linux)
  304. LDFLAGS="$LDFLAGS -rdynamic"
  305. ;;
  306. IRIX*)
  307. ranlib="echo ignoring ranlib"
  308. v4l="no"
  309. audio_oss="no"
  310. make="gmake"
  311. ;;
  312. OS/2)
  313. TMPE=$TMPE".exe"
  314. ar="emxomfar -p128"
  315. ranlib="echo ignoring ranlib"
  316. strip="echo ignoring strip"
  317. CFLAGS="-Zomf"
  318. LDFLAGS="-Zomf -Zstack 16384 -s"
  319. SHFLAGS="-Zdll -Zomf"
  320. FFSLDFLAGS=""
  321. LIBPREF=""
  322. LIBSUF=".lib"
  323. SLIBPREF=""
  324. SLIBSUF=".dll"
  325. EXESUF=".exe"
  326. extralibs=""
  327. v4l="no"
  328. audio_oss="no"
  329. dv1394="no"
  330. network="no"
  331. ffserver="no"
  332. vhook="no"
  333. os2="yes"
  334. ;;
  335. *) ;;
  336. esac
  337. # From mplayer configure. We need TARGET_OS available
  338. # to the Makefile, so it can distinguish between flavors
  339. # of AltiVec on PowerPC
  340. TARGET_OS=`( uname -s ) 2>&1`
  341. case "$TARGET_OS" in
  342. Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
  343. ;;
  344. IRIX*)
  345. TARGET_OS=IRIX
  346. ;;
  347. HP-UX*)
  348. TARGET_OS=HP-UX
  349. ;;
  350. [cC][yY][gG][wW][iI][nN]*)
  351. TARGET_OS=CYGWIN
  352. ;;
  353. *)
  354. TARGET_OS="$TARGET_OS-UNKNOWN"
  355. ;;
  356. esac
  357. # find source path
  358. # XXX: we assume an absolute path is given when launching configure,
  359. # except in './configure' case.
  360. source_path="`echo $0 | sed -e 's#/configure##'`"
  361. source_path_used="yes"
  362. if test -z "$source_path" -o "$source_path" = "." ; then
  363. source_path=`pwd`
  364. source_path_used="no"
  365. fi
  366. FFMPEG_CONFIGURATION=" "
  367. for opt do
  368. FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
  369. done
  370. CODEC_LIST=`grep 'register_avcodec(&[a-z]' libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
  371. for opt do
  372. case "$opt" in
  373. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  374. ;;
  375. --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
  376. ;;
  377. --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  378. ;;
  379. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  380. ;;
  381. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  382. ;;
  383. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  384. ;;
  385. --make=*) make=`echo $opt | cut -d '=' -f 2`
  386. ;;
  387. --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
  388. ;;
  389. --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
  390. ;;
  391. --extra-libs=*) extralibs=${opt#--extra-libs=}
  392. ;;
  393. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  394. ;;
  395. --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  396. ;;
  397. --powerpc-perf-enable) powerpc_perf="yes"
  398. ;;
  399. --disable-mmx) mmx="no"
  400. ;;
  401. --disable-altivec) altivec="no"
  402. ;;
  403. --enable-gprof) gprof="yes"
  404. ;;
  405. --disable-v4l) v4l="no"
  406. ;;
  407. --disable-audio-oss) audio_oss="no"
  408. ;;
  409. --disable-audio-beos) audio_beos="no"
  410. ;;
  411. --disable-dv1394) dv1394="no"
  412. ;;
  413. --disable-network) network="no"; ffserver="no"
  414. ;;
  415. --disable-zlib) zlib="no"
  416. ;;
  417. --enable-a52) a52="yes"
  418. ;;
  419. --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
  420. ;;
  421. --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
  422. ;;
  423. --enable-pp) pp="yes"
  424. ;;
  425. --enable-shared-pp) shared_pp="yes"
  426. ;;
  427. --enable-mp3lame) mp3lame="yes"
  428. ;;
  429. --enable-libogg) libogg="yes"
  430. ;;
  431. --enable-vorbis) vorbis="yes"
  432. ;;
  433. --enable-theora) theora="yes"
  434. ;;
  435. --enable-faad) faad="yes"
  436. ;;
  437. --enable-faadbin) faadbin="yes"
  438. ;;
  439. --enable-faac) faac="yes"
  440. ;;
  441. --enable-xvid) xvid="yes"
  442. ;;
  443. --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
  444. ;;
  445. --enable-dc1394) dc1394="yes"
  446. ;;
  447. --disable-vhook) vhook="no"
  448. ;;
  449. --disable-simple_idct) simpleidct="no"
  450. ;;
  451. --enable-mingw32) mingw32="yes"
  452. ;;
  453. --enable-shared) lshared="yes"
  454. ;;
  455. --disable-debug) debug="no"
  456. ;;
  457. --disable-opts) optimize="no"
  458. ;;
  459. --disable-mpegaudio-hp) mpegaudio_hp="no"
  460. ;;
  461. --disable-ffserver) ffserver="no"
  462. ;;
  463. --disable-ffplay) ffplay="no"
  464. ;;
  465. --enable-small) optimize="small"
  466. ;;
  467. --enable-amr_nb) amr_nb="yes"
  468. ;;
  469. --enable-amr_nb-fixed) amr_nb_fixed="yes"
  470. ;;
  471. --enable-amr_wb) amr_wb="yes"
  472. ;;
  473. --enable-amr_if2) amr_if2="yes"
  474. ;;
  475. --enable-sunmlib) sunmlib="yes"
  476. ;;
  477. --enable-pthreads) pthreads="yes"
  478. ;;
  479. --enable-gpl) gpl="yes"
  480. ;;
  481. --enable-memalign-hack) memalignhack="yes"
  482. ;;
  483. --disable-strip) dostrip="no"
  484. ;;
  485. --enable-codec=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-codec=}"
  486. ;;
  487. --disable-codec=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-codec=}##\"`"
  488. ;;
  489. --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  490. ;;
  491. esac
  492. done
  493. if test "$theora" = "yes" ; then
  494. if test "$libogg" = "no"; then
  495. echo "libogg must be enabled to enable Theora"
  496. fail="yes"
  497. theora="no"
  498. fi
  499. fi
  500. if test "$vorbis" = "yes" ; then
  501. if test "$libogg" = "no"; then
  502. echo "libogg must be enabled to enable Vorbis"
  503. fail="yes"
  504. vorbis="no"
  505. fi
  506. fi
  507. if test "$gpl" != "yes"; then
  508. if test "$pp" != "no" -o "$shared_pp" != "no"; then
  509. echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
  510. fail="yes"
  511. fi
  512. if test "$a52" != "no" -o "$a52bin" != "no"; then
  513. echo "liba52 is under GPL and --enable-gpl is not specified"
  514. fail="yes"
  515. fi
  516. if test "$xvid" != "no"; then
  517. echo "libxvidcore is under GPL and --enable-gpl is not specified"
  518. fail="yes"
  519. fi
  520. if test "$x264" != "no"; then
  521. echo "x264 is under GPL and --enable-gpl is not specified"
  522. fail="yes"
  523. fi
  524. if test "$dts" != "no"; then
  525. echo "libdts is under GPL and --enable-gpl is not specified"
  526. fail="yes"
  527. fi
  528. if test "$faad" != "no" -o "$faadbin" != "no"; then
  529. cat > $TMPC << EOF
  530. #include <faad.h>
  531. int main( void ) { return 0; }
  532. EOF
  533. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  534. cat > $TMPC << EOF
  535. #include <faad.h>
  536. #ifndef FAAD2_VERSION
  537. ok faad1
  538. #endif
  539. int main( void ) { return 0; }
  540. EOF
  541. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  542. echo "faad2 is under GPL and --enable-gpl is not specified"
  543. fail="yes"
  544. fi
  545. else
  546. faad="no"
  547. faadbin="no"
  548. echo "faad test failed"
  549. fi
  550. fi
  551. if test "$fail" = "yes"; then
  552. exit 1
  553. fi
  554. fi
  555. # compute mmx state
  556. if test $mmx = "default"; then
  557. if test $cpu = "x86" -o $cpu = "x86_64"; then
  558. mmx="yes"
  559. else
  560. mmx="no"
  561. fi
  562. fi
  563. #Darwin CC versions
  564. needmdynamicnopic="no"
  565. if test $targetos = Darwin; then
  566. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  567. CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  568. else
  569. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  570. case "$gcc_version" in
  571. *2.95*)
  572. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  573. ;;
  574. *[34].*)
  575. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
  576. if test "$lshared" = no; then
  577. needmdynamicnopic="yes"
  578. fi
  579. ;;
  580. *)
  581. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  582. if test "$lshared" = no; then
  583. needmdynamicnopic="yes"
  584. fi
  585. ;;
  586. esac
  587. fi
  588. fi
  589. # Can only do AltiVec on PowerPC
  590. if test $altivec = "default"; then
  591. if test $cpu = "powerpc"; then
  592. altivec="yes"
  593. else
  594. altivec="no"
  595. fi
  596. fi
  597. # Add processor-specific flags
  598. TUNECPU="generic"
  599. POWERPCMODE="32bits"
  600. if test $tune != "generic"; then
  601. case $tune in
  602. 601|ppc601|PowerPC601)
  603. CFLAGS="$CFLAGS -mcpu=601"
  604. if test $altivec = "yes"; then
  605. echo "WARNING: tuning for PPC601 but altivec enabled !";
  606. fi
  607. TUNECPU=ppc601
  608. ;;
  609. 603*|ppc603*|PowerPC603*)
  610. CFLAGS="$CFLAGS -mcpu=603"
  611. if test $altivec = "yes"; then
  612. echo "WARNING: tuning for PPC603 but altivec enabled !";
  613. fi
  614. TUNECPU=ppc603
  615. ;;
  616. 604*|ppc604*|PowerPC604*)
  617. CFLAGS="$CFLAGS -mcpu=604"
  618. if test $altivec = "yes"; then
  619. echo "WARNING: tuning for PPC604 but altivec enabled !";
  620. fi
  621. TUNECPU=ppc604
  622. ;;
  623. G3|g3|75*|ppc75*|PowerPC75*)
  624. CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
  625. if test $altivec = "yes"; then
  626. echo "WARNING: tuning for PPC75x but altivec enabled !";
  627. fi
  628. TUNECPU=ppc750
  629. ;;
  630. G4|g4|745*|ppc745*|PowerPC745*)
  631. CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
  632. if test $altivec = "no"; then
  633. echo "WARNING: tuning for PPC745x but altivec disabled !";
  634. fi
  635. TUNECPU=ppc7450
  636. ;;
  637. 74*|ppc74*|PowerPC74*)
  638. CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
  639. if test $altivec = "no"; then
  640. echo "WARNING: tuning for PPC74xx but altivec disabled !";
  641. fi
  642. TUNECPU=ppc7400
  643. ;;
  644. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  645. CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
  646. if test $altivec = "no"; then
  647. echo "WARNING: tuning for PPC970 but altivec disabled !";
  648. fi
  649. TUNECPU=ppc970
  650. POWERPCMODE="64bits"
  651. ;;
  652. *)
  653. echo "WARNING: unknown CPU "$tune", ignored"
  654. ;;
  655. esac
  656. fi
  657. # AltiVec flags: The FSF version of GCC differs from the Apple version
  658. if test $cpu = "powerpc"; then
  659. if test $altivec = "yes"; then
  660. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  661. CFLAGS="$CFLAGS -faltivec"
  662. else
  663. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  664. fi
  665. fi
  666. fi
  667. # See if we have <altivec.h>
  668. cat > $TMPC << EOF
  669. #include <altivec.h>
  670. int main( void ) { return 0; }
  671. EOF
  672. _altivec_h="no"
  673. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  674. _altivec_h="yes"
  675. fi
  676. # See does our compiler support Motorola AltiVec C API
  677. if test $altivec = "yes"; then
  678. if test $_altivec_h = "yes"; then
  679. cat > $TMPC << EOF
  680. #include <altivec.h>
  681. int main(void) {
  682. vector signed int v1, v2, v3;
  683. v1 = vec_add(v2,v3);
  684. return 0;
  685. }
  686. EOF
  687. else
  688. cat > $TMPC << EOF
  689. int main(void) {
  690. vector signed int v1, v2, v3;
  691. v1 = vec_add(v2,v3);
  692. return 0;
  693. }
  694. EOF
  695. fi
  696. $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
  697. fi
  698. # Can only do mmi on mips
  699. if test $mmi = "default"; then
  700. if test $cpu = "mips"; then
  701. mmi="yes"
  702. else
  703. mmi="no"
  704. fi
  705. fi
  706. # See does our compiler support mmi
  707. if test $mmi = "yes"; then
  708. cat > $TMPC << EOF
  709. int main(void) {
  710. __asm__ ("lq \$2, 0(\$2)");
  711. return 0;
  712. }
  713. EOF
  714. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  715. fi
  716. if test "$mingw32" = "yes" ; then
  717. v4l="no"
  718. audio_oss="no"
  719. dv1394="no"
  720. dc1394="no"
  721. ffserver="no"
  722. network="no"
  723. LIBPREF=""
  724. LIBSUF=".lib"
  725. SLIBPREF=""
  726. SLIBSUF=".dll"
  727. EXESUF=".exe"
  728. prefix="/c/Program Files/FFmpeg"
  729. bindir="$prefix"
  730. fi
  731. cc="${cross_prefix}${cc}"
  732. ar="${cross_prefix}${ar}"
  733. ranlib="${cross_prefix}${ranlib}"
  734. strip="${cross_prefix}${strip}"
  735. if test -z "$cross_prefix" ; then
  736. # ---
  737. # big/little endian test
  738. cat > $TMPC << EOF
  739. #include <inttypes.h>
  740. int main(int argc, char ** argv){
  741. volatile uint32_t i=0x01234567;
  742. return (*((uint8_t*)(&i))) == 0x67;
  743. }
  744. EOF
  745. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  746. $TMPE && bigendian="yes"
  747. else
  748. echo big/little test failed
  749. fi
  750. else
  751. # if cross compiling, cannot launch a program, so make a static guess
  752. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  753. bigendian="yes"
  754. fi
  755. fi
  756. # ---
  757. # *inttypes.h* test
  758. cat > $TMPC << EOF
  759. #include <inttypes.h>
  760. int main(int argc, char ** argv){
  761. return 0;
  762. }
  763. EOF
  764. $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
  765. # ---
  766. # *int_fast* test
  767. cat > $TMPC << EOF
  768. #include <inttypes.h>
  769. int main(int argc, char ** argv){
  770. volatile uint_fast64_t i=0x01234567;
  771. return 0;
  772. }
  773. EOF
  774. $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
  775. # ---
  776. # check availability of some header files
  777. cat > $TMPC << EOF
  778. #include <malloc.h>
  779. int main( void ) { return 0; }
  780. EOF
  781. _memalign=no
  782. _malloc_h=no
  783. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  784. _malloc_h=yes
  785. _memalign=yes
  786. # check for memalign - atmos
  787. cat > $TMPC << EOF
  788. #include <stdio.h>
  789. #include <malloc.h>
  790. int main ( void ) {
  791. char *string = NULL;
  792. string = memalign(64, sizeof(char));
  793. return 0;
  794. }
  795. EOF
  796. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  797. fi
  798. if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
  799. echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
  800. exit 1
  801. fi
  802. cat > $TMPC << EOF
  803. #include <time.h>
  804. int main( void ) { localtime_r(NULL, NULL); }
  805. EOF
  806. localtime_r=no
  807. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  808. localtime_r=yes
  809. fi
  810. if test "$zlib" = "yes"; then
  811. # check for zlib - mmu_man
  812. cat > $TMPC << EOF
  813. #include <zlib.h>
  814. int main ( void ) {
  815. if (zlibVersion() != ZLIB_VERSION)
  816. puts("zlib version differs !!!");
  817. return 1;
  818. return 0;
  819. }
  820. EOF
  821. $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  822. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  823. # XXX: more tests needed - runtime test
  824. fi
  825. if test "$zlib" = "yes"; then
  826. extralibs="$extralibs -lz"
  827. fi
  828. # test for lrintf in math.h
  829. cat > $TMPC << EOF
  830. #define _ISOC9X_SOURCE 1
  831. #include <math.h>
  832. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  833. EOF
  834. have_lrintf="no"
  835. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  836. have_lrintf="yes"
  837. # allanc@chickenandporn.com: cannot execute cross-compiled
  838. # code on the host. Only execute if not cross-compiling.
  839. if test -z "$cross_prefix" ; then
  840. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  841. fi
  842. fi
  843. _restrict=
  844. for restrict_keyword in restrict __restrict__ __restrict; do
  845. echo "void foo(char * $restrict_keyword p);" > $TMPC
  846. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  847. _restrict=$restrict_keyword
  848. break;
  849. fi
  850. done
  851. # test gcc version to see if vector builtins can be used
  852. # currently only used on i386 for MMX builtins
  853. cat > $TMPC << EOF
  854. #include <xmmintrin.h>
  855. int main(void) {
  856. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  857. return 0;
  858. #else
  859. #error no vector builtins
  860. #endif
  861. }
  862. EOF
  863. builtin_vector=no
  864. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  865. builtin_vector=yes
  866. fi
  867. # dlopen/dlfcn.h probing
  868. cat > $TMPC << EOF
  869. #include <dlfcn.h>
  870. int main( void ) { return (int) dlopen("foo", 0); }
  871. EOF
  872. ldl=-ldl
  873. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  874. dlfcn=yes
  875. dlopen=yes
  876. fi
  877. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  878. dlfcn=yes
  879. dlopen=yes
  880. ldl=""
  881. fi
  882. cat > $TMPC << EOF
  883. int main( void ) { return (int) dlopen("foo", 0); }
  884. EOF
  885. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  886. dlopen=yes
  887. fi
  888. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  889. dlopen=yes
  890. ldl=""
  891. fi
  892. if test "$vhook" = "default" ; then
  893. vhook="$dlopen"
  894. fi
  895. ##########################################
  896. # imlib probe
  897. cat > $TMPC << EOF
  898. #include <X11/Xlib.h>
  899. #include <Imlib2.h>
  900. int main( void ) { return (int) imlib_load_font("foo"); }
  901. EOF
  902. imlib2=no
  903. if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
  904. imlib2=yes
  905. fi
  906. ##########################################
  907. # freetype probe
  908. cat > $TMPC << EOF
  909. #include <ft2build.h>
  910. int main( void ) { return (int) FT_Init_FreeType(0); }
  911. EOF
  912. freetype2=no
  913. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  914. if (freetype-config --version) >/dev/null 2>&1 ; then
  915. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
  916. freetype2=yes
  917. fi
  918. fi
  919. fi
  920. ##########################################
  921. # SDL probe
  922. cat > $TMPC << EOF
  923. #include <SDL.h>
  924. #undef main /* We don't want SDL to override our main() */
  925. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  926. EOF
  927. sdl_too_old=no
  928. sdl=no
  929. if (sdl-config --version) >/dev/null 2>&1 ; then
  930. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
  931. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  932. if test "$_sdlversion" -lt 121 ; then
  933. sdl_too_old=yes
  934. else
  935. sdl=yes
  936. fi
  937. fi
  938. fi
  939. ##########################################
  940. # texi2html probe
  941. texi2html=no
  942. if (texi2html -version) >/dev/null 2>&1; then
  943. texi2html=yes
  944. fi
  945. if test "$network" = "yes" ; then
  946. ##########################################
  947. # IPv6 probe
  948. cat > $TMPC << EOF
  949. #include <sys/types.h>
  950. #include <sys/socket.h>
  951. #include <netinet/in.h>
  952. #include <netdb.h>
  953. int main( void ) {
  954. struct sockaddr_storage saddr;
  955. struct ipv6_mreq mreq6;
  956. getaddrinfo(0,0,0,0);
  957. getnameinfo(0,0,0,0,0,0,0);
  958. IN6_IS_ADDR_MULTICAST(0);
  959. }
  960. EOF
  961. ipv6=no
  962. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  963. ipv6=yes
  964. fi
  965. fi
  966. case "`$cc -v 2>&1 | grep version`" in
  967. *gcc*)
  968. CFLAGS="-Wall -Wno-switch $CFLAGS"
  969. ;;
  970. *)
  971. ;;
  972. esac
  973. if test "$sdl" = "no" ; then
  974. ffplay=no
  975. fi
  976. if test "$debug" = "yes"; then
  977. CFLAGS="-g $CFLAGS"
  978. fi
  979. if test "$optimize" = "small"; then
  980. # CFLAGS=${CFLAGS//-O3/-Os}
  981. CFLAGS="$CFLAGS -Os"
  982. fi
  983. if test "$optimize" = "yes"; then
  984. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  985. CFLAGS="$CFLAGS -O5"
  986. LDFLAGS="$LDFLAGS -O5"
  987. else
  988. CFLAGS="-O3 $CFLAGS"
  989. fi
  990. fi
  991. if test x"$bindir" = x""; then
  992. bindir="${prefix}/bin"
  993. fi
  994. if test x"$libdir" = x""; then
  995. libdir="${prefix}/lib"
  996. fi
  997. if test x"$mandir" = x""; then
  998. mandir="${prefix}/man"
  999. fi
  1000. echo "Install prefix $prefix"
  1001. echo "Source path $source_path"
  1002. echo "C compiler $cc"
  1003. echo "make $make"
  1004. echo "CPU $cpu ($tune)"
  1005. echo "Big Endian $bigendian"
  1006. echo "inttypes.h $inttypes"
  1007. echo "broken inttypes.h $emu_fast_int"
  1008. if test $cpu = "x86" -o $cpu = "x86_64"; then
  1009. echo "MMX enabled $mmx"
  1010. echo "Vector Builtins $builtin_vector"
  1011. fi
  1012. if test $cpu = "mips"; then
  1013. echo "MMI enabled $mmi"
  1014. fi
  1015. if test $cpu = "powerpc"; then
  1016. echo "AltiVec enabled $altivec"
  1017. fi
  1018. echo "gprof enabled $gprof"
  1019. echo "zlib enabled $zlib"
  1020. echo "mp3lame enabled $mp3lame"
  1021. echo "libogg enabled $libogg"
  1022. echo "vorbis enabled $vorbis"
  1023. echo "theora enabled $theora"
  1024. echo "faad enabled $faad"
  1025. echo "faadbin enabled $faadbin"
  1026. echo "faac enabled $faac"
  1027. echo "xvid enabled $xvid"
  1028. echo "x264 enabled $x264"
  1029. echo "a52 support $a52"
  1030. echo "a52 dlopened $a52bin"
  1031. echo "dts support $dts"
  1032. echo "pp support $pp"
  1033. echo "debug symbols $debug"
  1034. echo "strip symbols $dostrip"
  1035. echo "optimize $optimize"
  1036. echo "shared pp $shared_pp"
  1037. echo "Video hooking $vhook"
  1038. echo "SDL support $sdl"
  1039. if test $sdl_too_old = "yes"; then
  1040. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  1041. fi
  1042. if test "$vhook" = "yes" ; then
  1043. echo "Imlib2 support $imlib2"
  1044. echo "freetype support $freetype2"
  1045. fi
  1046. echo "Sun medialib support" $sunmlib
  1047. echo "pthreads support" $pthreads
  1048. echo "AMR-NB float support" $amr_nb
  1049. echo "AMR-NB fixed support" $amr_nb_fixed
  1050. echo "AMR-WB float support" $amr_wb
  1051. echo "AMR-WB IF2 support" $amr_if2
  1052. echo "network support $network"
  1053. if test "$network" = "yes" ; then
  1054. echo "IPv6 support $ipv6"
  1055. fi
  1056. if test "$gpl" = "no" ; then
  1057. echo "License: LGPL"
  1058. else
  1059. echo "License: GPL"
  1060. fi
  1061. echo "Creating config.mak and config.h"
  1062. date >> config.log
  1063. echo " $0 $FFMPEG_CONFIGURATION" >> config.log
  1064. echo "# Automatically generated by configure - do not modify" > config.mak
  1065. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  1066. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1067. echo "prefix=$prefix" >> config.mak
  1068. echo "libdir=$libdir" >> config.mak
  1069. echo "bindir=$bindir" >> config.mak
  1070. echo "mandir=$mandir" >> config.mak
  1071. echo "MAKE=$make" >> config.mak
  1072. echo "CC=$cc" >> config.mak
  1073. echo "AR=$ar" >> config.mak
  1074. echo "RANLIB=$ranlib" >> config.mak
  1075. if test "$dostrip" = "yes" ; then
  1076. echo "STRIP=$strip" >> config.mak
  1077. echo "INSTALLSTRIP=-s" >> config.mak
  1078. else
  1079. echo "STRIP=echo ignoring strip" >> config.mak
  1080. echo "INSTALLSTRIP=" >> config.mak
  1081. fi
  1082. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
  1083. # shared modules on OS/X (vhook/Makefile).
  1084. SHCFLAGS=$CFLAGS
  1085. if test "$needmdynamicnopic" = yes; then
  1086. CFLAGS="$CFLAGS -mdynamic-no-pic"
  1087. fi
  1088. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1089. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  1090. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1091. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  1092. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1093. echo "LIBPREF=$LIBPREF" >> config.mak
  1094. echo "LIBSUF=$LIBSUF" >> config.mak
  1095. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1096. echo "SLIBSUF=$SLIBSUF" >> config.mak
  1097. echo "EXESUF=$EXESUF" >> config.mak
  1098. echo "TARGET_OS=$TARGET_OS" >> config.mak
  1099. if test "$cpu" = "x86" ; then
  1100. echo "TARGET_ARCH_X86=yes" >> config.mak
  1101. echo "#define ARCH_X86 1" >> $TMPH
  1102. elif test "$cpu" = "x86_64" ; then
  1103. echo "TARGET_ARCH_X86_64=yes" >> config.mak
  1104. echo "#define ARCH_X86_64 1" >> $TMPH
  1105. elif test "$cpu" = "armv4l" ; then
  1106. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  1107. echo "#define ARCH_ARMV4L 1" >> $TMPH
  1108. elif test "$cpu" = "alpha" ; then
  1109. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  1110. echo "#define ARCH_ALPHA 1" >> $TMPH
  1111. elif test "$cpu" = "sparc64" ; then
  1112. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  1113. echo "#define ARCH_SPARC64 1" >> $TMPH
  1114. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1115. echo "#define ARCH_SPARC 1" >> $TMPH
  1116. elif test "$cpu" = "sparc" ; then
  1117. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1118. echo "#define ARCH_SPARC 1" >> $TMPH
  1119. elif test "$cpu" = "powerpc" ; then
  1120. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  1121. echo "#define ARCH_POWERPC 1" >> $TMPH
  1122. if test $POWERPCMODE = "32bits"; then
  1123. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  1124. else
  1125. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1126. fi
  1127. if test "$powerpc_perf" = "yes"; then
  1128. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1129. fi
  1130. elif test "$cpu" = "mips" ; then
  1131. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1132. echo "#define ARCH_MIPS 1" >> $TMPH
  1133. elif test "$cpu" = "sh4" ; then
  1134. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1135. echo "#define ARCH_SH4 1" >> $TMPH
  1136. fi
  1137. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1138. if test "$bigendian" = "yes" ; then
  1139. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1140. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1141. fi
  1142. if test "$inttypes" != "yes" ; then
  1143. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1144. fi
  1145. if test "$emu_fast_int" = "yes" ; then
  1146. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1147. fi
  1148. if test "$mmx" = "yes" ; then
  1149. echo "TARGET_MMX=yes" >> config.mak
  1150. echo "#define HAVE_MMX 1" >> $TMPH
  1151. echo "#define __CPU__ 586" >> $TMPH
  1152. fi
  1153. if test "$builtin_vector" = "yes" ; then
  1154. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1155. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1156. fi
  1157. if test "$mmi" = "yes" ; then
  1158. echo "TARGET_MMI=yes" >> config.mak
  1159. echo "#define HAVE_MMI 1" >> $TMPH
  1160. fi
  1161. if test "$altivec" = "yes" ; then
  1162. echo "TARGET_ALTIVEC=yes" >> config.mak
  1163. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1164. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1165. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1166. if test "$_altivec_h" = "yes" ; then
  1167. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1168. else
  1169. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1170. fi
  1171. fi
  1172. if test "$gprof" = "yes" ; then
  1173. echo "TARGET_GPROF=yes" >> config.mak
  1174. echo "#define HAVE_GPROF 1" >> $TMPH
  1175. fi
  1176. if test "$localtime_r" = "yes" ; then
  1177. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1178. fi
  1179. if test "$imlib2" = "yes" ; then
  1180. echo "HAVE_IMLIB2=yes" >> config.mak
  1181. fi
  1182. if test "$freetype2" = "yes" ; then
  1183. echo "HAVE_FREETYPE2=yes" >> config.mak
  1184. fi
  1185. if test "$sunmlib" = "yes" ; then
  1186. echo "HAVE_MLIB=yes" >> config.mak
  1187. echo "#define HAVE_MLIB 1" >> $TMPH
  1188. extralibs="$extralibs -lmlib"
  1189. fi
  1190. if test "$pthreads" = "yes" ; then
  1191. echo "HAVE_PTHREADS=yes" >> config.mak
  1192. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1193. echo "#define HAVE_THREADS 1" >> $TMPH
  1194. if test $targetos != FreeBSD; then
  1195. extralibs="$extralibs -lpthread"
  1196. fi
  1197. fi
  1198. if test "$sdl" = "yes" ; then
  1199. echo "CONFIG_SDL=yes" >> config.mak
  1200. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  1201. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  1202. fi
  1203. if test "$texi2html" = "yes"; then
  1204. echo "BUILD_DOC=yes" >> config.mak
  1205. fi
  1206. if test "$have_lrintf" = "yes" ; then
  1207. echo "#define HAVE_LRINTF 1" >> $TMPH
  1208. fi
  1209. if test "$vhook" = "yes" ; then
  1210. echo "BUILD_VHOOK=yes" >> config.mak
  1211. echo "#define HAVE_VHOOK 1" >> $TMPH
  1212. extralibs="$extralibs $ldl"
  1213. fi
  1214. if test "$lshared" = "yes" ; then
  1215. echo "BUILD_SHARED=yes" >> config.mak
  1216. echo "PIC=-fPIC" >> config.mak
  1217. fi
  1218. echo "EXTRALIBS=$extralibs" >> config.mak
  1219. version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
  1220. cut -d '"' -f 2`
  1221. echo "VERSION=$version" >>config.mak
  1222. # if you do not want to use encoders, disable that.
  1223. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1224. echo "CONFIG_ENCODERS=yes" >> config.mak
  1225. # if you do not want to use decoders, disable that.
  1226. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1227. echo "CONFIG_DECODERS=yes" >> config.mak
  1228. # AC3
  1229. if test "$a52" = "yes" ; then
  1230. echo "#define CONFIG_AC3 1" >> $TMPH
  1231. echo "CONFIG_AC3=yes" >> config.mak
  1232. if test "$a52bin" = "yes" ; then
  1233. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1234. echo "CONFIG_A52BIN=yes" >> config.mak
  1235. fi
  1236. fi
  1237. # DTS
  1238. if test "$dts" = "yes" ; then
  1239. echo "#define CONFIG_DTS 1" >> $TMPH
  1240. echo "CONFIG_DTS=yes" >> config.mak
  1241. fi
  1242. # PP
  1243. if test "$pp" = "yes" ; then
  1244. echo "#define CONFIG_PP 1" >> $TMPH
  1245. echo "CONFIG_PP=yes" >> config.mak
  1246. if test "$shared_pp" = "yes" ; then
  1247. echo "#define SHARED_PP 1" >> $TMPH
  1248. echo "SHARED_PP=yes" >> config.mak
  1249. fi
  1250. fi
  1251. # mpeg audio high precision mode
  1252. if test "$mpegaudio_hp" = "yes" ; then
  1253. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1254. fi
  1255. if test "$v4l" = "yes" ; then
  1256. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1257. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1258. fi
  1259. if test "$dv1394" = "yes" ; then
  1260. echo "#define CONFIG_DV1394 1" >> $TMPH
  1261. echo "CONFIG_DV1394=yes" >> config.mak
  1262. fi
  1263. if test "$dc1394" = "yes" ; then
  1264. echo "#define CONFIG_DC1394 1" >> $TMPH
  1265. echo "CONFIG_DC1394=yes" >> config.mak
  1266. fi
  1267. if test "$dlopen" = "yes" ; then
  1268. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1269. fi
  1270. if test "$dlfcn" = "yes" ; then
  1271. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1272. fi
  1273. if test "$audio_oss" = "yes" ; then
  1274. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1275. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1276. fi
  1277. if test "$audio_beos" = "yes" ; then
  1278. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1279. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1280. fi
  1281. if test "$network" = "yes" ; then
  1282. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1283. echo "CONFIG_NETWORK=yes" >> config.mak
  1284. fi
  1285. if test "$ipv6" = "yes" ; then
  1286. echo "#define CONFIG_IPV6 1" >> $TMPH
  1287. fi
  1288. if test "$zlib" = "yes" ; then
  1289. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1290. echo "CONFIG_ZLIB=yes" >> config.mak
  1291. fi
  1292. if test "$mp3lame" = "yes" ; then
  1293. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1294. echo "CONFIG_MP3LAME=yes" >> config.mak
  1295. fi
  1296. if test "$libogg" = "yes" ; then
  1297. echo "#define CONFIG_LIBOGG 1" >> $TMPH
  1298. echo "CONFIG_LIBOGG=yes" >> config.mak
  1299. fi
  1300. if test "$vorbis" = "yes" ; then
  1301. echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
  1302. echo "CONFIG_LIBVORBIS=yes" >> config.mak
  1303. fi
  1304. if test "$theora" = "yes" ; then
  1305. echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
  1306. echo "CONFIG_LIBTHEORA=yes" >> config.mak
  1307. fi
  1308. if test "$faad" = "yes" ; then
  1309. echo "#define CONFIG_FAAD 1" >> $TMPH
  1310. echo "CONFIG_FAAD=yes" >> config.mak
  1311. fi
  1312. if test "$faadbin" = "yes" ; then
  1313. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1314. echo "CONFIG_FAADBIN=yes" >> config.mak
  1315. fi
  1316. if test "$faac" = "yes" ; then
  1317. echo "#define CONFIG_FAAC 1" >> $TMPH
  1318. echo "CONFIG_FAAC=yes" >> config.mak
  1319. fi
  1320. if test "$xvid" = "yes" ; then
  1321. echo "#define CONFIG_XVID 1" >> $TMPH
  1322. echo "CONFIG_XVID=yes" >> config.mak
  1323. fi
  1324. if test "$x264" = "yes" ; then
  1325. echo "#define CONFIG_X264 1" >> $TMPH
  1326. echo "CONFIG_X264=yes" >> config.mak
  1327. fi
  1328. if test "$mingw32" = "yes" ; then
  1329. echo "#define CONFIG_WIN32 1" >> $TMPH
  1330. echo "CONFIG_WIN32=yes" >> config.mak
  1331. echo "HAVE_W32THREADS=yes" >> config.mak
  1332. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1333. echo "#define HAVE_THREADS 1" >> $TMPH
  1334. echo "#ifndef __MINGW32__" >> $TMPH
  1335. echo "#define __MINGW32__ 1" >> $TMPH
  1336. echo "#endif" >> $TMPH
  1337. fi
  1338. if test "$os2" = "yes" ; then
  1339. echo "#define CONFIG_OS2 1" >> $TMPH
  1340. echo "CONFIG_OS2=yes" >> config.mak
  1341. fi
  1342. if test "$TARGET_OS" = "SunOS" ; then
  1343. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1344. fi
  1345. if test "$TARGET_OS" = "BeOS" ; then
  1346. echo "HAVE_BEOSTHREADS=yes" >> config.mak
  1347. echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
  1348. echo "#define HAVE_THREADS 1" >> $TMPH
  1349. fi
  1350. if test "$darwin" = "yes"; then
  1351. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1352. echo "CONFIG_DARWIN=yes" >> config.mak
  1353. fi
  1354. if test "$_malloc_h" = "yes" ; then
  1355. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1356. else
  1357. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1358. fi
  1359. if test "$_memalign" = "yes" ; then
  1360. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1361. else
  1362. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1363. fi
  1364. if test "$memalignhack" = "yes" ; then
  1365. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1366. fi
  1367. if test "$netserver" = "yes" ; then
  1368. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1369. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1370. fi
  1371. if test "$need_inet_aton" = "yes" ; then
  1372. echo "NEED_INET_ATON=yes" >> config.mak
  1373. fi
  1374. if test "$simpleidct" = "yes" ; then
  1375. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1376. fi
  1377. if test "$ffserver" = "yes" ; then
  1378. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1379. echo "CONFIG_FFSERVER=yes" >> config.mak
  1380. fi
  1381. if test "$ffplay" = "yes" ; then
  1382. echo "CONFIG_FFPLAY=yes" >> config.mak
  1383. fi
  1384. if test "$gpl" = "yes" ; then
  1385. echo "#define CONFIG_GPL 1" >> $TMPH
  1386. echo "CONFIG_GPL=yes" >> config.mak
  1387. fi
  1388. echo "#define restrict $_restrict" >> $TMPH
  1389. if test "$optimize" = "small"; then
  1390. echo "#define always_inline" >> $TMPH
  1391. fi
  1392. # build tree in object directory if source path is different from current one
  1393. if test "$source_path_used" = "yes" ; then
  1394. DIRS="doc libavformat libavcodec libavcodec/alpha libavcodec/armv4l \
  1395. libavcodec/i386 libavcodec/sparc libavcodec/mlib \
  1396. libavcodec/ppc libavcodec/liba52 libavcodec/libpostproc tests vhook"
  1397. FILES="Makefile libavformat/Makefile libavcodec/Makefile \
  1398. libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile \
  1399. doc/Makefile doc/texi2pod.pl"
  1400. for dir in $DIRS ; do
  1401. mkdir -p $dir
  1402. done
  1403. for f in $FILES ; do
  1404. ln -sf "$source_path/$f" $f
  1405. done
  1406. echo "SRC_PATH=$source_path" >> config.mak
  1407. else
  1408. echo "SRC_PATH='$source_path'" >> config.mak
  1409. fi
  1410. if test "$amr_wb" = "yes" ; then
  1411. echo "#define AMR_WB 1" >> $TMPH
  1412. echo "AMR_WB=yes" >> config.mak
  1413. echo
  1414. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1415. echo "V5.1.0 from "
  1416. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1417. echo "and extracted the source to libavcodec/amrwb_float"
  1418. echo
  1419. fi
  1420. if test "$amr_nb" = "yes" ; then
  1421. echo "#define AMR_NB 1" >> $TMPH
  1422. echo "AMR_NB=yes" >> config.mak
  1423. echo
  1424. if test "$amr_nb_fixed" = "yes" ; then
  1425. echo "AMR_NB_FIXED=yes" >> config.mak
  1426. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1427. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1428. echo "REL-5 version 5.1.0 from "
  1429. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
  1430. echo "and extracted src to libavcodec/amr"
  1431. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1432. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1433. echo
  1434. else
  1435. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1436. echo "REL-5 V5.1.0 from "
  1437. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
  1438. echo "and extracted the source to libavcodec/amr_float"
  1439. echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
  1440. echo
  1441. fi
  1442. if test "$amr_if2" = "yes" ; then
  1443. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1444. fi
  1445. fi
  1446. for codec in $CODEC_LIST ; do
  1447. echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
  1448. echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
  1449. done
  1450. diff $TMPH config.h >/dev/null 2>&1
  1451. if test $? -ne 0 ; then
  1452. mv -f $TMPH config.h
  1453. else
  1454. echo "config.h is unchanged"
  1455. fi
  1456. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH