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.

2358 lines
68KB

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