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.

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