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.

1622 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. *)
  667. echo "WARNING: unknown CPU "$tune", ignored"
  668. ;;
  669. esac
  670. fi
  671. # AltiVec flags: The FSF version of GCC differs from the Apple version
  672. if test $cpu = "powerpc"; then
  673. if test $altivec = "yes"; then
  674. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  675. CFLAGS="$CFLAGS -faltivec"
  676. else
  677. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  678. fi
  679. fi
  680. fi
  681. # See if we have <altivec.h>
  682. cat > $TMPC << EOF
  683. #include <altivec.h>
  684. int main( void ) { return 0; }
  685. EOF
  686. _altivec_h="no"
  687. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  688. _altivec_h="yes"
  689. fi
  690. # See does our compiler support Motorola AltiVec C API
  691. if test $altivec = "yes"; then
  692. if test $_altivec_h = "yes"; then
  693. cat > $TMPC << EOF
  694. #include <altivec.h>
  695. int main(void) {
  696. vector signed int v1, v2, v3;
  697. v1 = vec_add(v2,v3);
  698. return 0;
  699. }
  700. EOF
  701. else
  702. cat > $TMPC << EOF
  703. int main(void) {
  704. vector signed int v1, v2, v3;
  705. v1 = vec_add(v2,v3);
  706. return 0;
  707. }
  708. EOF
  709. fi
  710. $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
  711. fi
  712. # Can only do mmi on mips
  713. if test $mmi = "default"; then
  714. if test $cpu = "mips"; then
  715. mmi="yes"
  716. else
  717. mmi="no"
  718. fi
  719. fi
  720. # See does our compiler support mmi
  721. if test $mmi = "yes"; then
  722. cat > $TMPC << EOF
  723. int main(void) {
  724. __asm__ ("lq \$2, 0(\$2)");
  725. return 0;
  726. }
  727. EOF
  728. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  729. fi
  730. if test "$mingw32" = "yes" ; then
  731. v4l="no"
  732. audio_oss="no"
  733. dv1394="no"
  734. dc1394="no"
  735. ffserver="no"
  736. network="no"
  737. LIBPREF=""
  738. LIBSUF=".lib"
  739. SLIBPREF=""
  740. SLIBSUF=".dll"
  741. EXESUF=".exe"
  742. prefix="/c/Program Files/FFmpeg"
  743. bindir="$prefix"
  744. fi
  745. cc="${cross_prefix}${cc}"
  746. ar="${cross_prefix}${ar}"
  747. ranlib="${cross_prefix}${ranlib}"
  748. strip="${cross_prefix}${strip}"
  749. if test -z "$cross_prefix" ; then
  750. # ---
  751. # big/little endian test
  752. cat > $TMPC << EOF
  753. #include <inttypes.h>
  754. int main(int argc, char ** argv){
  755. volatile uint32_t i=0x01234567;
  756. return (*((uint8_t*)(&i))) == 0x67;
  757. }
  758. EOF
  759. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  760. $TMPE && bigendian="yes"
  761. else
  762. echo big/little test failed
  763. fi
  764. else
  765. # if cross compiling, cannot launch a program, so make a static guess
  766. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  767. bigendian="yes"
  768. fi
  769. fi
  770. # ---
  771. # *inttypes.h* test
  772. cat > $TMPC << EOF
  773. #include <inttypes.h>
  774. int main(int argc, char ** argv){
  775. return 0;
  776. }
  777. EOF
  778. $cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
  779. # ---
  780. # *int_fast* test
  781. cat > $TMPC << EOF
  782. #include <inttypes.h>
  783. int main(int argc, char ** argv){
  784. volatile uint_fast64_t i=0x01234567;
  785. return 0;
  786. }
  787. EOF
  788. $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
  789. # ---
  790. # check availability of some header files
  791. cat > $TMPC << EOF
  792. #include <malloc.h>
  793. int main( void ) { return 0; }
  794. EOF
  795. _memalign=no
  796. _malloc_h=no
  797. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  798. _malloc_h=yes
  799. _memalign=yes
  800. # check for memalign - atmos
  801. cat > $TMPC << EOF
  802. #include <stdio.h>
  803. #include <malloc.h>
  804. int main ( void ) {
  805. char *string = NULL;
  806. string = memalign(64, sizeof(char));
  807. return 0;
  808. }
  809. EOF
  810. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  811. fi
  812. if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
  813. echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
  814. exit 1
  815. fi
  816. cat > $TMPC << EOF
  817. #include <time.h>
  818. int main( void ) { localtime_r(NULL, NULL); }
  819. EOF
  820. localtime_r=no
  821. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  822. localtime_r=yes
  823. fi
  824. if test "$zlib" = "yes"; then
  825. # check for zlib - mmu_man
  826. cat > $TMPC << EOF
  827. #include <zlib.h>
  828. int main ( void ) {
  829. if (zlibVersion() != ZLIB_VERSION)
  830. puts("zlib version differs !!!");
  831. return 1;
  832. return 0;
  833. }
  834. EOF
  835. $cc $CFLAGS $LDFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  836. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  837. # XXX: more tests needed - runtime test
  838. fi
  839. if test "$zlib" = "yes"; then
  840. extralibs="$extralibs -lz"
  841. fi
  842. # test for lrintf in math.h
  843. cat > $TMPC << EOF
  844. #define _ISOC9X_SOURCE 1
  845. #include <math.h>
  846. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  847. EOF
  848. have_lrintf="no"
  849. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  850. have_lrintf="yes"
  851. # allanc@chickenandporn.com: cannot execute cross-compiled
  852. # code on the host. Only execute if not cross-compiling.
  853. if test -z "$cross_prefix" ; then
  854. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  855. fi
  856. fi
  857. _restrict=
  858. for restrict_keyword in restrict __restrict__ __restrict; do
  859. echo "void foo(char * $restrict_keyword p);" > $TMPC
  860. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  861. _restrict=$restrict_keyword
  862. break;
  863. fi
  864. done
  865. # test gcc version to see if vector builtins can be used
  866. # currently only used on i386 for MMX builtins
  867. cat > $TMPC << EOF
  868. #include <xmmintrin.h>
  869. int main(void) {
  870. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  871. return 0;
  872. #else
  873. #error no vector builtins
  874. #endif
  875. }
  876. EOF
  877. builtin_vector=no
  878. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  879. builtin_vector=yes
  880. fi
  881. # dlopen/dlfcn.h probing
  882. cat > $TMPC << EOF
  883. #include <dlfcn.h>
  884. int main( void ) { return (int) dlopen("foo", 0); }
  885. EOF
  886. ldl=-ldl
  887. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  888. dlfcn=yes
  889. dlopen=yes
  890. fi
  891. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  892. dlfcn=yes
  893. dlopen=yes
  894. ldl=""
  895. fi
  896. cat > $TMPC << EOF
  897. int main( void ) { return (int) dlopen("foo", 0); }
  898. EOF
  899. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  900. dlopen=yes
  901. fi
  902. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  903. dlopen=yes
  904. ldl=""
  905. fi
  906. if test "$vhook" = "default" ; then
  907. vhook="$dlopen"
  908. fi
  909. ##########################################
  910. # imlib probe
  911. cat > $TMPC << EOF
  912. #include <X11/Xlib.h>
  913. #include <Imlib2.h>
  914. int main( void ) { return (int) imlib_load_font("foo"); }
  915. EOF
  916. imlib2=no
  917. if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
  918. imlib2=yes
  919. fi
  920. ##########################################
  921. # freetype probe
  922. cat > $TMPC << EOF
  923. #include <ft2build.h>
  924. int main( void ) { return (int) FT_Init_FreeType(0); }
  925. EOF
  926. freetype2=no
  927. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  928. if (freetype-config --version) >/dev/null 2>&1 ; then
  929. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
  930. freetype2=yes
  931. fi
  932. fi
  933. fi
  934. ##########################################
  935. # SDL probe
  936. cat > $TMPC << EOF
  937. #include <SDL.h>
  938. #undef main /* We don't want SDL to override our main() */
  939. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  940. EOF
  941. sdl_too_old=no
  942. sdl=no
  943. if (sdl-config --version) >/dev/null 2>&1 ; then
  944. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
  945. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  946. if test "$_sdlversion" -lt 121 ; then
  947. sdl_too_old=yes
  948. else
  949. sdl=yes
  950. fi
  951. fi
  952. fi
  953. ##########################################
  954. # texi2html probe
  955. texi2html=no
  956. if (texi2html -version) >/dev/null 2>&1; then
  957. texi2html=yes
  958. fi
  959. if test "$network" = "yes" ; then
  960. ##########################################
  961. # IPv6 probe
  962. cat > $TMPC << EOF
  963. #include <sys/types.h>
  964. #include <sys/socket.h>
  965. #include <netinet/in.h>
  966. #include <netdb.h>
  967. int main( void ) {
  968. struct sockaddr_storage saddr;
  969. struct ipv6_mreq mreq6;
  970. getaddrinfo(0,0,0,0);
  971. getnameinfo(0,0,0,0,0,0,0);
  972. IN6_IS_ADDR_MULTICAST(0);
  973. }
  974. EOF
  975. ipv6=no
  976. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  977. ipv6=yes
  978. fi
  979. fi
  980. case "`$cc -v 2>&1 | grep version`" in
  981. *gcc*)
  982. CFLAGS="-Wall -Wno-switch $CFLAGS"
  983. ;;
  984. *)
  985. ;;
  986. esac
  987. if test "$sdl" = "no" ; then
  988. ffplay=no
  989. fi
  990. if test "$debug" = "yes"; then
  991. CFLAGS="-g $CFLAGS"
  992. fi
  993. if test "$optimize" = "small"; then
  994. # CFLAGS=${CFLAGS//-O3/-Os}
  995. CFLAGS="$CFLAGS -Os"
  996. fi
  997. if test "$optimize" = "yes"; then
  998. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  999. CFLAGS="$CFLAGS -O5"
  1000. LDFLAGS="$LDFLAGS -O5"
  1001. else
  1002. CFLAGS="-O3 $CFLAGS"
  1003. fi
  1004. fi
  1005. if test x"$bindir" = x""; then
  1006. bindir="${prefix}/bin"
  1007. fi
  1008. if test x"$libdir" = x""; then
  1009. libdir="${prefix}/lib"
  1010. fi
  1011. if test x"$mandir" = x""; then
  1012. mandir="${prefix}/man"
  1013. fi
  1014. echo "Install prefix $prefix"
  1015. echo "Source path $source_path"
  1016. echo "C compiler $cc"
  1017. echo "make $make"
  1018. echo "CPU $cpu ($tune)"
  1019. if test "$BUILDSUF" != ""; then
  1020. echo "Build suffix $BUILDSUF"
  1021. fi
  1022. echo "Big Endian $bigendian"
  1023. echo "inttypes.h $inttypes"
  1024. echo "broken inttypes.h $emu_fast_int"
  1025. if test $cpu = "x86" -o $cpu = "x86_64"; then
  1026. echo "MMX enabled $mmx"
  1027. echo "Vector Builtins $builtin_vector"
  1028. fi
  1029. if test $cpu = "mips"; then
  1030. echo "MMI enabled $mmi"
  1031. fi
  1032. if test $cpu = "powerpc"; then
  1033. echo "AltiVec enabled $altivec"
  1034. fi
  1035. echo "gprof enabled $gprof"
  1036. echo "zlib enabled $zlib"
  1037. echo "mp3lame enabled $mp3lame"
  1038. echo "libogg enabled $libogg"
  1039. echo "vorbis enabled $vorbis"
  1040. echo "theora enabled $theora"
  1041. echo "faad enabled $faad"
  1042. echo "faadbin enabled $faadbin"
  1043. echo "faac enabled $faac"
  1044. echo "xvid enabled $xvid"
  1045. echo "x264 enabled $x264"
  1046. echo "a52 support $a52"
  1047. echo "a52 dlopened $a52bin"
  1048. echo "dts support $dts"
  1049. echo "pp support $pp"
  1050. echo "debug symbols $debug"
  1051. echo "strip symbols $dostrip"
  1052. echo "optimize $optimize"
  1053. echo "shared pp $shared_pp"
  1054. echo "Video hooking $vhook"
  1055. echo "SDL support $sdl"
  1056. if test $sdl_too_old = "yes"; then
  1057. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  1058. fi
  1059. if test "$vhook" = "yes" ; then
  1060. echo "Imlib2 support $imlib2"
  1061. echo "freetype support $freetype2"
  1062. fi
  1063. echo "Sun medialib support" $sunmlib
  1064. echo "pthreads support" $pthreads
  1065. echo "AMR-NB float support" $amr_nb
  1066. echo "AMR-NB fixed support" $amr_nb_fixed
  1067. echo "AMR-WB float support" $amr_wb
  1068. echo "AMR-WB IF2 support" $amr_if2
  1069. echo "network support $network"
  1070. if test "$network" = "yes" ; then
  1071. echo "IPv6 support $ipv6"
  1072. fi
  1073. if test "$gpl" = "no" ; then
  1074. echo "License: LGPL"
  1075. else
  1076. echo "License: GPL"
  1077. fi
  1078. echo "Creating config.mak and config.h"
  1079. date >> config.log
  1080. echo " $0 $FFMPEG_CONFIGURATION" >> config.log
  1081. echo "# Automatically generated by configure - do not modify" > config.mak
  1082. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  1083. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1084. echo "prefix=$prefix" >> config.mak
  1085. echo "libdir=$libdir" >> config.mak
  1086. echo "bindir=$bindir" >> config.mak
  1087. echo "mandir=$mandir" >> config.mak
  1088. echo "MAKE=$make" >> config.mak
  1089. echo "CC=$cc" >> config.mak
  1090. echo "AR=$ar" >> config.mak
  1091. echo "RANLIB=$ranlib" >> config.mak
  1092. if test "$dostrip" = "yes" ; then
  1093. echo "STRIP=$strip" >> config.mak
  1094. echo "INSTALLSTRIP=-s" >> config.mak
  1095. else
  1096. echo "STRIP=echo ignoring strip" >> config.mak
  1097. echo "INSTALLSTRIP=" >> config.mak
  1098. fi
  1099. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
  1100. # shared modules on OS/X (vhook/Makefile).
  1101. SHCFLAGS=$CFLAGS
  1102. if test "$needmdynamicnopic" = yes; then
  1103. CFLAGS="$CFLAGS -mdynamic-no-pic"
  1104. fi
  1105. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1106. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  1107. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1108. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  1109. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1110. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1111. echo "LIBPREF=$LIBPREF" >> config.mak
  1112. echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
  1113. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1114. echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
  1115. echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
  1116. echo "TARGET_OS=$TARGET_OS" >> config.mak
  1117. if test "$cpu" = "x86" ; then
  1118. echo "TARGET_ARCH_X86=yes" >> config.mak
  1119. echo "#define ARCH_X86 1" >> $TMPH
  1120. elif test "$cpu" = "x86_64" ; then
  1121. echo "TARGET_ARCH_X86_64=yes" >> config.mak
  1122. echo "#define ARCH_X86_64 1" >> $TMPH
  1123. elif test "$cpu" = "armv4l" ; then
  1124. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  1125. echo "#define ARCH_ARMV4L 1" >> $TMPH
  1126. elif test "$cpu" = "alpha" ; then
  1127. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  1128. echo "#define ARCH_ALPHA 1" >> $TMPH
  1129. elif test "$cpu" = "sparc64" ; then
  1130. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  1131. echo "#define ARCH_SPARC64 1" >> $TMPH
  1132. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1133. echo "#define ARCH_SPARC 1" >> $TMPH
  1134. elif test "$cpu" = "sparc" ; then
  1135. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1136. echo "#define ARCH_SPARC 1" >> $TMPH
  1137. elif test "$cpu" = "powerpc" ; then
  1138. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  1139. echo "#define ARCH_POWERPC 1" >> $TMPH
  1140. if test $POWERPCMODE = "32bits"; then
  1141. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  1142. else
  1143. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1144. fi
  1145. if test "$powerpc_perf" = "yes"; then
  1146. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1147. fi
  1148. elif test "$cpu" = "mips" ; then
  1149. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1150. echo "#define ARCH_MIPS 1" >> $TMPH
  1151. elif test "$cpu" = "sh4" ; then
  1152. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1153. echo "#define ARCH_SH4 1" >> $TMPH
  1154. fi
  1155. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1156. if test "$bigendian" = "yes" ; then
  1157. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1158. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1159. fi
  1160. if test "$inttypes" != "yes" ; then
  1161. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1162. fi
  1163. if test "$emu_fast_int" = "yes" ; then
  1164. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1165. fi
  1166. if test "$mmx" = "yes" ; then
  1167. echo "TARGET_MMX=yes" >> config.mak
  1168. echo "#define HAVE_MMX 1" >> $TMPH
  1169. echo "#define __CPU__ 586" >> $TMPH
  1170. fi
  1171. if test "$builtin_vector" = "yes" ; then
  1172. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1173. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1174. fi
  1175. if test "$mmi" = "yes" ; then
  1176. echo "TARGET_MMI=yes" >> config.mak
  1177. echo "#define HAVE_MMI 1" >> $TMPH
  1178. fi
  1179. if test "$altivec" = "yes" ; then
  1180. echo "TARGET_ALTIVEC=yes" >> config.mak
  1181. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1182. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1183. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1184. if test "$_altivec_h" = "yes" ; then
  1185. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1186. else
  1187. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1188. fi
  1189. fi
  1190. if test "$gprof" = "yes" ; then
  1191. echo "TARGET_GPROF=yes" >> config.mak
  1192. echo "#define HAVE_GPROF 1" >> $TMPH
  1193. fi
  1194. if test "$localtime_r" = "yes" ; then
  1195. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1196. fi
  1197. if test "$imlib2" = "yes" ; then
  1198. echo "HAVE_IMLIB2=yes" >> config.mak
  1199. fi
  1200. if test "$freetype2" = "yes" ; then
  1201. echo "HAVE_FREETYPE2=yes" >> config.mak
  1202. fi
  1203. if test "$sunmlib" = "yes" ; then
  1204. echo "HAVE_MLIB=yes" >> config.mak
  1205. echo "#define HAVE_MLIB 1" >> $TMPH
  1206. extralibs="$extralibs -lmlib"
  1207. fi
  1208. if test "$pthreads" = "yes" ; then
  1209. echo "HAVE_PTHREADS=yes" >> config.mak
  1210. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1211. echo "#define HAVE_THREADS 1" >> $TMPH
  1212. if test $targetos != FreeBSD -a $targetos != OpenBSD ; then
  1213. extralibs="$extralibs -lpthread"
  1214. fi
  1215. fi
  1216. if test "$sdl" = "yes" ; then
  1217. echo "CONFIG_SDL=yes" >> config.mak
  1218. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  1219. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  1220. fi
  1221. if test "$texi2html" = "yes"; then
  1222. echo "BUILD_DOC=yes" >> config.mak
  1223. fi
  1224. if test "$have_lrintf" = "yes" ; then
  1225. echo "#define HAVE_LRINTF 1" >> $TMPH
  1226. fi
  1227. if test "$vhook" = "yes" ; then
  1228. echo "BUILD_VHOOK=yes" >> config.mak
  1229. echo "#define HAVE_VHOOK 1" >> $TMPH
  1230. extralibs="$extralibs $ldl"
  1231. fi
  1232. if test "$lshared" = "yes" ; then
  1233. echo "BUILD_SHARED=yes" >> config.mak
  1234. echo "PIC=-fPIC -DPIC" >> config.mak
  1235. fi
  1236. echo "EXTRALIBS=$extralibs" >> config.mak
  1237. version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
  1238. cut -d '"' -f 2`
  1239. echo "VERSION=$version" >>config.mak
  1240. # if you do not want to use encoders, disable that.
  1241. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1242. echo "CONFIG_ENCODERS=yes" >> config.mak
  1243. # if you do not want to use decoders, disable that.
  1244. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1245. echo "CONFIG_DECODERS=yes" >> config.mak
  1246. # AC3
  1247. if test "$a52" = "yes" ; then
  1248. echo "#define CONFIG_AC3 1" >> $TMPH
  1249. echo "CONFIG_AC3=yes" >> config.mak
  1250. if test "$a52bin" = "yes" ; then
  1251. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1252. echo "CONFIG_A52BIN=yes" >> config.mak
  1253. fi
  1254. fi
  1255. # DTS
  1256. if test "$dts" = "yes" ; then
  1257. echo "#define CONFIG_DTS 1" >> $TMPH
  1258. echo "CONFIG_DTS=yes" >> config.mak
  1259. fi
  1260. # PP
  1261. if test "$pp" = "yes" ; then
  1262. echo "#define CONFIG_PP 1" >> $TMPH
  1263. echo "CONFIG_PP=yes" >> config.mak
  1264. if test "$shared_pp" = "yes" ; then
  1265. echo "#define SHARED_PP 1" >> $TMPH
  1266. echo "SHARED_PP=yes" >> config.mak
  1267. fi
  1268. fi
  1269. # mpeg audio high precision mode
  1270. if test "$mpegaudio_hp" = "yes" ; then
  1271. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1272. fi
  1273. if test "$v4l" = "yes" ; then
  1274. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1275. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1276. fi
  1277. if test "$dv1394" = "yes" ; then
  1278. echo "#define CONFIG_DV1394 1" >> $TMPH
  1279. echo "CONFIG_DV1394=yes" >> config.mak
  1280. fi
  1281. if test "$dc1394" = "yes" ; then
  1282. echo "#define CONFIG_DC1394 1" >> $TMPH
  1283. echo "CONFIG_DC1394=yes" >> config.mak
  1284. fi
  1285. if test "$dlopen" = "yes" ; then
  1286. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1287. fi
  1288. if test "$dlfcn" = "yes" ; then
  1289. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1290. fi
  1291. if test "$audio_oss" = "yes" ; then
  1292. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1293. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1294. fi
  1295. if test "$audio_beos" = "yes" ; then
  1296. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1297. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1298. fi
  1299. if test "$network" = "yes" ; then
  1300. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1301. echo "CONFIG_NETWORK=yes" >> config.mak
  1302. fi
  1303. if test "$ipv6" = "yes" ; then
  1304. echo "#define CONFIG_IPV6 1" >> $TMPH
  1305. fi
  1306. if test "$zlib" = "yes" ; then
  1307. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1308. echo "CONFIG_ZLIB=yes" >> config.mak
  1309. fi
  1310. if test "$mp3lame" = "yes" ; then
  1311. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1312. echo "CONFIG_MP3LAME=yes" >> config.mak
  1313. fi
  1314. if test "$libogg" = "yes" ; then
  1315. echo "#define CONFIG_LIBOGG 1" >> $TMPH
  1316. echo "CONFIG_LIBOGG=yes" >> config.mak
  1317. fi
  1318. if test "$vorbis" = "yes" ; then
  1319. echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
  1320. echo "CONFIG_LIBVORBIS=yes" >> config.mak
  1321. fi
  1322. if test "$theora" = "yes" ; then
  1323. echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
  1324. echo "CONFIG_LIBTHEORA=yes" >> config.mak
  1325. fi
  1326. if test "$faad" = "yes" ; then
  1327. echo "#define CONFIG_FAAD 1" >> $TMPH
  1328. echo "CONFIG_FAAD=yes" >> config.mak
  1329. fi
  1330. if test "$faadbin" = "yes" ; then
  1331. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1332. echo "CONFIG_FAADBIN=yes" >> config.mak
  1333. fi
  1334. if test "$faac" = "yes" ; then
  1335. echo "#define CONFIG_FAAC 1" >> $TMPH
  1336. echo "CONFIG_FAAC=yes" >> config.mak
  1337. fi
  1338. if test "$xvid" = "yes" ; then
  1339. echo "#define CONFIG_XVID 1" >> $TMPH
  1340. echo "CONFIG_XVID=yes" >> config.mak
  1341. fi
  1342. if test "$x264" = "yes" ; then
  1343. echo "#define CONFIG_X264 1" >> $TMPH
  1344. echo "CONFIG_X264=yes" >> config.mak
  1345. fi
  1346. if test "$mingw32" = "yes" ; then
  1347. echo "#define CONFIG_WIN32 1" >> $TMPH
  1348. echo "CONFIG_WIN32=yes" >> config.mak
  1349. echo "HAVE_W32THREADS=yes" >> config.mak
  1350. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1351. echo "#define HAVE_THREADS 1" >> $TMPH
  1352. echo "#ifndef __MINGW32__" >> $TMPH
  1353. echo "#define __MINGW32__ 1" >> $TMPH
  1354. echo "#endif" >> $TMPH
  1355. fi
  1356. if test "$os2" = "yes" ; then
  1357. echo "#define CONFIG_OS2 1" >> $TMPH
  1358. echo "CONFIG_OS2=yes" >> config.mak
  1359. fi
  1360. if test "$TARGET_OS" = "SunOS" ; then
  1361. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1362. fi
  1363. if test "$TARGET_OS" = "BeOS" ; then
  1364. echo "HAVE_BEOSTHREADS=yes" >> config.mak
  1365. echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
  1366. echo "#define HAVE_THREADS 1" >> $TMPH
  1367. fi
  1368. if test "$darwin" = "yes"; then
  1369. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1370. echo "CONFIG_DARWIN=yes" >> config.mak
  1371. fi
  1372. if test "$_malloc_h" = "yes" ; then
  1373. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1374. else
  1375. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1376. fi
  1377. if test "$_memalign" = "yes" ; then
  1378. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1379. else
  1380. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1381. fi
  1382. if test "$memalignhack" = "yes" ; then
  1383. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1384. fi
  1385. if test "$netserver" = "yes" ; then
  1386. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1387. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1388. fi
  1389. if test "$need_inet_aton" = "yes" ; then
  1390. echo "NEED_INET_ATON=yes" >> config.mak
  1391. fi
  1392. if test "$simpleidct" = "yes" ; then
  1393. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1394. fi
  1395. if test "$ffserver" = "yes" ; then
  1396. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1397. echo "CONFIG_FFSERVER=yes" >> config.mak
  1398. fi
  1399. if test "$ffplay" = "yes" ; then
  1400. echo "CONFIG_FFPLAY=yes" >> config.mak
  1401. fi
  1402. if test "$gpl" = "yes" ; then
  1403. echo "#define CONFIG_GPL 1" >> $TMPH
  1404. echo "CONFIG_GPL=yes" >> config.mak
  1405. fi
  1406. echo "#define restrict $_restrict" >> $TMPH
  1407. if test "$optimize" = "small"; then
  1408. echo "#define always_inline" >> $TMPH
  1409. fi
  1410. # build tree in object directory if source path is different from current one
  1411. if test "$source_path_used" = "yes" ; then
  1412. DIRS="doc libavformat libavcodec libavcodec/alpha libavcodec/armv4l \
  1413. libavcodec/i386 libavcodec/sparc libavcodec/mlib \
  1414. libavcodec/ppc libavcodec/liba52 libavcodec/libpostproc tests vhook"
  1415. FILES="Makefile libavformat/Makefile libavcodec/Makefile \
  1416. libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile \
  1417. doc/Makefile doc/texi2pod.pl"
  1418. for dir in $DIRS ; do
  1419. mkdir -p $dir
  1420. done
  1421. for f in $FILES ; do
  1422. ln -sf "$source_path/$f" $f
  1423. done
  1424. echo "SRC_PATH=$source_path" >> config.mak
  1425. else
  1426. echo "SRC_PATH='$source_path'" >> config.mak
  1427. fi
  1428. if test "$amr_wb" = "yes" ; then
  1429. echo "#define AMR_WB 1" >> $TMPH
  1430. echo "AMR_WB=yes" >> config.mak
  1431. echo
  1432. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1433. echo "V5.1.0 from "
  1434. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1435. echo "and extracted the source to libavcodec/amrwb_float"
  1436. echo
  1437. fi
  1438. if test "$amr_nb" = "yes" ; then
  1439. echo "#define AMR_NB 1" >> $TMPH
  1440. echo "AMR_NB=yes" >> config.mak
  1441. echo
  1442. if test "$amr_nb_fixed" = "yes" ; then
  1443. echo "AMR_NB_FIXED=yes" >> config.mak
  1444. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1445. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1446. echo "REL-5 version 5.1.0 from "
  1447. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
  1448. echo "and extracted src to libavcodec/amr"
  1449. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1450. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1451. echo
  1452. else
  1453. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1454. echo "REL-5 V5.1.0 from "
  1455. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
  1456. echo "and extracted the source to libavcodec/amr_float"
  1457. echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
  1458. echo
  1459. fi
  1460. if test "$amr_if2" = "yes" ; then
  1461. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1462. fi
  1463. fi
  1464. for codec in $CODEC_LIST ; do
  1465. echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
  1466. echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
  1467. done
  1468. diff $TMPH config.h >/dev/null 2>&1
  1469. if test $? -ne 0 ; then
  1470. mv -f $TMPH config.h
  1471. else
  1472. echo "config.h is unchanged"
  1473. fi
  1474. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH