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.

2145 lines
61KB

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