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.

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