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.

2140 lines
56KB

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