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.

2284 lines
59KB

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