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.

2388 lines
62KB

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