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. }
  305. check_func(){
  306. log check_func "$@"
  307. func=$1
  308. shift
  309. check_ld "$@" <<EOF
  310. extern int $func();
  311. int main(){
  312. $func();
  313. }
  314. EOF
  315. }
  316. check_lib(){
  317. log check_lib "$@"
  318. header="$1"
  319. func="$2"
  320. shift 2
  321. temp_extralibs "$@"
  322. check_header $header && check_func $func && add_extralibs "$@"
  323. err=$?
  324. restore_flags
  325. return $err
  326. }
  327. check_exec(){
  328. check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
  329. }
  330. require(){
  331. name="$1"
  332. header="$2"
  333. func="$3"
  334. shift 3
  335. check_lib $header $func "$@" || die "ERROR: $name not found"
  336. }
  337. CONFIG_LIST='
  338. encoders
  339. decoders
  340. parsers
  341. muxers
  342. demuxers
  343. a52
  344. a52bin
  345. amr
  346. amr_nb
  347. amr_nb_fixed
  348. amr_wb
  349. audio_beos
  350. audio_oss
  351. avisynth
  352. beos_netserver
  353. bktr
  354. dc1394
  355. dts
  356. dv1394
  357. faac
  358. faad
  359. faadbin
  360. ffmpeg
  361. ffplay
  362. ffserver
  363. gpl
  364. ipv6
  365. libgsm
  366. libnut
  367. libogg
  368. libvorbis
  369. memalign_hack
  370. mp3lame
  371. mpegaudio_hp
  372. network
  373. pp
  374. protocols
  375. swscaler
  376. vhook
  377. video4linux
  378. video4linux2
  379. x264
  380. xvid
  381. zlib
  382. '
  383. HAVE_LIST='
  384. altivec_h
  385. beosthreads
  386. byteswap_h
  387. dcbzl
  388. dlfcn_h
  389. dlopen
  390. freetype2
  391. gprof
  392. imlib2
  393. inet_aton
  394. localtime_r
  395. lrintf
  396. malloc_h
  397. memalign
  398. mlib
  399. os2threads
  400. pthreads
  401. sdl
  402. sdl_video_size
  403. threads
  404. w32threads
  405. '
  406. # set temporary file name
  407. if test ! -z "$TMPDIR" ; then
  408. TMPDIR1="${TMPDIR}"
  409. elif test ! -z "$TEMPDIR" ; then
  410. TMPDIR1="${TEMPDIR}"
  411. else
  412. TMPDIR1="/tmp"
  413. fi
  414. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  415. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  416. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  417. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  418. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  419. # default parameters
  420. logging="yes"
  421. logfile="config.err"
  422. PREFIX="/usr/local"
  423. libdir='${PREFIX}/lib'
  424. shlibdir="$libdir"
  425. incdir='${PREFIX}/include/ffmpeg'
  426. mandir='${PREFIX}/man'
  427. bindir='${PREFIX}/bin'
  428. cross_prefix=""
  429. cross_compile="no"
  430. cc="gcc"
  431. ar="ar"
  432. ranlib="ranlib"
  433. make="make"
  434. strip="strip"
  435. arch=`uname -m`
  436. cpu="generic"
  437. powerpc_perf="no"
  438. mmx="default"
  439. cmov="no"
  440. cmov_is_fast="no"
  441. armv5te="default"
  442. iwmmxt="default"
  443. altivec="default"
  444. dcbzl="no"
  445. mmi="default"
  446. case "$arch" in
  447. i386|i486|i586|i686|i86pc|BePC)
  448. arch="x86_32"
  449. ;;
  450. x86_64|amd64)
  451. arch="x86_32"
  452. canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
  453. if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
  454. if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
  455. arch="x86_64"
  456. fi
  457. fi
  458. ;;
  459. # armv4l is a subset of armv[567]*l
  460. arm|armv[4567]*l)
  461. arch="armv4l"
  462. ;;
  463. alpha)
  464. arch="alpha"
  465. ;;
  466. "Power Macintosh"|ppc|ppc64|powerpc)
  467. arch="powerpc"
  468. ;;
  469. mips|mipsel|IP*)
  470. arch="mips"
  471. ;;
  472. sun4u|sparc64)
  473. arch="sparc64"
  474. ;;
  475. sparc)
  476. arch="sparc"
  477. ;;
  478. sh4)
  479. arch="sh4"
  480. ;;
  481. parisc|parisc64)
  482. arch="parisc"
  483. ;;
  484. s390|s390x)
  485. arch="s390"
  486. ;;
  487. m68k)
  488. arch="m68k"
  489. ;;
  490. ia64)
  491. arch="ia64"
  492. ;;
  493. bfin)
  494. arch="bfin"
  495. ;;
  496. *)
  497. arch="unknown"
  498. ;;
  499. esac
  500. gprof="no"
  501. video4linux="yes"
  502. video4linux2="yes"
  503. bktr="no"
  504. audio_oss="yes"
  505. audio_beos="no"
  506. dv1394="yes"
  507. dc1394="no"
  508. network="yes"
  509. ipv6="yes"
  510. zlib="yes"
  511. libgsm="no"
  512. mp3lame="no"
  513. libnut="no"
  514. libogg="no"
  515. libvorbis="no"
  516. faad="no"
  517. faadbin="no"
  518. faac="no"
  519. xvid="no"
  520. x264="no"
  521. a52="no"
  522. a52bin="no"
  523. dts="no"
  524. pp="no"
  525. mingw32="no"
  526. mingwce="no"
  527. os2="no"
  528. lstatic="yes"
  529. lshared="no"
  530. optimize="yes"
  531. debug="yes"
  532. extrawarnings="no"
  533. dostrip="yes"
  534. installstrip="-s"
  535. extralibs="-lm"
  536. bigendian="no"
  537. vhook="default"
  538. avisynth="no"
  539. dlfcn_h="no"
  540. dlopen="no"
  541. mpegaudio_hp="yes"
  542. SHFLAGS='-shared -Wl,-soname,$@'
  543. VHOOKSHFLAGS='$(SHFLAGS)'
  544. beos_netserver="no"
  545. protocols="yes"
  546. ffmpeg="yes"
  547. ffserver="yes"
  548. ffplay="yes"
  549. LIBOBJFLAGS=""
  550. FFLDFLAGS=-Wl,--warn-common
  551. LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  552. FFSERVERLDFLAGS=-Wl,-E
  553. LDCONFIG="ldconfig"
  554. LIBPREF="lib"
  555. LIBSUF=".a"
  556. LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
  557. SLIBPREF="lib"
  558. SLIBSUF=".so"
  559. SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
  560. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  561. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  562. EXESUF=""
  563. BUILDSUF=""
  564. amr_nb="no"
  565. amr_wb="no"
  566. amr_nb_fixed="no"
  567. amr_if2="no"
  568. mlib="no"
  569. pthreads="no"
  570. swscaler="no"
  571. gpl="no"
  572. memalign_hack="no"
  573. asmalign_pot="unknown"
  574. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
  575. # OS specific
  576. targetos=`uname -s`
  577. case $targetos in
  578. BeOS)
  579. PREFIX="/boot/home/config"
  580. # helps building libavcodec
  581. add_cflags "-DPIC -fomit-frame-pointer"
  582. # 3 gcc releases known for BeOS, each with ugly bugs
  583. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  584. case "$gcc_version" in
  585. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  586. mmx="no"
  587. ;;
  588. *20010315*) echo "BeBits gcc"
  589. add_cflags "-fno-expensive-optimizations"
  590. ;;
  591. esac
  592. SHFLAGS=-nostart
  593. # disable Linux things
  594. audio_oss="no"
  595. video4linux="no"
  596. video4linux2="no"
  597. dv1394="no"
  598. # enable BeOS things
  599. audio_beos="yes"
  600. beosthreads="yes"
  601. # no need for libm, but the inet stuff
  602. # Check for BONE
  603. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  604. extralibs="-lbind -lsocket"
  605. else
  606. beos_netserver="yes"
  607. extralibs="-lnet"
  608. fi ;;
  609. SunOS)
  610. video4linux="no"
  611. video4linux2="no"
  612. audio_oss="no"
  613. dv1394="no"
  614. make="gmake"
  615. FFLDFLAGS=""
  616. FFSERVERLDFLAGS=""
  617. SHFLAGS="-shared -Wl,-h,\$@"
  618. add_extralibs "-lsocket -lnsl"
  619. ;;
  620. NetBSD)
  621. video4linux="no"
  622. video4linux2="no"
  623. bktr="yes"
  624. audio_oss="yes"
  625. dv1394="no"
  626. make="gmake"
  627. add_extralibs "-lossaudio"
  628. ;;
  629. OpenBSD)
  630. video4linux="no"
  631. video4linux2="no"
  632. bktr="yes"
  633. audio_oss="yes"
  634. dv1394="no"
  635. make="gmake"
  636. LIBOBJFLAGS="\$(PIC)"
  637. LDCONFIG="ldconfig -m \$(shlibdir)"
  638. add_extralibs "-lossaudio"
  639. ;;
  640. FreeBSD)
  641. video4linux="no"
  642. video4linux2="no"
  643. bktr="yes"
  644. audio_oss="yes"
  645. dv1394="no"
  646. make="gmake"
  647. add_cflags "-pthread"
  648. ;;
  649. GNU/kFreeBSD)
  650. video4linux="no"
  651. video4linux2="no"
  652. bktr="yes"
  653. audio_oss="yes"
  654. dv1394="no"
  655. add_cflags "-pthread"
  656. ;;
  657. BSD/OS)
  658. video4linux="no"
  659. video4linux2="no"
  660. bktr="yes"
  661. audio_oss="yes"
  662. dv1394="no"
  663. extralibs="-lpoll -lgnugetopt -lm"
  664. make="gmake"
  665. strip="strip -d"
  666. installstrip=""
  667. ;;
  668. Darwin)
  669. cc="cc"
  670. video4linux="no"
  671. video4linux2="no"
  672. audio_oss="no"
  673. dv1394="no"
  674. SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
  675. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
  676. extralibs=""
  677. strip="strip -x"
  678. installstrip=""
  679. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  680. SLIBSUF=".dylib"
  681. SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
  682. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
  683. FFSERVERLDFLAGS=-Wl,-bind_at_load
  684. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
  685. ;;
  686. MINGW32*)
  687. # Note: the rest of the mingw32 config is done afterwards as mingw32
  688. # can be forced on the command line for Linux cross compilation.
  689. mingw32="yes"
  690. ;;
  691. CYGWIN*)
  692. targetos=CYGWIN
  693. shlibdir='${PREFIX}/bin'
  694. video4linux="no"
  695. video4linux2="no"
  696. audio_oss="yes"
  697. dv1394="no"
  698. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  699. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  700. extralibs=""
  701. EXESUF=".exe"
  702. SLIBPREF="cyg"
  703. SLIBSUF=".dll"
  704. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  705. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  706. SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
  707. ;;
  708. Linux)
  709. LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
  710. ;;
  711. IRIX*)
  712. targetos=IRIX
  713. ranlib="echo ignoring ranlib"
  714. video4linux="no"
  715. video4linux2="no"
  716. audio_oss="no"
  717. make="gmake"
  718. ;;
  719. OS/2)
  720. TMPE=$TMPE".exe"
  721. ar="emxomfar -p128"
  722. ranlib="echo ignoring ranlib"
  723. strip="echo ignoring strip"
  724. add_cflags "-Zomf"
  725. FFLDFLAGS="-Zomf -Zstack 16384 -s"
  726. SHFLAGS="-Zdll -Zomf"
  727. FFSERVERLDFLAGS=""
  728. LIBPREF=""
  729. LIBSUF=".lib"
  730. SLIBPREF=""
  731. SLIBSUF=".dll"
  732. EXESUF=".exe"
  733. extralibs=""
  734. pkg_requires=""
  735. video4linux="no"
  736. video4linux2="no"
  737. audio_oss="no"
  738. dv1394="no"
  739. ffserver="no"
  740. vhook="no"
  741. os2="yes"
  742. os2threads="yes"
  743. ;;
  744. *)
  745. targetos="${targetos}-UNKNOWN"
  746. ;;
  747. esac
  748. # find source path
  749. source_path="`dirname \"$0\"`"
  750. source_path_used="yes"
  751. if test -z "$source_path" -o "$source_path" = "." ; then
  752. source_path="`pwd`"
  753. source_path_used="no"
  754. else
  755. source_path="`cd \"$source_path\"; pwd`"
  756. echo "$source_path" | grep -q '[[:blank:]]' &&
  757. die "Out of tree builds are impossible with whitespace in source path."
  758. fi
  759. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  760. show_help
  761. fi
  762. FFMPEG_CONFIGURATION=" "
  763. for opt do
  764. FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
  765. done
  766. ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
  767. DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
  768. PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
  769. MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
  770. DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
  771. enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
  772. for opt do
  773. optval="${opt#*=}"
  774. case "$opt" in
  775. --log)
  776. ;;
  777. --log=*) logging="$optval"
  778. ;;
  779. --prefix=*) PREFIX="$optval"; force_prefix=yes
  780. ;;
  781. --libdir=*) libdir="$optval"; force_libdir=yes
  782. ;;
  783. --shlibdir=*) shlibdir="$optval"
  784. ;;
  785. --incdir=*) incdir="$optval"
  786. ;;
  787. --mandir=*) mandir="$optval"
  788. ;;
  789. --source-path=*) source_path="$optval"
  790. ;;
  791. --cross-prefix=*) cross_prefix="$optval"
  792. ;;
  793. --cross-compile) cross_compile=yes
  794. ;;
  795. --cc=*) cc="$optval"
  796. ;;
  797. --make=*) make="$optval"
  798. ;;
  799. --extra-cflags=*) add_cflags "$optval"
  800. ;;
  801. --extra-ldflags=*) add_ldflags "$optval"
  802. ;;
  803. --extra-libs=*) add_extralibs "$optval"
  804. ;;
  805. --build-suffix=*) BUILDSUF="$optval"
  806. ;;
  807. --arch=*) arch="$optval"
  808. ;;
  809. --cpu=*) cpu="$optval"
  810. ;;
  811. --powerpc-perf-enable) powerpc_perf="yes"
  812. ;;
  813. --disable-mmx) mmx="no"
  814. ;;
  815. --disable-armv5te) armv5te="no"
  816. ;;
  817. --disable-iwmmxt) iwmmxt="no"
  818. ;;
  819. --disable-altivec) altivec="no"
  820. ;;
  821. --enable-gprof) gprof="yes"
  822. ;;
  823. --disable-v4l) video4linux="no"
  824. ;;
  825. --disable-v4l2) video4linux2="no"
  826. ;;
  827. --disable-bktr) bktr="no"
  828. ;;
  829. --disable-audio-oss) audio_oss="no"
  830. ;;
  831. --disable-audio-beos) audio_beos="no"
  832. ;;
  833. --disable-dv1394) dv1394="no"
  834. ;;
  835. --disable-network) network="no"; ffserver="no"
  836. ;;
  837. --disable-ipv6) ipv6="no";
  838. ;;
  839. --disable-zlib) zlib="no"
  840. ;;
  841. --enable-a52) a52="yes"
  842. ;;
  843. --enable-a52bin) a52bin="yes"
  844. ;;
  845. --enable-dts) dts="yes"
  846. ;;
  847. --enable-pp) pp="yes"
  848. ;;
  849. --enable-libgsm) libgsm="yes"
  850. ;;
  851. --enable-mp3lame) mp3lame="yes"
  852. ;;
  853. --enable-libnut) libnut="yes"
  854. ;;
  855. --enable-libogg) libogg="yes"
  856. pkg_requires="$pkg_requires ogg >= 1.1"
  857. ;;
  858. --enable-vorbis) libvorbis="yes"
  859. pkg_requires="$pkg_requires vorbis vorbisenc"
  860. ;;
  861. --enable-faad) faad="yes"
  862. ;;
  863. --enable-faadbin) faadbin="yes"
  864. ;;
  865. --enable-faac) faac="yes"
  866. ;;
  867. --enable-xvid) xvid="yes"
  868. ;;
  869. --enable-x264) x264="yes"
  870. ;;
  871. --enable-avisynth) avisynth="yes";
  872. ;;
  873. --enable-dc1394) dc1394="yes"
  874. pkg_requires="$pkg_requires libraw1394"
  875. ;;
  876. --disable-vhook) vhook="no"
  877. ;;
  878. --enable-mingw32) mingw32="yes"
  879. ;;
  880. --enable-mingwce) mingwce="yes"
  881. ;;
  882. --enable-static) lstatic="yes"
  883. ;;
  884. --disable-static) lstatic="no"
  885. ;;
  886. --enable-shared) lshared="yes"
  887. ;;
  888. --disable-shared) lshared="no"
  889. ;;
  890. --disable-debug) debug="no"
  891. ;;
  892. --disable-opts) optimize="no"
  893. ;;
  894. --enable-extra-warnings) extrawarnings="yes"
  895. ;;
  896. --disable-mpegaudio-hp) mpegaudio_hp="no"
  897. ;;
  898. --disable-protocols) protocols="no"; network="no"; ffserver="no"
  899. ;;
  900. --disable-ffmpeg) ffmpeg="no"
  901. ;;
  902. --disable-ffserver) ffserver="no"
  903. ;;
  904. --disable-ffplay) ffplay="no"
  905. ;;
  906. --enable-small) optimize="small"
  907. ;;
  908. --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
  909. ;;
  910. --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
  911. ;;
  912. --enable-amr_wb) amr="yes"; amr_wb="yes"
  913. ;;
  914. --enable-amr_if2) amr="yes"; amr_if2="yes"
  915. ;;
  916. --enable-sunmlib) mlib="yes"
  917. ;;
  918. --enable-pthreads) pthreads="yes"
  919. ;;
  920. --enable-swscaler) swscaler="yes"
  921. ;;
  922. --enable-gpl) gpl="yes"
  923. ;;
  924. --enable-memalign-hack) memalign_hack="yes"
  925. ;;
  926. --disable-strip) dostrip="no"
  927. ;;
  928. --enable-encoder=*) enable ${optval}_encoder
  929. ;;
  930. --enable-decoder=*) enable ${optval}_decoder
  931. ;;
  932. --disable-encoder=*) disable ${optval}_encoder
  933. ;;
  934. --disable-decoder=*) disable ${optval}_decoder
  935. ;;
  936. --disable-encoders) disable $ENCODER_LIST
  937. ;;
  938. --disable-decoders) disable $DECODER_LIST
  939. ;;
  940. --enable-muxer=*) enable ${optval}_muxer
  941. ;;
  942. --disable-muxer=*) disable ${optval}_muxer
  943. ;;
  944. --disable-muxers) disable $MUXER_LIST; ffserver="no"
  945. ;;
  946. --enable-demuxer=*) enable ${optval}_demuxer
  947. ;;
  948. --disable-demuxer=*) disable ${optval}_demuxer
  949. ;;
  950. --disable-demuxers) disable $DEMUXER_LIST
  951. ;;
  952. --enable-parser=*) enable ${optval}_parser
  953. ;;
  954. --disable-parser=*) disable ${optval}_parser
  955. ;;
  956. --disable-parsers) disable $PARSER_LIST
  957. ;;
  958. --help) show_help
  959. ;;
  960. *)
  961. echo "Unknown option \"$opt\"."
  962. echo "See $0 --help for available options."
  963. exit 1
  964. ;;
  965. esac
  966. done
  967. if test "$logging" != no; then
  968. test "$logging" = yes || logfile="$logging"
  969. echo "# $0 $@" >$logfile
  970. set >>$logfile
  971. else
  972. logfile=/dev/null
  973. fi
  974. if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
  975. if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
  976. cat <<EOF
  977. You can only build one library type at once on MinGW.
  978. Specify --disable-static --enable-shared to only build
  979. the shared libraries. To build only the static libraries
  980. you do not need to pass additional options.
  981. EOF
  982. exit 1
  983. fi
  984. video4linux="no"
  985. video4linux2="no"
  986. bktr="no"
  987. audio_oss="no"
  988. dv1394="no"
  989. dc1394="no"
  990. ffserver="no"
  991. network="no"
  992. if enabled mingw32; then
  993. w32threads="yes"
  994. fi
  995. if test "$mingwce" = "yes"; then
  996. protocols="no"
  997. fi
  998. SLIBPREF=""
  999. SLIBSUF=".dll"
  1000. EXESUF=".exe"
  1001. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1002. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  1003. SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
  1004. SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
  1005. if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
  1006. if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
  1007. shlibdir='${PREFIX}'
  1008. fi
  1009. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1010. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1011. test -n "$cross_prefix" && cross_compile=yes
  1012. cc="${cross_prefix}${cc}"
  1013. ar="${cross_prefix}${ar}"
  1014. ranlib="${cross_prefix}${ranlib}"
  1015. strip="${cross_prefix}${strip}"
  1016. # we need to build at least one lib type
  1017. if test "$lstatic" = "no" && test "$lshared" = "no" ; then
  1018. cat <<EOF
  1019. At least one library type must be built.
  1020. Specify --enable-static to build the static libraries or --enable-shared to
  1021. build the shared libraries as well. To only build the shared libraries specify
  1022. --disable-static in addition to --enable-shared.
  1023. EOF
  1024. exit 1;
  1025. fi
  1026. if test "$libvorbis" = "yes" ; then
  1027. if test "$libogg" = "no"; then
  1028. echo "libogg must be enabled to enable Vorbis."
  1029. fail="yes"
  1030. fi
  1031. fi
  1032. if test "$gpl" != "yes"; then
  1033. if test "$pp" != "no"; then
  1034. echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
  1035. fail="yes"
  1036. fi
  1037. if test "$a52" != "no" -o "$a52bin" != "no"; then
  1038. echo "liba52 is under GPL and --enable-gpl is not specified."
  1039. fail="yes"
  1040. fi
  1041. if test "$xvid" != "no"; then
  1042. echo "libxvidcore is under GPL and --enable-gpl is not specified."
  1043. fail="yes"
  1044. fi
  1045. if test "$x264" != "no"; then
  1046. echo "x264 is under GPL and --enable-gpl is not specified."
  1047. fail="yes"
  1048. fi
  1049. if test "$dts" != "no"; then
  1050. echo "libdts is under GPL and --enable-gpl is not specified."
  1051. fail="yes"
  1052. fi
  1053. if test "$faad" != "no" -o "$faadbin" != "no"; then
  1054. if check_header faad.h; then
  1055. check_cc << EOF
  1056. #include <faad.h>
  1057. #ifndef FAAD2_VERSION
  1058. ok faad1
  1059. #endif
  1060. int main( void ) { return 0; }
  1061. EOF
  1062. if test $? = 0 ; then
  1063. echo "FAAD2 is under GPL and --enable-gpl is not specified."
  1064. fail="yes"
  1065. fi
  1066. else
  1067. faad="no"
  1068. faadbin="no"
  1069. echo "FAAD test failed."
  1070. fi
  1071. fi
  1072. if test "$swscaler" != "no"; then
  1073. echo "The software scaler is under GPL and --enable-gpl is not specified."
  1074. fail="yes"
  1075. fi
  1076. fi
  1077. if test "$fail" = "yes"; then
  1078. exit 1
  1079. fi
  1080. # compute MMX state
  1081. if test $mmx = "default"; then
  1082. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1083. mmx="yes"
  1084. else
  1085. mmx="no"
  1086. fi
  1087. fi
  1088. #Darwin CC versions
  1089. needmdynamicnopic="no"
  1090. if test $targetos = Darwin; then
  1091. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1092. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1093. else
  1094. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1095. case "$gcc_version" in
  1096. *2.95*)
  1097. add_cflags "-no-cpp-precomp -pipe"
  1098. ;;
  1099. *[34].*)
  1100. add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
  1101. if test "$lshared" = no; then
  1102. needmdynamicnopic="yes"
  1103. fi
  1104. ;;
  1105. *)
  1106. add_cflags "-no-cpp-precomp -pipe"
  1107. if test "$lshared" = no; then
  1108. needmdynamicnopic="yes"
  1109. fi
  1110. ;;
  1111. esac
  1112. fi
  1113. fi
  1114. if test $optimize != "no"; then
  1115. add_cflags "-fomit-frame-pointer"
  1116. fi
  1117. # Can only do AltiVec on PowerPC
  1118. if test $altivec = "default"; then
  1119. if test $arch = "powerpc"; then
  1120. altivec="yes"
  1121. else
  1122. altivec="no"
  1123. fi
  1124. fi
  1125. # Add processor-specific flags
  1126. TUNECPU="generic"
  1127. POWERPCMODE="32bits"
  1128. if test $cpu != "generic"; then
  1129. case $cpu in
  1130. 601|ppc601|PowerPC601)
  1131. add_cflags "-mcpu=601"
  1132. if test $altivec = "yes"; then
  1133. echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
  1134. fi
  1135. TUNECPU=ppc601
  1136. ;;
  1137. 603*|ppc603*|PowerPC603*)
  1138. add_cflags "-mcpu=603"
  1139. if test $altivec = "yes"; then
  1140. echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
  1141. fi
  1142. TUNECPU=ppc603
  1143. ;;
  1144. 604*|ppc604*|PowerPC604*)
  1145. add_cflags "-mcpu=604"
  1146. if test $altivec = "yes"; then
  1147. echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
  1148. fi
  1149. TUNECPU=ppc604
  1150. ;;
  1151. G3|g3|75*|ppc75*|PowerPC75*)
  1152. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1153. if test $altivec = "yes"; then
  1154. echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
  1155. fi
  1156. TUNECPU=ppc750
  1157. ;;
  1158. G4|g4|745*|ppc745*|PowerPC745*)
  1159. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1160. if test $altivec = "no"; then
  1161. echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
  1162. fi
  1163. TUNECPU=ppc7450
  1164. ;;
  1165. 74*|ppc74*|PowerPC74*)
  1166. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1167. if test $altivec = "no"; then
  1168. echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
  1169. fi
  1170. TUNECPU=ppc7400
  1171. ;;
  1172. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1173. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1174. if test $altivec = "no"; then
  1175. echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
  1176. fi
  1177. TUNECPU=ppc970
  1178. POWERPCMODE="64bits"
  1179. ;;
  1180. # targets that do NOT support conditional mov (cmov)
  1181. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1182. add_cflags "-march=$cpu"
  1183. cmov="no"
  1184. ;;
  1185. # targets that do support conditional mov (cmov)
  1186. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
  1187. add_cflags "-march=$cpu"
  1188. cmov="yes"
  1189. cmov_is_fast="yes"
  1190. ;;
  1191. # targets that do support conditional mov but on which it's slow
  1192. pentium4|prescott|nocona)
  1193. add_cflags "-march=$cpu"
  1194. cmov="yes"
  1195. cmov_is_fast="no"
  1196. ;;
  1197. sparc64)
  1198. add_cflags "-mcpu=v9"
  1199. ;;
  1200. *)
  1201. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1202. ;;
  1203. esac
  1204. fi
  1205. # make sure we can execute files in $TMPDIR
  1206. cat >$TMPE 2>>$logfile <<EOF
  1207. #! /bin/sh
  1208. EOF
  1209. chmod +x $TMPE >>$logfile 2>&1
  1210. if ! $TMPE >>$logfile 2>&1; then
  1211. cat <<EOF
  1212. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1213. variable to another directory and make sure that $TMPDIR1 is not mounted
  1214. noexec.
  1215. EOF
  1216. die "Sanity test failed."
  1217. fi
  1218. rm $TMPE
  1219. # compiler sanity check
  1220. check_exec <<EOF
  1221. int main(){
  1222. return 0;
  1223. }
  1224. EOF
  1225. if test "$?" != 0; then
  1226. echo "$cc is unable to create an executable file."
  1227. if test -z "$cross_prefix" -a "$cross_compile" = no; then
  1228. echo "If $cc is a cross-compiler, use the --cross-compile option."
  1229. echo "Only do this if you know what cross compiling means."
  1230. fi
  1231. die "C compiler test failed."
  1232. fi
  1233. # check for assembler specific support
  1234. if test $arch = "powerpc"; then
  1235. check_cc <<EOF && dcbzl=yes
  1236. int main(void) {
  1237. register long zero = 0;
  1238. char data[1024];
  1239. asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
  1240. return 0;
  1241. }
  1242. EOF
  1243. fi
  1244. # check for SIMD availability
  1245. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1246. if test $arch = "powerpc"; then
  1247. if test $altivec = "yes"; then
  1248. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  1249. add_cflags "-faltivec"
  1250. else
  1251. add_cflags "-maltivec -mabi=altivec"
  1252. fi
  1253. fi
  1254. fi
  1255. check_header altivec.h && altivec_h=yes || altivec_h=no
  1256. # check if our compiler supports Motorola AltiVec C API
  1257. if test $altivec = "yes"; then
  1258. if test $altivec_h = "yes"; then
  1259. inc_altivec_h="#include <altivec.h>"
  1260. else
  1261. inc_altivec_h=
  1262. fi
  1263. check_cc <<EOF || altivec=no
  1264. $inc_altivec_h
  1265. int main(void) {
  1266. vector signed int v1, v2, v3;
  1267. v1 = vec_add(v2,v3);
  1268. return 0;
  1269. }
  1270. EOF
  1271. fi
  1272. # check armv5te instructions support
  1273. if test $armv5te = "default" -a $arch = "armv4l"; then
  1274. armv5te=no
  1275. check_cc <<EOF && armv5te=yes
  1276. int main(void) {
  1277. __asm__ __volatile__ ("qadd r0, r0, r0");
  1278. }
  1279. EOF
  1280. fi
  1281. # check iwmmxt support
  1282. if test $iwmmxt = "default" -a $arch = "armv4l"; then
  1283. iwmmxt=no
  1284. check_cc <<EOF && iwmmxt=yes
  1285. int main(void) {
  1286. __asm__ __volatile__ ("wunpckelub wr6, wr4");
  1287. }
  1288. EOF
  1289. fi
  1290. # mmi only available on mips
  1291. if test $mmi = "default"; then
  1292. if test $arch = "mips"; then
  1293. mmi="yes"
  1294. else
  1295. mmi="no"
  1296. fi
  1297. fi
  1298. # check if our compiler supports mmi
  1299. enabled mmi && check_cc <<EOF || mmi="no"
  1300. int main(void) {
  1301. __asm__ ("lq \$2, 0(\$2)");
  1302. return 0;
  1303. }
  1304. EOF
  1305. # ---
  1306. # big/little-endian test
  1307. if test "$cross_compile" = "no"; then
  1308. check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
  1309. #include <inttypes.h>
  1310. int main(int argc, char ** argv){
  1311. volatile uint32_t i=0x01234567;
  1312. return (*((uint8_t*)(&i))) == 0x67;
  1313. }
  1314. EOF
  1315. else
  1316. # programs cannot be launched if cross compiling, so make a static guess
  1317. if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
  1318. bigendian="yes"
  1319. fi
  1320. fi
  1321. # ---
  1322. # check availability of some header files
  1323. memalign=no
  1324. malloc_h=no
  1325. if check_header malloc.h; then
  1326. malloc_h=yes
  1327. memalign=yes
  1328. check_func memalign || memalign="no"
  1329. fi
  1330. if test "$memalign" = "no" -a "$mmx" = "yes" -a \
  1331. "$memalign_hack" != "yes" -a "$targetos" != "Darwin" -a \
  1332. "$targetos" != "FreeBSD" ; then
  1333. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1334. fi
  1335. check_header byteswap.h && byteswap_h=yes || byteswap_h=no
  1336. check_func inet_aton && inet_aton=yes || inet_aton=no
  1337. check_func localtime_r && localtime_r=yes || localtime_r=no
  1338. enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
  1339. # check for some common methods of building with pthread support
  1340. # do this before the optional library checks as some of them require pthreads
  1341. if enabled pthreads; then
  1342. { check_cflags -pthread && check_ldflags -pthread; } ||
  1343. { check_cflags -pthreads && check_ldflags -pthreads; } ||
  1344. check_lib pthread.h pthread_create -lpthread ||
  1345. check_func pthread_create ||
  1346. die "ERROR: can't find pthreads library"
  1347. fi
  1348. # these are off by default, so fail if requested and not available
  1349. enabled dts && require libdts dts.h dts_init -ldts -lm
  1350. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1351. enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
  1352. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
  1353. enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
  1354. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1355. enabled xvid && require XviD xvid.h xvid_global -lxvidcore
  1356. enabled x264 && require x264 x264.h x264_encoder_open -lx264
  1357. enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
  1358. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1359. # Ugh, faac uses stdcall calling convention on win32 so we can't use
  1360. # the generic test functions
  1361. if enabled faac; then
  1362. save_flags
  1363. temp_extralibs -lfaac
  1364. check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
  1365. #include <stdint.h>
  1366. #include <faac.h>
  1367. int main(){
  1368. char *id, *cpr;
  1369. faacEncGetVersion(&id, &cpr);
  1370. return 0;
  1371. }
  1372. EOF
  1373. restore_flags
  1374. fi
  1375. # Ugh, recent faad2 versions have renamed all functions and #define the
  1376. # old names in faad.h. Generic tests won't work.
  1377. if enabled faad; then
  1378. save_flags
  1379. temp_extralibs -lfaad
  1380. check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
  1381. #include <faad.h>
  1382. int main(){
  1383. faacDecOpen();
  1384. return 0;
  1385. }
  1386. EOF
  1387. restore_flags
  1388. fi
  1389. # Ugh, avisynth uses WINAPI calls. Generic tests won't work.
  1390. if enabled avisynth; then
  1391. save_flags
  1392. temp_extralibs -lvfw32
  1393. check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
  1394. #include <windows.h>
  1395. #include <vfw.h>
  1396. int main(){
  1397. AVIFileInit();
  1398. return 0;
  1399. }
  1400. EOF
  1401. restore_flags
  1402. fi
  1403. # test for lrintf in math.h
  1404. check_exec <<EOF && lrintf=yes || lrintf=no
  1405. #define _ISOC9X_SOURCE 1
  1406. #include <math.h>
  1407. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  1408. EOF
  1409. _restrict=
  1410. for restrict_keyword in restrict __restrict__ __restrict; do
  1411. check_cc <<EOF && _restrict=$restrict_keyword && break
  1412. void foo(char * $restrict_keyword p);
  1413. EOF
  1414. done
  1415. # dlopen/dlfcn.h probing
  1416. check_header dlfcn.h && dlfcn_h=yes
  1417. temp_extralibs -ldl
  1418. if check_func dlopen; then
  1419. dlopen=yes
  1420. ldl=-ldl
  1421. fi
  1422. restore_flags
  1423. if check_func dlopen; then
  1424. dlopen=yes
  1425. ldl=
  1426. fi
  1427. if test "$vhook" = "default"; then
  1428. vhook="$dlopen"
  1429. fi
  1430. if enabled_any vhook a52bin faadbin; then
  1431. add_extralibs $ldl
  1432. fi
  1433. if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
  1434. vhook="no"
  1435. echo
  1436. echo "At the moment vhooks don't work on Cygwin static builds."
  1437. echo "Patches welcome."
  1438. echo
  1439. fi
  1440. if enabled vhook; then
  1441. check_ldflags -rdynamic
  1442. check_ldflags -export-dynamic
  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