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.

2112 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. fi
  1103. if test "$fail" = "yes"; then
  1104. exit 1
  1105. fi
  1106. # compute MMX state
  1107. if test $mmx = "default"; then
  1108. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1109. mmx="yes"
  1110. else
  1111. mmx="no"
  1112. fi
  1113. fi
  1114. test -z "$need_memalign" && need_memalign="$mmx"
  1115. #Darwin CC versions
  1116. needmdynamicnopic="no"
  1117. if test $targetos = Darwin; then
  1118. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1119. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1120. else
  1121. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1122. case "$gcc_version" in
  1123. *2.95*)
  1124. add_cflags "-no-cpp-precomp -pipe"
  1125. ;;
  1126. *[34].*)
  1127. add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
  1128. if test "$lshared" = no; then
  1129. needmdynamicnopic="yes"
  1130. fi
  1131. ;;
  1132. *)
  1133. add_cflags "-no-cpp-precomp -pipe"
  1134. if test "$lshared" = no; then
  1135. needmdynamicnopic="yes"
  1136. fi
  1137. ;;
  1138. esac
  1139. fi
  1140. fi
  1141. if test $optimize != "no"; then
  1142. add_cflags "-fomit-frame-pointer"
  1143. fi
  1144. # Can only do AltiVec on PowerPC
  1145. if test $altivec = "default"; then
  1146. if test $arch = "powerpc"; then
  1147. altivec="yes"
  1148. else
  1149. altivec="no"
  1150. fi
  1151. fi
  1152. # Add processor-specific flags
  1153. POWERPCMODE="32bits"
  1154. if test $cpu != "generic"; then
  1155. case $cpu in
  1156. 601|ppc601|PowerPC601)
  1157. add_cflags "-mcpu=601"
  1158. if test $altivec = "yes"; then
  1159. echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
  1160. fi
  1161. ;;
  1162. 603*|ppc603*|PowerPC603*)
  1163. add_cflags "-mcpu=603"
  1164. if test $altivec = "yes"; then
  1165. echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
  1166. fi
  1167. ;;
  1168. 604*|ppc604*|PowerPC604*)
  1169. add_cflags "-mcpu=604"
  1170. if test $altivec = "yes"; then
  1171. echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
  1172. fi
  1173. ;;
  1174. G3|g3|75*|ppc75*|PowerPC75*)
  1175. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1176. if test $altivec = "yes"; then
  1177. echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
  1178. fi
  1179. ;;
  1180. G4|g4|745*|ppc745*|PowerPC745*)
  1181. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1182. if test $altivec = "no"; then
  1183. echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
  1184. fi
  1185. ;;
  1186. 74*|ppc74*|PowerPC74*)
  1187. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1188. if test $altivec = "no"; then
  1189. echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
  1190. fi
  1191. ;;
  1192. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1193. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1194. if test $altivec = "no"; then
  1195. echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
  1196. fi
  1197. POWERPCMODE="64bits"
  1198. ;;
  1199. # targets that do NOT support conditional mov (cmov)
  1200. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1201. add_cflags "-march=$cpu"
  1202. cmov="no"
  1203. ;;
  1204. # targets that do support conditional mov (cmov)
  1205. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
  1206. add_cflags "-march=$cpu"
  1207. cmov="yes"
  1208. cmov_is_fast="yes"
  1209. ;;
  1210. # targets that do support conditional mov but on which it's slow
  1211. pentium4|prescott|nocona)
  1212. add_cflags "-march=$cpu"
  1213. cmov="yes"
  1214. cmov_is_fast="no"
  1215. ;;
  1216. sparc64)
  1217. add_cflags "-mcpu=v9"
  1218. ;;
  1219. *)
  1220. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1221. ;;
  1222. esac
  1223. fi
  1224. # make sure we can execute files in $TMPDIR
  1225. cat >$TMPE 2>>$logfile <<EOF
  1226. #! /bin/sh
  1227. EOF
  1228. chmod +x $TMPE >>$logfile 2>&1
  1229. if ! $TMPE >>$logfile 2>&1; then
  1230. cat <<EOF
  1231. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1232. variable to another directory and make sure that $TMPDIR1 is not mounted
  1233. noexec.
  1234. EOF
  1235. die "Sanity test failed."
  1236. fi
  1237. rm $TMPE
  1238. # compiler sanity check
  1239. check_exec <<EOF
  1240. int main(){
  1241. return 0;
  1242. }
  1243. EOF
  1244. if test "$?" != 0; then
  1245. echo "$cc is unable to create an executable file."
  1246. if test -z "$cross_prefix" -a "$cross_compile" = no; then
  1247. echo "If $cc is a cross-compiler, use the --cross-compile option."
  1248. echo "Only do this if you know what cross compiling means."
  1249. fi
  1250. die "C compiler test failed."
  1251. fi
  1252. # check for assembler specific support
  1253. if test $arch = "powerpc"; then
  1254. check_cc <<EOF && dcbzl=yes
  1255. int main(void) {
  1256. register long zero = 0;
  1257. char data[1024];
  1258. asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
  1259. return 0;
  1260. }
  1261. EOF
  1262. fi
  1263. # check for SIMD availability
  1264. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1265. if test $arch = "powerpc"; then
  1266. if test $altivec = "yes"; then
  1267. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  1268. add_cflags "-faltivec"
  1269. else
  1270. add_cflags "-maltivec -mabi=altivec"
  1271. fi
  1272. fi
  1273. fi
  1274. check_header altivec.h
  1275. # check if our compiler supports Motorola AltiVec C API
  1276. if test $altivec = "yes"; then
  1277. if test $altivec_h = "yes"; then
  1278. inc_altivec_h="#include <altivec.h>"
  1279. else
  1280. inc_altivec_h=
  1281. fi
  1282. check_cc <<EOF || altivec=no
  1283. $inc_altivec_h
  1284. int main(void) {
  1285. vector signed int v1, v2, v3;
  1286. v1 = vec_add(v2,v3);
  1287. return 0;
  1288. }
  1289. EOF
  1290. fi
  1291. # check armv5te instructions support
  1292. if test $armv5te = "default" -a $arch = "armv4l"; then
  1293. armv5te=no
  1294. check_cc <<EOF && armv5te=yes
  1295. int main(void) {
  1296. __asm__ __volatile__ ("qadd r0, r0, r0");
  1297. }
  1298. EOF
  1299. fi
  1300. # check iwmmxt support
  1301. if test $iwmmxt = "default" -a $arch = "armv4l"; then
  1302. iwmmxt=no
  1303. check_cc <<EOF && iwmmxt=yes
  1304. int main(void) {
  1305. __asm__ __volatile__ ("wunpckelub wr6, wr4");
  1306. }
  1307. EOF
  1308. fi
  1309. # mmi only available on mips
  1310. if test $mmi = "default"; then
  1311. if test $arch = "mips"; then
  1312. mmi="yes"
  1313. else
  1314. mmi="no"
  1315. fi
  1316. fi
  1317. # check if our compiler supports mmi
  1318. enabled mmi && check_cc <<EOF || mmi="no"
  1319. int main(void) {
  1320. __asm__ ("lq \$2, 0(\$2)");
  1321. return 0;
  1322. }
  1323. EOF
  1324. # ---
  1325. # big/little-endian test
  1326. if test "$cross_compile" = "no"; then
  1327. check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
  1328. #include <inttypes.h>
  1329. int main(int argc, char ** argv){
  1330. volatile uint32_t i=0x01234567;
  1331. return (*((uint8_t*)(&i))) == 0x67;
  1332. }
  1333. EOF
  1334. else
  1335. # programs cannot be launched if cross compiling, so make a static guess
  1336. if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
  1337. bigendian="yes"
  1338. fi
  1339. fi
  1340. # ---
  1341. # check availability of some header files
  1342. check_header malloc.h
  1343. check_func memalign
  1344. if test "$memalign" = "no" -a "$need_memalign" = "yes" -a \
  1345. "$memalign_hack" != "yes"; then
  1346. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1347. fi
  1348. check_header byteswap.h
  1349. check_func inet_aton
  1350. check_func localtime_r
  1351. enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
  1352. # check for some common methods of building with pthread support
  1353. # do this before the optional library checks as some of them require pthreads
  1354. if enabled pthreads; then
  1355. if check_func pthread_create; then
  1356. :
  1357. elif check_func pthread_create -pthread; then
  1358. add_cflags -pthread
  1359. add_ldflags -pthread
  1360. elif check_func pthread_create -pthreads; then
  1361. add_cflags -pthreads
  1362. add_ldflags -pthreads
  1363. elif ! check_lib pthread.h pthread_create -lpthread; then
  1364. die "ERROR: can't find pthreads library"
  1365. fi
  1366. fi
  1367. # these are off by default, so fail if requested and not available
  1368. enabled dts && require libdts dts.h dts_init -ldts -lm
  1369. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1370. enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
  1371. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
  1372. enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
  1373. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1374. enabled xvid && require XviD xvid.h xvid_global -lxvidcore
  1375. enabled x264 && require x264 x264.h x264_encoder_open -lx264
  1376. enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
  1377. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1378. # Ugh, faac uses stdcall calling convention on win32 so we can't use
  1379. # the generic test functions
  1380. if enabled faac; then
  1381. save_flags
  1382. temp_extralibs -lfaac
  1383. check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
  1384. #include <stdint.h>
  1385. #include <faac.h>
  1386. int main(){
  1387. char *id, *cpr;
  1388. faacEncGetVersion(&id, &cpr);
  1389. return 0;
  1390. }
  1391. EOF
  1392. restore_flags
  1393. fi
  1394. # Ugh, recent faad2 versions have renamed all functions and #define the
  1395. # old names in faad.h. Generic tests won't work.
  1396. if enabled faad; then
  1397. save_flags
  1398. temp_extralibs -lfaad
  1399. check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
  1400. #include <faad.h>
  1401. int main(){
  1402. faacDecOpen();
  1403. return 0;
  1404. }
  1405. EOF
  1406. restore_flags
  1407. fi
  1408. # Ugh, avisynth uses WINAPI calls. Generic tests won't work.
  1409. if enabled avisynth; then
  1410. save_flags
  1411. temp_extralibs -lvfw32
  1412. check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
  1413. #include <windows.h>
  1414. #include <vfw.h>
  1415. int main(){
  1416. AVIFileInit();
  1417. return 0;
  1418. }
  1419. EOF
  1420. restore_flags
  1421. fi
  1422. # test for lrintf in math.h
  1423. check_exec <<EOF && lrintf=yes || lrintf=no
  1424. #define _ISOC9X_SOURCE 1
  1425. #include <math.h>
  1426. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  1427. EOF
  1428. _restrict=
  1429. for restrict_keyword in restrict __restrict__ __restrict; do
  1430. check_cc <<EOF && _restrict=$restrict_keyword && break
  1431. void foo(char * $restrict_keyword p);
  1432. EOF
  1433. done
  1434. # dlopen/dlfcn.h probing
  1435. check_header dlfcn.h
  1436. if check_func dlopen; then
  1437. ldl=
  1438. elif check_func dlopen -ldl; then
  1439. ldl=-ldl
  1440. fi
  1441. if test "$vhook" = "default"; then
  1442. vhook="$dlopen"
  1443. fi
  1444. if enabled_any vhook a52bin faadbin; then
  1445. add_extralibs $ldl
  1446. fi
  1447. if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
  1448. vhook="no"
  1449. echo
  1450. echo "At the moment vhooks don't work on Cygwin static builds."
  1451. echo "Patches welcome."
  1452. echo
  1453. fi
  1454. if enabled vhook; then
  1455. check_ldflags -rdynamic
  1456. check_ldflags -export-dynamic
  1457. fi
  1458. if enabled audio_beos; then
  1459. add_extralibs "-lmedia -lbe"
  1460. fi
  1461. ##########################################
  1462. # imlib check
  1463. temp_extralibs -lImlib2
  1464. check_ld <<EOF && imlib2=yes || imlib2=no
  1465. #include <X11/Xlib.h>
  1466. #include <Imlib2.h>
  1467. int main( void ) { return (int) imlib_load_font("foo"); }
  1468. EOF
  1469. restore_flags
  1470. ##########################################
  1471. # FreeType check
  1472. freetype2=no
  1473. if test "x$targetos" != "xBeOS"; then
  1474. if (freetype-config --version) >/dev/null 2>&1 ; then
  1475. temp_cflags `freetype-config --cflags`
  1476. temp_extralibs `freetype-config --libs`
  1477. check_ld <<EOF && freetype2=yes
  1478. #include <ft2build.h>
  1479. int main( void ) { return (int) FT_Init_FreeType(0); }
  1480. EOF
  1481. restore_flags
  1482. fi
  1483. fi
  1484. ##########################################
  1485. # SDL check
  1486. sdl_too_old=no
  1487. sdl=no
  1488. SDL_CONFIG="${cross_prefix}sdl-config"
  1489. if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
  1490. temp_cflags `"${SDL_CONFIG}" --cflags`
  1491. temp_extralibs `"${SDL_CONFIG}" --libs`
  1492. check_ld <<EOF
  1493. #include <SDL.h>
  1494. #undef main /* We don't want SDL to override our main() */
  1495. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  1496. EOF
  1497. if test $? = 0; then
  1498. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1499. if test "$_sdlversion" -lt 121 ; then
  1500. sdl_too_old=yes
  1501. else
  1502. sdl=yes
  1503. check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
  1504. #include <SDL.h>
  1505. int main(void){
  1506. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1507. int w = vi->current_w;
  1508. return 0;
  1509. }
  1510. EOF
  1511. fi
  1512. fi
  1513. restore_flags
  1514. fi
  1515. enabled sdl || ffplay=no
  1516. ##########################################
  1517. # texi2html check
  1518. texi2html=no
  1519. if (texi2html -version) >/dev/null 2>&1; then
  1520. texi2html=yes
  1521. fi
  1522. ##########################################
  1523. # IPv6 check
  1524. enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
  1525. #include <sys/types.h>
  1526. #include <sys/socket.h>
  1527. #include <netinet/in.h>
  1528. #include <netdb.h>
  1529. int main( void ) {
  1530. struct sockaddr_storage saddr;
  1531. struct ipv6_mreq mreq6;
  1532. getaddrinfo(0,0,0,0);
  1533. getnameinfo(0,0,0,0,0,0,0);
  1534. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1535. }
  1536. EOF
  1537. # check for video4linux2 --- V4L2_PIX_FMT_YUV420
  1538. enabled video4linux2 && check_cc <<EOF || video4linux2="no"
  1539. #include <sys/time.h>
  1540. #include <asm/types.h>
  1541. #include <linux/videodev2.h>
  1542. int dummy = V4L2_PIX_FMT_YUV420;
  1543. struct v4l2_buffer dummy1;
  1544. EOF
  1545. # Deal with the x11 frame grabber
  1546. enabled gpl &&
  1547. enabled x11_grab_device_demuxer &&
  1548. check_header X11/Xlib.h &&
  1549. check_header X11/extensions/XShm.h &&
  1550. check_func XOpenDisplay -lX11 &&
  1551. check_func XShmCreateImage -lX11 -lXext &&
  1552. add_extralibs -lX11 -lXext ||
  1553. disable x11_grab_device_demuxer
  1554. enabled debug && add_cflags -g
  1555. # add some useful compiler flags if supported
  1556. check_cflags -Wdeclaration-after-statement
  1557. check_cflags -Wall
  1558. check_cflags -Wno-switch
  1559. check_cflags -Wdisabled-optimization
  1560. check_cflags -Wpointer-arith
  1561. check_cflags -Wredundant-decls
  1562. enabled extrawarnings && check_cflags -Winline
  1563. # add some linker flags
  1564. check_ldflags $LDLATEFLAGS
  1565. # not all compilers support -Os
  1566. test "$optimize" = "small" && check_cflags -Os
  1567. if enabled optimize; then
  1568. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1569. add_cflags "-O5"
  1570. add_ldflags "-O5"
  1571. else
  1572. add_cflags "-O3"
  1573. fi
  1574. fi
  1575. # PIC flags for shared library objects where they are needed
  1576. if test "$lshared" = "yes" ; then
  1577. # LIBOBJFLAGS may have already been set in the OS configuration
  1578. if test -z "$LIBOBJFLAGS" ; then
  1579. case "$arch" in
  1580. x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
  1581. esac
  1582. fi
  1583. fi
  1584. if test "$gprof" = "yes" ; then
  1585. add_cflags "-p"
  1586. add_ldflags "-p"
  1587. fi
  1588. VHOOKCFLAGS="-fPIC $CFLAGS"
  1589. test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
  1590. # find if .align arg is power-of-two or not
  1591. if test $asmalign_pot = "unknown"; then
  1592. asmalign_pot="no"
  1593. echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
  1594. fi
  1595. echo "install prefix $PREFIX"
  1596. echo "source path $source_path"
  1597. echo "C compiler $cc"
  1598. echo "make $make"
  1599. echo "ARCH $arch ($cpu)"
  1600. if test "$BUILDSUF" != ""; then
  1601. echo "build suffix $BUILDSUF"
  1602. fi
  1603. echo "big-endian $bigendian"
  1604. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1605. echo "MMX enabled $mmx"
  1606. echo "CMOV enabled $cmov"
  1607. echo "CMOV is fast $cmov_is_fast"
  1608. fi
  1609. if test $arch = "armv4l"; then
  1610. echo "ARMv5TE enabled $armv5te"
  1611. echo "IWMMXT enabled $iwmmxt"
  1612. fi
  1613. if test $arch = "mips"; then
  1614. echo "MMI enabled $mmi"
  1615. fi
  1616. if test $arch = "powerpc"; then
  1617. echo "AltiVec enabled $altivec"
  1618. echo "dcbzl available $dcbzl"
  1619. fi
  1620. echo "gprof enabled $gprof"
  1621. echo "zlib enabled $zlib"
  1622. echo "libgsm enabled $libgsm"
  1623. echo "mp3lame enabled $mp3lame"
  1624. echo "libnut enabled $libnut"
  1625. echo "libogg enabled $libogg"
  1626. echo "Vorbis enabled $libvorbis"
  1627. echo "FAAD enabled $faad"
  1628. echo "faadbin enabled $faadbin"
  1629. echo "FAAC enabled $faac"
  1630. echo "XviD enabled $xvid"
  1631. echo "x264 enabled $x264"
  1632. echo "a52 support $a52"
  1633. echo "a52 dlopened $a52bin"
  1634. echo "DTS support $dts"
  1635. echo "pp support $pp"
  1636. echo "Software Scaler enabled $swscaler"
  1637. echo "AVISynth enabled $avisynth"
  1638. echo "debug symbols $debug"
  1639. echo "strip symbols $dostrip"
  1640. echo "optimize $optimize"
  1641. echo "static $lstatic"
  1642. echo "shared $lshared"
  1643. echo "video hooking $vhook"
  1644. echo "SDL support $sdl"
  1645. if test $sdl_too_old = "yes"; then
  1646. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1647. fi
  1648. if test "$vhook" = "yes"; then
  1649. echo "Imlib2 support $imlib2"
  1650. echo "FreeType support $freetype2"
  1651. fi
  1652. echo "Sun medialib support" $mlib
  1653. echo "pthreads support" $pthreads
  1654. echo "AMR-NB float support" $amr_nb
  1655. echo "AMR-NB fixed support" $amr_nb_fixed
  1656. echo "AMR-WB float support" $amr_wb
  1657. echo "AMR-WB IF2 support" $amr_if2
  1658. echo "network support $network"
  1659. if test "$network" = "yes" ; then
  1660. echo "IPv6 support $ipv6"
  1661. fi
  1662. echo ".align is power-of-two" $asmalign_pot
  1663. if test "$gpl" = "no" ; then
  1664. echo "License: LGPL"
  1665. else
  1666. echo "License: GPL"
  1667. fi
  1668. echo "Creating config.mak and config.h..."
  1669. echo "# Automatically generated by configure - do not modify!" > config.mak
  1670. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1671. echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
  1672. echo "PREFIX=$PREFIX" >> config.mak
  1673. echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
  1674. echo "libdir=\$(DESTDIR)$libdir" >> config.mak
  1675. echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
  1676. echo "incdir=\$(DESTDIR)$incdir" >> config.mak
  1677. echo "bindir=\$(DESTDIR)$bindir" >> config.mak
  1678. echo "mandir=\$(DESTDIR)$mandir" >> config.mak
  1679. echo "MAKE=$make" >> config.mak
  1680. echo "CC=$cc" >> config.mak
  1681. echo "AR=$ar" >> config.mak
  1682. echo "RANLIB=$ranlib" >> config.mak
  1683. if test "$dostrip" = "yes" ; then
  1684. echo "STRIP=$strip" >> config.mak
  1685. echo "INSTALLSTRIP=$installstrip" >> config.mak
  1686. else
  1687. echo "STRIP=echo ignoring strip" >> config.mak
  1688. echo "INSTALLSTRIP=" >> config.mak
  1689. fi
  1690. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1691. echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
  1692. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1693. echo "LDCONFIG=$LDCONFIG" >> config.mak
  1694. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1695. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1696. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  1697. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  1698. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1699. echo "BUILD_STATIC=$lstatic" >> config.mak
  1700. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1701. echo "LIBPREF=$LIBPREF" >> config.mak
  1702. echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
  1703. if test "$lstatic" = "yes" ; then
  1704. echo "LIB=$LIB" >> config.mak
  1705. else # Some Make complain if this variable does not exist.
  1706. echo "LIB=" >> config.mak
  1707. fi
  1708. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1709. echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
  1710. echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
  1711. echo "TARGET_OS=$targetos" >> config.mak
  1712. ucarch=`toupper $arch`
  1713. echo "TARGET_ARCH_${ucarch}=yes" >> config.mak
  1714. echo "#define ARCH_${ucarch} 1" >> $TMPH
  1715. # special cases
  1716. case "$arch" in
  1717. x86_32|x86_64)
  1718. echo "TARGET_ARCH_X86=yes" >> config.mak
  1719. echo "#define ARCH_X86 1" >> $TMPH
  1720. ;;
  1721. powerpc)
  1722. if test "$POWERPCMODE" = "64bits"; then
  1723. echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
  1724. fi
  1725. if test "$powerpc_perf" = "yes"; then
  1726. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  1727. fi
  1728. ;;
  1729. sparc64)
  1730. echo "TARGET_ARCH_SPARC=yes" >> config.mak
  1731. echo "#define ARCH_SPARC 1" >> $TMPH
  1732. ;;
  1733. esac
  1734. if test "$bigendian" = "yes" ; then
  1735. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1736. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1737. fi
  1738. if test "$mmx" = "yes" ; then
  1739. echo "TARGET_MMX=yes" >> config.mak
  1740. echo "#define HAVE_MMX 1" >> $TMPH
  1741. echo "#define __CPU__ 586" >> $TMPH
  1742. fi
  1743. if test "$cmov" = "yes" ; then
  1744. echo "TARGET_CMOV=yes" >> config.mak
  1745. echo "#define HAVE_CMOV 1" >> $TMPH
  1746. fi
  1747. if test "$cmov_is_fast" = "yes" ; then
  1748. echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
  1749. echo "#define CMOV_IS_FAST 1" >> $TMPH
  1750. fi
  1751. if test "$armv5te" = "yes" ; then
  1752. echo "TARGET_ARMV5TE=yes" >> config.mak
  1753. echo "#define HAVE_ARMV5TE 1" >> $TMPH
  1754. fi
  1755. if test "$iwmmxt" = "yes" ; then
  1756. echo "TARGET_IWMMXT=yes" >> config.mak
  1757. echo "#define HAVE_IWMMXT 1" >> $TMPH
  1758. fi
  1759. if test "$mmi" = "yes" ; then
  1760. echo "TARGET_MMI=yes" >> config.mak
  1761. echo "#define HAVE_MMI 1" >> $TMPH
  1762. fi
  1763. if test "$altivec" = "yes" ; then
  1764. echo "TARGET_ALTIVEC=yes" >> config.mak
  1765. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  1766. fi
  1767. if test "$sdl" = "yes" ; then
  1768. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1769. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1770. fi
  1771. if test "$texi2html" = "yes"; then
  1772. echo "BUILD_DOC=yes" >> config.mak
  1773. fi
  1774. sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
  1775. pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
  1776. lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
  1777. lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
  1778. lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
  1779. if test "$lshared" = "yes" ; then
  1780. echo "BUILD_SHARED=yes" >> config.mak
  1781. echo "PIC=-fPIC -DPIC" >> config.mak
  1782. echo "SPPMAJOR=${pp_version%%.*}" >> config.mak
  1783. echo "SPPVERSION=$pp_version" >> config.mak
  1784. echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
  1785. echo "LAVCVERSION=$lavc_version" >> config.mak
  1786. echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
  1787. echo "LAVFVERSION=$lavf_version" >> config.mak
  1788. echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
  1789. echo "LAVUVERSION=$lavu_version" >> config.mak
  1790. echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
  1791. echo "SWSVERSION=$sws_version" >> config.mak
  1792. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1793. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1794. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1795. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1796. fi
  1797. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1798. echo "EXTRALIBS=$extralibs" >> config.mak
  1799. enabled_any $ENCODER_LIST && enable encoders
  1800. enabled_any $DECODER_LIST && enable decoders
  1801. enabled_any $MUXER_LIST && enable muxers
  1802. enabled_any $DEMUXER_LIST && enable demuxers
  1803. enabled_any pthreads beosthreads os2threads w32threads && enable threads
  1804. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  1805. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
  1806. if test "$targetos" = "Darwin"; then
  1807. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1808. fi
  1809. echo "#define restrict $_restrict" >> $TMPH
  1810. if test "$optimize" = "small"; then
  1811. echo "#define always_inline" >> $TMPH
  1812. echo "#define CONFIG_SMALL 1" >> $TMPH
  1813. fi
  1814. echo "SRC_PATH=\"$source_path\"" >> config.mak
  1815. echo "SRC_PATH_BARE=$source_path" >> config.mak
  1816. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  1817. if test "$amr_if2" = "yes" ; then
  1818. echo "AMR_CFLAGS=-DIF2=1" >> config.mak
  1819. fi
  1820. # Apparently it's not possible to portably echo a backslash.
  1821. if test "$asmalign_pot" = "yes" ; then
  1822. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
  1823. else
  1824. printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
  1825. fi
  1826. for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
  1827. ucname="`toupper $codec`"
  1828. config_name="CONFIG_$ucname"
  1829. enabled_name="ENABLE_$ucname"
  1830. if enabled $codec; then
  1831. echo "#define $config_name 1" >> $TMPH
  1832. echo "#define $enabled_name 1" >> $TMPH
  1833. echo "$config_name=yes" >> config.mak
  1834. else
  1835. echo "#define $enabled_name 0" >> $TMPH
  1836. fi
  1837. done
  1838. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  1839. if ! cmp -s $TMPH config.h; then
  1840. mv -f $TMPH config.h
  1841. else
  1842. echo "config.h is unchanged"
  1843. fi
  1844. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
  1845. # build tree in object directory if source path is different from current one
  1846. if test "$source_path_used" = "yes" ; then
  1847. DIRS="\
  1848. doc \
  1849. libavformat \
  1850. libavcodec \
  1851. libavcodec/alpha \
  1852. libavcodec/armv4l \
  1853. libavcodec/bfin \
  1854. libavcodec/i386 \
  1855. libavcodec/sparc \
  1856. libavcodec/mlib \
  1857. libavcodec/ppc \
  1858. libavcodec/liba52 \
  1859. libpostproc \
  1860. libavutil \
  1861. libswscale \
  1862. tests \
  1863. vhook \
  1864. "
  1865. FILES="\
  1866. Makefile \
  1867. common.mak \
  1868. libavformat/Makefile \
  1869. libavcodec/Makefile \
  1870. libpostproc/Makefile \
  1871. libavutil/Makefile \
  1872. libswscale/Makefile \
  1873. tests/Makefile \
  1874. vhook/Makefile \
  1875. doc/Makefile \
  1876. doc/texi2pod.pl \
  1877. "
  1878. for dir in $DIRS ; do
  1879. mkdir -p $dir
  1880. done
  1881. for f in $FILES ; do
  1882. ln -sf "$source_path/$f" $f
  1883. done
  1884. fi
  1885. # build pkg-config files
  1886. pkgconfig_generate(){
  1887. name=$1
  1888. comment=$2
  1889. version=$3
  1890. libs=$4
  1891. requires=$5
  1892. include=$6
  1893. cat <<EOF >$name.pc
  1894. prefix=$PREFIX
  1895. exec_prefix=\${prefix}
  1896. libdir=\${exec_prefix}/lib
  1897. includedir=\${prefix}/include
  1898. Name: $name
  1899. Description: $comment
  1900. Version: $version
  1901. Requires: $requires
  1902. Conflicts:
  1903. Libs: -L\${libdir} $libs
  1904. Cflags: -I\${includedir} -I\${includedir}/$include
  1905. EOF
  1906. }
  1907. pkgconfig_generate_uninstalled(){
  1908. name=$1
  1909. shortname=${name#lib}
  1910. comment=$2
  1911. version=$3
  1912. libs=$4
  1913. requires=$5
  1914. cat <<EOF >$name-uninstalled.pc
  1915. prefix=
  1916. exec_prefix=
  1917. libdir=\${pcfiledir}/$name
  1918. includedir=\${pcfiledir}/$name
  1919. Name: $name
  1920. Description: $comment
  1921. Version: $version
  1922. Requires: $requires
  1923. Conflicts:
  1924. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  1925. Cflags: -I\${includedir}
  1926. EOF
  1927. }
  1928. pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
  1929. pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
  1930. pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
  1931. pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
  1932. pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
  1933. pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
  1934. pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
  1935. pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
  1936. if test "$swscaler" != "no"; then
  1937. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "-lswscale" "$pkg_requires libavutil = $lavu_version" swscale
  1938. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavutil = $lavu_version"
  1939. else
  1940. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" swscale
  1941. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
  1942. apply libswscale.pc sed s/^Libs:.*$/Libs:/
  1943. apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/
  1944. fi