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.

2329 lines
61KB

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