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.

2218 lines
64KB

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