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.

2268 lines
58KB

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