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.

2215 lines
57KB

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