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.

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