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.

2232 lines
59KB

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