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.

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