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.

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