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.

2222 lines
63KB

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