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.

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