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.

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