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.

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