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.

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