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.

2215 lines
57KB

  1. #!/bin/sh
  2. #
  3. # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. # make sure we are running under a compatible shell
  6. (: ${foo%%bar}) 2>/dev/null
  7. if test "$?" != 0; then
  8. if test "x$FFMPEG_CONFIGURE_EXEC" = x; then
  9. FFMPEG_CONFIGURE_EXEC=1
  10. export FFMPEG_CONFIGURE_EXEC
  11. exec bash "$0" "$@"
  12. exec ksh "$0" "$@"
  13. exec /usr/xpg4/bin/sh "$0" "$@"
  14. fi
  15. echo "No compatible shell script interpreter found."
  16. exit 1
  17. fi
  18. show_help(){
  19. echo "Usage: configure [options]"
  20. echo "Options: [defaults in brackets after descriptions]"
  21. echo
  22. echo "Standard options:"
  23. echo " --help print this message"
  24. echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]"
  25. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  26. echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
  27. echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
  28. echo " --mandir=DIR install man page in DIR [PREFIX/man]"
  29. echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]"
  30. echo " --enable-libogg enable Ogg support via libogg [default=no]"
  31. echo " --enable-vorbis enable Vorbis support via libvorbis [default=no]"
  32. echo " --enable-theora enable Theora support via libtheora [default=no]"
  33. echo " --enable-faad enable FAAD support via libfaad [default=no]"
  34. echo " --enable-faadbin build FAAD support with runtime linking [default=no]"
  35. echo " --enable-faac enable FAAC support via libfaac [default=no]"
  36. echo " --enable-libgsm enable GSM support via libgsm [default=no]"
  37. echo " --enable-xvid enable XviD support via xvidcore [default=no]"
  38. echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
  39. echo " --enable-mingw32 enable MinGW native/cross Windows compile"
  40. echo " --enable-mingwce enable MinGW native/cross WinCE compile"
  41. echo " --enable-a52 enable GPLed A52 support [default=no]"
  42. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  43. echo " --enable-dts enable GPLed DTS support [default=no]"
  44. echo " --enable-pp enable GPLed postprocessing support [default=no]"
  45. echo " --enable-static build static libraries [default=yes]"
  46. echo " --disable-static do not build static libraries [default=no]"
  47. echo " --enable-shared build shared libraries [default=no]"
  48. echo " --disable-shared do not build shared libraries [default=yes]"
  49. echo " --enable-amr_nb enable amr_nb float audio codec"
  50. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  51. echo " --enable-amr_wb enable amr_wb float audio codec"
  52. echo " --enable-amr_if2 enable amr_wb IF2 audio codec"
  53. echo " --enable-sunmlib use Sun medialib [default=no]"
  54. echo " --enable-pthreads use pthreads [default=no]"
  55. echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
  56. echo " and libraw1394 [default=no]"
  57. echo " --enable-gpl allow use of GPL code, the resulting libav*"
  58. echo " and ffmpeg will be under GPL [default=no]"
  59. echo ""
  60. echo "Advanced options (experts only):"
  61. echo " --source-path=PATH path to source code [$source_path]"
  62. echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
  63. echo " --cross-compile assume a cross-compiler is used"
  64. echo " --cc=CC use C compiler CC [$cc]"
  65. echo " --make=MAKE use specified make [$make]"
  66. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  67. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  68. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  69. echo " --build-suffix=SUFFIX suffix for application specific build []"
  70. echo " --cpu=CPU force cpu to CPU [$cpu]"
  71. echo " --tune=CPU tune code for a particular CPU"
  72. echo " (may fail or perform badly on other CPUs)"
  73. echo " --powerpc-perf-enable enable performance report on PPC"
  74. echo " (requires enabling PMC)"
  75. echo " --disable-mmx disable MMX usage"
  76. echo " --disable-iwmmxt disable iwmmxt usage"
  77. echo " --disable-altivec disable AltiVec usage"
  78. echo " --disable-audio-oss disable OSS audio support [default=no]"
  79. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  80. echo " --disable-v4l disable video4linux grabbing [default=no]"
  81. echo " --disable-v4l2 disable video4linux2 grabbing [default=no]"
  82. echo " --disable-bktr disable bktr video grabbing [default=no]"
  83. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  84. echo " --disable-network disable network support [default=no]"
  85. echo " --disable-zlib disable zlib [default=no]"
  86. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  87. echo " --disable-vhook disable video hooking support"
  88. echo " --enable-gprof enable profiling with gprof [$gprof]"
  89. echo " --disable-debug disable debugging symbols"
  90. echo " --disable-opts disable compiler optimizations"
  91. echo " --disable-mpegaudio-hp faster (but less accurate)"
  92. echo " MPEG audio decoding [default=no]"
  93. echo " --disable-protocols disable I/O protocols support [default=no]"
  94. echo " --disable-ffserver disable ffserver build"
  95. echo " --disable-ffplay disable ffplay build"
  96. echo " --enable-small optimize for size instead of speed"
  97. echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
  98. echo " --disable-strip disable stripping of executables and shared libraries"
  99. echo " --disable-encoder=NAME disables encoder NAME"
  100. echo " --enable-encoder=NAME enables encoder NAME"
  101. echo " --disable-decoder=NAME disables decoder NAME"
  102. echo " --enable-decoder=NAME enables decoder NAME"
  103. echo " --disable-encoders disables all encoders"
  104. echo " --disable-decoders disables all decoders"
  105. echo " --disable-muxers disables all muxers"
  106. echo " --disable-demuxers disables all demuxers"
  107. echo ""
  108. echo "NOTE: Object files are built at the place where configure is launched."
  109. exit 1
  110. }
  111. log(){
  112. echo "$@" >>$logfile
  113. }
  114. log_file(){
  115. log BEGIN $1
  116. cat -n $1 >>$logfile
  117. log END $1
  118. }
  119. echolog(){
  120. log "$@"
  121. echo "$@"
  122. }
  123. die(){
  124. echolog "$@"
  125. cat <<EOF
  126. If you think configure made a mistake, make sure you are using the latest
  127. version from SVN. If the latest version fails, report the problem to the
  128. ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  129. EOF
  130. if enabled logging; then
  131. cat <<EOF
  132. Include the log file "$logfile" produced by configure as this will help
  133. solving the problem.
  134. EOF
  135. else
  136. cat <<EOF
  137. Rerun configure with logging enabled (do not use --log=no), and include the
  138. log this produces with your report.
  139. EOF
  140. fi
  141. rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
  142. exit 1
  143. }
  144. enabled(){
  145. eval test "\$$1" = "yes"
  146. }
  147. flags_saved(){
  148. (: ${SAVE_CFLAGS?}) 2>/dev/null
  149. }
  150. save_flags(){
  151. flags_saved && return
  152. SAVE_CFLAGS="$CFLAGS"
  153. SAVE_LDFLAGS="$LDFLAGS"
  154. SAVE_extralibs="$extralibs"
  155. }
  156. restore_flags(){
  157. CFLAGS="$SAVE_CFLAGS"
  158. LDFLAGS="$SAVE_LDFLAGS"
  159. extralibs="$SAVE_extralibs"
  160. unset SAVE_CFLAGS
  161. unset SAVE_LDFLAGS
  162. unset SAVE_extralibs
  163. }
  164. temp_cflags(){
  165. save_flags
  166. CFLAGS="$CFLAGS $*"
  167. }
  168. temp_ldflags(){
  169. save_flags
  170. LDFLAGS="$LDFLAGS $*"
  171. }
  172. temp_extralibs(){
  173. save_flags
  174. extralibs="$extralibs $*"
  175. }
  176. append(){
  177. var=$1
  178. shift
  179. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  180. eval "$var=\"\$$var $*\""
  181. }
  182. add_cflags(){
  183. append CFLAGS "$@"
  184. }
  185. add_ldflags(){
  186. append LDFLAGS "$@"
  187. }
  188. add_extralibs(){
  189. append extralibs "$@"
  190. }
  191. check_cc(){
  192. log check_cc "$@"
  193. cat >$TMPC
  194. log_file $TMPC
  195. log $cc $CFLAGS "$@" -c -o $TMPO $TMPC
  196. $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
  197. }
  198. check_cpp(){
  199. log check_cpp "$@"
  200. cat >$TMPC
  201. log_file $TMPC
  202. log $cc $CFLAGS "$@" -E -o $TMPO $TMPC
  203. $cc $CFLAGS "$@" -E -o $TMPO $TMPC >>$logfile 2>&1
  204. }
  205. check_ld(){
  206. log check_ld "$@"
  207. cat >$TMPC
  208. log_file $TMPC
  209. log $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs
  210. $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >>$logfile 2>&1
  211. }
  212. check_cflags(){
  213. log check_cflags "$@"
  214. check_cc "$@" <<EOF && add_cflags "$@"
  215. int x;
  216. EOF
  217. }
  218. check_ldflags(){
  219. log check_ldflags "$@"
  220. check_ld "$@" <<EOF && add_ldflags "$@"
  221. int main(){
  222. return 0;
  223. }
  224. EOF
  225. }
  226. check_header(){
  227. log check_header "$@"
  228. header=$1
  229. shift
  230. check_cpp "$@" <<EOF
  231. #include <$header>
  232. int x;
  233. EOF
  234. }
  235. check_func(){
  236. log check_func "$@"
  237. func=$1
  238. shift
  239. check_ld "$@" <<EOF
  240. extern int $func();
  241. int main(){
  242. $func();
  243. }
  244. EOF
  245. }
  246. check_lib(){
  247. log check_lib "$@"
  248. header="$1"
  249. func="$2"
  250. shift 2
  251. temp_extralibs "$@"
  252. check_header $header && check_func $func && add_extralibs "$@"
  253. err=$?
  254. restore_flags
  255. return $err
  256. }
  257. check_exec(){
  258. check_ld "$@" && { test "$cross_compile" = yes || $TMPE 2>&1 >>$logfile; }
  259. }
  260. require(){
  261. name="$1"
  262. header="$2"
  263. func="$3"
  264. shift 3
  265. check_lib $header $func "$@" || die "ERROR: $name not found"
  266. }
  267. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  268. show_help
  269. fi
  270. # set temporary file name
  271. if test ! -z "$TMPDIR" ; then
  272. TMPDIR1="${TMPDIR}"
  273. elif test ! -z "$TEMPDIR" ; then
  274. TMPDIR1="${TEMPDIR}"
  275. else
  276. TMPDIR1="/tmp"
  277. fi
  278. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  279. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  280. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  281. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  282. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  283. # default parameters
  284. logging="yes"
  285. logfile="config.err"
  286. prefix="/usr/local"
  287. libdir=""
  288. incdir=""
  289. mandir=""
  290. bindir=""
  291. cross_prefix=""
  292. cross_compile="no"
  293. cc="gcc"
  294. ar="ar"
  295. ranlib="ranlib"
  296. make="make"
  297. strip="strip"
  298. cpu=`uname -m`
  299. tune="generic"
  300. powerpc_perf="no"
  301. mmx="default"
  302. iwmmxt="default"
  303. altivec="default"
  304. mmi="default"
  305. case "$cpu" in
  306. i386|i486|i586|i686|i86pc|BePC)
  307. cpu="x86"
  308. ;;
  309. x86_64|amd64)
  310. cpu="x86"
  311. canon_arch="`cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
  312. if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
  313. if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
  314. cpu="x86_64"
  315. fi
  316. fi
  317. ;;
  318. # armv4l is a subset of armv5tel
  319. armv4l|armv5tel)
  320. cpu="armv4l"
  321. ;;
  322. alpha)
  323. cpu="alpha"
  324. ;;
  325. "Power Macintosh"|ppc|powerpc)
  326. cpu="powerpc"
  327. ;;
  328. mips|mipsel|IP*)
  329. cpu="mips"
  330. ;;
  331. sun4u|sparc64)
  332. cpu="sparc64"
  333. ;;
  334. sparc)
  335. cpu="sparc"
  336. ;;
  337. sh4)
  338. cpu="sh4"
  339. ;;
  340. parisc|parisc64)
  341. cpu="parisc"
  342. ;;
  343. s390|s390x)
  344. cpu="s390"
  345. ;;
  346. m68k)
  347. cpu="m68k"
  348. ;;
  349. ia64)
  350. cpu="ia64"
  351. ;;
  352. *)
  353. cpu="unknown"
  354. ;;
  355. esac
  356. gprof="no"
  357. v4l="yes"
  358. v4l2="yes"
  359. bktr="no"
  360. audio_oss="yes"
  361. audio_beos="no"
  362. dv1394="yes"
  363. dc1394="no"
  364. network="yes"
  365. zlib="yes"
  366. libgsm="no"
  367. mp3lame="no"
  368. libogg="no"
  369. vorbis="no"
  370. theora="no"
  371. faad="no"
  372. faadbin="no"
  373. faac="no"
  374. xvid="no"
  375. x264="no"
  376. a52="no"
  377. a52bin="no"
  378. dts="no"
  379. pp="no"
  380. mingw32="no"
  381. mingwce="no"
  382. cygwin="no"
  383. os2="no"
  384. lstatic="yes"
  385. lshared="no"
  386. optimize="yes"
  387. debug="yes"
  388. dostrip="yes"
  389. installstrip="-s"
  390. extralibs="-lm"
  391. simpleidct="yes"
  392. bigendian="no"
  393. inttypes="yes"
  394. emu_fast_int="no"
  395. vhook="default"
  396. dlfcn="no"
  397. dlopen="no"
  398. mpegaudio_hp="yes"
  399. SHFLAGS='-shared -Wl,-soname,$@'
  400. netserver="no"
  401. need_inet_aton="no"
  402. protocols="yes"
  403. ffserver="yes"
  404. ffplay="yes"
  405. LIBOBJFLAGS=""
  406. FFLDFLAGS=-Wl,--warn-common
  407. FFSLDFLAGS=-Wl,-E
  408. LDCONFIG="ldconfig"
  409. LIBPREF="lib"
  410. LIBSUF=".a"
  411. LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
  412. SLIBPREF="lib"
  413. SLIBSUF=".so"
  414. SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
  415. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  416. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  417. EXESUF=""
  418. BUILDSUF=""
  419. amr_nb="no"
  420. amr_wb="no"
  421. amr_nb_fixed="no"
  422. amr_if2="no"
  423. sunmlib="no"
  424. pthreads="no"
  425. gpl="no"
  426. memalignhack="no"
  427. muxers="yes"
  428. demuxers="yes"
  429. # OS specific
  430. targetos=`uname -s`
  431. case $targetos in
  432. BeOS)
  433. prefix="/boot/home/config"
  434. # helps building libavcodec
  435. CFLAGS="$CFLAGS -DPIC -fomit-frame-pointer"
  436. # 3 gcc releases known for BeOS, each with ugly bugs
  437. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  438. case "$gcc_version" in
  439. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  440. mmx="no"
  441. ;;
  442. *20010315*) echo "BeBits gcc"
  443. CFLAGS="$CFLAGS -fno-expensive-optimizations"
  444. ;;
  445. esac
  446. SHFLAGS=-nostart
  447. # disable Linux things
  448. audio_oss="no"
  449. v4l="no"
  450. v4l2="no"
  451. dv1394="no"
  452. # enable BeOS things
  453. audio_beos="yes"
  454. # no need for libm, but the inet stuff
  455. # Check for BONE
  456. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  457. extralibs="-lbind -lsocket"
  458. else
  459. netserver="yes"
  460. need_inet_aton="yes"
  461. extralibs="-lnet"
  462. fi ;;
  463. SunOS)
  464. v4l="no"
  465. v4l2="no"
  466. audio_oss="no"
  467. dv1394="no"
  468. make="gmake"
  469. FFLDFLAGS=""
  470. FFSLDFLAGS=""
  471. SHFLAGS="-shared -Wl,-h,\$@"
  472. need_inet_aton="yes"
  473. extralibs="$extralibs -lsocket -lnsl"
  474. ;;
  475. NetBSD)
  476. v4l="no"
  477. v4l2="no"
  478. bktr="yes"
  479. audio_oss="yes"
  480. dv1394="no"
  481. make="gmake"
  482. extralibs="$extralibs -lossaudio"
  483. ;;
  484. OpenBSD)
  485. v4l="no"
  486. v4l2="no"
  487. bktr="yes"
  488. audio_oss="yes"
  489. dv1394="no"
  490. make="gmake"
  491. LIBOBJFLAGS="\$(PIC)"
  492. LDCONFIG="ldconfig -m \$(libdir)"
  493. extralibs="$extralibs -lossaudio"
  494. ;;
  495. FreeBSD)
  496. v4l="no"
  497. v4l2="no"
  498. bktr="yes"
  499. audio_oss="yes"
  500. dv1394="no"
  501. make="gmake"
  502. CFLAGS="$CFLAGS -pthread"
  503. ;;
  504. GNU/kFreeBSD)
  505. v4l="no"
  506. v4l2="no"
  507. bktr="yes"
  508. audio_oss="yes"
  509. dv1394="no"
  510. CFLAGS="$CFLAGS -pthread"
  511. ;;
  512. BSD/OS)
  513. v4l="no"
  514. v4l2="no"
  515. bktr="yes"
  516. audio_oss="yes"
  517. dv1394="no"
  518. extralibs="-lpoll -lgnugetopt -lm"
  519. make="gmake"
  520. strip="strip -d"
  521. installstrip=""
  522. ;;
  523. Darwin)
  524. cc="cc"
  525. v4l="no"
  526. v4l2="no"
  527. audio_oss="no"
  528. dv1394="no"
  529. SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
  530. extralibs=""
  531. darwin="yes"
  532. strip="strip -x"
  533. installstrip=""
  534. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  535. SLIBSUF=".dylib"
  536. SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
  537. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
  538. FFSLDFLAGS=-Wl,-bind_at_load
  539. ;;
  540. MINGW32*)
  541. # Note: the rest of the mingw32 config is done afterwards as mingw32
  542. # can be forced on the command line for Linux cross compilation.
  543. mingw32="yes"
  544. ;;
  545. CYGWIN*)
  546. v4l="no"
  547. v4l2="no"
  548. audio_oss="yes"
  549. dv1394="no"
  550. vhook="no"
  551. extralibs=""
  552. cygwin="yes"
  553. EXESUF=".exe"
  554. ;;
  555. Linux)
  556. ;;
  557. IRIX*)
  558. ranlib="echo ignoring ranlib"
  559. v4l="no"
  560. v4l2="no"
  561. audio_oss="no"
  562. make="gmake"
  563. ;;
  564. OS/2)
  565. TMPE=$TMPE".exe"
  566. ar="emxomfar -p128"
  567. ranlib="echo ignoring ranlib"
  568. strip="echo ignoring strip"
  569. CFLAGS="$CFLAGS -Zomf"
  570. FFLDFLAGS="-Zomf -Zstack 16384 -s"
  571. SHFLAGS="-Zdll -Zomf"
  572. FFSLDFLAGS=""
  573. LIBPREF=""
  574. LIBSUF=".lib"
  575. SLIBPREF=""
  576. SLIBSUF=".dll"
  577. EXESUF=".exe"
  578. extralibs=""
  579. pkg_requires=""
  580. v4l="no"
  581. v4l2="no"
  582. audio_oss="no"
  583. dv1394="no"
  584. ffserver="no"
  585. vhook="no"
  586. os2="yes"
  587. ;;
  588. *) ;;
  589. esac
  590. # From MPlayer configure. We need TARGET_OS available
  591. # to the Makefile, so it can distinguish between flavors
  592. # of AltiVec on PowerPC.
  593. TARGET_OS=`( uname -s ) 2>&1`
  594. case "$TARGET_OS" in
  595. Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
  596. ;;
  597. IRIX*)
  598. TARGET_OS=IRIX
  599. ;;
  600. HP-UX*)
  601. TARGET_OS=HP-UX
  602. ;;
  603. [cC][yY][gG][wW][iI][nN]*)
  604. TARGET_OS=CYGWIN
  605. ;;
  606. *)
  607. TARGET_OS="$TARGET_OS-UNKNOWN"
  608. ;;
  609. esac
  610. # find source path
  611. source_path="`dirname $0`"
  612. source_path_used="yes"
  613. if test -z "$source_path" -o "$source_path" = "." ; then
  614. source_path=`pwd`
  615. source_path_used="no"
  616. else
  617. source_path="`cd \"$source_path\"; pwd`"
  618. fi
  619. FFMPEG_CONFIGURATION=" "
  620. for opt do
  621. FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
  622. done
  623. CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c | sed 's/.*&\(.*\)).*/\1/'`
  624. for opt do
  625. case "$opt" in
  626. --log)
  627. ;;
  628. --log=*) logging="${opt#*=}"
  629. ;;
  630. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
  631. ;;
  632. --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
  633. ;;
  634. --incdir=*) incdir=`echo $opt | cut -d '=' -f 2`;
  635. ;;
  636. --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  637. ;;
  638. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  639. ;;
  640. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  641. ;;
  642. --cross-compile) cross_compile=yes
  643. ;;
  644. --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
  645. ;;
  646. --make=*) make=`echo $opt | cut -d '=' -f 2`
  647. ;;
  648. --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
  649. ;;
  650. --extra-ldflags=*) FFLDFLAGS="$FFLDFLAGS ${opt#--extra-ldflags=}"
  651. ;;
  652. --extra-libs=*) extralibs=${opt#--extra-libs=}
  653. ;;
  654. --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  655. ;;
  656. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  657. ;;
  658. --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  659. ;;
  660. --powerpc-perf-enable) powerpc_perf="yes"
  661. ;;
  662. --disable-mmx) mmx="no"
  663. ;;
  664. --disable-iwmmxt) iwmmxt="no"
  665. ;;
  666. --disable-altivec) altivec="no"
  667. ;;
  668. --enable-gprof) gprof="yes"
  669. ;;
  670. --disable-v4l) v4l="no"
  671. ;;
  672. --disable-v4l2) v4l2="no"
  673. ;;
  674. --disable-bktr) bktr="no"
  675. ;;
  676. --disable-audio-oss) audio_oss="no"
  677. ;;
  678. --disable-audio-beos) audio_beos="no"
  679. ;;
  680. --disable-dv1394) dv1394="no"
  681. ;;
  682. --disable-network) network="no"; ffserver="no"
  683. ;;
  684. --disable-zlib) zlib="no"
  685. ;;
  686. --enable-a52) a52="yes"
  687. ;;
  688. --enable-a52bin) a52bin="yes"
  689. ;;
  690. --enable-dts) dts="yes"
  691. ;;
  692. --enable-pp) pp="yes"
  693. ;;
  694. --enable-libgsm) libgsm="yes"
  695. ;;
  696. --enable-mp3lame) mp3lame="yes"
  697. ;;
  698. --enable-libogg) libogg="yes"
  699. pkg_requires="$pkg_requires ogg >= 1.1"
  700. ;;
  701. --enable-vorbis) vorbis="yes"
  702. pkg_requires="$pkg_requires vorbis vorbisenc"
  703. ;;
  704. --enable-theora) theora="yes"
  705. pkg_requires="$pkg_requires theora"
  706. ;;
  707. --enable-faad) faad="yes"
  708. ;;
  709. --enable-faadbin) faadbin="yes"
  710. ;;
  711. --enable-faac) faac="yes"
  712. ;;
  713. --enable-xvid) xvid="yes"
  714. ;;
  715. --enable-x264) x264="yes"
  716. ;;
  717. --enable-dc1394) dc1394="yes"
  718. pkg_requires="$pkg_requires libraw1394"
  719. ;;
  720. --disable-vhook) vhook="no"
  721. ;;
  722. --disable-simple_idct) simpleidct="no"
  723. ;;
  724. --enable-mingw32) mingw32="yes"
  725. ;;
  726. --enable-mingwce) mingwce="yes"
  727. ;;
  728. --enable-static) lstatic="yes"
  729. ;;
  730. --disable-static) lstatic="no"
  731. ;;
  732. --enable-shared) lshared="yes"
  733. ;;
  734. --disable-shared) lshared="no"
  735. ;;
  736. --disable-debug) debug="no"
  737. ;;
  738. --disable-opts) optimize="no"
  739. ;;
  740. --disable-mpegaudio-hp) mpegaudio_hp="no"
  741. ;;
  742. --disable-protocols) protocols="no"; network="no"; ffserver="no"
  743. ;;
  744. --disable-ffserver) ffserver="no"
  745. ;;
  746. --disable-ffplay) ffplay="no"
  747. ;;
  748. --enable-small) optimize="small"
  749. ;;
  750. --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
  751. ;;
  752. --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
  753. ;;
  754. --enable-amr_wb) amr="yes"; amr_wb="yes"
  755. ;;
  756. --enable-amr_if2) amr="yes"; amr_if2="yes"
  757. ;;
  758. --enable-sunmlib) sunmlib="yes"
  759. ;;
  760. --enable-pthreads) pthreads="yes"
  761. ;;
  762. --enable-gpl) gpl="yes"
  763. ;;
  764. --enable-memalign-hack) memalignhack="yes"
  765. ;;
  766. --disable-strip) dostrip="no"
  767. ;;
  768. --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
  769. ;;
  770. --enable-decoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-decoder=}_decoder"
  771. ;;
  772. --disable-encoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-encoder=}_encoder##\"`"
  773. ;;
  774. --disable-decoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-decoder=}_decoder##\"`"
  775. ;;
  776. --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  777. ;;
  778. --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  779. ;;
  780. --disable-muxers) muxers="no"; ffserver="no"
  781. ;;
  782. --disable-demuxers) demuxers="no"
  783. ;;
  784. --help) show_help
  785. ;;
  786. *)
  787. echo "Unknown option \"$opt\"."
  788. echo "See $0 --help for available options."
  789. exit 1
  790. ;;
  791. esac
  792. done
  793. if test "$logging" != no; then
  794. test "$logging" = yes || logfile="$logging"
  795. echo "# $0 $@" >$logfile
  796. set >>$logfile
  797. else
  798. logfile=/dev/null
  799. fi
  800. # Combine FFLDFLAGS and the LDFLAGS environment variable
  801. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  802. test -n "$cross_prefix" && cross_compile=yes
  803. cc="${cross_prefix}${cc}"
  804. ar="${cross_prefix}${ar}"
  805. ranlib="${cross_prefix}${ranlib}"
  806. strip="${cross_prefix}${strip}"
  807. # we need to build at least one lib type
  808. if test "$lstatic" = "no" && test "$lshared" = "no" ; then
  809. cat <<EOF
  810. At least one library type must be built.
  811. Specify --enable-static to build the static libraries or --enable-shared to
  812. build the shared libraries as well. To only build the shared libraries specify
  813. --disable-static in addition to --enable-shared.
  814. EOF
  815. exit 1;
  816. fi
  817. if test "$theora" = "yes" ; then
  818. if test "$libogg" = "no"; then
  819. echo "libogg must be enabled to enable Theora."
  820. fail="yes"
  821. theora="no"
  822. fi
  823. fi
  824. if test "$vorbis" = "yes" ; then
  825. if test "$libogg" = "no"; then
  826. echo "libogg must be enabled to enable Vorbis."
  827. fail="yes"
  828. vorbis="no"
  829. fi
  830. fi
  831. if test "$gpl" != "yes"; then
  832. if test "$pp" != "no"; then
  833. echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
  834. fail="yes"
  835. fi
  836. if test "$a52" != "no" -o "$a52bin" != "no"; then
  837. echo "liba52 is under GPL and --enable-gpl is not specified."
  838. fail="yes"
  839. fi
  840. if test "$xvid" != "no"; then
  841. echo "libxvidcore is under GPL and --enable-gpl is not specified."
  842. fail="yes"
  843. fi
  844. if test "$x264" != "no"; then
  845. echo "x264 is under GPL and --enable-gpl is not specified."
  846. fail="yes"
  847. fi
  848. if test "$dts" != "no"; then
  849. echo "libdts is under GPL and --enable-gpl is not specified."
  850. fail="yes"
  851. fi
  852. if test "$faad" != "no" -o "$faadbin" != "no"; then
  853. if check_header faad.h; then
  854. check_cc << EOF
  855. #include <faad.h>
  856. #ifndef FAAD2_VERSION
  857. ok faad1
  858. #endif
  859. int main( void ) { return 0; }
  860. EOF
  861. if test $? = 0 ; then
  862. echo "FAAD2 is under GPL and --enable-gpl is not specified."
  863. fail="yes"
  864. fi
  865. else
  866. faad="no"
  867. faadbin="no"
  868. echo "FAAD test failed."
  869. fi
  870. fi
  871. if test "$fail" = "yes"; then
  872. exit 1
  873. fi
  874. fi
  875. # compute MMX state
  876. if test $mmx = "default"; then
  877. if test $cpu = "x86" -o $cpu = "x86_64"; then
  878. mmx="yes"
  879. else
  880. mmx="no"
  881. fi
  882. fi
  883. # check iwmmxt support
  884. if test $iwmmxt = "default" -a $cpu = "armv4l"; then
  885. iwmmxt=no
  886. check_cc <<EOF && iwmmxt=yes
  887. int main(void) {
  888. __asm__ __volatile__ ("wunpckelub wr6, wr4");
  889. }
  890. EOF
  891. fi
  892. #Darwin CC versions
  893. needmdynamicnopic="no"
  894. if test $targetos = Darwin; then
  895. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  896. CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  897. else
  898. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  899. case "$gcc_version" in
  900. *2.95*)
  901. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  902. ;;
  903. *[34].*)
  904. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
  905. if test "$lshared" = no; then
  906. needmdynamicnopic="yes"
  907. fi
  908. ;;
  909. *)
  910. CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  911. if test "$lshared" = no; then
  912. needmdynamicnopic="yes"
  913. fi
  914. ;;
  915. esac
  916. fi
  917. fi
  918. # Can only do AltiVec on PowerPC
  919. if test $altivec = "default"; then
  920. if test $cpu = "powerpc"; then
  921. altivec="yes"
  922. else
  923. altivec="no"
  924. fi
  925. fi
  926. # Add processor-specific flags
  927. TUNECPU="generic"
  928. POWERPCMODE="32bits"
  929. if test $tune != "generic"; then
  930. case $tune in
  931. 601|ppc601|PowerPC601)
  932. CFLAGS="$CFLAGS -mcpu=601"
  933. if test $altivec = "yes"; then
  934. echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
  935. fi
  936. TUNECPU=ppc601
  937. ;;
  938. 603*|ppc603*|PowerPC603*)
  939. CFLAGS="$CFLAGS -mcpu=603"
  940. if test $altivec = "yes"; then
  941. echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
  942. fi
  943. TUNECPU=ppc603
  944. ;;
  945. 604*|ppc604*|PowerPC604*)
  946. CFLAGS="$CFLAGS -mcpu=604"
  947. if test $altivec = "yes"; then
  948. echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
  949. fi
  950. TUNECPU=ppc604
  951. ;;
  952. G3|g3|75*|ppc75*|PowerPC75*)
  953. CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
  954. if test $altivec = "yes"; then
  955. echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
  956. fi
  957. TUNECPU=ppc750
  958. ;;
  959. G4|g4|745*|ppc745*|PowerPC745*)
  960. CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
  961. if test $altivec = "no"; then
  962. echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
  963. fi
  964. TUNECPU=ppc7450
  965. ;;
  966. 74*|ppc74*|PowerPC74*)
  967. CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
  968. if test $altivec = "no"; then
  969. echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
  970. fi
  971. TUNECPU=ppc7400
  972. ;;
  973. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  974. CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
  975. if test $altivec = "no"; then
  976. echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
  977. fi
  978. TUNECPU=ppc970
  979. POWERPCMODE="64bits"
  980. ;;
  981. 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|athlon64|k8|opteron|athlon-fx)
  982. CFLAGS="$CFLAGS -march=$tune"
  983. ;;
  984. *)
  985. echo "WARNING: Unknown CPU \"$tune\", ignored."
  986. ;;
  987. esac
  988. fi
  989. # compiler sanity check
  990. check_exec <<EOF
  991. int main(){
  992. return 0;
  993. }
  994. EOF
  995. if test "$?" != 0; then
  996. echo "$cc is unable to create an executable file."
  997. if test -z "$cross_prefix" -a "$cross_compile" = no; then
  998. echo "If $cc is a cross-compiler, use the --cross-compile option."
  999. fi
  1000. die "C compiler test failed."
  1001. fi
  1002. # check for SIMD availability
  1003. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1004. if test $cpu = "powerpc"; then
  1005. if test $altivec = "yes"; then
  1006. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  1007. CFLAGS="$CFLAGS -faltivec"
  1008. else
  1009. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  1010. fi
  1011. fi
  1012. fi
  1013. check_header altivec.h && _altivec_h=yes || _altivec_h=no
  1014. # check if our compiler supports Motorola AltiVec C API
  1015. if test $altivec = "yes"; then
  1016. if test $_altivec_h = "yes"; then
  1017. inc_altivec_h="#include <altivec.h>"
  1018. else
  1019. inc_altivec_h=
  1020. fi
  1021. check_cc <<EOF || altivec=no
  1022. $inc_altivec_h
  1023. int main(void) {
  1024. vector signed int v1, v2, v3;
  1025. v1 = vec_add(v2,v3);
  1026. return 0;
  1027. }
  1028. EOF
  1029. fi
  1030. # mmi only available on mips
  1031. if test $mmi = "default"; then
  1032. if test $cpu = "mips"; then
  1033. mmi="yes"
  1034. else
  1035. mmi="no"
  1036. fi
  1037. fi
  1038. # check if our compiler supports mmi
  1039. enabled mmi && check_cc <<EOF || mmi="no"
  1040. int main(void) {
  1041. __asm__ ("lq \$2, 0(\$2)");
  1042. return 0;
  1043. }
  1044. EOF
  1045. # test gcc version to see if vector builtins can be used
  1046. # currently only used on i386 for MMX builtins
  1047. check_cc -msse <<EOF && builtin_vector=yes || builtin_vector=no
  1048. #include <xmmintrin.h>
  1049. int main(void) {
  1050. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  1051. return 0;
  1052. #else
  1053. #error no vector builtins
  1054. #endif
  1055. }
  1056. EOF
  1057. # test for mm3dnow.h
  1058. test "$cpu" = "x86_64" && march=k8 || march=athlon
  1059. check_cc -march=$march <<EOF && mm3dnow=yes || mm3dnow=no
  1060. #include <mm3dnow.h>
  1061. int main(void) {
  1062. __m64 b1;
  1063. b1 = _m_pswapd(b1);
  1064. _m_femms();
  1065. return 0;
  1066. }
  1067. EOF
  1068. if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
  1069. if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
  1070. cat <<EOF
  1071. You can only build one library type at once on MinGW.
  1072. Specify --disable-static --enable-shared to only build
  1073. the shared libraries. To build only the static libraries
  1074. you do not need to pass additional options.
  1075. EOF
  1076. exit 1
  1077. fi
  1078. v4l="no"
  1079. v4l2="no"
  1080. bktr="no"
  1081. audio_oss="no"
  1082. dv1394="no"
  1083. dc1394="no"
  1084. ffserver="no"
  1085. network="no"
  1086. if test "$mingwce" = "yes"; then
  1087. protocols="no"
  1088. fi
  1089. SLIBPREF=""
  1090. SLIBSUF=".dll"
  1091. EXESUF=".exe"
  1092. if test "$force_prefix" != yes; then prefix="$PROGRAMFILES/FFmpeg"; fi
  1093. if test "$force_libdir" != yes; then bindir="$prefix"; fi
  1094. fi
  1095. # ---
  1096. # big/little-endian test
  1097. if test "$cross_compile" = "no"; then
  1098. check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
  1099. #include <inttypes.h>
  1100. int main(int argc, char ** argv){
  1101. volatile uint32_t i=0x01234567;
  1102. return (*((uint8_t*)(&i))) == 0x67;
  1103. }
  1104. EOF
  1105. else
  1106. # programs cannot be launched if cross compiling, so make a static guess
  1107. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  1108. bigendian="yes"
  1109. fi
  1110. fi
  1111. # ---
  1112. # *inttypes.h* test
  1113. check_header inttypes.h || inttypes=no
  1114. # ---
  1115. # *int_fast* test
  1116. check_cc <<EOF || emu_fast_int=yes
  1117. #include <inttypes.h>
  1118. int main(int argc, char ** argv){
  1119. volatile uint_fast64_t i=0x01234567;
  1120. return 0;
  1121. }
  1122. EOF
  1123. # ---
  1124. # check availability of some header files
  1125. _memalign=no
  1126. _malloc_h=no
  1127. if check_header malloc.h; then
  1128. _malloc_h=yes
  1129. _memalign=yes
  1130. check_func memalign || _memalign="no"
  1131. fi
  1132. if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
  1133. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1134. fi
  1135. check_func localtime_r && localtime_r=yes || localtime_r=no
  1136. enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
  1137. # check for some common methods of building with pthread support
  1138. # do this before the optional library checks as some of them require pthreads
  1139. if enabled pthreads; then
  1140. { check_cflags -pthread && check_ldflags -pthread; } ||
  1141. { check_cflags -pthreads && check_ldflags -pthreads; } ||
  1142. check_lib pthread.h pthread_create -lpthread ||
  1143. check_func pthread_create ||
  1144. die "ERROR: can't find pthreads library"
  1145. fi
  1146. # these are off by default, so fail if requested and not available
  1147. enabled dts && require libdts dts.h dts_init -ldts
  1148. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1149. enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
  1150. enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc
  1151. enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
  1152. enabled theora && require libtheora theora/theora.h theora_info_init -ltheora
  1153. enabled xvid && require XviD xvid.h xvid_global -lxvidcore
  1154. enabled x264 && require x264 x264.h x264_encoder_open -lx264
  1155. enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
  1156. enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1157. # Ugh, faac uses stdcall calling convention on win32 so we can't use
  1158. # the generic test functions
  1159. if enabled faac; then
  1160. save_flags
  1161. temp_extralibs -lfaac
  1162. check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
  1163. #include <stdint.h>
  1164. #include <faac.h>
  1165. int main(){
  1166. char *id, *cpr;
  1167. faacEncGetVersion(&id, &cpr);
  1168. return 0;
  1169. }
  1170. EOF
  1171. restore_flags
  1172. fi
  1173. # Ugh, recent faad2 versions have renamed all functions and #define the
  1174. # old names in faad.h. Generic tests won't work.
  1175. if enabled faad; then
  1176. save_flags
  1177. temp_extralibs -lfaad
  1178. check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
  1179. #include <faad.h>
  1180. int main(){
  1181. faacDecOpen();
  1182. return 0;
  1183. }
  1184. EOF
  1185. restore_flags
  1186. fi
  1187. # test for lrintf in math.h
  1188. check_exec <<EOF && have_lrintf=yes || have_lrintf=no
  1189. #define _ISOC9X_SOURCE 1
  1190. #include <math.h>
  1191. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  1192. EOF
  1193. _restrict=
  1194. for restrict_keyword in restrict __restrict__ __restrict; do
  1195. check_cc <<EOF && _restrict=$restrict_keyword && break
  1196. void foo(char * $restrict_keyword p);
  1197. EOF
  1198. done
  1199. # dlopen/dlfcn.h probing
  1200. check_header dlfcn.h && dlfcn=yes
  1201. temp_extralibs -ldl
  1202. if check_func dlopen; then
  1203. dlopen=yes
  1204. ldl=-ldl
  1205. fi
  1206. restore_flags
  1207. if check_func dlopen; then
  1208. dlopen=yes
  1209. ldl=
  1210. fi
  1211. if test "$vhook" = "default"; then
  1212. vhook="$dlopen"
  1213. fi
  1214. if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
  1215. add_extralibs $ldl
  1216. fi
  1217. if enabled vhook; then
  1218. check_ldflags -rdynamic
  1219. check_ldflags -export-dynamic
  1220. fi
  1221. ##########################################
  1222. # imlib check
  1223. temp_extralibs -lImlib2
  1224. check_ld <<EOF && imlib2=yes || imlib2=no
  1225. #include <X11/Xlib.h>
  1226. #include <Imlib2.h>
  1227. int main( void ) { return (int) imlib_load_font("foo"); }
  1228. EOF
  1229. restore_flags
  1230. ##########################################
  1231. # FreeType check
  1232. freetype2=no
  1233. if test "x$targetos" != "xBeOS"; then
  1234. if (freetype-config --version) >/dev/null 2>&1 ; then
  1235. temp_cflags `freetype-config --cflags`
  1236. temp_extralibs `freetype-config --libs`
  1237. check_ld <<EOF && freetype2=yes
  1238. #include <ft2build.h>
  1239. int main( void ) { return (int) FT_Init_FreeType(0); }
  1240. EOF
  1241. restore_flags
  1242. fi
  1243. fi
  1244. ##########################################
  1245. # SDL check
  1246. sdl_too_old=no
  1247. sdl=no
  1248. SDL_CONFIG="${cross_prefix}sdl-config"
  1249. if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
  1250. temp_cflags `"${SDL_CONFIG}" --cflags`
  1251. temp_extralibs `"${SDL_CONFIG}" --libs`
  1252. check_ld <<EOF
  1253. #include <SDL.h>
  1254. #undef main /* We don't want SDL to override our main() */
  1255. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  1256. EOF
  1257. if test $? = 0; then
  1258. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1259. if test "$_sdlversion" -lt 121 ; then
  1260. sdl_too_old=yes
  1261. else
  1262. sdl=yes
  1263. check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
  1264. #include <SDL.h>
  1265. int main(void){
  1266. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1267. int w = vi->current_w;
  1268. return 0;
  1269. }
  1270. EOF
  1271. fi
  1272. fi
  1273. restore_flags
  1274. fi
  1275. enabled sdl || ffplay=no
  1276. ##########################################
  1277. # texi2html check
  1278. texi2html=no
  1279. if (texi2html -version) >/dev/null 2>&1; then
  1280. texi2html=yes
  1281. fi
  1282. ##########################################
  1283. # IPv6 check
  1284. enabled network && check_ld <<EOF && ipv6=yes || ipv6=no
  1285. #include <sys/types.h>
  1286. #include <sys/socket.h>
  1287. #include <netinet/in.h>
  1288. #include <netdb.h>
  1289. int main( void ) {
  1290. struct sockaddr_storage saddr;
  1291. struct ipv6_mreq mreq6;
  1292. getaddrinfo(0,0,0,0);
  1293. getnameinfo(0,0,0,0,0,0,0);
  1294. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1295. }
  1296. EOF
  1297. # check for video4linux2 --- V4L2_PIX_FMT_YUV420
  1298. enabled v4l2 && check_cc <<EOF || v4l2="no"
  1299. #include <sys/time.h>
  1300. #include <asm/types.h>
  1301. #include <linux/videodev2.h>
  1302. int dummy = V4L2_PIX_FMT_YUV420;
  1303. struct v4l2_buffer dummy1;
  1304. EOF
  1305. enabled debug && add_cflags -g
  1306. # add some useful compiler flags if supported
  1307. check_cflags -Wdeclaration-after-statement
  1308. check_cflags -Wall
  1309. check_cflags -Wno-switch
  1310. # add some linker flags
  1311. check_ldflags '-Wl,--as-needed' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavformat' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  1312. # not all compilers support -Os
  1313. test "$optimize" = "small" && check_cflags -Os
  1314. if enabled optimize; then
  1315. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1316. CFLAGS="$CFLAGS -O5"
  1317. LDFLAGS="$LDFLAGS -O5"
  1318. else
  1319. CFLAGS="-O3 $CFLAGS"
  1320. fi
  1321. fi
  1322. # PIC flags for shared library objects where they are needed
  1323. if test "$lshared" = "yes" ; then
  1324. # LIBOBJFLAGS may have already been set in the OS configuration
  1325. if test -z "$LIBOBJFLAGS" ; then
  1326. case "$cpu" in
  1327. x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
  1328. esac
  1329. fi
  1330. fi
  1331. if test x"$bindir" = x""; then
  1332. bindir="${prefix}/bin"
  1333. fi
  1334. if test x"$libdir" = x""; then
  1335. libdir="${prefix}/lib"
  1336. fi
  1337. if test x"$incdir" = x""; then
  1338. incdir="${prefix}/include/ffmpeg"
  1339. fi
  1340. if test x"$mandir" = x""; then
  1341. mandir="${prefix}/man"
  1342. fi
  1343. echo "install prefix $prefix"
  1344. echo "source path $source_path"
  1345. echo "C compiler $cc"
  1346. echo "make $make"
  1347. echo "CPU $cpu ($tune)"
  1348. if test "$BUILDSUF" != ""; then
  1349. echo "build suffix $BUILDSUF"
  1350. fi
  1351. echo "big-endian $bigendian"
  1352. echo "inttypes.h $inttypes"
  1353. echo "broken inttypes.h $emu_fast_int"
  1354. if test $cpu = "x86" -o $cpu = "x86_64"; then
  1355. echo "MMX enabled $mmx"
  1356. echo "Vector Builtins $builtin_vector"
  1357. echo "3DNow! Builtins $mm3dnow"
  1358. fi
  1359. if test $cpu = "armv4l"; then
  1360. echo "IWMMXT enabled $iwmmxt"
  1361. fi
  1362. if test $cpu = "mips"; then
  1363. echo "MMI enabled $mmi"
  1364. fi
  1365. if test $cpu = "powerpc"; then
  1366. echo "AltiVec enabled $altivec"
  1367. fi
  1368. echo "gprof enabled $gprof"
  1369. echo "zlib enabled $zlib"
  1370. echo "libgsm enabled $libgsm"
  1371. echo "mp3lame enabled $mp3lame"
  1372. echo "libogg enabled $libogg"
  1373. echo "Vorbis enabled $vorbis"
  1374. echo "Theora enabled $theora"
  1375. echo "FAAD enabled $faad"
  1376. echo "faadbin enabled $faadbin"
  1377. echo "FAAC enabled $faac"
  1378. echo "XviD enabled $xvid"
  1379. echo "x264 enabled $x264"
  1380. echo "a52 support $a52"
  1381. echo "a52 dlopened $a52bin"
  1382. echo "DTS support $dts"
  1383. echo "pp support $pp"
  1384. echo "debug symbols $debug"
  1385. echo "strip symbols $dostrip"
  1386. echo "optimize $optimize"
  1387. echo "static $lstatic"
  1388. echo "shared $lshared"
  1389. echo "video hooking $vhook"
  1390. echo "SDL support $sdl"
  1391. if test $sdl_too_old = "yes"; then
  1392. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1393. fi
  1394. if test "$vhook" = "yes"; then
  1395. echo "Imlib2 support $imlib2"
  1396. echo "FreeType support $freetype2"
  1397. fi
  1398. echo "Sun medialib support" $sunmlib
  1399. echo "pthreads support" $pthreads
  1400. echo "AMR-NB float support" $amr_nb
  1401. echo "AMR-NB fixed support" $amr_nb_fixed
  1402. echo "AMR-WB float support" $amr_wb
  1403. echo "AMR-WB IF2 support" $amr_if2
  1404. echo "network support $network"
  1405. if test "$network" = "yes" ; then
  1406. echo "IPv6 support $ipv6"
  1407. fi
  1408. if test "$gpl" = "no" ; then
  1409. echo "License: LGPL"
  1410. else
  1411. echo "License: GPL"
  1412. fi
  1413. echo "Creating config.mak and config.h..."
  1414. date >> config.log
  1415. echo " $0 $FFMPEG_CONFIGURATION" >> config.log
  1416. echo "# Automatically generated by configure - do not modify!" > config.mak
  1417. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1418. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1419. echo "prefix=\$(DESTDIR)$prefix" >> config.mak
  1420. echo "libdir=\$(DESTDIR)$libdir" >> config.mak
  1421. echo "incdir=\$(DESTDIR)$incdir" >> config.mak
  1422. echo "bindir=\$(DESTDIR)$bindir" >> config.mak
  1423. echo "mandir=\$(DESTDIR)$mandir" >> config.mak
  1424. echo "MAKE=$make" >> config.mak
  1425. echo "CC=$cc" >> config.mak
  1426. echo "AR=$ar" >> config.mak
  1427. echo "RANLIB=$ranlib" >> config.mak
  1428. if test "$dostrip" = "yes" ; then
  1429. echo "STRIP=$strip" >> config.mak
  1430. echo "INSTALLSTRIP=$installstrip" >> config.mak
  1431. else
  1432. echo "STRIP=echo ignoring strip" >> config.mak
  1433. echo "INSTALLSTRIP=" >> config.mak
  1434. fi
  1435. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic, used when building
  1436. # shared modules on OS/X (vhook/Makefile).
  1437. SHCFLAGS="$CFLAGS"
  1438. test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
  1439. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1440. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  1441. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1442. echo "LDCONFIG=$LDCONFIG" >> config.mak
  1443. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  1444. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1445. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1446. echo "BUILD_STATIC=$lstatic" >> config.mak
  1447. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1448. echo "LIBPREF=$LIBPREF" >> config.mak
  1449. echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
  1450. if test "$lstatic" = "yes" ; then
  1451. echo "LIB=$LIB" >> config.mak
  1452. else # Some Make complain if this variable does not exist.
  1453. echo "LIB=" >> config.mak
  1454. fi
  1455. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1456. echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
  1457. echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
  1458. echo "TARGET_OS=$TARGET_OS" >> config.mak
  1459. if test "$cpu" = "x86" ; then
  1460. echo "TARGET_ARCH_X86=yes" >> config.mak
  1461. echo "#define ARCH_X86 1" >> $TMPH
  1462. elif test "$cpu" = "x86_64" ; then
  1463. echo "TARGET_ARCH_X86_64=yes" >> config.mak
  1464. echo "#define ARCH_X86_64 1" >> $TMPH
  1465. elif test "$cpu" = "armv4l" ; then
  1466. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  1467. echo "#define ARCH_ARMV4L 1" >> $TMPH
  1468. elif test "$cpu" = "alpha" ; then
  1469. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  1470. echo "#define ARCH_ALPHA 1" >> $TMPH
  1471. elif test "$cpu" = "sparc64" ; then
  1472. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  1473. echo "#define ARCH_SPARC64 1" >> $TMPH
  1474. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1475. echo "#define ARCH_SPARC 1" >> $TMPH
  1476. elif test "$cpu" = "sparc" ; then
  1477. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1478. echo "#define ARCH_SPARC 1" >> $TMPH
  1479. elif test "$cpu" = "powerpc" ; then
  1480. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  1481. echo "#define ARCH_POWERPC 1" >> $TMPH
  1482. if test $POWERPCMODE = "32bits"; then
  1483. echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
  1484. else
  1485. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1486. fi
  1487. if test "$powerpc_perf" = "yes"; then
  1488. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1489. fi
  1490. elif test "$cpu" = "mips" ; then
  1491. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  1492. echo "#define ARCH_MIPS 1" >> $TMPH
  1493. elif test "$cpu" = "sh4" ; then
  1494. echo "TARGET_ARCH_SH4=yes" >> config.mak
  1495. echo "#define ARCH_SH4 1" >> $TMPH
  1496. elif test "$cpu" = "parisc" ; then
  1497. echo "TARGET_ARCH_PARISC=yes" >> config.mak
  1498. echo "#define ARCH_PARISC 1" >> $TMPH
  1499. elif test "$cpu" = "s390" ; then
  1500. echo "TARGET_ARCH_S390=yes" >> config.mak
  1501. echo "#define ARCH_S390 1" >> $TMPH
  1502. elif test "$cpu" = "m68k" ; then
  1503. echo "TARGET_ARCH_M68K=yes" >> config.mak
  1504. echo "#define ARCH_M68K 1" >> $TMPH
  1505. elif test "$cpu" = "ia64" ; then
  1506. echo "TARGET_ARCH_IA64=yes" >> config.mak
  1507. echo "#define ARCH_IA64 1" >> $TMPH
  1508. fi
  1509. echo "#define TUNECPU $TUNECPU" >> $TMPH
  1510. if test "$bigendian" = "yes" ; then
  1511. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1512. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1513. fi
  1514. if test "$inttypes" != "yes" ; then
  1515. echo "#define EMULATE_INTTYPES 1" >> $TMPH
  1516. fi
  1517. if test "$emu_fast_int" = "yes" ; then
  1518. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  1519. fi
  1520. if test "$mmx" = "yes" ; then
  1521. echo "TARGET_MMX=yes" >> config.mak
  1522. echo "#define HAVE_MMX 1" >> $TMPH
  1523. echo "#define __CPU__ 586" >> $TMPH
  1524. fi
  1525. if test "$builtin_vector" = "yes" ; then
  1526. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  1527. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  1528. fi
  1529. if test "$mm3dnow" = "yes" ; then
  1530. echo "TARGET_BUILTIN_3DNOW=yes" >> config.mak
  1531. echo "#define HAVE_MM3DNOW 1" >> $TMPH
  1532. fi
  1533. if test "$iwmmxt" = "yes" ; then
  1534. echo "TARGET_IWMMXT=yes" >> config.mak
  1535. echo "#define HAVE_IWMMXT 1" >> $TMPH
  1536. fi
  1537. if test "$mmi" = "yes" ; then
  1538. echo "TARGET_MMI=yes" >> config.mak
  1539. echo "#define HAVE_MMI 1" >> $TMPH
  1540. fi
  1541. if test "$altivec" = "yes" ; then
  1542. echo "TARGET_ALTIVEC=yes" >> config.mak
  1543. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1544. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  1545. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  1546. if test "$_altivec_h" = "yes" ; then
  1547. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  1548. else
  1549. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  1550. fi
  1551. fi
  1552. if test "$gprof" = "yes" ; then
  1553. echo "TARGET_GPROF=yes" >> config.mak
  1554. echo "#define HAVE_GPROF 1" >> $TMPH
  1555. fi
  1556. if test "$localtime_r" = "yes" ; then
  1557. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  1558. fi
  1559. if test "$imlib2" = "yes" ; then
  1560. echo "HAVE_IMLIB2=yes" >> config.mak
  1561. fi
  1562. if test "$freetype2" = "yes" ; then
  1563. echo "HAVE_FREETYPE2=yes" >> config.mak
  1564. fi
  1565. if test "$sunmlib" = "yes" ; then
  1566. echo "HAVE_MLIB=yes" >> config.mak
  1567. echo "#define HAVE_MLIB 1" >> $TMPH
  1568. fi
  1569. if test "$pthreads" = "yes" ; then
  1570. echo "HAVE_PTHREADS=yes" >> config.mak
  1571. echo "#define HAVE_PTHREADS 1" >> $TMPH
  1572. echo "#define HAVE_THREADS 1" >> $TMPH
  1573. fi
  1574. if test "$sdl" = "yes" ; then
  1575. echo "CONFIG_SDL=yes" >> config.mak
  1576. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1577. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1578. if test "$sdl_video_size" = "yes"; then
  1579. echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
  1580. fi
  1581. fi
  1582. if test "$texi2html" = "yes"; then
  1583. echo "BUILD_DOC=yes" >> config.mak
  1584. fi
  1585. if test "$have_lrintf" = "yes" ; then
  1586. echo "#define HAVE_LRINTF 1" >> $TMPH
  1587. fi
  1588. if test "$vhook" = "yes" ; then
  1589. echo "BUILD_VHOOK=yes" >> config.mak
  1590. echo "#define HAVE_VHOOK 1" >> $TMPH
  1591. fi
  1592. pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
  1593. lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
  1594. lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
  1595. lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
  1596. if test "$lshared" = "yes" ; then
  1597. echo "#define BUILD_SHARED_AV 1" >> $TMPH
  1598. echo "BUILD_SHARED=yes" >> config.mak
  1599. echo "PIC=-fPIC -DPIC" >> config.mak
  1600. echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
  1601. echo "SPPVERSION=$lavc_version" >> config.mak
  1602. echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
  1603. echo "LAVCVERSION=$lavc_version" >> config.mak
  1604. echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
  1605. echo "LAVFVERSION=$lavf_version" >> config.mak
  1606. echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
  1607. echo "LAVUVERSION=$lavu_version" >> config.mak
  1608. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1609. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1610. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1611. fi
  1612. echo "EXTRALIBS=$extralibs" >> config.mak
  1613. # If you do not want to use encoders, disable them.
  1614. if echo "$CODEC_LIST" | grep -q encoder; then
  1615. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  1616. echo "CONFIG_ENCODERS=yes" >> config.mak
  1617. fi
  1618. # If you do not want to use decoders, disable them.
  1619. if echo "$CODEC_LIST" | grep -q decoder; then
  1620. echo "#define CONFIG_DECODERS 1" >> $TMPH
  1621. echo "CONFIG_DECODERS=yes" >> config.mak
  1622. fi
  1623. # muxers
  1624. if test "$muxers" = "yes" ; then
  1625. echo "#define CONFIG_MUXERS 1" >> $TMPH
  1626. echo "CONFIG_MUXERS=yes" >> config.mak
  1627. fi
  1628. # demuxers
  1629. if test "$demuxers" = "yes" ; then
  1630. echo "#define CONFIG_DEMUXERS 1" >> $TMPH
  1631. echo "CONFIG_DEMUXERS=yes" >> config.mak
  1632. fi
  1633. # AC3
  1634. if test "$a52" = "yes" ; then
  1635. echo "#define CONFIG_AC3 1" >> $TMPH
  1636. echo "CONFIG_AC3=yes" >> config.mak
  1637. if test "$a52bin" = "yes" ; then
  1638. echo "#define CONFIG_A52BIN 1" >> $TMPH
  1639. echo "CONFIG_A52BIN=yes" >> config.mak
  1640. fi
  1641. fi
  1642. # DTS
  1643. if test "$dts" = "yes" ; then
  1644. echo "#define CONFIG_DTS 1" >> $TMPH
  1645. echo "CONFIG_DTS=yes" >> config.mak
  1646. fi
  1647. # PP
  1648. if test "$pp" = "yes" ; then
  1649. echo "#define CONFIG_PP 1" >> $TMPH
  1650. echo "CONFIG_PP=yes" >> config.mak
  1651. fi
  1652. # MPEG audio high precision mode
  1653. if test "$mpegaudio_hp" = "yes" ; then
  1654. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  1655. fi
  1656. if test "$v4l" = "yes" ; then
  1657. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  1658. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  1659. fi
  1660. if test "$v4l2" = "yes" ; then
  1661. echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
  1662. echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
  1663. fi
  1664. if test "$bktr" = "yes" ; then
  1665. echo "#define CONFIG_BKTR 1" >> $TMPH
  1666. echo "CONFIG_BKTR=yes" >> config.mak
  1667. fi
  1668. if test "$dv1394" = "yes" ; then
  1669. echo "#define CONFIG_DV1394 1" >> $TMPH
  1670. echo "CONFIG_DV1394=yes" >> config.mak
  1671. fi
  1672. if test "$dc1394" = "yes" ; then
  1673. echo "#define CONFIG_DC1394 1" >> $TMPH
  1674. echo "CONFIG_DC1394=yes" >> config.mak
  1675. fi
  1676. if test "$dlopen" = "yes" ; then
  1677. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1678. fi
  1679. if test "$dlfcn" = "yes" ; then
  1680. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1681. fi
  1682. if test "$audio_oss" = "yes" ; then
  1683. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1684. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1685. fi
  1686. if test "$audio_beos" = "yes" ; then
  1687. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1688. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1689. fi
  1690. if test "$network" = "yes" ; then
  1691. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1692. echo "CONFIG_NETWORK=yes" >> config.mak
  1693. fi
  1694. if test "$ipv6" = "yes" ; then
  1695. echo "#define CONFIG_IPV6 1" >> $TMPH
  1696. fi
  1697. if test "$zlib" = "yes" ; then
  1698. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1699. echo "CONFIG_ZLIB=yes" >> config.mak
  1700. fi
  1701. if test "$libgsm" = "yes" ; then
  1702. echo "#define CONFIG_LIBGSM 1" >> $TMPH
  1703. echo "CONFIG_LIBGSM=yes" >> config.mak
  1704. fi
  1705. if test "$mp3lame" = "yes" ; then
  1706. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1707. echo "CONFIG_MP3LAME=yes" >> config.mak
  1708. fi
  1709. if test "$libogg" = "yes" ; then
  1710. echo "#define CONFIG_LIBOGG 1" >> $TMPH
  1711. echo "CONFIG_LIBOGG=yes" >> config.mak
  1712. fi
  1713. if test "$vorbis" = "yes" ; then
  1714. echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
  1715. echo "CONFIG_LIBVORBIS=yes" >> config.mak
  1716. fi
  1717. if test "$theora" = "yes" ; then
  1718. echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
  1719. echo "CONFIG_LIBTHEORA=yes" >> config.mak
  1720. fi
  1721. if test "$faad" = "yes" ; then
  1722. echo "#define CONFIG_FAAD 1" >> $TMPH
  1723. echo "CONFIG_FAAD=yes" >> config.mak
  1724. fi
  1725. if test "$faadbin" = "yes" ; then
  1726. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1727. echo "CONFIG_FAADBIN=yes" >> config.mak
  1728. fi
  1729. if test "$faac" = "yes" ; then
  1730. echo "#define CONFIG_FAAC 1" >> $TMPH
  1731. echo "CONFIG_FAAC=yes" >> config.mak
  1732. fi
  1733. if test "$xvid" = "yes" ; then
  1734. echo "#define CONFIG_XVID 1" >> $TMPH
  1735. echo "CONFIG_XVID=yes" >> config.mak
  1736. fi
  1737. if test "$x264" = "yes" ; then
  1738. echo "#define CONFIG_X264 1" >> $TMPH
  1739. echo "CONFIG_X264=yes" >> config.mak
  1740. fi
  1741. if test "$mingw32" = "yes" ; then
  1742. echo "#define CONFIG_WIN32 1" >> $TMPH
  1743. echo "CONFIG_WIN32=yes" >> config.mak
  1744. echo "HAVE_W32THREADS=yes" >> config.mak
  1745. echo "#define HAVE_W32THREADS 1" >> $TMPH
  1746. echo "#define HAVE_THREADS 1" >> $TMPH
  1747. echo "#ifndef __MINGW32__" >> $TMPH
  1748. echo "#define __MINGW32__ 1" >> $TMPH
  1749. echo "#endif" >> $TMPH
  1750. fi
  1751. if test "$mingwce" = "yes" ; then
  1752. echo "#define CONFIG_WIN32 1" >> $TMPH
  1753. echo "CONFIG_WIN32=yes" >> config.mak
  1754. echo "#define CONFIG_WINCE 1" >> $TMPH
  1755. echo "CONFIG_WINCE=yes" >> config.mak
  1756. echo "#ifndef __MINGW32__" >> $TMPH
  1757. echo "#define __MINGW32__ 1" >> $TMPH
  1758. echo "#endif" >> $TMPH
  1759. fi
  1760. if test "$os2" = "yes" ; then
  1761. echo "#define CONFIG_OS2 1" >> $TMPH
  1762. echo "CONFIG_OS2=yes" >> config.mak
  1763. echo "HAVE_OS2THREADS=yes" >> config.mak
  1764. echo "#define HAVE_OS2THREADS 1" >> $TMPH
  1765. echo "#define HAVE_THREADS 1" >> $TMPH
  1766. fi
  1767. if test "$TARGET_OS" = "SunOS" ; then
  1768. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1769. fi
  1770. if test "$TARGET_OS" = "BeOS" ; then
  1771. echo "HAVE_BEOSTHREADS=yes" >> config.mak
  1772. echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
  1773. echo "#define HAVE_THREADS 1" >> $TMPH
  1774. fi
  1775. if test "$darwin" = "yes"; then
  1776. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1777. echo "CONFIG_DARWIN=yes" >> config.mak
  1778. fi
  1779. if test "$_malloc_h" = "yes" ; then
  1780. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1781. else
  1782. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1783. fi
  1784. if test "$_memalign" = "yes" ; then
  1785. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1786. else
  1787. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1788. fi
  1789. if test "$memalignhack" = "yes" ; then
  1790. echo "#define MEMALIGN_HACK 1" >> $TMPH
  1791. fi
  1792. if test "$netserver" = "yes" ; then
  1793. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1794. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1795. fi
  1796. if test "$need_inet_aton" = "yes" ; then
  1797. echo "NEED_INET_ATON=yes" >> config.mak
  1798. fi
  1799. if test "$simpleidct" = "yes" ; then
  1800. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1801. fi
  1802. if test "$protocols" = "yes" ; then
  1803. echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
  1804. echo "CONFIG_PROTOCOLS=yes" >> config.mak
  1805. fi
  1806. if test "$ffserver" = "yes" ; then
  1807. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1808. echo "CONFIG_FFSERVER=yes" >> config.mak
  1809. fi
  1810. if test "$ffplay" = "yes" ; then
  1811. echo "CONFIG_FFPLAY=yes" >> config.mak
  1812. fi
  1813. if test "$gpl" = "yes" ; then
  1814. echo "#define CONFIG_GPL 1" >> $TMPH
  1815. echo "CONFIG_GPL=yes" >> config.mak
  1816. fi
  1817. echo "#define restrict $_restrict" >> $TMPH
  1818. if test "$optimize" = "small"; then
  1819. echo "#define always_inline" >> $TMPH
  1820. fi
  1821. # build tree in object directory if source path is different from current one
  1822. if test "$source_path_used" = "yes" ; then
  1823. DIRS="\
  1824. doc \
  1825. libavformat \
  1826. libavcodec \
  1827. libavcodec/alpha \
  1828. libavcodec/armv4l \
  1829. libavcodec/i386 \
  1830. libavcodec/sparc \
  1831. libavcodec/mlib \
  1832. libavcodec/ppc \
  1833. libavcodec/liba52 \
  1834. libpostproc \
  1835. libavutil \
  1836. tests \
  1837. vhook \
  1838. "
  1839. FILES="\
  1840. Makefile \
  1841. libavformat/Makefile \
  1842. libavcodec/Makefile \
  1843. libpostproc/Makefile \
  1844. libavutil/Makefile \
  1845. tests/Makefile \
  1846. vhook/Makefile \
  1847. doc/Makefile \
  1848. doc/texi2pod.pl \
  1849. "
  1850. for dir in $DIRS ; do
  1851. mkdir -p $dir
  1852. done
  1853. for f in $FILES ; do
  1854. ln -sf "$source_path/$f" $f
  1855. done
  1856. fi
  1857. echo "SRC_PATH=$source_path" >> config.mak
  1858. echo "BUILD_ROOT=$PWD" >> config.mak
  1859. if test "$amr" = "yes" ; then
  1860. echo "#define AMR 1" >> $TMPH
  1861. echo "AMR=yes" >> config.mak
  1862. fi
  1863. if test "$amr_wb" = "yes" ; then
  1864. echo "#define AMR_WB 1" >> $TMPH
  1865. echo "AMR_WB=yes" >> config.mak
  1866. echo
  1867. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1868. echo "V5.1.0 from "
  1869. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1870. echo "and extracted the source to libavcodec/amrwb_float"
  1871. fi
  1872. if test "$amr_nb" = "yes" ; then
  1873. echo "#define AMR_NB 1" >> $TMPH
  1874. echo "AMR_NB=yes" >> config.mak
  1875. echo
  1876. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1877. echo "REL-5 V5.1.0 from "
  1878. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
  1879. echo "and extracted the source to libavcodec/amr_float"
  1880. echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
  1881. fi
  1882. if test "$amr_nb_fixed" = "yes" ; then
  1883. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1884. echo "AMR_NB_FIXED=yes" >> config.mak
  1885. echo
  1886. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1887. echo "REL-5 version 5.1.0 from "
  1888. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
  1889. echo "and extracted src to libavcodec/amr"
  1890. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1891. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1892. fi
  1893. if test "$amr_if2" = "yes" ; then
  1894. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1895. fi
  1896. for codec in $CODEC_LIST ; do
  1897. echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
  1898. echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
  1899. done
  1900. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  1901. diff $TMPH config.h >/dev/null 2>&1
  1902. if test "$?" != "0" ; then
  1903. mv -f $TMPH config.h
  1904. else
  1905. echo "config.h is unchanged"
  1906. fi
  1907. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
  1908. # build pkg-config files libav*.pc and libpostproc.pc
  1909. # libavutil.pc
  1910. cat <<EOF >libavutil.pc
  1911. prefix=$prefix
  1912. exec_prefix=\${prefix}
  1913. libdir=\${exec_prefix}/lib
  1914. includedir=\${prefix}/include
  1915. Name: libavutil
  1916. Description: FFmpeg utility library
  1917. Version: $lavu_version
  1918. Requires:
  1919. Conflicts:
  1920. Libs: -L\${libdir} -lavutil
  1921. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  1922. EOF
  1923. cat <<EOF >libavutil-uninstalled.pc
  1924. prefix=
  1925. exec_prefix=
  1926. libdir=\${pcfiledir}/libavutil
  1927. includedir=\${pcfiledir}/libavutil
  1928. Name: libavutil
  1929. Description: FFmpeg utility library
  1930. Version: $lavu_version
  1931. Requires:
  1932. Conflicts:
  1933. Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
  1934. Cflags: -I\${includedir}
  1935. EOF
  1936. # libavcodec.pc
  1937. cat <<EOF >libavcodec.pc
  1938. prefix=$prefix
  1939. exec_prefix=\${prefix}
  1940. libdir=\${exec_prefix}/lib
  1941. includedir=\${prefix}/include
  1942. Name: libavcodec
  1943. Description: FFmpeg codec library
  1944. Version: $lavc_version
  1945. Requires: $pkg_requires libavutil = $lavu_version
  1946. Conflicts:
  1947. Libs: -L\${libdir} -lavcodec $extralibs
  1948. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  1949. EOF
  1950. cat <<EOF >libavcodec-uninstalled.pc
  1951. prefix=
  1952. exec_prefix=
  1953. libdir=\${pcfiledir}/libavcodec
  1954. includedir=\${pcfiledir}/libavcodec
  1955. Name: libavcodec
  1956. Description: FFmpeg codec library
  1957. Version: $lavc_version
  1958. Requires: $pkg_requires libavutil = $lavu_version
  1959. Conflicts:
  1960. Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
  1961. Cflags: -I\${includedir}
  1962. EOF
  1963. # libavformat.pc
  1964. cat <<EOF >libavformat.pc
  1965. prefix=$prefix
  1966. exec_prefix=\${prefix}
  1967. libdir=\${exec_prefix}/lib
  1968. includedir=\${prefix}/include
  1969. Name: libavformat
  1970. Description: FFmpeg container format library
  1971. Version: $lavf_version
  1972. Requires: $pkg_requires libavcodec = $lavc_version
  1973. Conflicts:
  1974. Libs: -L\${libdir} -lavformat $extralibs
  1975. Cflags: -I\${includedir} -I\${includedir}/ffmpeg
  1976. EOF
  1977. cat <<EOF >libavformat-uninstalled.pc
  1978. prefix=
  1979. exec_prefix=
  1980. libdir=\${pcfiledir}/libavformat
  1981. includedir=\${pcfiledir}/libavformat
  1982. Name: libavformat
  1983. Description: FFmpeg container format library
  1984. Version: $lavf_version
  1985. Requires: $pkg_requires libavcodec = $lavc_version
  1986. Conflicts:
  1987. Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
  1988. Cflags: -I\${includedir}
  1989. EOF
  1990. # libpostproc.pc
  1991. cat <<EOF >libpostproc.pc
  1992. prefix=$prefix
  1993. exec_prefix=\${prefix}
  1994. libdir=\${exec_prefix}/lib
  1995. includedir=\${prefix}/include
  1996. Name: libpostproc
  1997. Description: FFmpeg post processing library
  1998. Version: $lavc_version
  1999. Requires:
  2000. Conflicts:
  2001. Libs: -L\${libdir} -lpostproc
  2002. Cflags: -I\${includedir} -I\${includedir}/postproc
  2003. EOF
  2004. cat <<EOF >libpostproc-uninstalled.pc
  2005. prefix=
  2006. exec_prefix=
  2007. libdir=\${pcfiledir}/libpostproc
  2008. includedir=\${pcfiledir}/libpostproc
  2009. Name: libpostproc
  2010. Description: FFmpeg post processing library
  2011. Version: $lavc_version
  2012. Requires:
  2013. Conflicts:
  2014. Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
  2015. Cflags: -I\${includedir}
  2016. EOF