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.

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