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.

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