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.

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