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.

2205 lines
64KB

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