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.

1419 lines
34KB

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