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.

1588 lines
39KB

  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-libogg 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. libogg="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 -p128"
  312. ranlib="echo ignoring ranlib"
  313. strip="echo ignoring strip"
  314. CFLAGS="-Zomf"
  315. LDFLAGS="-Zomf -Zstack 16384 -s"
  316. SHFLAGS="-Zdll -Zomf"
  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. vhook="no"
  330. os2="yes"
  331. ;;
  332. *) ;;
  333. esac
  334. # From mplayer configure. We need TARGET_OS available
  335. # to the Makefile, so it can distinguish between flavors
  336. # of AltiVec on PowerPC
  337. TARGET_OS=`( uname -s ) 2>&1`
  338. case "$TARGET_OS" in
  339. Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
  340. ;;
  341. IRIX*)
  342. TARGET_OS=IRIX
  343. ;;
  344. HP-UX*)
  345. TARGET_OS=HP-UX
  346. ;;
  347. [cC][yY][gG][wW][iI][nN]*)
  348. TARGET_OS=CYGWIN
  349. ;;
  350. *)
  351. TARGET_OS="$TARGET_OS-UNKNOWN"
  352. ;;
  353. esac
  354. # find source path
  355. # XXX: we assume an absolute path is given when launching configure,
  356. # except in './configure' case.
  357. source_path="`echo $0 | sed -e 's#/configure##'`"
  358. source_path_used="yes"
  359. if test -z "$source_path" -o "$source_path" = "." ; then
  360. source_path=`pwd`
  361. source_path_used="no"
  362. fi
  363. FFMPEG_CONFIGURATION=" "
  364. for opt do
  365. FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
  366. done
  367. for opt do
  368. case "$opt" in
  369. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  370. ;;
  371. --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
  372. ;;
  373. --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  374. ;;
  375. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  376. ;;
  377. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  378. ;;
  379. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  380. ;;
  381. --make=*) make=`echo $opt | cut -d '=' -f 2`
  382. ;;
  383. --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
  384. ;;
  385. --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
  386. ;;
  387. --extra-libs=*) extralibs=${opt#--extra-libs=}
  388. ;;
  389. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  390. ;;
  391. --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  392. ;;
  393. --powerpc-perf-enable) powerpc_perf="yes"
  394. ;;
  395. --disable-mmx) mmx="no"
  396. ;;
  397. --disable-altivec) altivec="no"
  398. ;;
  399. --enable-gprof) gprof="yes"
  400. ;;
  401. --disable-v4l) v4l="no"
  402. ;;
  403. --disable-audio-oss) audio_oss="no"
  404. ;;
  405. --disable-audio-beos) audio_beos="no"
  406. ;;
  407. --disable-dv1394) dv1394="no"
  408. ;;
  409. --disable-network) network="no"; ffserver="no"
  410. ;;
  411. --disable-zlib) zlib="no"
  412. ;;
  413. --enable-a52) a52="yes"
  414. ;;
  415. --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
  416. ;;
  417. --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
  418. ;;
  419. --enable-pp) pp="yes"
  420. ;;
  421. --enable-shared-pp) shared_pp="yes"
  422. ;;
  423. --enable-mp3lame) mp3lame="yes"
  424. ;;
  425. --enable-libogg) libogg="yes"
  426. ;;
  427. --enable-vorbis) vorbis="yes"
  428. ;;
  429. --enable-theora) theora="yes"
  430. ;;
  431. --enable-faad) faad="yes"
  432. ;;
  433. --enable-faadbin) faadbin="yes"
  434. ;;
  435. --enable-faac) faac="yes"
  436. ;;
  437. --enable-xvid) xvid="yes"
  438. ;;
  439. --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
  440. ;;
  441. --enable-dc1394) dc1394="yes"
  442. ;;
  443. --disable-vhook) vhook="no"
  444. ;;
  445. --disable-simple_idct) simpleidct="no"
  446. ;;
  447. --enable-mingw32) mingw32="yes"
  448. ;;
  449. --enable-shared) lshared="yes"
  450. ;;
  451. --disable-debug) debug="no"
  452. ;;
  453. --disable-opts) optimize="no"
  454. ;;
  455. --disable-mpegaudio-hp) mpegaudio_hp="no"
  456. ;;
  457. --disable-ffserver) ffserver="no"
  458. ;;
  459. --disable-ffplay) ffplay="no"
  460. ;;
  461. --enable-small) optimize="small"
  462. ;;
  463. --enable-amr_nb) amr_nb="yes"
  464. ;;
  465. --enable-amr_nb-fixed) amr_nb_fixed="yes"
  466. ;;
  467. --enable-amr_wb) amr_wb="yes"
  468. ;;
  469. --enable-amr_if2) amr_if2="yes"
  470. ;;
  471. --enable-sunmlib) sunmlib="yes"
  472. ;;
  473. --enable-pthreads) pthreads="yes"
  474. ;;
  475. --enable-gpl) gpl="yes"
  476. ;;
  477. --enable-memalign-hack) memalignhack="yes"
  478. ;;
  479. --disable-strip) dostrip="no"
  480. ;;
  481. esac
  482. done
  483. if test "$theora" = "yes" ; then
  484. if test "$libogg" = "no"; then
  485. echo "libogg must be enabled to enable Theora"
  486. fail="yes"
  487. theora="no"
  488. fi
  489. fi
  490. if test "$vorbis" = "yes" ; then
  491. if test "$libogg" = "no"; then
  492. echo "libogg must be enabled to enable Vorbis"
  493. fail="yes"
  494. vorbis="no"
  495. fi
  496. fi
  497. if test "$gpl" != "yes"; then
  498. if test "$pp" != "no" -o "$shared_pp" != "no"; then
  499. echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
  500. fail="yes"
  501. fi
  502. if test "$a52" != "no" -o "$a52bin" != "no"; then
  503. echo "liba52 is under GPL and --enable-gpl is not specified"
  504. fail="yes"
  505. fi
  506. if test "$xvid" != "no"; then
  507. echo "libxvidcore is under GPL and --enable-gpl is not specified"
  508. fail="yes"
  509. fi
  510. if test "$x264" != "no"; then
  511. echo "x264 is under GPL and --enable-gpl is not specified"
  512. fail="yes"
  513. fi
  514. if test "$dts" != "no"; then
  515. echo "libdts is under GPL and --enable-gpl is not specified"
  516. fail="yes"
  517. fi
  518. if test "$faad" != "no" -o "$faadbin" != "no"; then
  519. cat > $TMPC << EOF
  520. #include <faad.h>
  521. int main( void ) { return 0; }
  522. EOF
  523. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  524. cat > $TMPC << EOF
  525. #include <faad.h>
  526. #ifndef FAAD2_VERSION
  527. ok faad1
  528. #endif
  529. int main( void ) { return 0; }
  530. EOF
  531. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  532. echo "faad2 is under GPL and --enable-gpl is not specified"
  533. fail="yes"
  534. fi
  535. else
  536. faad="no"
  537. faadbin="no"
  538. echo "faad test failed"
  539. fi
  540. fi
  541. if test "$fail" = "yes"; then
  542. exit 1
  543. fi
  544. fi
  545. # compute mmx state
  546. if test $mmx = "default"; then
  547. if test $cpu = "x86" -o $cpu = "x86_64"; then
  548. mmx="yes"
  549. else
  550. mmx="no"
  551. fi
  552. fi
  553. #Darwin CC versions
  554. needmdynamicnopic="no"
  555. if test $targetos = Darwin; then
  556. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  557. CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  558. else
  559. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  560. case "$gcc_version" in
  561. *2.95*)
  562. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  563. ;;
  564. *3.*)
  565. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
  566. if test "$lshared" = no; then
  567. needmdynamicnopic="yes"
  568. fi
  569. ;;
  570. *)
  571. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  572. if test "$lshared" = no; then
  573. needmdynamicnopic="yes"
  574. fi
  575. ;;
  576. esac
  577. fi
  578. fi
  579. # Can only do AltiVec on PowerPC
  580. if test $altivec = "default"; then
  581. if test $cpu = "powerpc"; then
  582. altivec="yes"
  583. else
  584. altivec="no"
  585. fi
  586. fi
  587. # Add processor-specific flags
  588. TUNECPU="generic"
  589. POWERPCMODE="32bits"
  590. if test $tune != "generic"; then
  591. case $tune in
  592. 601|ppc601|PowerPC601)
  593. CFLAGS="$CFLAGS -mcpu=601"
  594. if test $altivec = "yes"; then
  595. echo "WARNING: tuning for PPC601 but altivec enabled !";
  596. fi
  597. TUNECPU=ppc601
  598. ;;
  599. 603*|ppc603*|PowerPC603*)
  600. CFLAGS="$CFLAGS -mcpu=603"
  601. if test $altivec = "yes"; then
  602. echo "WARNING: tuning for PPC603 but altivec enabled !";
  603. fi
  604. TUNECPU=ppc603
  605. ;;
  606. 604*|ppc604*|PowerPC604*)
  607. CFLAGS="$CFLAGS -mcpu=604"
  608. if test $altivec = "yes"; then
  609. echo "WARNING: tuning for PPC604 but altivec enabled !";
  610. fi
  611. TUNECPU=ppc604
  612. ;;
  613. G3|g3|75*|ppc75*|PowerPC75*)
  614. CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
  615. if test $altivec = "yes"; then
  616. echo "WARNING: tuning for PPC75x but altivec enabled !";
  617. fi
  618. TUNECPU=ppc750
  619. ;;
  620. G4|g4|745*|ppc745*|PowerPC745*)
  621. CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
  622. if test $altivec = "no"; then
  623. echo "WARNING: tuning for PPC745x but altivec disabled !";
  624. fi
  625. TUNECPU=ppc7450
  626. ;;
  627. 74*|ppc74*|PowerPC74*)
  628. CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
  629. if test $altivec = "no"; then
  630. echo "WARNING: tuning for PPC74xx but altivec disabled !";
  631. fi
  632. TUNECPU=ppc7400
  633. ;;
  634. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  635. CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
  636. if test $altivec = "no"; then
  637. echo "WARNING: tuning for PPC970 but altivec disabled !";
  638. fi
  639. TUNECPU=ppc970
  640. POWERPCMODE="64bits"
  641. ;;
  642. *)
  643. echo "WARNING: unknown CPU "$tune", ignored"
  644. ;;
  645. esac
  646. fi
  647. # AltiVec flags: The FSF version of GCC differs from the Apple version
  648. if test $cpu = "powerpc"; then
  649. if test $altivec = "yes"; then
  650. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  651. CFLAGS="$CFLAGS -faltivec"
  652. else
  653. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  654. fi
  655. fi
  656. fi
  657. # See if we have <altivec.h>
  658. cat > $TMPC << EOF
  659. #include <altivec.h>
  660. int main( void ) { return 0; }
  661. EOF
  662. _altivec_h="no"
  663. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  664. _altivec_h="yes"
  665. fi
  666. # See does our compiler support Motorola AltiVec C API
  667. if test $altivec = "yes"; then
  668. if test $_altivec_h = "yes"; then
  669. cat > $TMPC << EOF
  670. #include <altivec.h>
  671. int main(void) {
  672. vector signed int v1, v2, v3;
  673. v1 = vec_add(v2,v3);
  674. return 0;
  675. }
  676. EOF
  677. else
  678. cat > $TMPC << EOF
  679. int main(void) {
  680. vector signed int v1, v2, v3;
  681. v1 = vec_add(v2,v3);
  682. return 0;
  683. }
  684. EOF
  685. fi
  686. $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
  687. fi
  688. # Can only do mmi on mips
  689. if test $mmi = "default"; then
  690. if test $cpu = "mips"; then
  691. mmi="yes"
  692. else
  693. mmi="no"
  694. fi
  695. fi
  696. # See does our compiler support mmi
  697. if test $mmi = "yes"; then
  698. cat > $TMPC << EOF
  699. int main(void) {
  700. __asm__ ("lq \$2, 0(\$2)");
  701. return 0;
  702. }
  703. EOF
  704. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  705. fi
  706. if test "$mingw32" = "yes" ; then
  707. v4l="no"
  708. audio_oss="no"
  709. dv1394="no"
  710. dc1394="no"
  711. ffserver="no"
  712. network="no"
  713. LIBPREF=""
  714. LIBSUF=".lib"
  715. SLIBPREF=""
  716. SLIBSUF=".dll"
  717. EXESUF=".exe"
  718. prefix="/c/Program Files/FFmpeg"
  719. bindir="$prefix"
  720. fi
  721. cc="${cross_prefix}${cc}"
  722. ar="${cross_prefix}${ar}"
  723. ranlib="${cross_prefix}${ranlib}"
  724. strip="${cross_prefix}${strip}"
  725. if test -z "$cross_prefix" ; then
  726. # ---
  727. # big/little endian test
  728. cat > $TMPC << EOF
  729. #include <inttypes.h>
  730. int main(int argc, char ** argv){
  731. volatile uint32_t i=0x01234567;
  732. return (*((uint8_t*)(&i))) == 0x67;
  733. }
  734. EOF
  735. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  736. $TMPE && bigendian="yes"
  737. else
  738. echo big/little test failed
  739. fi
  740. else
  741. # if cross compiling, cannot launch a program, so make a static guess
  742. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  743. bigendian="yes"
  744. fi
  745. fi
  746. # ---
  747. # *inttypes.h* test
  748. cat > $TMPC << EOF
  749. #include <inttypes.h>
  750. int main(int argc, char ** argv){
  751. return 0;
  752. }
  753. EOF
  754. $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
  755. # ---
  756. # *int_fast* test
  757. cat > $TMPC << EOF
  758. #include <inttypes.h>
  759. int main(int argc, char ** argv){
  760. volatile uint_fast64_t i=0x01234567;
  761. return 0;
  762. }
  763. EOF
  764. $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
  765. # ---
  766. # check availability of some header files
  767. cat > $TMPC << EOF
  768. #include <malloc.h>
  769. int main( void ) { return 0; }
  770. EOF
  771. _memalign=no
  772. _malloc_h=no
  773. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  774. _malloc_h=yes
  775. _memalign=yes
  776. # check for memalign - atmos
  777. cat > $TMPC << EOF
  778. #include <stdio.h>
  779. #include <malloc.h>
  780. int main ( void ) {
  781. char *string = NULL;
  782. string = memalign(64, sizeof(char));
  783. return 0;
  784. }
  785. EOF
  786. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  787. fi
  788. if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
  789. echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
  790. exit 1
  791. fi
  792. cat > $TMPC << EOF
  793. #include <time.h>
  794. int main( void ) { localtime_r(NULL, NULL); }
  795. EOF
  796. localtime_r=no
  797. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  798. localtime_r=yes
  799. fi
  800. if test "$zlib" = "yes"; then
  801. # check for zlib - mmu_man
  802. cat > $TMPC << EOF
  803. #include <zlib.h>
  804. int main ( void ) {
  805. if (zlibVersion() != ZLIB_VERSION)
  806. puts("zlib version differs !!!");
  807. return 1;
  808. return 0;
  809. }
  810. EOF
  811. $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  812. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  813. # XXX: more tests needed - runtime test
  814. fi
  815. if test "$zlib" = "yes"; then
  816. extralibs="$extralibs -lz"
  817. fi
  818. # test for lrintf in math.h
  819. cat > $TMPC << EOF
  820. #define _ISOC9X_SOURCE 1
  821. #include <math.h>
  822. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  823. EOF
  824. have_lrintf="no"
  825. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  826. have_lrintf="yes"
  827. # allanc@chickenandporn.com: cannot execute cross-compiled
  828. # code on the host. Only execute if not cross-compiling.
  829. if test -z "$cross_prefix" ; then
  830. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  831. fi
  832. fi
  833. _restrict=
  834. for restrict_keyword in restrict __restrict__ __restrict; do
  835. echo "void foo(char * $restrict_keyword p);" > $TMPC
  836. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  837. _restrict=$restrict_keyword
  838. break;
  839. fi
  840. done
  841. # test gcc version to see if vector builtins can be used
  842. # currently only used on i386 for MMX builtins
  843. cat > $TMPC << EOF
  844. #include <xmmintrin.h>
  845. int main(void) {
  846. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  847. return 0;
  848. #else
  849. #error no vector builtins
  850. #endif
  851. }
  852. EOF
  853. builtin_vector=no
  854. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  855. builtin_vector=yes
  856. fi
  857. # dlopen/dlfcn.h probing
  858. cat > $TMPC << EOF
  859. #include <dlfcn.h>
  860. int main( void ) { return (int) dlopen("foo", 0); }
  861. EOF
  862. ldl=-ldl
  863. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  864. dlfcn=yes
  865. dlopen=yes
  866. fi
  867. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  868. dlfcn=yes
  869. dlopen=yes
  870. ldl=""
  871. fi
  872. cat > $TMPC << EOF
  873. int main( void ) { return (int) dlopen("foo", 0); }
  874. EOF
  875. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  876. dlopen=yes
  877. fi
  878. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  879. dlopen=yes
  880. ldl=""
  881. fi
  882. if test "$vhook" = "default" ; then
  883. vhook="$dlopen"
  884. fi
  885. ##########################################
  886. # imlib probe
  887. cat > $TMPC << EOF
  888. #include <X11/Xlib.h>
  889. #include <Imlib2.h>
  890. int main( void ) { return (int) imlib_load_font("foo"); }
  891. EOF
  892. imlib2=no
  893. if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
  894. imlib2=yes
  895. fi
  896. ##########################################
  897. # freetype probe
  898. cat > $TMPC << EOF
  899. #include <ft2build.h>
  900. int main( void ) { return (int) FT_Init_FreeType(0); }
  901. EOF
  902. freetype2=no
  903. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  904. if (freetype-config --version) >/dev/null 2>&1 ; then
  905. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
  906. freetype2=yes
  907. fi
  908. fi
  909. fi
  910. ##########################################
  911. # SDL probe
  912. cat > $TMPC << EOF
  913. #include <SDL.h>
  914. #undef main /* We don't want SDL to override our main() */
  915. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  916. EOF
  917. sdl_too_old=no
  918. sdl=no
  919. if (sdl-config --version) >/dev/null 2>&1 ; then
  920. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
  921. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  922. if test "$_sdlversion" -lt 121 ; then
  923. sdl_too_old=yes
  924. else
  925. sdl=yes
  926. fi
  927. fi
  928. fi
  929. ##########################################
  930. # texi2html probe
  931. texi2html=no
  932. if (texi2html -version) >/dev/null 2>&1; then
  933. texi2html=yes
  934. fi
  935. if test "$network" = "yes" ; then
  936. ##########################################
  937. # IPv6 probe
  938. cat > $TMPC << EOF
  939. #include <sys/types.h>
  940. #include <sys/socket.h>
  941. #include <netinet/in.h>
  942. #include <netdb.h>
  943. int main( void ) {
  944. struct sockaddr_storage saddr;
  945. struct ipv6_mreq mreq6;
  946. getaddrinfo(0,0,0,0);
  947. getnameinfo(0,0,0,0,0,0,0);
  948. IN6_IS_ADDR_MULTICAST(0);
  949. }
  950. EOF
  951. ipv6=no
  952. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  953. ipv6=yes
  954. fi
  955. fi
  956. case "`$cc -v 2>&1 | grep version`" in
  957. *gcc*)
  958. CFLAGS="-Wall -Wno-switch $CFLAGS"
  959. ;;
  960. *)
  961. ;;
  962. esac
  963. if test "$sdl" = "no" ; then
  964. ffplay=no
  965. fi
  966. if test "$debug" = "yes"; then
  967. CFLAGS="-g $CFLAGS"
  968. fi
  969. if test "$optimize" = "small"; then
  970. # CFLAGS=${CFLAGS//-O3/-Os}
  971. CFLAGS="$CFLAGS -Os"
  972. fi
  973. if test "$optimize" = "yes"; then
  974. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  975. CFLAGS="$CFLAGS -O5"
  976. LDFLAGS="$LDFLAGS -O5"
  977. else
  978. CFLAGS="-O3 $CFLAGS"
  979. fi
  980. fi
  981. if test x"$bindir" = x""; then
  982. bindir="${prefix}/bin"
  983. fi
  984. if test x"$libdir" = x""; then
  985. libdir="${prefix}/lib"
  986. fi
  987. if test x"$mandir" = x""; then
  988. mandir="${prefix}/man"
  989. fi
  990. echo "Install prefix $prefix"
  991. echo "Source path $source_path"
  992. echo "C compiler $cc"
  993. echo "make $make"
  994. echo "CPU $cpu ($tune)"
  995. echo "Big Endian $bigendian"
  996. echo "inttypes.h $inttypes"
  997. echo "broken inttypes.h $emu_fast_int"
  998. if test $cpu = "x86" -o $cpu = "x86_64"; then
  999. echo "MMX enabled $mmx"
  1000. echo "Vector Builtins $builtin_vector"
  1001. fi
  1002. if test $cpu = "mips"; then
  1003. echo "MMI enabled $mmi"
  1004. fi
  1005. if test $cpu = "powerpc"; then
  1006. echo "AltiVec enabled $altivec"
  1007. fi
  1008. echo "gprof enabled $gprof"
  1009. echo "zlib enabled $zlib"
  1010. echo "mp3lame enabled $mp3lame"
  1011. echo "libogg enabled $libogg"
  1012. echo "vorbis enabled $vorbis"
  1013. echo "theora enabled $theora"
  1014. echo "faad enabled $faad"
  1015. echo "faadbin enabled $faadbin"
  1016. echo "faac enabled $faac"
  1017. echo "xvid enabled $xvid"
  1018. echo "x264 enabled $x264"
  1019. echo "a52 support $a52"
  1020. echo "a52 dlopened $a52bin"
  1021. echo "dts support $dts"
  1022. echo "pp support $pp"
  1023. echo "debug symbols $debug"
  1024. echo "strip symbols $dostrip"
  1025. echo "optimize $optimize"
  1026. echo "shared pp $shared_pp"
  1027. echo "Video hooking $vhook"
  1028. echo "SDL support $sdl"
  1029. if test $sdl_too_old = "yes"; then
  1030. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  1031. fi
  1032. if test "$vhook" = "yes" ; then
  1033. echo "Imlib2 support $imlib2"
  1034. echo "freetype support $freetype2"
  1035. fi
  1036. echo "Sun medialib support" $sunmlib
  1037. echo "pthreads support" $pthreads
  1038. echo "AMR-NB float support" $amr_nb
  1039. echo "AMR-NB fixed support" $amr_nb_fixed
  1040. echo "AMR-WB float support" $amr_wb
  1041. echo "AMR-WB IF2 support" $amr_if2
  1042. echo "network support $network"
  1043. if test "$network" = "yes" ; then
  1044. echo "IPv6 support $ipv6"
  1045. fi
  1046. if test "$gpl" = "no" ; then
  1047. echo "License: LGPL"
  1048. else
  1049. echo "License: GPL"
  1050. fi
  1051. echo "Creating config.mak and config.h"
  1052. date >> config.log
  1053. echo " $0 $FFMPEG_CONFIGURATION" >> config.log
  1054. echo "# Automatically generated by configure - do not modify" > config.mak
  1055. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  1056. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1057. echo "prefix=$prefix" >> config.mak
  1058. echo "libdir=$libdir" >> config.mak
  1059. echo "bindir=$bindir" >> config.mak
  1060. echo "mandir=$mandir" >> config.mak
  1061. echo "MAKE=$make" >> config.mak
  1062. echo "CC=$cc" >> config.mak
  1063. echo "AR=$ar" >> config.mak
  1064. echo "RANLIB=$ranlib" >> config.mak
  1065. if test "$dostrip" = "yes" ; then
  1066. echo "STRIP=$strip" >> config.mak
  1067. echo "INSTALLSTRIP=-s" >> config.mak
  1068. else
  1069. echo "STRIP=echo ignoring strip" >> config.mak
  1070. echo "INSTALLSTRIP=" >> config.mak
  1071. fi
  1072. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
  1073. # shared modules on OS/X (vhook/Makefile).
  1074. SHCFLAGS=$CFLAGS
  1075. if test "$needmdynamicnopic" = yes; then
  1076. CFLAGS="$CFLAGS -mdynamic-no-pic"
  1077. fi
  1078. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1079. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  1080. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1081. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  1082. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1083. echo "LIBPREF=$LIBPREF" >> config.mak
  1084. echo "LIBSUF=$LIBSUF" >> config.mak
  1085. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1086. echo "SLIBSUF=$SLIBSUF" >> config.mak
  1087. echo "EXESUF=$EXESUF" >> config.mak
  1088. echo "TARGET_OS=$TARGET_OS" >> config.mak
  1089. if test "$cpu" = "x86" ; then
  1090. echo "TARGET_ARCH_X86=yes" >> config.mak
  1091. echo "#define ARCH_X86 1" >> $TMPH
  1092. elif test "$cpu" = "x86_64" ; then
  1093. echo "TARGET_ARCH_X86_64=yes" >> config.mak
  1094. echo "#define ARCH_X86_64 1" >> $TMPH
  1095. elif test "$cpu" = "armv4l" ; then
  1096. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  1097. echo "#define ARCH_ARMV4L 1" >> $TMPH
  1098. elif test "$cpu" = "alpha" ; then
  1099. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  1100. echo "#define ARCH_ALPHA 1" >> $TMPH
  1101. elif test "$cpu" = "sparc64" ; then
  1102. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  1103. echo "#define ARCH_SPARC64 1" >> $TMPH
  1104. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1105. echo "#define ARCH_SPARC 1" >> $TMPH
  1106. elif test "$cpu" = "sparc" ; then
  1107. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1108. echo "#define ARCH_SPARC 1" >> $TMPH
  1109. elif test "$cpu" = "powerpc" ; then
  1110. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  1111. echo "#define ARCH_POWERPC 1" >> $TMPH
  1112. if test $POWERPCMODE = "32bits"; then
  1113. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  1114. else
  1115. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1116. fi
  1117. if test "$powerpc_perf" = "yes"; then
  1118. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1119. fi
  1120. elif test "$cpu" = "mips" ; then
  1121. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1122. echo "#define ARCH_MIPS 1" >> $TMPH
  1123. elif test "$cpu" = "sh4" ; then
  1124. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1125. echo "#define ARCH_SH4 1" >> $TMPH
  1126. fi
  1127. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1128. if test "$bigendian" = "yes" ; then
  1129. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1130. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1131. fi
  1132. if test "$inttypes" != "yes" ; then
  1133. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1134. fi
  1135. if test "$emu_fast_int" = "yes" ; then
  1136. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1137. fi
  1138. if test "$mmx" = "yes" ; then
  1139. echo "TARGET_MMX=yes" >> config.mak
  1140. echo "#define HAVE_MMX 1" >> $TMPH
  1141. echo "#define __CPU__ 586" >> $TMPH
  1142. fi
  1143. if test "$builtin_vector" = "yes" ; then
  1144. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1145. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1146. fi
  1147. if test "$mmi" = "yes" ; then
  1148. echo "TARGET_MMI=yes" >> config.mak
  1149. echo "#define HAVE_MMI 1" >> $TMPH
  1150. fi
  1151. if test "$altivec" = "yes" ; then
  1152. echo "TARGET_ALTIVEC=yes" >> config.mak
  1153. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1154. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1155. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1156. if test "$_altivec_h" = "yes" ; then
  1157. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1158. else
  1159. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1160. fi
  1161. fi
  1162. if test "$gprof" = "yes" ; then
  1163. echo "TARGET_GPROF=yes" >> config.mak
  1164. echo "#define HAVE_GPROF 1" >> $TMPH
  1165. fi
  1166. if test "$localtime_r" = "yes" ; then
  1167. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1168. fi
  1169. if test "$imlib2" = "yes" ; then
  1170. echo "HAVE_IMLIB2=yes" >> config.mak
  1171. fi
  1172. if test "$freetype2" = "yes" ; then
  1173. echo "HAVE_FREETYPE2=yes" >> config.mak
  1174. fi
  1175. if test "$sunmlib" = "yes" ; then
  1176. echo "HAVE_MLIB=yes" >> config.mak
  1177. echo "#define HAVE_MLIB 1" >> $TMPH
  1178. extralibs="$extralibs -lmlib"
  1179. fi
  1180. if test "$pthreads" = "yes" ; then
  1181. echo "HAVE_PTHREADS=yes" >> config.mak
  1182. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1183. echo "#define HAVE_THREADS 1" >> $TMPH
  1184. if test $targetos != FreeBSD; then
  1185. extralibs="$extralibs -lpthread"
  1186. fi
  1187. fi
  1188. if test "$sdl" = "yes" ; then
  1189. echo "CONFIG_SDL=yes" >> config.mak
  1190. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  1191. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  1192. fi
  1193. if test "$texi2html" = "yes"; then
  1194. echo "BUILD_DOC=yes" >> config.mak
  1195. fi
  1196. if test "$have_lrintf" = "yes" ; then
  1197. echo "#define HAVE_LRINTF 1" >> $TMPH
  1198. fi
  1199. if test "$vhook" = "yes" ; then
  1200. echo "BUILD_VHOOK=yes" >> config.mak
  1201. echo "#define HAVE_VHOOK 1" >> $TMPH
  1202. extralibs="$extralibs $ldl"
  1203. fi
  1204. if test "$lshared" = "yes" ; then
  1205. echo "BUILD_SHARED=yes" >> config.mak
  1206. echo "PIC=-fPIC" >> config.mak
  1207. fi
  1208. echo "EXTRALIBS=$extralibs" >> config.mak
  1209. version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
  1210. cut -d '"' -f 2`
  1211. echo "VERSION=$version" >>config.mak
  1212. # if you do not want to use encoders, disable that.
  1213. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1214. echo "CONFIG_ENCODERS=yes" >> config.mak
  1215. # if you do not want to use decoders, disable that.
  1216. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1217. echo "CONFIG_DECODERS=yes" >> config.mak
  1218. # AC3
  1219. if test "$a52" = "yes" ; then
  1220. echo "#define CONFIG_AC3 1" >> $TMPH
  1221. echo "CONFIG_AC3=yes" >> config.mak
  1222. if test "$a52bin" = "yes" ; then
  1223. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1224. echo "CONFIG_A52BIN=yes" >> config.mak
  1225. fi
  1226. fi
  1227. # DTS
  1228. if test "$dts" = "yes" ; then
  1229. echo "#define CONFIG_DTS 1" >> $TMPH
  1230. echo "CONFIG_DTS=yes" >> config.mak
  1231. fi
  1232. # PP
  1233. if test "$pp" = "yes" ; then
  1234. echo "#define CONFIG_PP 1" >> $TMPH
  1235. echo "CONFIG_PP=yes" >> config.mak
  1236. if test "$shared_pp" = "yes" ; then
  1237. echo "#define SHARED_PP 1" >> $TMPH
  1238. echo "SHARED_PP=yes" >> config.mak
  1239. fi
  1240. fi
  1241. # mpeg audio high precision mode
  1242. if test "$mpegaudio_hp" = "yes" ; then
  1243. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1244. fi
  1245. if test "$v4l" = "yes" ; then
  1246. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1247. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1248. fi
  1249. if test "$dv1394" = "yes" ; then
  1250. echo "#define CONFIG_DV1394 1" >> $TMPH
  1251. echo "CONFIG_DV1394=yes" >> config.mak
  1252. fi
  1253. if test "$dc1394" = "yes" ; then
  1254. echo "#define CONFIG_DC1394 1" >> $TMPH
  1255. echo "CONFIG_DC1394=yes" >> config.mak
  1256. fi
  1257. if test "$dlopen" = "yes" ; then
  1258. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1259. fi
  1260. if test "$dlfcn" = "yes" ; then
  1261. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1262. fi
  1263. if test "$audio_oss" = "yes" ; then
  1264. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1265. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1266. fi
  1267. if test "$audio_beos" = "yes" ; then
  1268. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1269. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1270. fi
  1271. if test "$network" = "yes" ; then
  1272. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1273. echo "CONFIG_NETWORK=yes" >> config.mak
  1274. fi
  1275. if test "$ipv6" = "yes" ; then
  1276. echo "#define CONFIG_IPV6 1" >> $TMPH
  1277. fi
  1278. if test "$zlib" = "yes" ; then
  1279. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1280. echo "CONFIG_ZLIB=yes" >> config.mak
  1281. fi
  1282. if test "$mp3lame" = "yes" ; then
  1283. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1284. echo "CONFIG_MP3LAME=yes" >> config.mak
  1285. fi
  1286. if test "$libogg" = "yes" ; then
  1287. echo "#define CONFIG_LIBOGG 1" >> $TMPH
  1288. echo "CONFIG_LIBOGG=yes" >> config.mak
  1289. fi
  1290. if test "$vorbis" = "yes" ; then
  1291. echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
  1292. echo "CONFIG_LIBVORBIS=yes" >> config.mak
  1293. fi
  1294. if test "$theora" = "yes" ; then
  1295. echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
  1296. echo "CONFIG_LIBTHEORA=yes" >> config.mak
  1297. fi
  1298. if test "$faad" = "yes" ; then
  1299. echo "#define CONFIG_FAAD 1" >> $TMPH
  1300. echo "CONFIG_FAAD=yes" >> config.mak
  1301. fi
  1302. if test "$faadbin" = "yes" ; then
  1303. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1304. echo "CONFIG_FAADBIN=yes" >> config.mak
  1305. fi
  1306. if test "$faac" = "yes" ; then
  1307. echo "#define CONFIG_FAAC 1" >> $TMPH
  1308. echo "CONFIG_FAAC=yes" >> config.mak
  1309. fi
  1310. if test "$xvid" = "yes" ; then
  1311. echo "#define CONFIG_XVID 1" >> $TMPH
  1312. echo "CONFIG_XVID=yes" >> config.mak
  1313. fi
  1314. if test "$x264" = "yes" ; then
  1315. echo "#define CONFIG_X264 1" >> $TMPH
  1316. echo "CONFIG_X264=yes" >> config.mak
  1317. fi
  1318. if test "$mingw32" = "yes" ; then
  1319. echo "#define CONFIG_WIN32 1" >> $TMPH
  1320. echo "CONFIG_WIN32=yes" >> config.mak
  1321. echo "HAVE_W32THREADS=yes" >> config.mak
  1322. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1323. echo "#define HAVE_THREADS 1" >> $TMPH
  1324. echo "#ifndef __MINGW32__" >> $TMPH
  1325. echo "#define __MINGW32__ 1" >> $TMPH
  1326. echo "#endif" >> $TMPH
  1327. fi
  1328. if test "$os2" = "yes" ; then
  1329. echo "#define CONFIG_OS2 1" >> $TMPH
  1330. echo "CONFIG_OS2=yes" >> config.mak
  1331. fi
  1332. if test "$TARGET_OS" = "SunOS" ; then
  1333. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1334. fi
  1335. if test "$TARGET_OS" = "BeOS" ; then
  1336. echo "HAVE_BEOSTHREADS=yes" >> config.mak
  1337. echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
  1338. echo "#define HAVE_THREADS 1" >> $TMPH
  1339. fi
  1340. if test "$darwin" = "yes"; then
  1341. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1342. echo "CONFIG_DARWIN=yes" >> config.mak
  1343. fi
  1344. if test "$_malloc_h" = "yes" ; then
  1345. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1346. else
  1347. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1348. fi
  1349. if test "$_memalign" = "yes" ; then
  1350. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1351. else
  1352. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1353. fi
  1354. if test "$memalignhack" = "yes" ; then
  1355. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1356. fi
  1357. if test "$netserver" = "yes" ; then
  1358. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1359. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1360. fi
  1361. if test "$need_inet_aton" = "yes" ; then
  1362. echo "NEED_INET_ATON=yes" >> config.mak
  1363. fi
  1364. if test "$simpleidct" = "yes" ; then
  1365. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1366. fi
  1367. if test "$ffserver" = "yes" ; then
  1368. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1369. echo "CONFIG_FFSERVER=yes" >> config.mak
  1370. fi
  1371. if test "$ffplay" = "yes" ; then
  1372. echo "CONFIG_FFPLAY=yes" >> config.mak
  1373. fi
  1374. if test "$gpl" = "yes" ; then
  1375. echo "#define CONFIG_GPL 1" >> $TMPH
  1376. echo "CONFIG_GPL=yes" >> config.mak
  1377. fi
  1378. echo "#define restrict $_restrict" >> $TMPH
  1379. if test "$optimize" = "small"; then
  1380. echo "#define always_inline" >> $TMPH
  1381. fi
  1382. # build tree in object directory if source path is different from current one
  1383. if test "$source_path_used" = "yes" ; then
  1384. DIRS="doc libavformat libavcodec libavcodec/alpha libavcodec/armv4l \
  1385. libavcodec/i386 libavcodec/sparc libavcodec/mlib \
  1386. libavcodec/ppc libavcodec/liba52 libavcodec/libpostproc tests vhook"
  1387. FILES="Makefile libavformat/Makefile libavcodec/Makefile \
  1388. libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile \
  1389. doc/Makefile doc/texi2pod.pl"
  1390. for dir in $DIRS ; do
  1391. mkdir -p $dir
  1392. done
  1393. for f in $FILES ; do
  1394. ln -sf "$source_path/$f" $f
  1395. done
  1396. echo "SRC_PATH=$source_path" >> config.mak
  1397. else
  1398. echo "SRC_PATH='$source_path'" >> config.mak
  1399. fi
  1400. if test "$amr_wb" = "yes" ; then
  1401. echo "#define AMR_WB 1" >> $TMPH
  1402. echo "AMR_WB=yes" >> config.mak
  1403. echo
  1404. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1405. echo "V5.1.0 from "
  1406. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1407. echo "and extracted the source to libavcodec/amrwb_float"
  1408. echo
  1409. fi
  1410. if test "$amr_nb" = "yes" ; then
  1411. echo "#define AMR_NB 1" >> $TMPH
  1412. echo "AMR_NB=yes" >> config.mak
  1413. echo
  1414. if test "$amr_nb_fixed" = "yes" ; then
  1415. echo "AMR_NB_FIXED=yes" >> config.mak
  1416. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1417. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1418. echo "REL-5 version 5.1.0 from "
  1419. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
  1420. echo "and extracted src to libavcodec/amr"
  1421. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1422. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1423. echo
  1424. else
  1425. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1426. echo "REL-5 V5.1.0 from "
  1427. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
  1428. echo "and extracted the source to libavcodec/amr_float"
  1429. echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
  1430. echo
  1431. fi
  1432. if test "$amr_if2" = "yes" ; then
  1433. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1434. fi
  1435. fi
  1436. diff $TMPH config.h >/dev/null 2>&1
  1437. if test $? -ne 0 ; then
  1438. mv -f $TMPH config.h
  1439. else
  1440. echo "config.h is unchanged"
  1441. fi
  1442. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH