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.

1739 lines
43KB

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