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.

2330 lines
61KB

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