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.

2288 lines
60KB

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