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.

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