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.

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