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.

2291 lines
60KB

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