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.

2188 lines
62KB

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