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.

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