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.

1768 lines
43KB

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