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.

1793 lines
44KB

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