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.

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