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.

2182 lines
55KB

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