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.

1625 lines
40KB

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