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.

1726 lines
42KB

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