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.

2151 lines
62KB

  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. llrint
  643. lrint
  644. lrintf
  645. machine_ioctl_bt848_h
  646. machine_ioctl_meteor_h
  647. malloc_h
  648. memalign
  649. mkstemp
  650. mlib
  651. ppc64
  652. round
  653. roundf
  654. sdl
  655. sdl_video_size
  656. soundcard_h
  657. sys_poll_h
  658. sys_select_h
  659. sys_soundcard_h
  660. termios_h
  661. threads
  662. winsock2_h
  663. "
  664. CMDLINE_SELECT="
  665. $ARCH_EXT_LIST
  666. $CONFIG_LIST
  667. $THREADS_LIST
  668. debug
  669. extra_warnings
  670. optimizations
  671. shared
  672. static
  673. "
  674. # code dependency declarations
  675. # architecture extensions
  676. altivec_deps="powerpc"
  677. armv5te_deps="armv4l"
  678. armv6_deps="armv4l"
  679. iwmmxt_deps="armv4l"
  680. mmi_deps="mips"
  681. mmx_deps="x86"
  682. ssse3_deps="x86"
  683. vis_deps="sparc"
  684. # decoders / encoders
  685. ac3_decoder_deps="gpl"
  686. dxa_decoder_deps="zlib"
  687. flashsv_decoder_deps="zlib"
  688. flashsv_encoder_deps="zlib"
  689. flv_decoder_deps="h263_decoder"
  690. h263_decoder_deps="h263_parser mpeg4video_parser"
  691. h263i_decoder_deps="h263_decoder"
  692. h264_decoder_deps="h264_parser"
  693. mpeg_xvmc_decoder_deps="xvmc"
  694. mpeg4_decoder_deps="h263_decoder"
  695. msmpeg4v1_decoder_deps="h263_decoder"
  696. msmpeg4v2_decoder_deps="h263_decoder"
  697. msmpeg4v3_decoder_deps="h263_decoder"
  698. png_decoder_deps="zlib"
  699. png_encoder_deps="zlib"
  700. svq3_decoder_deps="h264_parser"
  701. vc1_decoder_deps="h263_decoder"
  702. wmv1_decoder_deps="h263_decoder"
  703. wmv2_decoder_deps="h263_decoder"
  704. wmv3_decoder_deps="h263_decoder"
  705. zmbv_decoder_deps="zlib"
  706. zmbv_encoder_deps="zlib"
  707. # external libraries
  708. liba52_decoder_deps="liba52"
  709. liba52bin_decoder_extralibs='$ldl'
  710. libamr_nb_decoder_deps="libamr_nb"
  711. libamr_nb_encoder_deps="libamr_nb"
  712. libamr_wb_decoder_deps="libamr_wb"
  713. libamr_wb_encoder_deps="libamr_wb"
  714. libfaac_encoder_deps="libfaac"
  715. libfaad_decoder_deps="libfaad"
  716. libfaadbin_decoder_extralibs='$ldl'
  717. libgsm_decoder_deps="libgsm"
  718. libgsm_encoder_deps="libgsm"
  719. libgsm_ms_decoder_deps="libgsm"
  720. libgsm_ms_encoder_deps="libgsm"
  721. libmp3lame_encoder_deps="libmp3lame"
  722. libtheora_encoder_deps="libtheora"
  723. libvorbis_encoder_deps="libvorbis"
  724. libx264_encoder_deps="libx264"
  725. libxvid_encoder_deps="libxvid"
  726. mpeg4aac_decoder_deps="libfaad"
  727. # demuxers / muxers
  728. ac3_demuxer_deps="ac3_parser"
  729. audio_beos_demuxer_deps="audio_beos"
  730. audio_beos_demuxer_extralibs="-lmedia -lbe"
  731. audio_beos_muxer_deps="audio_beos"
  732. audio_beos_muxer_extralibs="-lmedia -lbe"
  733. avisynth_demuxer_deps="avisynth"
  734. bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  735. dv1394_demuxer_deps="dv1394 dv_demuxer"
  736. libdc1394_demuxer_deps="libdc1394"
  737. libnut_demuxer_deps="libnut"
  738. libnut_muxer_deps="libnut"
  739. mp3_demuxer_deps="mpegaudio_parser"
  740. oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  741. oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  742. redir_demuxer_deps="network"
  743. rtp_muxer_deps="network mpegts_demuxer"
  744. rtsp_demuxer_deps="rtp_protocol rtp_muxer"
  745. sdp_demuxer_deps="rtsp_demuxer"
  746. v4l2_demuxer_deps="linux_videodev2_h"
  747. v4l_demuxer_deps="linux_videodev_h"
  748. x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  749. x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  750. # protocols
  751. http_protocol_deps="network"
  752. rtp_protocol_deps="udp_protocol"
  753. tcp_protocol_deps="network"
  754. udp_protocol_deps="network"
  755. # programs
  756. ffplay_deps="sdl"
  757. ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  758. ffserver_extralibs='$ldl'
  759. vhook_extralibs='$ldl'
  760. # set temporary file name
  761. if test ! -z "$TMPDIR" ; then
  762. TMPDIR1="${TMPDIR}"
  763. elif test ! -z "$TEMPDIR" ; then
  764. TMPDIR1="${TEMPDIR}"
  765. else
  766. TMPDIR1="/tmp"
  767. fi
  768. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  769. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  770. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  771. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  772. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  773. # default parameters
  774. enable logging
  775. logfile="config.err"
  776. # installation paths
  777. PREFIX="/usr/local"
  778. libdir='$(PREFIX)/lib'
  779. shlibdir="$libdir"
  780. incdir='$(PREFIX)/include/ffmpeg'
  781. mandir='$(PREFIX)/share/man'
  782. bindir='$(PREFIX)/bin'
  783. # toolchain
  784. cc="gcc"
  785. ar="ar"
  786. ranlib="ranlib"
  787. make="make"
  788. strip="strip"
  789. asmalign_pot="unknown"
  790. ln_s="ln -sf"
  791. # machine
  792. arch=`uname -m`
  793. cpu="generic"
  794. # OS
  795. targetos=$(tolower $(uname -s))
  796. # libraries
  797. enable zlib
  798. # configurable options
  799. enable debug
  800. enable dostrip
  801. enable ffmpeg
  802. enable ffplay
  803. enable ffserver
  804. enable ipv6
  805. enable static
  806. enable mpegaudio_hp
  807. enable network
  808. enable optimizations
  809. enable protocols
  810. vhook="default"
  811. # build settings
  812. SHFLAGS='-shared -Wl,-soname,$@'
  813. VHOOKSHFLAGS='$(SHFLAGS)'
  814. LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  815. FFSERVERLDFLAGS=-Wl,-E
  816. LDCONFIG="ldconfig"
  817. LIBPREF="lib"
  818. LIBSUF=".a"
  819. FULLNAME='$(NAME)$(BUILDSUF)'
  820. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  821. SLIBPREF="lib"
  822. SLIBSUF=".so"
  823. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  824. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  825. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  826. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  827. # find source path
  828. source_path="`dirname \"$0\"`"
  829. enable source_path_used
  830. if test -z "$source_path" -o "$source_path" = "." ; then
  831. source_path="`pwd`"
  832. disable source_path_used
  833. else
  834. source_path="`cd \"$source_path\"; pwd`"
  835. echo "$source_path" | grep -q '[[:blank:]]' &&
  836. die "Out of tree builds are impossible with whitespace in source path."
  837. fi
  838. FFMPEG_CONFIGURATION="$@"
  839. ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
  840. DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
  841. PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
  842. BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
  843. MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
  844. DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
  845. OUTDEV_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavdevice/alldevices.c"`
  846. INDEV_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavdevice/alldevices.c"`
  847. PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
  848. enable $ARCH_EXT_LIST \
  849. $DECODER_LIST \
  850. $ENCODER_LIST \
  851. $PARSER_LIST \
  852. $BSF_LIST \
  853. $DEMUXER_LIST \
  854. $MUXER_LIST \
  855. $PROTOCOL_LIST \
  856. $INDEV_LIST \
  857. $OUTDEV_LIST \
  858. die_unknown(){
  859. echo "Unknown option \"$1\"."
  860. echo "See $0 --help for available options."
  861. exit 1
  862. }
  863. show_list() {
  864. suffix=_$1
  865. shift
  866. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  867. exit 0
  868. }
  869. for opt do
  870. optval="${opt#*=}"
  871. case "$opt" in
  872. --log)
  873. ;;
  874. --log=*) logging="$optval"
  875. ;;
  876. --prefix=*) PREFIX="$optval"
  877. ;;
  878. --libdir=*) libdir="$optval"
  879. ;;
  880. --shlibdir=*) shlibdir="$optval"
  881. ;;
  882. --incdir=*) incdir="$optval"
  883. ;;
  884. --mandir=*) mandir="$optval"
  885. ;;
  886. --source-path=*) source_path="$optval"
  887. ;;
  888. --cross-prefix=*) cross_prefix="$optval"
  889. ;;
  890. --cross-compile) enable cross_compile
  891. ;;
  892. --target-os=*) targetos="$optval"
  893. ;;
  894. --cc=*) cc="$optval"
  895. ;;
  896. --make=*) make="$optval"
  897. ;;
  898. --extra-cflags=*) add_cflags "$optval"
  899. ;;
  900. --extra-ldflags=*) add_ldflags "$optval"
  901. ;;
  902. --extra-libs=*) add_extralibs "$optval"
  903. ;;
  904. --build-suffix=*) BUILDSUF="$optval"
  905. ;;
  906. --arch=*) arch="$optval"
  907. ;;
  908. --cpu=*) cpu="$optval"
  909. ;;
  910. --enable-sunmlib) enable mlib
  911. ;;
  912. --disable-strip) disable dostrip
  913. ;;
  914. --disable-encoders) disable $ENCODER_LIST
  915. ;;
  916. --disable-decoders) disable $DECODER_LIST
  917. ;;
  918. --disable-muxers) disable $MUXER_LIST
  919. ;;
  920. --disable-demuxers) disable $DEMUXER_LIST
  921. ;;
  922. --disable-parsers) disable $PARSER_LIST
  923. ;;
  924. --disable-bsfs) disable $BSF_LIST
  925. ;;
  926. --disable-protocols) disable $PROTOCOL_LIST
  927. ;;
  928. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  929. ;;
  930. --enable-*=*|--disable-*=*)
  931. eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
  932. case "$thing" in
  933. encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;;
  934. *) die_unknown "$opt" ;;
  935. esac
  936. ;;
  937. --enable-?*|--disable-?*)
  938. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  939. echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
  940. $action $option
  941. ;;
  942. --list-*)
  943. NAME="${opt#--list-}"
  944. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  945. NAME=${NAME%s}
  946. eval show_list $NAME \$$(toupper $NAME)_LIST
  947. ;;
  948. --help|-h) show_help
  949. ;;
  950. *)
  951. die_unknown $opt
  952. ;;
  953. esac
  954. done
  955. case "$arch" in
  956. i386|i486|i586|i686|i86pc|BePC)
  957. arch="x86_32"
  958. enable fast_unaligned
  959. ;;
  960. x86_64|amd64)
  961. arch="x86_32"
  962. enable fast_unaligned
  963. canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
  964. if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
  965. if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
  966. arch="x86_64"
  967. enable fast_64bit
  968. fi
  969. fi
  970. ;;
  971. # armv4l is a subset of armv[567]*l
  972. arm|armv[4567]*l)
  973. arch="armv4l"
  974. ;;
  975. alpha)
  976. arch="alpha"
  977. enable fast_64bit
  978. ;;
  979. "Power Macintosh"|ppc|powerpc)
  980. arch="powerpc"
  981. ;;
  982. ppc64)
  983. arch="powerpc"
  984. enable fast_64bit
  985. ;;
  986. mips|mipsel|IP*)
  987. arch="mips"
  988. ;;
  989. sun4u|sparc64)
  990. arch="sparc64"
  991. enable fast_64bit
  992. ;;
  993. sparc)
  994. arch="sparc"
  995. ;;
  996. sh4)
  997. arch="sh4"
  998. ;;
  999. parisc)
  1000. arch="parisc"
  1001. ;;
  1002. parisc64)
  1003. arch="parisc"
  1004. enable fast_64bit
  1005. ;;
  1006. s390|s390x)
  1007. arch="s390"
  1008. ;;
  1009. m68k)
  1010. arch="m68k"
  1011. ;;
  1012. ia64)
  1013. arch="ia64"
  1014. enable fast_64bit
  1015. ;;
  1016. bfin)
  1017. arch="bfin"
  1018. ;;
  1019. *)
  1020. arch="unknown"
  1021. ;;
  1022. esac
  1023. enable $arch
  1024. enabled_any x86_32 x86_64 && enable x86
  1025. enabled sparc64 && enable sparc
  1026. # OS specific
  1027. case $targetos in
  1028. beos|haiku|zeta)
  1029. PREFIX="$HOME/config"
  1030. # helps building libavcodec
  1031. add_cflags "-DPIC -fomit-frame-pointer"
  1032. # 3 gcc releases known for BeOS, each with ugly bugs
  1033. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1034. case "$gcc_version" in
  1035. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1036. disable mmx
  1037. ;;
  1038. *20010315*) echo "BeBits gcc"
  1039. add_cflags "-fno-expensive-optimizations"
  1040. ;;
  1041. esac
  1042. LDCONFIG="echo ignoring ldconfig"
  1043. SHFLAGS=-nostart
  1044. # enable BeOS things
  1045. enable audio_beos
  1046. # no need for libm, but the inet stuff
  1047. # Check for BONE
  1048. # XXX: actually should check for NOT net_server
  1049. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  1050. network_extralibs="-lbind -lsocket"
  1051. else
  1052. enable beos_netserver
  1053. network_extralibs="-lnet"
  1054. fi ;;
  1055. sunos)
  1056. FFSERVERLDFLAGS=""
  1057. SHFLAGS='-shared -Wl,-h,$@'
  1058. network_extralibs="-lsocket -lnsl"
  1059. ;;
  1060. netbsd)
  1061. oss_demuxer_extralibs="-lossaudio"
  1062. oss_muxer_extralibs="-lossaudio"
  1063. ;;
  1064. openbsd)
  1065. disable need_memalign
  1066. LIBOBJFLAGS='$(PIC)'
  1067. LDCONFIG='ldconfig -m $(SHLIBDIR)'
  1068. SHFLAGS='-shared'
  1069. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
  1070. SLIBNAME_WITH_VERSION='$(SLIBNAME)'
  1071. SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
  1072. oss_demuxer_extralibs="-lossaudio"
  1073. oss_muxer_extralibs="-lossaudio"
  1074. ;;
  1075. freebsd)
  1076. disable need_memalign
  1077. ;;
  1078. bsd/os)
  1079. osextralibs="-lpoll -lgnugetopt"
  1080. strip="strip -d"
  1081. ;;
  1082. darwin)
  1083. disable need_memalign
  1084. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION) -Wl,-read_only_relocs,suppress'
  1085. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$@'
  1086. strip="strip -x"
  1087. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1088. SLIBSUF=".dylib"
  1089. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1090. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1091. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1092. ;;
  1093. mingw32*)
  1094. targetos=mingw32
  1095. shlibdir="$bindir"
  1096. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1097. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1098. if enabled swscaler; then
  1099. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1100. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1101. fi
  1102. disable ffserver
  1103. SLIBPREF=""
  1104. SLIBSUF=".dll"
  1105. EXESUF=".exe"
  1106. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1107. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1108. SLIB_EXTRA_CMD='-lib /machine:i386 /def:$(@:$(SLIBSUF)=.def)'
  1109. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1110. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1111. SHFLAGS='-shared -Wl,--output-def,$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1112. ;;
  1113. cygwin*)
  1114. targetos=cygwin
  1115. shlibdir="$bindir"
  1116. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1117. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1118. if enabled swscaler; then
  1119. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1120. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1121. fi
  1122. EXESUF=".exe"
  1123. SLIBPREF="cyg"
  1124. SLIBSUF=".dll"
  1125. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1126. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1127. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1128. ;;
  1129. *-dos|freedos|opendos)
  1130. enable memalign_hack
  1131. disable ffplay ffserver vhook
  1132. disable $INDEV_LIST $OUTDEV_LIST
  1133. network_extralibs="-lsocket"
  1134. EXESUF=".exe"
  1135. ;;
  1136. linux)
  1137. LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
  1138. enable dv1394
  1139. ;;
  1140. irix*)
  1141. targetos=irix
  1142. ranlib="echo ignoring ranlib"
  1143. ;;
  1144. os/2*)
  1145. ar="emxomfar -p256"
  1146. ranlib="echo ignoring ranlib"
  1147. strip="lxlite"
  1148. ln_s="cp -f"
  1149. add_cflags "-Zomf"
  1150. EXESUF=".exe"
  1151. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1152. SHFLAGS='$(NAME).def -Zdll -Zomf'
  1153. FFSERVERLDFLAGS=""
  1154. LIBSUF="_s.lib"
  1155. SLIBPREF=""
  1156. SLIBSUF=".dll"
  1157. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1158. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1159. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(NAME).def; \
  1160. echo PROTMODE >> $(NAME).def; \
  1161. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(NAME).def; \
  1162. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(NAME).def; \
  1163. echo EXPORTS >> $(NAME).def; \
  1164. emxexp -o $(OBJS) >> $(NAME).def'
  1165. SLIB_EXTRA_CMD='emximp -o $(LIBPREF)$(NAME)_dll.a $(NAME).def; \
  1166. emximp -o $(LIBPREF)$(NAME)_dll.lib $(NAME).def;'
  1167. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1168. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1169. vhook="no"
  1170. ;;
  1171. *)
  1172. targetos="${targetos}-UNKNOWN"
  1173. ;;
  1174. esac
  1175. add_extralibs $osextralibs
  1176. if ! disabled logging ; then
  1177. enabled logging || logfile="$logging"
  1178. echo "# $0 $@" >$logfile
  1179. set >>$logfile
  1180. else
  1181. logfile=/dev/null
  1182. fi
  1183. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1184. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1185. test -n "$cross_prefix" && enable cross_compile
  1186. cc="${cross_prefix}${cc}"
  1187. ar="${cross_prefix}${ar}"
  1188. ranlib="${cross_prefix}${ranlib}"
  1189. strip="${cross_prefix}${strip}"
  1190. # we need to build at least one lib type
  1191. if ! enabled_any static shared; then
  1192. cat <<EOF
  1193. At least one library type must be built.
  1194. Specify --enable-static to build the static libraries or --enable-shared to
  1195. build the shared libraries as well. To only build the shared libraries specify
  1196. --disable-static in addition to --enable-shared.
  1197. EOF
  1198. exit 1;
  1199. fi
  1200. disabled static && LIBNAME=""
  1201. if enabled_any libfaad libfaadbin ; then
  1202. if check_header faad.h; then
  1203. check_cc << EOF
  1204. #include <faad.h>
  1205. #ifndef FAAD2_VERSION
  1206. ok faad1
  1207. #endif
  1208. int main(void) { return 0; }
  1209. EOF
  1210. test $? = 0 && enable libfaad2
  1211. else
  1212. die "FAAD test failed."
  1213. fi
  1214. fi
  1215. if ! enabled gpl; then
  1216. die_gpl_disabled(){
  1217. name=$1
  1218. shift
  1219. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1220. }
  1221. die_gpl_disabled "The Postprocessing code" pp
  1222. die_gpl_disabled "liba52" liba52
  1223. die_gpl_disabled "libx264" libx264
  1224. die_gpl_disabled "libxvidcore" libxvid
  1225. die_gpl_disabled "FAAD2" libfaad2
  1226. die_gpl_disabled "The X11 grabber" x11grab
  1227. die_gpl_disabled "The software scaler" swscaler
  1228. fi
  1229. check_deps $ARCH_EXT_LIST
  1230. test -z "$need_memalign" && need_memalign="$mmx"
  1231. #Darwin CC versions
  1232. if test $targetos = darwin; then
  1233. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1234. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1235. else
  1236. add_cflags "-no-cpp-precomp -pipe"
  1237. check_cflags "-force_cpusubtype_ALL"
  1238. check_cflags "-Wno-sign-compare"
  1239. disabled shared && add_cflags -mdynamic-no-pic
  1240. fi
  1241. fi
  1242. disabled optimizations || add_cflags -fomit-frame-pointer
  1243. # Add processor-specific flags
  1244. if test $cpu != "generic"; then
  1245. warn_altivec(){
  1246. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1247. }
  1248. case $cpu in
  1249. 601|ppc601|PowerPC601)
  1250. add_cflags "-mcpu=601"
  1251. warn_altivec enabled PPC601
  1252. ;;
  1253. 603*|ppc603*|PowerPC603*)
  1254. add_cflags "-mcpu=603"
  1255. warn_altivec enabled PPC603
  1256. ;;
  1257. 604*|ppc604*|PowerPC604*)
  1258. add_cflags "-mcpu=604"
  1259. warn_altivec enabled PPC604
  1260. ;;
  1261. G3|g3|75*|ppc75*|PowerPC75*)
  1262. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1263. warn_altivec enabled PPC75x
  1264. ;;
  1265. G4|g4|745*|ppc745*|PowerPC745*)
  1266. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1267. warn_altivec disabled PPC745x
  1268. ;;
  1269. 74*|ppc74*|PowerPC74*)
  1270. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1271. warn_altivec disabled PPC74xx
  1272. ;;
  1273. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1274. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1275. warn_altivec disabled PPC970
  1276. enable ppc64
  1277. ;;
  1278. Cell|CELL|cell)
  1279. add_cflags "-mcpu=cell"
  1280. warn_altivec disabled Cell
  1281. enable ppc64
  1282. ;;
  1283. # targets that do NOT support conditional mov (cmov)
  1284. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1285. add_cflags "-march=$cpu"
  1286. disable cmov
  1287. ;;
  1288. # targets that do support conditional mov (cmov)
  1289. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1290. add_cflags "-march=$cpu"
  1291. enable cmov
  1292. enable fast_cmov
  1293. ;;
  1294. # targets that do support conditional mov but on which it's slow
  1295. pentium4|prescott|nocona)
  1296. add_cflags "-march=$cpu"
  1297. enable cmov
  1298. disable fast_cmov
  1299. ;;
  1300. sparc64)
  1301. add_cflags "-mcpu=v9"
  1302. ;;
  1303. bf*) #bf531 bf532 bf533 bf561 bf5xx all get this config
  1304. add_cflags "-mfdpic"
  1305. add_ldflags "-mfdpic"
  1306. ;;
  1307. arm*)
  1308. add_cflags "-mcpu=$cpu"
  1309. ;;
  1310. *)
  1311. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1312. ;;
  1313. esac
  1314. fi
  1315. gnu_make(){
  1316. $1 --version 2>&1 | grep -q GNU
  1317. }
  1318. if ! gnu_make $make; then
  1319. gnu_make gmake && make=gmake || die "GNU make not found."
  1320. fi
  1321. # make sure we can execute files in $TMPDIR
  1322. cat >$TMPE 2>>$logfile <<EOF
  1323. #! /bin/sh
  1324. EOF
  1325. chmod +x $TMPE >>$logfile 2>&1
  1326. if ! $TMPE >>$logfile 2>&1; then
  1327. cat <<EOF
  1328. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1329. variable to another directory and make sure that $TMPDIR1 is not mounted
  1330. noexec.
  1331. EOF
  1332. die "Sanity test failed."
  1333. fi
  1334. rm $TMPE
  1335. # compiler sanity check
  1336. check_exec <<EOF
  1337. int main(void){
  1338. return 0;
  1339. }
  1340. EOF
  1341. if test "$?" != 0; then
  1342. echo "$cc is unable to create an executable file."
  1343. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1344. echo "If $cc is a cross-compiler, use the --cross-compile option."
  1345. echo "Only do this if you know what cross compiling means."
  1346. fi
  1347. die "C compiler test failed."
  1348. fi
  1349. if enabled x86; then
  1350. # check whether EBP is available on x86
  1351. # As 'i' is stored on the stack, this program will crash
  1352. # if the base pointer is used to access it because the
  1353. # base pointer is cleared in the inline assembly code.
  1354. check_exec_crash <<EOF && enable ebp_available
  1355. volatile int i=0;
  1356. asm volatile (
  1357. "xorl %%ebp, %%ebp"
  1358. ::: "%ebp");
  1359. return i;
  1360. EOF
  1361. # check wether EBX is available on x86
  1362. check_asm ebx_available '"":::"%ebx"'
  1363. # check whether binutils is new enough to compile SSSE3
  1364. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1365. fi
  1366. # check for assembler specific support
  1367. if test $arch = "powerpc"; then
  1368. check_cc <<EOF && enable dcbzl
  1369. int main(void) {
  1370. register long zero = 0;
  1371. char data[1024];
  1372. asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
  1373. return 0;
  1374. }
  1375. EOF
  1376. fi
  1377. # check for SIMD availability
  1378. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1379. if enabled altivec; then
  1380. test -n "`$cc -v 2>&1 | grep version | grep Apple`" &&
  1381. add_cflags "-faltivec" ||
  1382. add_cflags "-maltivec -mabi=altivec"
  1383. check_header altivec.h
  1384. # check if our compiler supports Motorola AltiVec C API
  1385. enabled altivec_h &&
  1386. inc_altivec_h="#include <altivec.h>" ||
  1387. inc_altivec_h=
  1388. check_cc <<EOF || disable altivec
  1389. $inc_altivec_h
  1390. int main(void) {
  1391. vector signed int v1, v2, v3;
  1392. v1 = vec_add(v2,v3);
  1393. return 0;
  1394. }
  1395. EOF
  1396. fi
  1397. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1398. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1399. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1400. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1401. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1402. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1403. # ---
  1404. # big/little-endian test
  1405. check_cc <<EOF || die "endian test failed"
  1406. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1407. EOF
  1408. grep -q BIGE $TMPO && enable bigendian
  1409. # ---
  1410. # check availability of some header files
  1411. if check_func dlopen; then
  1412. ldl=
  1413. elif check_func dlopen -ldl; then
  1414. ldl=-ldl
  1415. fi
  1416. check_func fork
  1417. check_func gethrtime
  1418. check_func getrusage
  1419. check_func inet_aton
  1420. check_func memalign
  1421. check_func mkstemp
  1422. check_func2 windows.h GetProcessTimes
  1423. check_header byteswap.h
  1424. check_header conio.h
  1425. check_header dlfcn.h
  1426. check_header malloc.h
  1427. check_header termios.h
  1428. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1429. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1430. fi
  1431. enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
  1432. # ffserver uses poll(),
  1433. # if it's not found we can emulate it using select().
  1434. if enabled ffserver; then
  1435. check_header sys/poll.h
  1436. check_header sys/select.h
  1437. fi
  1438. # check for some common methods of building with pthread support
  1439. # do this before the optional library checks as some of them require pthreads
  1440. if enabled pthreads; then
  1441. if check_func pthread_create; then
  1442. :
  1443. elif check_func pthread_create -pthread; then
  1444. add_cflags -pthread
  1445. add_ldflags -pthread
  1446. elif check_func pthread_create -pthreads; then
  1447. add_cflags -pthreads
  1448. add_ldflags -pthreads
  1449. elif ! check_lib pthread.h pthread_create -lpthread; then
  1450. die "ERROR: can't find pthreads library"
  1451. fi
  1452. fi
  1453. for thread in $THREADS_LIST; do
  1454. if enabled $thread; then
  1455. test -n "$thread_type" &&
  1456. die "ERROR: Only one thread type must be selected." ||
  1457. thread_type="$thread"
  1458. fi
  1459. done
  1460. check_lib math.h sin -lm
  1461. # test for C99 functions in math.h
  1462. for func in llrint lrint lrintf round roundf; do
  1463. check_exec <<EOF && enable $func || disable $func
  1464. #define _ISOC9X_SOURCE 1
  1465. #include <math.h>
  1466. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1467. EOF
  1468. done
  1469. enabled_any libamr_nb libamr_wb && enable libamr
  1470. # these are off by default, so fail if requested and not available
  1471. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1472. enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
  1473. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1474. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1475. enabled libdc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
  1476. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1477. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1478. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1479. enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
  1480. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1481. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1482. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1483. enabled libx264 && require x264 x264.h x264_encoder_open -lx264
  1484. enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
  1485. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1486. # disable the native AC-3 decoder if liba52 is enabled
  1487. enabled liba52 && disable ac3_decoder
  1488. _restrict=
  1489. for restrict_keyword in restrict __restrict__ __restrict; do
  1490. check_cc <<EOF && _restrict=$restrict_keyword && break
  1491. void foo(char * $restrict_keyword p);
  1492. EOF
  1493. done
  1494. test "$vhook" = "default" && vhook="$dlopen"
  1495. if test "$targetos" = cygwin -o "$targetos" = mingw32 && enabled_all static vhook ; then
  1496. disable vhook
  1497. echo
  1498. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1499. echo "Patches welcome."
  1500. echo
  1501. fi
  1502. if enabled vhook; then
  1503. check_ldflags -rdynamic
  1504. check_ldflags -export-dynamic
  1505. fi
  1506. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1507. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1508. ##########################################
  1509. # SDL check
  1510. disable sdl_too_old
  1511. disable sdl
  1512. SDL_CONFIG="${cross_prefix}sdl-config"
  1513. if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
  1514. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1515. temp_cflags $sdl_cflags
  1516. temp_extralibs `"${SDL_CONFIG}" --libs`
  1517. if check_lib SDL.h SDL_Init; then
  1518. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1519. if test "$_sdlversion" -lt 121 ; then
  1520. enable sdl_too_old
  1521. else
  1522. enable sdl
  1523. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1524. #include <SDL.h>
  1525. int main(void){
  1526. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1527. int w = vi->current_w;
  1528. return 0;
  1529. }
  1530. EOF
  1531. fi
  1532. fi
  1533. restore_flags
  1534. fi
  1535. texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html
  1536. ##########################################
  1537. # Network check
  1538. if enabled network; then
  1539. # Prefer arpa/inet.h over winsock2
  1540. if check_header arpa/inet.h ; then
  1541. check_func closesocket
  1542. elif check_header winsock2.h ; then
  1543. network_extralibs="-lws2_32"
  1544. check_func2 winsock2.h closesocket
  1545. fi
  1546. fi
  1547. ##########################################
  1548. # IPv6 check
  1549. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1550. #include <sys/types.h>
  1551. #include <sys/socket.h>
  1552. #include <netinet/in.h>
  1553. #include <netdb.h>
  1554. int main(void) {
  1555. struct sockaddr_storage saddr;
  1556. struct ipv6_mreq mreq6;
  1557. getaddrinfo(0,0,0,0);
  1558. getnameinfo(0,0,0,0,0,0,0);
  1559. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1560. }
  1561. EOF
  1562. check_header linux/videodev.h
  1563. check_header linux/videodev2.h
  1564. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1565. { check_header dev/bktr/ioctl_meteor.h &&
  1566. check_header dev/bktr/ioctl_bt848.h; } ||
  1567. { check_header machine/ioctl_meteor.h &&
  1568. check_header machine/ioctl_bt848.h; } ||
  1569. { check_header dev/video/meteor/ioctl_meteor.h &&
  1570. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1571. check_header dev/ic/bt8xx.h
  1572. check_header sys/soundcard.h
  1573. check_header soundcard.h
  1574. # deal with the X11 frame grabber
  1575. enabled x11grab &&
  1576. check_header X11/Xlib.h &&
  1577. check_header X11/extensions/XShm.h &&
  1578. check_func XOpenDisplay -lX11 &&
  1579. check_func XShmCreateImage -lX11 -lXext
  1580. enabled debug && add_cflags -g
  1581. # add some useful compiler flags if supported
  1582. check_cflags -Wdeclaration-after-statement
  1583. check_cflags -Wall
  1584. check_cflags -Wno-switch
  1585. check_cflags -Wdisabled-optimization
  1586. check_cflags -Wpointer-arith
  1587. check_cflags -Wredundant-decls
  1588. check_cflags -Wno-pointer-sign
  1589. enabled extra_warnings && check_cflags -Winline
  1590. # add some linker flags
  1591. check_ldflags -Wl,--warn-common
  1592. check_ldflags $LDLATEFLAGS
  1593. check_ldflags -Wl,-Bsymbolic
  1594. if enabled small; then
  1595. check_cflags -Os # not all compilers support -Os
  1596. optimizations="small"
  1597. elif enabled optimizations; then
  1598. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  1599. add_cflags "-O5"
  1600. add_ldflags "-O5"
  1601. else
  1602. add_cflags "-O3"
  1603. fi
  1604. fi
  1605. # PIC flags for shared library objects where they are needed
  1606. if enabled shared; then
  1607. # LIBOBJFLAGS may have already been set in the OS configuration
  1608. if test -z "$LIBOBJFLAGS" ; then
  1609. case "$arch" in
  1610. x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS='$(PIC)' ;;
  1611. esac
  1612. fi
  1613. fi
  1614. if enabled gprof; then
  1615. add_cflags "-p"
  1616. add_ldflags "-p"
  1617. fi
  1618. VHOOKCFLAGS="-fPIC"
  1619. # Find out if the .align argument is a power of two or not.
  1620. if test $asmalign_pot = "unknown"; then
  1621. disable asmalign_pot
  1622. echo 'asm (".align 3");' | check_cc && enable asmalign_pot
  1623. fi
  1624. enabled_any $DECODER_LIST && enable decoders
  1625. enabled_any $ENCODER_LIST && enable encoders
  1626. enabled_any $BSF_LIST && enable bsfs
  1627. enabled_any $DEMUXER_LIST && enable demuxers
  1628. enabled_any $MUXER_LIST && enable muxers
  1629. enabled_any $INDEV_LIST && enable demuxers
  1630. enabled_any $OUTDEV_LIST && enable muxers
  1631. enabled_any $PROTOCOL_LIST && enable protocols
  1632. enabled_any $THREADS_LIST && enable threads
  1633. check_deps $CONFIG_LIST \
  1634. $HAVE_LIST \
  1635. $DECODER_LIST \
  1636. $ENCODER_LIST \
  1637. $PARSER_LIST \
  1638. $BSF_LIST \
  1639. $DEMUXER_LIST \
  1640. $MUXER_LIST \
  1641. $INDEV_LIST \
  1642. $OUTDEV_LIST \
  1643. $PROTOCOL_LIST \
  1644. enabled libdc1394 && append pkg_requires "libraw1394"
  1645. enabled libtheora && append pkg_requires "theora"
  1646. enabled libvorbis && append pkg_requires "vorbisenc"
  1647. echo "install prefix $PREFIX"
  1648. echo "source path $source_path"
  1649. echo "C compiler $cc"
  1650. echo "make $make"
  1651. echo ".align is power-of-two $asmalign_pot"
  1652. echo "ARCH $arch ($cpu)"
  1653. if test "$BUILDSUF" != ""; then
  1654. echo "build suffix $BUILDSUF"
  1655. fi
  1656. echo "big-endian ${bigendian-no}"
  1657. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1658. echo "MMX enabled ${mmx-no}"
  1659. echo "CMOV enabled ${cmov-no}"
  1660. echo "CMOV is fast ${fast_cmov-no}"
  1661. echo "EBX available ${ebx_available-no}"
  1662. echo "EBP available ${ebp_available-no}"
  1663. fi
  1664. if test $arch = "armv4l"; then
  1665. echo "ARMv5TE enabled ${armv5te-no}"
  1666. echo "ARMv6 enabled ${armv6-no}"
  1667. echo "IWMMXT enabled ${iwmmxt-no}"
  1668. fi
  1669. if test $arch = "mips"; then
  1670. echo "MMI enabled ${mmi-no}"
  1671. fi
  1672. if test $arch = "powerpc"; then
  1673. echo "AltiVec enabled ${altivec-no}"
  1674. echo "dcbzl available ${dcbzl-no}"
  1675. fi
  1676. echo "gprof enabled ${gprof-no}"
  1677. echo "debug symbols ${debug-no}"
  1678. echo "strip symbols ${dostrip-no}"
  1679. echo "optimizations ${optimizations-no}"
  1680. echo "static ${static-no}"
  1681. echo "shared ${shared-no}"
  1682. echo "postprocessing support ${pp-no}"
  1683. echo "software scaler enabled ${swscaler-no}"
  1684. echo "video hooking ${vhook-no}"
  1685. if enabled vhook; then
  1686. echo "Imlib2 support ${imlib2-no}"
  1687. echo "FreeType support ${freetype2-no}"
  1688. fi
  1689. echo "network support ${network-no}"
  1690. if enabled network; then
  1691. echo "IPv6 support ${ipv6-no}"
  1692. fi
  1693. echo "threading support ${thread_type-no}"
  1694. echo "SDL support ${sdl-no}"
  1695. if enabled sdl_too_old; then
  1696. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1697. fi
  1698. echo "Sun medialib support ${mlib-no}"
  1699. echo "AVISynth enabled ${avisynth-no}"
  1700. echo "liba52 support ${liba52-no}"
  1701. echo "liba52 dlopened ${liba52bin-no}"
  1702. echo "libamr-nb support ${libamr_nb-no}"
  1703. echo "libamr-wb support ${libamr_wb-no}"
  1704. echo "libdc1394 support ${libdc1394-no}"
  1705. echo "libfaac enabled ${libfaac-no}"
  1706. echo "libfaad enabled ${libfaad-no}"
  1707. echo "libfaad dlopened ${libfaadbin-no}"
  1708. echo "libgsm enabled ${libgsm-no}"
  1709. echo "libmp3lame enabled ${libmp3lame-no}"
  1710. echo "libnut enabled ${libnut-no}"
  1711. echo "libtheora enabled ${libtheora-no}"
  1712. echo "libvorbis enabled ${libvorbis-no}"
  1713. echo "x264 enabled ${libx264-no}"
  1714. echo "XviD enabled ${libxvid-no}"
  1715. echo "zlib enabled ${zlib-no}"
  1716. enabled gpl &&
  1717. echo "License: GPL" ||
  1718. echo "License: LGPL"
  1719. for type in decoder encoder parser demuxer muxer protocol bsf indev outdev; do
  1720. echo "Enabled ${type}s:"
  1721. ucname="\$`toupper $type`_LIST"
  1722. list="`eval echo $ucname`"
  1723. partlist=""
  1724. for part in $list; do
  1725. enabled $part && partlist="$partlist $part"
  1726. done
  1727. partlist=`echo $partlist | sed s/_$type//g | tr ' ' '\n' | sort`
  1728. echo $partlist
  1729. done
  1730. echo "Creating config.mak and config.h..."
  1731. echo "# Automatically generated by configure - do not modify!" > config.mak
  1732. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1733. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1734. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1735. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1736. echo "PREFIX=$PREFIX" >> config.mak
  1737. echo "prefix=\$(DESTDIR)\$(PREFIX)" >> config.mak
  1738. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1739. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1740. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1741. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1742. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1743. echo "MAKE=$make" >> config.mak
  1744. echo "CC=$cc" >> config.mak
  1745. echo "AR=$ar" >> config.mak
  1746. echo "RANLIB=$ranlib" >> config.mak
  1747. echo "LDCONFIG=$LDCONFIG" >> config.mak
  1748. echo "LN_S=$ln_s" >> config.mak
  1749. enabled dostrip &&
  1750. echo "STRIP=$strip" >> config.mak ||
  1751. echo "STRIP=echo ignoring strip" >> config.mak
  1752. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1753. echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
  1754. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1755. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1756. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1757. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  1758. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  1759. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1760. echo "BUILD_STATIC=$static" >> config.mak
  1761. echo "BUILDSUF=$BUILDSUF" >> config.mak
  1762. echo "FULLNAME=$FULLNAME" >> config.mak
  1763. echo "LIBPREF=$LIBPREF" >> config.mak
  1764. echo "LIBSUF=$LIBSUF" >> config.mak
  1765. echo "LIBNAME=$LIBNAME" >> config.mak
  1766. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1767. echo "SLIBSUF=$SLIBSUF" >> config.mak
  1768. echo "EXESUF=$EXESUF" >> config.mak
  1769. if enabled bigendian; then
  1770. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1771. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1772. fi
  1773. if enabled mmx; then
  1774. echo "#define __CPU__ 586" >> $TMPH
  1775. fi
  1776. if enabled sdl; then
  1777. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1778. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1779. fi
  1780. if enabled texi2html; then
  1781. echo "BUILD_DOC=yes" >> config.mak
  1782. fi
  1783. sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
  1784. pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
  1785. lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
  1786. lavd_version=`grep '#define LIBAVDEVICE_VERSION ' "$source_path/libavdevice/avdevice.h" | sed 's/[^0-9\.]//g'`
  1787. lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
  1788. lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
  1789. if enabled shared; then
  1790. echo "BUILD_SHARED=yes" >> config.mak
  1791. echo "PIC=-fPIC -DPIC" >> config.mak
  1792. echo "SPPMAJOR=${pp_version%%.*}" >> config.mak
  1793. echo "SPPVERSION=$pp_version" >> config.mak
  1794. echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
  1795. echo "LAVCVERSION=$lavc_version" >> config.mak
  1796. echo "LAVDMAJOR=${lavd_version%%.*}" >> config.mak
  1797. echo "LAVDVERSION=$lavd_version" >> config.mak
  1798. echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
  1799. echo "LAVFVERSION=$lavf_version" >> config.mak
  1800. echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
  1801. echo "LAVUVERSION=$lavu_version" >> config.mak
  1802. echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
  1803. echo "SWSVERSION=$sws_version" >> config.mak
  1804. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1805. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1806. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1807. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  1808. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1809. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  1810. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  1811. fi
  1812. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1813. echo "EXTRALIBS=$extralibs" >> config.mak
  1814. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  1815. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  1816. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  1817. $DECODER_LIST \
  1818. $ENCODER_LIST \
  1819. $PARSER_LIST \
  1820. $BSF_LIST \
  1821. $DEMUXER_LIST \
  1822. $MUXER_LIST \
  1823. $PROTOCOL_LIST \
  1824. $INDEV_LIST \
  1825. $OUTDEV_LIST \
  1826. echo "#define restrict $_restrict" >> $TMPH
  1827. if enabled small; then
  1828. echo "#define av_always_inline" >> $TMPH
  1829. fi
  1830. echo "SRC_PATH=\"$source_path\"" >> config.mak
  1831. echo "SRC_PATH_BARE=$source_path" >> config.mak
  1832. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  1833. # Apparently it's not possible to portably echo a backslash.
  1834. enabled asmalign_pot &&
  1835. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  1836. printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
  1837. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  1838. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  1839. cmp -s $TMPH config.h &&
  1840. echo "config.h is unchanged" ||
  1841. mv -f $TMPH config.h
  1842. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
  1843. # build tree in object directory if source path is different from current one
  1844. if enabled source_path_used; then
  1845. DIRS="\
  1846. doc \
  1847. libavcodec \
  1848. libavcodec/alpha \
  1849. libavcodec/armv4l \
  1850. libavcodec/bfin \
  1851. libavcodec/i386 \
  1852. libavcodec/mlib \
  1853. libavcodec/ppc \
  1854. libavcodec/sh4 \
  1855. libavcodec/sparc \
  1856. libavdevice \
  1857. libavformat \
  1858. libavutil \
  1859. libpostproc \
  1860. libswscale \
  1861. tests \
  1862. tools \
  1863. vhook \
  1864. "
  1865. FILES="\
  1866. Makefile \
  1867. common.mak \
  1868. doc/texi2pod.pl \
  1869. libavcodec/Makefile \
  1870. libavdevice/Makefile \
  1871. libavformat/Makefile \
  1872. libavutil/Makefile \
  1873. libpostproc/Makefile \
  1874. libswscale/Makefile \
  1875. "
  1876. for dir in $DIRS ; do
  1877. mkdir -p $dir
  1878. done
  1879. for f in $FILES ; do
  1880. $ln_s "$source_path/$f" $f
  1881. done
  1882. fi
  1883. # build pkg-config files
  1884. # FIXME: libdir and includedir are hardcoded and may differ from the real path.
  1885. pkgconfig_generate(){
  1886. name=$1
  1887. comment=$2
  1888. version=$3
  1889. libs=$4
  1890. requires=$5
  1891. include=$6
  1892. cat <<EOF >$name.pc
  1893. prefix=$PREFIX
  1894. exec_prefix=\${prefix}
  1895. libdir=\${exec_prefix}/lib
  1896. includedir=\${prefix}/include
  1897. Name: $name
  1898. Description: $comment
  1899. Version: $version
  1900. Requires: $requires
  1901. Conflicts:
  1902. Libs: -L\${libdir} $libs
  1903. Cflags: -I\${includedir}/$include
  1904. EOF
  1905. }
  1906. pkgconfig_generate_uninstalled(){
  1907. name=$1
  1908. shortname=${name#lib}
  1909. comment=$2
  1910. version=$3
  1911. libs=$4
  1912. requires=$5
  1913. cat <<EOF >$name-uninstalled.pc
  1914. prefix=
  1915. exec_prefix=
  1916. libdir=\${pcfiledir}/$name
  1917. includedir=\${pcfiledir}/$name
  1918. Name: $name
  1919. Description: $comment
  1920. Version: $version
  1921. Requires: $requires
  1922. Conflicts:
  1923. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  1924. Cflags: -I\${includedir}
  1925. EOF
  1926. }
  1927. pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
  1928. pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
  1929. pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
  1930. pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
  1931. pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
  1932. pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
  1933. pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version" ffmpeg
  1934. pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$lavd_version" "$extralibs" "$pkg_requires libavformat = $lavf_version"
  1935. if enabled pp; then
  1936. pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
  1937. pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
  1938. fi
  1939. if enabled swscaler; then
  1940. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version" ffmpeg
  1941. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version"
  1942. else
  1943. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" ffmpeg
  1944. pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
  1945. apply libswscale.pc sed s/^Libs:.*$/Libs:/
  1946. apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/
  1947. fi