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.

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