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.

2259 lines
58KB

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