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.

2219 lines
64KB

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