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.

2358 lines
62KB

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