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.

2208 lines
58KB

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