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.

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