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.

2222 lines
58KB

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