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.

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