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.

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