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.

2230 lines
57KB

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