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.

1423 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. # allanc@chickenandporn.com: cannot execute cross-compiled
  755. # code on the host. Only execute if not cross-compiling.
  756. if test -z "$cross_prefix" ; then
  757. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  758. fi
  759. fi
  760. _restrict=
  761. for restrict_keyword in restrict __restrict__ __restrict; do
  762. echo "void foo(char * $restrict_keyword p);" > $TMPC
  763. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  764. _restrict=$restrict_keyword
  765. break;
  766. fi
  767. done
  768. # test gcc version to see if vector builtins can be used
  769. # currently only used on i386 for MMX builtins
  770. cat > $TMPC << EOF
  771. int main(void) {
  772. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  773. return 0;
  774. #else
  775. #error no vector builtins
  776. #endif
  777. }
  778. EOF
  779. builtin_vector=no
  780. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  781. builtin_vector=yes
  782. fi
  783. # dlopen/dlfcn.h probing
  784. cat > $TMPC << EOF
  785. #include <dlfcn.h>
  786. int main( void ) { return (int) dlopen("foo", 0); }
  787. EOF
  788. ldl=-ldl
  789. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  790. dlfcn=yes
  791. dlopen=yes
  792. fi
  793. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  794. dlfcn=yes
  795. dlopen=yes
  796. ldl=""
  797. fi
  798. cat > $TMPC << EOF
  799. int main( void ) { return (int) dlopen("foo", 0); }
  800. EOF
  801. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  802. dlopen=yes
  803. fi
  804. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  805. dlopen=yes
  806. ldl=""
  807. fi
  808. if test "$vhook" = "default" ; then
  809. vhook="$dlopen"
  810. fi
  811. ##########################################
  812. # imlib probe
  813. cat > $TMPC << EOF
  814. #include <X11/Xlib.h>
  815. #include <Imlib2.h>
  816. int main( void ) { return (int) imlib_load_font("foo"); }
  817. EOF
  818. imlib2=no
  819. if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
  820. imlib2=yes
  821. fi
  822. ##########################################
  823. # freetype probe
  824. cat > $TMPC << EOF
  825. #include <ft2build.h>
  826. int main( void ) { return (int) FT_Init_FreeType(0); }
  827. EOF
  828. freetype2=no
  829. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  830. if (freetype-config --version) >/dev/null 2>&1 ; then
  831. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
  832. freetype2=yes
  833. fi
  834. fi
  835. fi
  836. ##########################################
  837. # SDL probe
  838. cat > $TMPC << EOF
  839. #include <SDL.h>
  840. #undef main /* We don't want SDL to override our main() */
  841. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  842. EOF
  843. sdl_too_old=no
  844. sdl=no
  845. if (sdl-config --version) >/dev/null 2>&1 ; then
  846. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
  847. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  848. if test "$_sdlversion" -lt 121 ; then
  849. sdl_too_old=yes
  850. else
  851. sdl=yes
  852. fi
  853. fi
  854. fi
  855. ##########################################
  856. # texi2html probe
  857. texi2html=no
  858. if (texi2html -version) >/dev/null 2>&1; then
  859. texi2html=yes
  860. fi
  861. case "`$cc -v 2>&1 | grep version`" in
  862. *gcc*)
  863. CFLAGS="-Wall $CFLAGS"
  864. ;;
  865. *)
  866. ;;
  867. esac
  868. if test "$sdl" = "no" ; then
  869. ffplay=no
  870. fi
  871. if test "$debug" = "yes"; then
  872. CFLAGS="-g $CFLAGS"
  873. fi
  874. if test "$optimize" = "small"; then
  875. # CFLAGS=${CFLAGS//-O3/-Os}
  876. CFLAGS="$CFLAGS -Os"
  877. fi
  878. if test "$optimize" = "yes"; then
  879. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  880. CFLAGS="$CFLAGS -O5"
  881. LDFLAGS="$LDFLAGS -O5"
  882. else
  883. CFLAGS="-O3 $CFLAGS"
  884. fi
  885. fi
  886. if test x"$bindir" = x""; then
  887. bindir="${prefix}/bin"
  888. fi
  889. if test x"$mandir" = x""; then
  890. mandir="${prefix}/man"
  891. fi
  892. echo "Install prefix $prefix"
  893. echo "Source path $source_path"
  894. echo "C compiler $cc"
  895. echo "make $make"
  896. echo "CPU $cpu ($tune)"
  897. echo "Big Endian $bigendian"
  898. echo "inttypes.h $inttypes"
  899. echo "broken inttypes.h $emu_fast_int"
  900. if test $cpu = "x86"; then
  901. echo "MMX enabled $mmx"
  902. echo "Vector Builtins $builtin_vector"
  903. fi
  904. if test $cpu = "mips"; then
  905. echo "MMI enabled $mmi"
  906. fi
  907. if test $cpu = "powerpc"; then
  908. echo "AltiVec enabled $altivec"
  909. fi
  910. echo "gprof enabled $gprof"
  911. echo "zlib enabled $zlib"
  912. echo "mp3lame enabled $mp3lame"
  913. echo "vorbis enabled $vorbis"
  914. echo "faad enabled $faad"
  915. echo "faadbin enabled $faadbin"
  916. echo "faac enabled $faac"
  917. echo "xvid enabled $xvid"
  918. echo "a52 support $a52"
  919. echo "a52 dlopened $a52bin"
  920. echo "dts support $dts"
  921. echo "pp support $pp"
  922. echo "debug symbols $debug"
  923. echo "optimize $optimize"
  924. echo "shared pp $shared_pp"
  925. echo "Video hooking $vhook"
  926. echo "SDL support $sdl"
  927. if test $sdl_too_old = "yes"; then
  928. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  929. fi
  930. echo "risky / patent encumbered codecs $risky"
  931. if test "$vhook" = "yes" ; then
  932. echo "Imlib2 support $imlib2"
  933. echo "freetype support $freetype2"
  934. fi
  935. echo "Sun medialib support" $sunmlib
  936. echo "pthreads support" $pthreads
  937. echo "AMR-NB float support" $amr_nb
  938. echo "AMR-NB fixed support" $amr_nb_fixed
  939. echo "AMR-WB float support" $amr_wb
  940. if test "$gpl" = "no" ; then
  941. echo "License: LGPL"
  942. else
  943. echo "License: GPL"
  944. fi
  945. echo "Creating config.mak and config.h"
  946. echo "# Automatically generated by configure - do not modify" > config.mak
  947. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  948. echo "prefix=$prefix" >> config.mak
  949. echo "bindir=$bindir" >> config.mak
  950. echo "mandir=$mandir" >> config.mak
  951. echo "MAKE=$make" >> config.mak
  952. echo "CC=$cc" >> config.mak
  953. echo "AR=$ar" >> config.mak
  954. echo "RANLIB=$ranlib" >> config.mak
  955. echo "STRIP=$strip" >> config.mak
  956. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
  957. # shared modules on OS/X (vhook/Makefile).
  958. SHCFLAGS=$CFLAGS
  959. if test "$needmdynamicnopic" = yes; then
  960. CFLAGS="$CFLAGS -mdynamic-no-pic"
  961. fi
  962. echo "OPTFLAGS=$CFLAGS" >> config.mak
  963. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  964. echo "LDFLAGS=$LDFLAGS" >> config.mak
  965. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  966. echo "SHFLAGS=$SHFLAGS" >> config.mak
  967. echo "LIBPREF=$LIBPREF" >> config.mak
  968. echo "LIBSUF=$LIBSUF" >> config.mak
  969. echo "SLIBPREF=$SLIBPREF" >> config.mak
  970. echo "SLIBSUF=$SLIBSUF" >> config.mak
  971. echo "EXESUF=$EXESUF" >> config.mak
  972. echo "TARGET_OS=$TARGET_OS" >> config.mak
  973. if test "$cpu" = "x86" ; then
  974. echo "TARGET_ARCH_X86=yes" >> config.mak
  975. echo "#define ARCH_X86 1" >> $TMPH
  976. elif test "$cpu" = "armv4l" ; then
  977. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  978. echo "#define ARCH_ARMV4L 1" >> $TMPH
  979. elif test "$cpu" = "alpha" ; then
  980. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  981. echo "#define ARCH_ALPHA 1" >> $TMPH
  982. elif test "$cpu" = "sparc64" ; then
  983. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  984. echo "#define ARCH_SPARC64 1" >> $TMPH
  985. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  986. echo "#define ARCH_SPARC 1" >> $TMPH
  987. elif test "$cpu" = "sparc" ; then
  988. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  989. echo "#define ARCH_SPARC 1" >> $TMPH
  990. elif test "$cpu" = "powerpc" ; then
  991. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  992. echo "#define ARCH_POWERPC 1" >> $TMPH
  993. if test $POWERPCMODE = "32bits"; then
  994. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  995. else
  996. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  997. fi
  998. if test "$powerpc_perf" = "yes"; then
  999. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1000. fi
  1001. elif test "$cpu" = "mips" ; then
  1002. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1003. echo "#define ARCH_MIPS 1" >> $TMPH
  1004. elif test "$cpu" = "sh4" ; then
  1005. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1006. echo "#define ARCH_SH4 1" >> $TMPH
  1007. fi
  1008. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1009. if test "$bigendian" = "yes" ; then
  1010. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1011. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1012. fi
  1013. if test "$inttypes" != "yes" ; then
  1014. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1015. fi
  1016. if test "$emu_fast_int" = "yes" ; then
  1017. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1018. fi
  1019. if test "$mmx" = "yes" ; then
  1020. echo "TARGET_MMX=yes" >> config.mak
  1021. echo "#define HAVE_MMX 1" >> $TMPH
  1022. echo "#define __CPU__ 586" >> $TMPH
  1023. fi
  1024. if test "$builtin_vector" = "yes" ; then
  1025. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1026. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1027. fi
  1028. if test "$mmi" = "yes" ; then
  1029. echo "TARGET_MMI=yes" >> config.mak
  1030. echo "#define HAVE_MMI 1" >> $TMPH
  1031. fi
  1032. if test "$altivec" = "yes" ; then
  1033. echo "TARGET_ALTIVEC=yes" >> config.mak
  1034. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1035. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1036. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1037. if test "$_altivec_h" = "yes" ; then
  1038. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1039. else
  1040. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1041. fi
  1042. fi
  1043. if test "$gprof" = "yes" ; then
  1044. echo "TARGET_GPROF=yes" >> config.mak
  1045. echo "#define HAVE_GPROF 1" >> $TMPH
  1046. fi
  1047. if test "$localtime_r" = "yes" ; then
  1048. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1049. fi
  1050. if test "$imlib2" = "yes" ; then
  1051. echo "HAVE_IMLIB2=yes" >> config.mak
  1052. fi
  1053. if test "$freetype2" = "yes" ; then
  1054. echo "HAVE_FREETYPE2=yes" >> config.mak
  1055. fi
  1056. if test "$sunmlib" = "yes" ; then
  1057. echo "HAVE_MLIB=yes" >> config.mak
  1058. echo "#define HAVE_MLIB 1" >> $TMPH
  1059. extralibs="$extralibs -lmlib"
  1060. fi
  1061. if test "$pthreads" = "yes" ; then
  1062. echo "HAVE_PTHREADS=yes" >> config.mak
  1063. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1064. if test $targetos != FreeBSD; then
  1065. extralibs="$extralibs -lpthread"
  1066. fi
  1067. fi
  1068. if test "$sdl" = "yes" ; then
  1069. echo "CONFIG_SDL=yes" >> config.mak
  1070. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  1071. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  1072. fi
  1073. if test "$texi2html" = "yes"; then
  1074. echo "BUILD_DOC=yes" >> config.mak
  1075. fi
  1076. if test "$have_lrintf" = "yes" ; then
  1077. echo "#define HAVE_LRINTF 1" >> $TMPH
  1078. fi
  1079. if test "$vhook" = "yes" ; then
  1080. echo "BUILD_VHOOK=yes" >> config.mak
  1081. echo "#define HAVE_VHOOK 1" >> $TMPH
  1082. extralibs="$extralibs $ldl"
  1083. fi
  1084. if test "$lshared" = "yes" ; then
  1085. echo "BUILD_SHARED=yes" >> config.mak
  1086. echo "PIC=-fPIC" >> config.mak
  1087. fi
  1088. echo "EXTRALIBS=$extralibs" >> config.mak
  1089. version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
  1090. cut -d '"' -f 2`
  1091. echo "VERSION=$version" >>config.mak
  1092. # if you do not want to use encoders, disable that.
  1093. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1094. echo "CONFIG_ENCODERS=yes" >> config.mak
  1095. # if you do not want to use decoders, disable that.
  1096. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1097. echo "CONFIG_DECODERS=yes" >> config.mak
  1098. # AC3
  1099. if test "$a52" = "yes" ; then
  1100. echo "#define CONFIG_AC3 1" >> $TMPH
  1101. echo "CONFIG_AC3=yes" >> config.mak
  1102. if test "$a52bin" = "yes" ; then
  1103. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1104. echo "CONFIG_A52BIN=yes" >> config.mak
  1105. fi
  1106. fi
  1107. # DTS
  1108. if test "$dts" = "yes" ; then
  1109. echo "#define CONFIG_DTS 1" >> $TMPH
  1110. echo "CONFIG_DTS=yes" >> config.mak
  1111. fi
  1112. # PP
  1113. if test "$pp" = "yes" ; then
  1114. echo "#define CONFIG_PP 1" >> $TMPH
  1115. echo "CONFIG_PP=yes" >> config.mak
  1116. if test "$shared_pp" = "yes" ; then
  1117. echo "#define SHARED_PP 1" >> $TMPH
  1118. echo "SHARED_PP=yes" >> config.mak
  1119. fi
  1120. fi
  1121. # mpeg audio high precision mode
  1122. if test "$mpegaudio_hp" = "yes" ; then
  1123. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1124. fi
  1125. if test "$v4l" = "yes" ; then
  1126. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1127. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1128. fi
  1129. if test "$dv1394" = "yes" ; then
  1130. echo "#define CONFIG_DV1394 1" >> $TMPH
  1131. echo "CONFIG_DV1394=yes" >> config.mak
  1132. fi
  1133. if test "$dlopen" = "yes" ; then
  1134. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1135. fi
  1136. if test "$dlfcn" = "yes" ; then
  1137. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1138. fi
  1139. if test "$audio_oss" = "yes" ; then
  1140. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1141. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1142. fi
  1143. if test "$audio_beos" = "yes" ; then
  1144. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1145. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1146. fi
  1147. if test "$network" = "yes" ; then
  1148. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1149. echo "CONFIG_NETWORK=yes" >> config.mak
  1150. fi
  1151. if test "$zlib" = "yes" ; then
  1152. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1153. echo "CONFIG_ZLIB=yes" >> config.mak
  1154. fi
  1155. if test "$mp3lame" = "yes" ; then
  1156. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1157. echo "CONFIG_MP3LAME=yes" >> config.mak
  1158. fi
  1159. if test "$vorbis" = "yes" ; then
  1160. echo "#define CONFIG_VORBIS 1" >> $TMPH
  1161. echo "CONFIG_VORBIS=yes" >> config.mak
  1162. fi
  1163. if test "$faad" = "yes" ; then
  1164. echo "#define CONFIG_FAAD 1" >> $TMPH
  1165. echo "CONFIG_FAAD=yes" >> config.mak
  1166. fi
  1167. if test "$faadbin" = "yes" ; then
  1168. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1169. echo "CONFIG_FAADBIN=yes" >> config.mak
  1170. fi
  1171. if test "$faac" = "yes" ; then
  1172. echo "#define CONFIG_FAAC 1" >> $TMPH
  1173. echo "CONFIG_FAAC=yes" >> config.mak
  1174. fi
  1175. if test "$xvid" = "yes" ; then
  1176. echo "#define CONFIG_XVID 1" >> $TMPH
  1177. echo "CONFIG_XVID=yes" >> config.mak
  1178. fi
  1179. if test "$mingw32" = "yes" ; then
  1180. echo "#define CONFIG_WIN32 1" >> $TMPH
  1181. echo "CONFIG_WIN32=yes" >> config.mak
  1182. echo "HAVE_W32THREADS=yes" >> config.mak
  1183. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1184. echo "#ifndef __MINGW32__" >> $TMPH
  1185. echo "#define __MINGW32__ 1" >> $TMPH
  1186. echo "#endif" >> $TMPH
  1187. fi
  1188. if test "$os2" = "yes" ; then
  1189. echo "#define CONFIG_OS2 1" >> $TMPH
  1190. echo "CONFIG_OS2=yes" >> config.mak
  1191. fi
  1192. if test "$TARGET_OS" = "SunOS" ; then
  1193. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1194. fi
  1195. if test "$darwin" = "yes"; then
  1196. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1197. echo "CONFIG_DARWIN=yes" >> config.mak
  1198. fi
  1199. if test "$_malloc_h" = "yes" ; then
  1200. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1201. else
  1202. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1203. fi
  1204. if test "$_memalign" = "yes" ; then
  1205. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1206. else
  1207. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1208. fi
  1209. if test "$memalignhack" = "yes" ; then
  1210. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1211. fi
  1212. if test "$netserver" = "yes" ; then
  1213. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1214. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1215. fi
  1216. if test "$need_inet_aton" = "yes" ; then
  1217. echo "NEED_INET_ATON=yes" >> config.mak
  1218. fi
  1219. if test "$simpleidct" = "yes" ; then
  1220. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1221. fi
  1222. if test "$ffserver" = "yes" ; then
  1223. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1224. echo "CONFIG_FFSERVER=yes" >> config.mak
  1225. fi
  1226. if test "$ffplay" = "yes" ; then
  1227. echo "CONFIG_FFPLAY=yes" >> config.mak
  1228. fi
  1229. if test "$risky" = "yes" ; then
  1230. echo "#define CONFIG_RISKY 1" >> $TMPH
  1231. echo "CONFIG_RISKY=yes" >> config.mak
  1232. fi
  1233. if test "$gpl" = "yes" ; then
  1234. echo "#define CONFIG_GPL 1" >> $TMPH
  1235. echo "CONFIG_GPL=yes" >> config.mak
  1236. fi
  1237. echo "#define restrict $_restrict" >> $TMPH
  1238. if test "$optimize" = "small"; then
  1239. echo "#define always_inline" >> $TMPH
  1240. fi
  1241. # build tree in object directory if source path is different from current one
  1242. if test "$source_path_used" = "yes" ; then
  1243. DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  1244. libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
  1245. FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
  1246. for dir in $DIRS ; do
  1247. mkdir -p $dir
  1248. done
  1249. for f in $FILES ; do
  1250. ln -sf $source_path/$f $f
  1251. done
  1252. fi
  1253. echo "SRC_PATH=$source_path" >> config.mak
  1254. if test "$amr_wb" = "yes" ; then
  1255. echo "#define AMR_WB 1" >> $TMPH
  1256. echo "AMR_WB=yes" >> config.mak
  1257. echo
  1258. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1259. echo "V5.1.0 from "
  1260. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1261. echo "and extracted the source to libavcodec/amrwb_float"
  1262. echo
  1263. fi
  1264. if test "$amr_nb" = "yes" ; then
  1265. echo "#define AMR_NB 1" >> $TMPH
  1266. echo "AMR_NB=yes" >> config.mak
  1267. echo
  1268. if test "$amr_nb_fixed" = "yes" ; then
  1269. echo "AMR_NB_FIXED=yes" >> config.mak
  1270. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1271. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1272. echo "REL-5 version 5.1.0 from "
  1273. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
  1274. echo "and extracted src to libavcodec/amr"
  1275. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1276. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1277. echo
  1278. else
  1279. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1280. echo "REL-5 V5.1.0 from "
  1281. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
  1282. echo "and extracted the source to libavcodec/amr_float"
  1283. echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
  1284. echo
  1285. fi
  1286. fi
  1287. diff $TMPH config.h >/dev/null 2>&1
  1288. if test $? -ne 0 ; then
  1289. mv -f $TMPH config.h
  1290. else
  1291. echo "config.h is unchanged"
  1292. fi
  1293. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH