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.

1562 lines
38KB

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