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.

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