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.

3158 lines
89KB

  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. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Standard options:
  55. --help print this message
  56. --logfile=FILE log tests and output to FILE [config.err]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-ffplay disable ffplay build
  76. --disable-ffprobe disable ffprobe build
  77. --disable-ffserver disable ffserver build
  78. --disable-avdevice disable libavdevice build
  79. --disable-avcodec disable libavcodec build
  80. --disable-avformat disable libavformat build
  81. --disable-swscale disable libswscale build
  82. --enable-postproc enable GPLed postprocessing support [no]
  83. --enable-avfilter video filter support [no]
  84. --enable-avfilter-lavf video filters dependent on avformat [no]
  85. --enable-beosthreads use BeOS threads [no]
  86. --enable-os2threads use OS/2 threads [no]
  87. --enable-pthreads use pthreads [no]
  88. --enable-w32threads use Win32 threads [no]
  89. --enable-x11grab enable X11 grabbing [no]
  90. --disable-network disable network support [no]
  91. --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
  92. --enable-gray enable full grayscale support (slower color)
  93. --disable-swscale-alpha disable alpha channel support in swscale
  94. --disable-fastdiv disable table-based division
  95. --enable-small optimize for size instead of speed
  96. --disable-aandct disable AAN DCT code
  97. --disable-dct disable DCT code
  98. --disable-fft disable FFT code
  99. --disable-golomb disable Golomb code
  100. --disable-lpc disable LPC code
  101. --disable-mdct disable MDCT code
  102. --disable-rdft disable RDFT code
  103. --disable-vaapi disable VAAPI code
  104. --disable-vdpau disable VDPAU code
  105. --disable-dxva2 disable DXVA2 code
  106. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  107. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  108. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  109. --enable-beos-netserver enable BeOS netserver
  110. --disable-encoder=NAME disable encoder NAME
  111. --enable-encoder=NAME enable encoder NAME
  112. --disable-encoders disable all encoders
  113. --disable-decoder=NAME disable decoder NAME
  114. --enable-decoder=NAME enable decoder NAME
  115. --disable-decoders disable all decoders
  116. --disable-hwaccel=NAME disable hwaccel NAME
  117. --enable-hwaccel=NAME enable hwaccel NAME
  118. --disable-hwaccels disable all hwaccels
  119. --disable-muxer=NAME disable muxer NAME
  120. --enable-muxer=NAME enable muxer NAME
  121. --disable-muxers disable all muxers
  122. --disable-demuxer=NAME disable demuxer NAME
  123. --enable-demuxer=NAME enable demuxer NAME
  124. --disable-demuxers disable all demuxers
  125. --enable-parser=NAME enable parser NAME
  126. --disable-parser=NAME disable parser NAME
  127. --disable-parsers disable all parsers
  128. --enable-bsf=NAME enable bitstream filter NAME
  129. --disable-bsf=NAME disable bitstream filter NAME
  130. --disable-bsfs disable all bitstream filters
  131. --enable-protocol=NAME enable protocol NAME
  132. --disable-protocol=NAME disable protocol NAME
  133. --disable-protocols disable all protocols
  134. --disable-indev=NAME disable input device NAME
  135. --disable-outdev=NAME disable output device NAME
  136. --disable-indevs disable input devices
  137. --disable-outdevs disable output devices
  138. --disable-devices disable all devices
  139. --enable-filter=NAME enable filter NAME
  140. --disable-filter=NAME disable filter NAME
  141. --disable-filters disable all filters
  142. --list-decoders show all available decoders
  143. --list-encoders show all available encoders
  144. --list-hwaccels show all available hardware accelerators
  145. --list-muxers show all available muxers
  146. --list-demuxers show all available demuxers
  147. --list-parsers show all available parsers
  148. --list-protocols show all available protocols
  149. --list-bsfs show all available bitstream filters
  150. --list-indevs show all available input devices
  151. --list-outdevs show all available output devices
  152. --list-filters show all available filters
  153. External library support:
  154. --enable-avisynth enable reading of AVISynth script files [no]
  155. --enable-bzlib enable bzlib [autodetect]
  156. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  157. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  158. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  159. and libraw1394 [no]
  160. --enable-libdirac enable Dirac support via libdirac [no]
  161. --enable-libfaac enable FAAC support via libfaac [no]
  162. --enable-libfaad enable FAAD support via libfaad [no]
  163. --enable-libfaadbin open libfaad.so.0 at runtime [no]
  164. --enable-libgsm enable GSM support via libgsm [no]
  165. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  166. --enable-libnut enable NUT (de)muxing via libnut,
  167. native (de)muxer exists [no]
  168. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  169. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  170. --enable-libspeex enable Speex decoding via libspeex [no]
  171. --enable-libtheora enable Theora encoding via libtheora [no]
  172. --enable-libvorbis enable Vorbis encoding via libvorbis,
  173. native implementation exists [no]
  174. --enable-libx264 enable H.264 encoding via x264 [no]
  175. --enable-libxvid enable Xvid encoding via xvidcore,
  176. native MPEG-4/Xvid encoder exists [no]
  177. --enable-mlib enable Sun medialib [no]
  178. --enable-zlib enable zlib [autodetect]
  179. Advanced options (experts only):
  180. --source-path=PATH path to source code [$source_path]
  181. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  182. --enable-cross-compile assume a cross-compiler is used
  183. --sysroot=PATH root of cross-build tree
  184. --sysinclude=PATH location of cross-build system headers
  185. --target-os=OS compiler targets OS [$target_os]
  186. --target-exec=CMD command to run executables on target
  187. --target-path=DIR path to view of build directory on target
  188. --nm=NM use nm tool
  189. --as=AS use assembler AS [$as_default]
  190. --cc=CC use C compiler CC [$cc_default]
  191. --ld=LD use linker LD
  192. --host-cc=HOSTCC use host C compiler HOSTCC
  193. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  194. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  195. --host-libs=HLIBS use libs HLIBS when linking for host
  196. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  197. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  198. --extra-libs=ELIBS add ELIBS [$ELIBS]
  199. --extra-version=STRING version string suffix []
  200. --build-suffix=SUFFIX library name suffix []
  201. --arch=ARCH select architecture [$arch]
  202. --cpu=CPU select the minimum required CPU (affects
  203. instruction selection, may crash on older CPUs)
  204. --enable-powerpc-perf enable performance report on PPC
  205. (requires enabling PMC)
  206. --disable-asm disable all assembler optimizations
  207. --disable-altivec disable AltiVec optimizations
  208. --disable-amd3dnow disable 3DNow! optimizations
  209. --disable-amd3dnowext disable 3DNow! extended optimizations
  210. --disable-mmx disable MMX optimizations
  211. --disable-mmx2 disable MMX2 optimizations
  212. --disable-sse disable SSE optimizations
  213. --disable-ssse3 disable SSSE3 optimizations
  214. --disable-armv5te disable armv5te optimizations
  215. --disable-armv6 disable armv6 optimizations
  216. --disable-armv6t2 disable armv6t2 optimizations
  217. --disable-armvfp disable ARM VFP optimizations
  218. --disable-iwmmxt disable iwmmxt optimizations
  219. --disable-mmi disable MMI optimizations
  220. --disable-neon disable neon optimizations
  221. --disable-vis disable VIS optimizations
  222. --disable-yasm disable use of yasm assembler
  223. --enable-pic build position-independent code
  224. --malloc-prefix=PFX prefix malloc and related names with PFX
  225. --enable-sram allow use of on-chip SRAM
  226. Developer options (useful when working on FFmpeg itself):
  227. --disable-debug disable debugging symbols
  228. --enable-debug=LEVEL set the debug level [$debuglevel]
  229. --enable-gprof enable profiling with gprof [$gprof]
  230. --disable-optimizations disable compiler optimizations
  231. --enable-extra-warnings enable more compiler warnings
  232. --disable-stripping disable stripping of executables and shared libraries
  233. NOTE: Object files are built at the place where configure is launched.
  234. EOF
  235. exit 0
  236. }
  237. log(){
  238. echo "$@" >> $logfile
  239. }
  240. log_file(){
  241. log BEGIN $1
  242. pr -n -t $1 >> $logfile
  243. log END $1
  244. }
  245. echolog(){
  246. log "$@"
  247. echo "$@"
  248. }
  249. die(){
  250. echolog "$@"
  251. cat <<EOF
  252. If you think configure made a mistake, make sure you are using the latest
  253. version from SVN. If the latest version fails, report the problem to the
  254. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  255. EOF
  256. if disabled logging; then
  257. cat <<EOF
  258. Rerun configure with logging enabled (do not use --disable-logging), and
  259. include the log this produces with your report.
  260. EOF
  261. else
  262. cat <<EOF
  263. Include the log file "$logfile" produced by configure as this will help
  264. solving the problem.
  265. EOF
  266. fi
  267. exit 1
  268. }
  269. # Avoid locale weirdness, besides we really just want to translate ASCII.
  270. toupper(){
  271. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  272. }
  273. tolower(){
  274. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  275. }
  276. c_escape(){
  277. echo "$*" | sed 's/["\\]/\\\0/g'
  278. }
  279. sh_quote(){
  280. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  281. test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
  282. echo "$v"
  283. }
  284. filter(){
  285. pat=$1
  286. shift
  287. for v; do
  288. eval "case $v in $pat) echo $v ;; esac"
  289. done
  290. }
  291. map(){
  292. m=$1
  293. shift
  294. for _; do; eval $m; done
  295. }
  296. set_all(){
  297. value=$1
  298. shift
  299. for var in $*; do
  300. eval $var=$value
  301. done
  302. }
  303. set_weak(){
  304. value=$1
  305. shift
  306. for var; do
  307. eval : \${$var:=$value}
  308. done
  309. }
  310. pushvar(){
  311. for var in $*; do
  312. eval level=\${${var}_level:=0}
  313. eval ${var}_${level}="\$$var"
  314. eval ${var}_level=$(($level+1))
  315. done
  316. }
  317. popvar(){
  318. for var in $*; do
  319. eval level=\${${var}_level:-0}
  320. test $level = 0 && continue
  321. eval level=$(($level-1))
  322. eval $var="\${${var}_${level}}"
  323. eval ${var}_level=$level
  324. eval unset ${var}_${level}
  325. done
  326. }
  327. enable(){
  328. set_all yes $*
  329. }
  330. disable(){
  331. set_all no $*
  332. }
  333. enable_weak(){
  334. set_weak yes $*
  335. }
  336. disable_weak(){
  337. set_weak no $*
  338. }
  339. enable_safe(){
  340. for var; do
  341. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  342. done
  343. }
  344. disable_safe(){
  345. for var; do
  346. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  347. done
  348. }
  349. do_enable_deep(){
  350. for var; do
  351. enabled $var && continue
  352. eval sel="\$${var}_select"
  353. eval sgs="\$${var}_suggest"
  354. pushvar var sgs
  355. enable_deep $sel
  356. popvar sgs
  357. enable_deep_weak $sgs
  358. popvar var
  359. done
  360. }
  361. enable_deep(){
  362. do_enable_deep $*
  363. enable $*
  364. }
  365. enable_deep_weak(){
  366. do_enable_deep $*
  367. enable_weak $*
  368. }
  369. enabled(){
  370. test "${1#!}" = "$1" && op== || op=!=
  371. eval test "x\$${1#!}" $op "xyes"
  372. }
  373. disabled(){
  374. test "${1#!}" = "$1" && op== || op=!=
  375. eval test "x\$${1#!}" $op "xno"
  376. }
  377. enabled_all(){
  378. for opt; do
  379. enabled $opt || return 1
  380. done
  381. }
  382. disabled_all(){
  383. for opt; do
  384. disabled $opt || return 1
  385. done
  386. }
  387. enabled_any(){
  388. for opt; do
  389. enabled $opt && return 0
  390. done
  391. }
  392. disabled_any(){
  393. for opt; do
  394. disabled $opt && return 0
  395. done
  396. return 1
  397. }
  398. set_default(){
  399. for opt; do
  400. eval : \${$opt:=\$${opt}_default}
  401. done
  402. }
  403. is_in(){
  404. value=$1
  405. shift
  406. for var in $*; do
  407. [ $var = $value ] && return 0
  408. done
  409. return 1
  410. }
  411. check_deps(){
  412. for cfg; do
  413. cfg="${cfg#!}"
  414. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  415. disabled ${cfg}_checking && continue
  416. enable ${cfg}_checking
  417. eval dep_all="\$${cfg}_deps"
  418. eval dep_any="\$${cfg}_deps_any"
  419. eval dep_sel="\$${cfg}_select"
  420. eval dep_sgs="\$${cfg}_suggest"
  421. eval dep_ifa="\$${cfg}_if"
  422. eval dep_ifn="\$${cfg}_if_any"
  423. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  424. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  425. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  426. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  427. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  428. enabled_all $dep_all || disable $cfg
  429. enabled_any $dep_any || disable $cfg
  430. disabled_any $dep_sel && disable $cfg
  431. if enabled $cfg; then
  432. eval dep_extralibs="\$${cfg}_extralibs"
  433. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  434. enable_deep $dep_sel
  435. enable_deep_weak $dep_sgs
  436. fi
  437. disable ${cfg}_checking
  438. done
  439. }
  440. print_config(){
  441. pfx=$1
  442. header=$2
  443. makefile=$3
  444. shift 3
  445. for cfg; do
  446. ucname="$(toupper $cfg)"
  447. if enabled $cfg; then
  448. echo "#define ${pfx}${ucname} 1" >> $header
  449. echo "${pfx}${ucname}=yes" >> $makefile
  450. else
  451. echo "#define ${pfx}${ucname} 0" >> $header
  452. echo "!${pfx}${ucname}=yes" >> $makefile
  453. fi
  454. done
  455. }
  456. flags_saved(){
  457. (: ${SAVE_CFLAGS?}) 2> /dev/null
  458. }
  459. save_flags(){
  460. flags_saved && return
  461. SAVE_CFLAGS="$CFLAGS"
  462. SAVE_LDFLAGS="$LDFLAGS"
  463. SAVE_extralibs="$extralibs"
  464. }
  465. restore_flags(){
  466. flags_saved || return
  467. CFLAGS="$SAVE_CFLAGS"
  468. LDFLAGS="$SAVE_LDFLAGS"
  469. extralibs="$SAVE_extralibs"
  470. unset SAVE_CFLAGS
  471. unset SAVE_LDFLAGS
  472. unset SAVE_extralibs
  473. }
  474. temp_cflags(){
  475. save_flags
  476. CFLAGS="$CFLAGS $*"
  477. }
  478. temp_ldflags(){
  479. save_flags
  480. LDFLAGS="$LDFLAGS $*"
  481. }
  482. temp_extralibs(){
  483. save_flags
  484. extralibs="$extralibs $*"
  485. }
  486. append(){
  487. var=$1
  488. shift
  489. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  490. eval "$var=\"\$$var $*\""
  491. }
  492. add_cppflags(){
  493. append CPPFLAGS $($filter_cppflags "$@")
  494. }
  495. add_cflags(){
  496. append CFLAGS $($filter_cflags "$@")
  497. }
  498. add_asflags(){
  499. append ASFLAGS $($filter_asflags "$@")
  500. }
  501. add_ldflags(){
  502. append LDFLAGS "$@"
  503. }
  504. add_extralibs(){
  505. append extralibs "$@"
  506. }
  507. check_cmd(){
  508. log "$@"
  509. "$@" >> $logfile 2>&1
  510. }
  511. check_cc(){
  512. log check_cc "$@"
  513. cat > $TMPC
  514. log_file $TMPC
  515. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  516. }
  517. check_cpp(){
  518. log check_cpp "$@"
  519. cat > $TMPC
  520. log_file $TMPC
  521. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  522. }
  523. check_as(){
  524. log check_as "$@"
  525. cat > $TMPC
  526. log_file $TMPC
  527. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  528. }
  529. check_asm(){
  530. log check_asm "$@"
  531. name="$1"
  532. code="$2"
  533. shift 2
  534. disable $name
  535. check_as "$@" <<EOF && enable $name
  536. void foo(void){ __asm__ volatile($code); }
  537. EOF
  538. }
  539. check_yasm(){
  540. log check_yasm "$@"
  541. echo "$1" > $TMPS
  542. log_file $TMPS
  543. shift 1
  544. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  545. }
  546. check_ld(){
  547. log check_ld "$@"
  548. flags=''
  549. libs=''
  550. for f; do
  551. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  552. done
  553. check_cc $($filter_cflags $flags) || return
  554. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  555. }
  556. check_cppflags(){
  557. log check_cppflags "$@"
  558. set -- $($filter_cppflags "$@")
  559. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  560. int x;
  561. EOF
  562. }
  563. check_cflags(){
  564. log check_cflags "$@"
  565. set -- $($filter_cflags "$@")
  566. check_cc "$@" <<EOF && append CFLAGS "$@"
  567. int x;
  568. EOF
  569. }
  570. test_ldflags(){
  571. log test_ldflags "$@"
  572. check_ld "$@" <<EOF
  573. int main(void){ return 0; }
  574. EOF
  575. }
  576. check_ldflags(){
  577. log check_ldflags "$@"
  578. test_ldflags "$@" && add_ldflags "$@"
  579. }
  580. check_header(){
  581. log check_header "$@"
  582. header=$1
  583. shift
  584. disable_safe $header
  585. check_cpp "$@" <<EOF && enable_safe $header
  586. #include <$header>
  587. int x;
  588. EOF
  589. }
  590. check_func(){
  591. log check_func "$@"
  592. func=$1
  593. shift
  594. disable $func
  595. check_ld "$@" <<EOF && enable $func
  596. extern int $func();
  597. int main(void){ $func(); }
  598. EOF
  599. }
  600. check_mathfunc(){
  601. log check_mathfunc "$@"
  602. func=$1
  603. shift
  604. disable $func
  605. check_ld "$@" <<EOF && enable $func
  606. #include <math.h>
  607. float foo(float f) { return $func(f); }
  608. int main(void){ return 0; }
  609. EOF
  610. }
  611. check_func_headers(){
  612. log check_func_headers "$@"
  613. headers=$1
  614. func=$2
  615. shift 2
  616. disable $func
  617. incs=""
  618. for hdr in $headers; do
  619. incs="$incs
  620. #include <$hdr>"
  621. done
  622. check_ld "$@" <<EOF && enable $func && enable_safe $headers
  623. $incs
  624. int main(int argc, char **argv){
  625. return (long) $func;
  626. }
  627. EOF
  628. }
  629. check_cpp_condition(){
  630. log check_cpp_condition "$@"
  631. header=$1
  632. condition=$2
  633. shift 2
  634. check_cpp $($filter_cppflags "$@") <<EOF
  635. #include <$header>
  636. #if !($condition)
  637. #error "unsatisfied condition: $condition"
  638. #endif
  639. EOF
  640. }
  641. check_lib(){
  642. log check_lib "$@"
  643. header="$1"
  644. func="$2"
  645. shift 2
  646. temp_extralibs "$@"
  647. check_header $header && check_func $func && add_extralibs "$@"
  648. err=$?
  649. restore_flags
  650. return $err
  651. }
  652. check_lib2(){
  653. log check_lib2 "$@"
  654. headers="$1"
  655. func="$2"
  656. shift 2
  657. check_func_headers "$headers" $func "$@" && add_extralibs "$@"
  658. }
  659. check_exec(){
  660. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  661. }
  662. check_exec_crash(){
  663. code=$(cat)
  664. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  665. # are safe but may not be available everywhere. Thus we use
  666. # raise(SIGTERM) instead. The check is run in a subshell so we
  667. # can redirect the "Terminated" message from the shell. SIGBUS
  668. # is not defined by standard C so it is used conditionally.
  669. (check_exec "$@") >> $logfile 2>&1 <<EOF
  670. #include <signal.h>
  671. static void sighandler(int sig){
  672. raise(SIGTERM);
  673. }
  674. int main(void){
  675. signal(SIGILL, sighandler);
  676. signal(SIGFPE, sighandler);
  677. signal(SIGSEGV, sighandler);
  678. #ifdef SIGBUS
  679. signal(SIGBUS, sighandler);
  680. #endif
  681. { $code }
  682. }
  683. EOF
  684. }
  685. check_type(){
  686. log check_type "$@"
  687. headers=$1
  688. type=$2
  689. shift 2
  690. disable_safe "$type"
  691. incs=""
  692. for hdr in $headers; do
  693. incs="$incs
  694. #include <$hdr>"
  695. done
  696. check_cc "$@" <<EOF && enable_safe "$type"
  697. $incs
  698. $type v;
  699. EOF
  700. }
  701. check_struct(){
  702. log check_type "$@"
  703. headers=$1
  704. struct=$2
  705. member=$3
  706. shift 3
  707. disable_safe "${struct}_${member}"
  708. incs=""
  709. for hdr in $headers; do
  710. incs="$incs
  711. #include <$hdr>"
  712. done
  713. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  714. $incs
  715. const void *p = &(($struct *)0)->$member;
  716. EOF
  717. }
  718. require(){
  719. name="$1"
  720. header="$2"
  721. func="$3"
  722. shift 3
  723. check_lib $header $func "$@" || die "ERROR: $name not found"
  724. }
  725. require2(){
  726. name="$1"
  727. headers="$2"
  728. func="$3"
  729. shift 3
  730. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  731. }
  732. check_foo_config(){
  733. cfg=$1
  734. pkg=$2
  735. header=$3
  736. func=$4
  737. shift 4
  738. disable $cfg
  739. check_cmd ${pkg}-config --version
  740. err=$?
  741. if test "$err" = 0; then
  742. temp_cflags $(${pkg}-config --cflags)
  743. temp_extralibs $(${pkg}-config --libs)
  744. check_lib "$@" $header $func && enable $cfg
  745. fi
  746. return $err
  747. }
  748. check_host_cc(){
  749. log check_host_cc "$@"
  750. cat > $TMPC
  751. log_file $TMPC
  752. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  753. }
  754. check_host_cflags(){
  755. log check_host_cflags "$@"
  756. check_host_cc "$@" <<EOF && append host_cflags "$@"
  757. int x;
  758. EOF
  759. }
  760. apply(){
  761. file=$1
  762. shift
  763. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  764. }
  765. cp_if_changed(){
  766. cmp -s "$1" "$2" &&
  767. echo "$2 is unchanged" ||
  768. cp -f "$1" "$2"
  769. }
  770. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  771. # system-dependent things.
  772. COMPONENT_LIST="
  773. bsfs
  774. decoders
  775. demuxers
  776. encoders
  777. filters
  778. hwaccels
  779. indevs
  780. muxers
  781. outdevs
  782. parsers
  783. protocols
  784. "
  785. CONFIG_LIST="
  786. $COMPONENT_LIST
  787. aandct
  788. avcodec
  789. avdevice
  790. avfilter
  791. avfilter_lavf
  792. avformat
  793. avisynth
  794. beos_netserver
  795. bzlib
  796. dct
  797. doc
  798. dxva2
  799. fastdiv
  800. ffmpeg
  801. ffplay
  802. ffprobe
  803. ffserver
  804. fft
  805. golomb
  806. gpl
  807. gprof
  808. gray
  809. hardcoded_tables
  810. libdc1394
  811. libdirac
  812. libfaac
  813. libfaad
  814. libfaadbin
  815. libgsm
  816. libmp3lame
  817. libnut
  818. libopencore_amrnb
  819. libopencore_amrwb
  820. libopenjpeg
  821. libschroedinger
  822. libspeex
  823. libtheora
  824. libvorbis
  825. libx264
  826. libxvid
  827. lpc
  828. lsp
  829. mdct
  830. memalign_hack
  831. mlib
  832. mpegaudio_hp
  833. network
  834. nonfree
  835. pic
  836. postproc
  837. powerpc_perf
  838. rdft
  839. runtime_cpudetect
  840. shared
  841. small
  842. sram
  843. static
  844. swscale
  845. swscale_alpha
  846. vaapi
  847. vdpau
  848. version3
  849. x11grab
  850. zlib
  851. "
  852. THREADS_LIST='
  853. beosthreads
  854. os2threads
  855. pthreads
  856. w32threads
  857. '
  858. ARCH_LIST='
  859. alpha
  860. arm
  861. avr32
  862. avr32_ap
  863. avr32_uc
  864. bfin
  865. ia64
  866. m68k
  867. mips
  868. mips64
  869. parisc
  870. ppc
  871. ppc64
  872. s390
  873. sh4
  874. sparc
  875. sparc64
  876. tomi
  877. x86
  878. x86_32
  879. x86_64
  880. '
  881. ARCH_EXT_LIST='
  882. altivec
  883. amd3dnow
  884. amd3dnowext
  885. armv5te
  886. armv6
  887. armv6t2
  888. armvfp
  889. iwmmxt
  890. mmi
  891. mmx
  892. mmx2
  893. neon
  894. ppc4xx
  895. sse
  896. ssse3
  897. vis
  898. '
  899. HAVE_LIST_PUB='
  900. bigendian
  901. '
  902. HAVE_LIST="
  903. $ARCH_EXT_LIST
  904. $HAVE_LIST_PUB
  905. $THREADS_LIST
  906. alsa_asoundlib_h
  907. altivec_h
  908. arpa_inet_h
  909. attribute_may_alias
  910. attribute_packed
  911. bswap
  912. closesocket
  913. cmov
  914. conio_h
  915. dcbzl
  916. dev_bktr_ioctl_bt848_h
  917. dev_bktr_ioctl_meteor_h
  918. dev_ic_bt8xx_h
  919. dev_video_meteor_ioctl_meteor_h
  920. dev_video_bktr_ioctl_bt848_h
  921. dlfcn_h
  922. dlopen
  923. dos_paths
  924. ebp_available
  925. ebx_available
  926. exp2
  927. exp2f
  928. fast_64bit
  929. fast_clz
  930. fast_cmov
  931. fast_unaligned
  932. fork
  933. getaddrinfo
  934. gethrtime
  935. GetProcessMemoryInfo
  936. GetProcessTimes
  937. getrusage
  938. struct_rusage_ru_maxrss
  939. inet_aton
  940. inline_asm
  941. isatty
  942. ldbrx
  943. libdc1394_1
  944. libdc1394_2
  945. llrint
  946. local_aligned_16
  947. local_aligned_8
  948. log2
  949. log2f
  950. loongson
  951. lrint
  952. lrintf
  953. lzo1x_999_compress
  954. machine_ioctl_bt848_h
  955. machine_ioctl_meteor_h
  956. malloc_h
  957. memalign
  958. mkstemp
  959. pld
  960. posix_memalign
  961. round
  962. roundf
  963. sdl
  964. sdl_video_size
  965. setmode
  966. socklen_t
  967. soundcard_h
  968. poll_h
  969. setrlimit
  970. struct_addrinfo
  971. struct_ipv6_mreq
  972. struct_sockaddr_in6
  973. struct_sockaddr_sa_len
  974. struct_sockaddr_storage
  975. sys_mman_h
  976. sys_resource_h
  977. sys_select_h
  978. sys_soundcard_h
  979. sys_videoio_h
  980. ten_operands
  981. termios_h
  982. threads
  983. truncf
  984. vfp_args
  985. VirtualAlloc
  986. winsock2_h
  987. xform_asm
  988. yasm
  989. "
  990. # options emitted with CONFIG_ prefix but not available on command line
  991. CONFIG_EXTRA="
  992. avutil
  993. gplv3
  994. lgplv3
  995. "
  996. CMDLINE_SELECT="
  997. $ARCH_EXT_LIST
  998. $CONFIG_LIST
  999. $THREADS_LIST
  1000. asm
  1001. cross_compile
  1002. debug
  1003. extra_warnings
  1004. logging
  1005. optimizations
  1006. stripping
  1007. yasm
  1008. "
  1009. PATHS_LIST='
  1010. bindir
  1011. datadir
  1012. incdir
  1013. libdir
  1014. mandir
  1015. prefix
  1016. shlibdir
  1017. '
  1018. CMDLINE_SET="
  1019. $PATHS_LIST
  1020. arch
  1021. as
  1022. build_suffix
  1023. cc
  1024. cpu
  1025. cross_prefix
  1026. dep_cc
  1027. extra_version
  1028. host_cc
  1029. host_cflags
  1030. host_ldflags
  1031. host_libs
  1032. host_os
  1033. ld
  1034. logfile
  1035. malloc_prefix
  1036. nm
  1037. source_path
  1038. strip
  1039. sysinclude
  1040. sysroot
  1041. target_exec
  1042. target_os
  1043. target_path
  1044. "
  1045. CMDLINE_APPEND="
  1046. extra_cflags
  1047. "
  1048. # code dependency declarations
  1049. # architecture extensions
  1050. armv5te_deps="arm"
  1051. armv6_deps="arm"
  1052. armv6t2_deps="arm"
  1053. armvfp_deps="arm"
  1054. iwmmxt_deps="arm"
  1055. neon_deps="arm"
  1056. mmi_deps="mips"
  1057. altivec_deps="ppc"
  1058. ppc4xx_deps="ppc"
  1059. vis_deps="sparc"
  1060. x86_64_suggest="cmov fast_cmov"
  1061. amd3dnow_deps="mmx"
  1062. amd3dnowext_deps="amd3dnow"
  1063. mmx_deps="x86"
  1064. mmx2_deps="mmx"
  1065. sse_deps="mmx"
  1066. ssse3_deps="sse"
  1067. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1068. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1069. fast_unaligned_if_any="armv6 ppc x86"
  1070. need_memalign="altivec neon sse"
  1071. inline_asm_deps="!tms470"
  1072. # subsystems
  1073. mdct_select="fft"
  1074. rdft_select="fft"
  1075. # decoders / encoders / hardware accelerators
  1076. aac_decoder_select="mdct rdft aac_parser"
  1077. aac_encoder_select="mdct"
  1078. ac3_decoder_select="mdct ac3_parser"
  1079. alac_encoder_select="lpc"
  1080. amrnb_decoder_select="lsp"
  1081. atrac1_decoder_select="mdct"
  1082. atrac3_decoder_select="mdct"
  1083. binkaudio_dct_decoder_select="mdct rdft dct"
  1084. binkaudio_rdft_decoder_select="mdct rdft"
  1085. cavs_decoder_select="golomb"
  1086. cook_decoder_select="mdct"
  1087. cscd_decoder_suggest="zlib"
  1088. dca_decoder_select="mdct"
  1089. dnxhd_encoder_select="aandct"
  1090. dxa_decoder_select="zlib"
  1091. eac3_decoder_select="ac3_decoder"
  1092. eamad_decoder_select="aandct"
  1093. eatgq_decoder_select="aandct"
  1094. eatqi_decoder_select="aandct"
  1095. ffv1_decoder_select="golomb"
  1096. flac_decoder_select="golomb"
  1097. flac_encoder_select="golomb lpc"
  1098. flashsv_decoder_select="zlib"
  1099. flashsv_encoder_select="zlib"
  1100. flv_decoder_select="h263_decoder"
  1101. flv_encoder_select="h263_encoder"
  1102. h261_encoder_select="aandct"
  1103. h263_decoder_select="h263_parser"
  1104. h263_encoder_select="aandct"
  1105. h263_vaapi_hwaccel_deps="va_va_h"
  1106. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1107. h263i_decoder_select="h263_decoder"
  1108. h263p_encoder_select="h263_encoder"
  1109. h264_decoder_select="golomb"
  1110. h264_dxva2_hwaccel_deps="dxva2api_h"
  1111. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1112. h264_vaapi_hwaccel_deps="va_va_h"
  1113. h264_vaapi_hwaccel_select="vaapi"
  1114. h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1115. h264_vdpau_decoder_select="vdpau h264_decoder"
  1116. imc_decoder_select="fft mdct"
  1117. jpegls_decoder_select="golomb"
  1118. jpegls_encoder_select="golomb"
  1119. ljpeg_encoder_select="aandct"
  1120. loco_decoder_select="golomb"
  1121. mjpeg_encoder_select="aandct"
  1122. mlp_decoder_select="mlp_parser"
  1123. mpeg1video_encoder_select="aandct"
  1124. mpeg2video_encoder_select="aandct"
  1125. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1126. mpeg4_encoder_select="h263_encoder"
  1127. mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1128. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1129. mpeg1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1130. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1131. mpeg2_vaapi_hwaccel_deps="va_va_h"
  1132. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1133. mpeg4_vaapi_hwaccel_deps="va_va_h"
  1134. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1135. mpeg4_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1136. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1137. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1138. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1139. msmpeg4v1_decoder_select="h263_decoder"
  1140. msmpeg4v1_encoder_select="h263_encoder"
  1141. msmpeg4v2_decoder_select="h263_decoder"
  1142. msmpeg4v2_encoder_select="h263_encoder"
  1143. msmpeg4v3_decoder_select="h263_decoder"
  1144. msmpeg4v3_encoder_select="h263_encoder"
  1145. nellymoser_decoder_select="mdct"
  1146. nellymoser_encoder_select="mdct"
  1147. png_decoder_select="zlib"
  1148. png_encoder_select="zlib"
  1149. qcelp_decoder_select="lsp"
  1150. qdm2_decoder_select="mdct rdft"
  1151. rv10_decoder_select="h263_decoder"
  1152. rv10_encoder_select="h263_encoder"
  1153. rv20_decoder_select="h263_decoder"
  1154. rv20_encoder_select="h263_encoder"
  1155. rv30_decoder_select="golomb"
  1156. rv40_decoder_select="golomb"
  1157. shorten_decoder_select="golomb"
  1158. sipr_decoder_select="lsp"
  1159. snow_encoder_select="aandct"
  1160. sonic_decoder_select="golomb"
  1161. sonic_encoder_select="golomb"
  1162. sonic_ls_encoder_select="golomb"
  1163. svq1_encoder_select="aandct"
  1164. svq3_decoder_select="golomb"
  1165. svq3_decoder_suggest="zlib"
  1166. theora_decoder_select="vp3_decoder"
  1167. tiff_decoder_suggest="zlib"
  1168. tiff_encoder_suggest="zlib"
  1169. truehd_decoder_select="mlp_decoder"
  1170. tscc_decoder_select="zlib"
  1171. twinvq_decoder_select="mdct lsp"
  1172. vc1_decoder_select="h263_decoder"
  1173. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1174. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1175. vc1_vaapi_hwaccel_deps="va_va_h"
  1176. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1177. vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1178. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1179. vorbis_decoder_select="mdct"
  1180. vorbis_encoder_select="mdct"
  1181. vp6a_decoder_select="vp6_decoder"
  1182. vp6f_decoder_select="vp6_decoder"
  1183. wmapro_decoder_select="mdct"
  1184. wmav1_decoder_select="mdct"
  1185. wmav1_encoder_select="mdct"
  1186. wmav2_decoder_select="mdct"
  1187. wmav2_encoder_select="mdct"
  1188. wmavoice_decoder_select="lsp"
  1189. wmv1_decoder_select="h263_decoder"
  1190. wmv1_encoder_select="h263_encoder"
  1191. wmv2_decoder_select="h263_decoder"
  1192. wmv2_encoder_select="h263_encoder"
  1193. wmv3_decoder_select="vc1_decoder"
  1194. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1195. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1196. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1197. zlib_decoder_select="zlib"
  1198. zlib_encoder_select="zlib"
  1199. zmbv_decoder_select="zlib"
  1200. zmbv_encoder_select="zlib"
  1201. # parsers
  1202. h264_parser_select="golomb"
  1203. # bitstream_filters
  1204. aac_adtstoasc_bsf_select="aac_parser"
  1205. # external libraries
  1206. libdirac_decoder_deps="libdirac !libschroedinger"
  1207. libdirac_encoder_deps="libdirac"
  1208. libfaac_encoder_deps="libfaac"
  1209. libfaad_decoder_deps="libfaad"
  1210. libfaadbin_decoder_extralibs='$ldl'
  1211. libgsm_decoder_deps="libgsm"
  1212. libgsm_encoder_deps="libgsm"
  1213. libgsm_ms_decoder_deps="libgsm"
  1214. libgsm_ms_encoder_deps="libgsm"
  1215. libmp3lame_encoder_deps="libmp3lame"
  1216. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1217. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1218. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1219. libopenjpeg_decoder_deps="libopenjpeg"
  1220. libschroedinger_decoder_deps="libschroedinger"
  1221. libschroedinger_encoder_deps="libschroedinger"
  1222. libspeex_decoder_deps="libspeex"
  1223. libtheora_encoder_deps="libtheora"
  1224. libvorbis_encoder_deps="libvorbis"
  1225. libx264_encoder_deps="libx264"
  1226. libxvid_encoder_deps="libxvid"
  1227. # demuxers / muxers
  1228. ac3_demuxer_deps="ac3_parser"
  1229. asf_stream_muxer_select="asf_muxer"
  1230. avisynth_demuxer_deps="avisynth"
  1231. dirac_demuxer_deps="dirac_parser"
  1232. eac3_demuxer_select="ac3_parser"
  1233. ipod_muxer_select="mov_muxer"
  1234. libnut_demuxer_deps="libnut"
  1235. libnut_muxer_deps="libnut"
  1236. matroska_audio_muxer_select="matroska_muxer"
  1237. matroska_demuxer_suggest="zlib bzlib"
  1238. mov_demuxer_suggest="zlib"
  1239. mp3_demuxer_deps="mpegaudio_parser"
  1240. mp4_muxer_select="mov_muxer"
  1241. mpegtsraw_demuxer_select="mpegts_demuxer"
  1242. mxf_d10_muxer_select="mxf_muxer"
  1243. ogg_demuxer_select="golomb"
  1244. psp_muxer_select="mov_muxer"
  1245. rtsp_demuxer_deps="sdp_demuxer"
  1246. rtsp_muxer_deps="sdp_demuxer"
  1247. rtsp_muxer_select="rtp_muxer"
  1248. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1249. spdif_muxer_select="aac_parser"
  1250. tg2_muxer_select="mov_muxer"
  1251. tgp_muxer_select="mov_muxer"
  1252. w64_demuxer_deps="wav_demuxer"
  1253. # indevs / outdevs
  1254. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1255. alsa_indev_extralibs="-lasound"
  1256. alsa_outdev_deps="alsa_asoundlib_h"
  1257. alsa_outdev_extralibs="-lasound"
  1258. audio_beos_indev_deps="audio_beos"
  1259. audio_beos_indev_extralibs="-lmedia -lbe"
  1260. audio_beos_outdev_deps="audio_beos"
  1261. audio_beos_outdev_extralibs="-lmedia -lbe"
  1262. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1263. dv1394_indev_deps="dv1394 dv_demuxer"
  1264. jack_indev_deps="jack_jack_h"
  1265. jack_indev_extralibs="-ljack"
  1266. libdc1394_indev_deps="libdc1394"
  1267. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1268. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1269. v4l_indev_deps="linux_videodev_h"
  1270. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1271. vfwcap_indev_deps="capCreateCaptureWindow"
  1272. vfwcap_indev_extralibs="-lavicap32"
  1273. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1274. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1275. # protocols
  1276. gopher_protocol_deps="network"
  1277. http_protocol_deps="network"
  1278. http_protocol_select="tcp_protocol"
  1279. rtmp_protocol_deps="tcp_protocol"
  1280. rtp_protocol_deps="udp_protocol"
  1281. tcp_protocol_deps="network"
  1282. udp_protocol_deps="network"
  1283. # filters
  1284. movie_filter_deps="avfilter_lavf"
  1285. avfilter_lavf_deps="avformat"
  1286. # libraries
  1287. avdevice_deps="avcodec avformat"
  1288. avformat_deps="avcodec"
  1289. # programs
  1290. ffmpeg_deps="avcodec avformat swscale"
  1291. ffplay_deps="avcodec avformat swscale sdl"
  1292. ffplay_select="rdft"
  1293. ffprobe_deps="avcodec avformat"
  1294. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1295. ffserver_extralibs='$ldl'
  1296. doc_deps="texi2html"
  1297. # default parameters
  1298. logfile="config.err"
  1299. # installation paths
  1300. prefix_default="/usr/local"
  1301. bindir_default='${prefix}/bin'
  1302. datadir_default='${prefix}/share/ffmpeg'
  1303. incdir_default='${prefix}/include'
  1304. libdir_default='${prefix}/lib'
  1305. mandir_default='${prefix}/share/man'
  1306. shlibdir_default="$libdir_default"
  1307. # toolchain
  1308. ar="ar"
  1309. cc_default="gcc"
  1310. cc_version=\"unknown\"
  1311. host_cc_default="gcc"
  1312. ln_s="ln -sf"
  1313. nm_default="nm"
  1314. objformat="elf"
  1315. ranlib="ranlib"
  1316. strip_default="strip"
  1317. yasmexe="yasm"
  1318. nm_opts='-g'
  1319. # machine
  1320. arch_default=$(uname -m)
  1321. cpu="generic"
  1322. # OS
  1323. target_os_default=$(tolower $(uname -s))
  1324. host_os=$target_os_default
  1325. # configurable options
  1326. enable avcodec
  1327. enable avdevice
  1328. enable avformat
  1329. enable avutil
  1330. enable asm
  1331. enable debug
  1332. enable doc
  1333. enable fastdiv
  1334. enable ffmpeg
  1335. enable ffplay
  1336. enable ffprobe
  1337. enable ffserver
  1338. enable mpegaudio_hp
  1339. enable network
  1340. enable optimizations
  1341. enable protocols
  1342. enable static
  1343. enable stripping
  1344. enable swscale
  1345. enable swscale_alpha
  1346. # build settings
  1347. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1348. FFSERVERLDFLAGS=-Wl,-E
  1349. LIBPREF="lib"
  1350. LIBSUF=".a"
  1351. FULLNAME='$(NAME)$(BUILDSUF)'
  1352. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1353. SLIBPREF="lib"
  1354. SLIBSUF=".so"
  1355. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1356. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1357. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1358. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1359. CC_O='-o $@'
  1360. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1361. host_libs='-lm'
  1362. target_path='$(CURDIR)'
  1363. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1364. # full relative path for objects in subdirectories for non-recursive Make.
  1365. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1366. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1367. # find source path
  1368. source_path="$(dirname "$0")"
  1369. enable source_path_used
  1370. if test -f configure; then
  1371. source_path="$(pwd)"
  1372. disable source_path_used
  1373. else
  1374. source_path="$(cd "$source_path"; pwd)"
  1375. echo "$source_path" | grep -q '[[:blank:]]' &&
  1376. die "Out of tree builds are impossible with whitespace in source path."
  1377. test -e "$source_path/config.h" &&
  1378. die "Out of tree builds are impossible with config.h in source dir."
  1379. fi
  1380. for v in "$@"; do
  1381. r=${v#*=}
  1382. l=${v%"$r"}
  1383. r=$(sh_quote "$r")
  1384. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1385. done
  1386. find_things(){
  1387. thing=$1
  1388. pattern=$2
  1389. file=$source_path/$3
  1390. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1391. }
  1392. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1393. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1394. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1395. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1396. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1397. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1398. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1399. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1400. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1401. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1402. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1403. enable $ARCH_EXT_LIST \
  1404. $DECODER_LIST \
  1405. $ENCODER_LIST \
  1406. $HWACCEL_LIST \
  1407. $PARSER_LIST \
  1408. $BSF_LIST \
  1409. $DEMUXER_LIST \
  1410. $MUXER_LIST \
  1411. $FILTER_LIST \
  1412. $PROTOCOL_LIST \
  1413. $INDEV_LIST \
  1414. $OUTDEV_LIST \
  1415. die_unknown(){
  1416. echo "Unknown option \"$1\"."
  1417. echo "See $0 --help for available options."
  1418. exit 1
  1419. }
  1420. show_list() {
  1421. suffix=_$1
  1422. shift
  1423. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1424. exit 0
  1425. }
  1426. for opt do
  1427. optval="${opt#*=}"
  1428. case "$opt" in
  1429. --extra-ldflags=*) add_ldflags $optval
  1430. ;;
  1431. --extra-libs=*) add_extralibs $optval
  1432. ;;
  1433. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1434. ;;
  1435. --enable-debug=*) debuglevel="$optval"
  1436. ;;
  1437. --disable-everything)
  1438. map 'eval disable \${$(toupper ${_%s})_LIST}' $COMPONENT_LIST
  1439. ;;
  1440. --enable-*=*|--disable-*=*)
  1441. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1442. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1443. eval list=\$$(toupper $thing)_LIST
  1444. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1445. $action $(filter "$name" $list)
  1446. ;;
  1447. --enable-?*|--disable-?*)
  1448. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1449. if is_in $option $COMPONENT_LIST; then
  1450. test $action = disable && action=unset
  1451. eval $action \$$(toupper ${option%s})_LIST
  1452. elif is_in $option $CMDLINE_SELECT; then
  1453. $action $option
  1454. else
  1455. die_unknown $opt
  1456. fi
  1457. ;;
  1458. --list-*)
  1459. NAME="${opt#--list-}"
  1460. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1461. NAME=${NAME%s}
  1462. eval show_list $NAME \$$(toupper $NAME)_LIST
  1463. ;;
  1464. --help|-h) show_help
  1465. ;;
  1466. *)
  1467. optname="${opt%%=*}"
  1468. optname="${optname#--}"
  1469. optname=$(echo "$optname" | sed 's/-/_/g')
  1470. if is_in $optname $CMDLINE_SET; then
  1471. eval $optname='$optval'
  1472. elif is_in $optname $CMDLINE_APPEND; then
  1473. append $optname "$optval"
  1474. else
  1475. die_unknown $opt
  1476. fi
  1477. ;;
  1478. esac
  1479. done
  1480. disabled logging && logfile=/dev/null
  1481. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1482. set >> $logfile
  1483. test -n "$cross_prefix" && enable cross_compile
  1484. if enabled cross_compile; then
  1485. test -n "$arch" && test -n "$target_os" ||
  1486. die "Must specify target arch and OS when cross-compiling"
  1487. fi
  1488. set_default arch target_os
  1489. ar="${cross_prefix}${ar}"
  1490. cc_default="${cross_prefix}${cc_default}"
  1491. nm_default="${cross_prefix}${nm_default}"
  1492. ranlib="${cross_prefix}${ranlib}"
  1493. strip_default="${cross_prefix}${strip_default}"
  1494. sysinclude_default="${sysroot}/usr/include"
  1495. set_default cc nm strip sysinclude
  1496. enabled cross_compile || host_cc_default=$cc
  1497. set_default host_cc
  1498. exesuf() {
  1499. case $1 in
  1500. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1501. esac
  1502. }
  1503. EXESUF=$(exesuf $target_os)
  1504. HOSTEXESUF=$(exesuf $host_os)
  1505. # set temporary file name
  1506. : ${TMPDIR:=$TEMPDIR}
  1507. : ${TMPDIR:=$TMP}
  1508. : ${TMPDIR:=/tmp}
  1509. if ! check_cmd type mktemp; then
  1510. # simple replacement for missing mktemp
  1511. # NOT SAFE FOR GENERAL USE
  1512. mktemp(){
  1513. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1514. }
  1515. fi
  1516. tmpfile(){
  1517. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1518. (set -C; exec > $tmp) 2>/dev/null ||
  1519. die "Unable to create temporary file in $TMPDIR."
  1520. append TMPFILES $tmp
  1521. eval $1=$tmp
  1522. }
  1523. trap 'rm -f -- $TMPFILES' EXIT
  1524. trap exit HUP INT TERM
  1525. tmpfile TMPC .c
  1526. tmpfile TMPE $EXESUF
  1527. tmpfile TMPH .h
  1528. tmpfile TMPO .o
  1529. tmpfile TMPS .S
  1530. tmpfile TMPV .ver
  1531. tmpfile TMPSH .sh
  1532. unset -f mktemp
  1533. # make sure we can execute files in $TMPDIR
  1534. cat > $TMPSH 2>> $logfile <<EOF
  1535. #! /bin/sh
  1536. EOF
  1537. chmod +x $TMPSH >> $logfile 2>&1
  1538. if ! $TMPSH >> $logfile 2>&1; then
  1539. cat <<EOF
  1540. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1541. variable to another directory and make sure that it is not mounted noexec.
  1542. EOF
  1543. die "Sanity test failed."
  1544. fi
  1545. filter_cflags=echo
  1546. filter_cppflags=echo
  1547. filter_asflags=echo
  1548. if $cc -v 2>&1 | grep -qi ^gcc; then
  1549. cc_type=gcc
  1550. cc_version=__VERSION__
  1551. if ! $cc -dumpversion | grep -q '^2\.'; then
  1552. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1553. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1554. fi
  1555. speed_cflags='-O3'
  1556. size_cflags='-Os'
  1557. elif $cc --version 2>/dev/null | grep -q Intel; then
  1558. cc_type=icc
  1559. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1560. CC_DEPFLAGS='-MMD'
  1561. AS_DEPFLAGS='-MMD'
  1562. speed_cflags='-O3'
  1563. size_cflags='-Os'
  1564. elif $cc -v 2>&1 | grep -q xlc; then
  1565. cc_type=xlc
  1566. cc_version="AV_STRINGIFY(__IBMC__)"
  1567. speed_cflags='-O5'
  1568. size_cflags='-O5 -qcompact'
  1569. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1570. cc_type=ccc
  1571. cc_version="AV_STRINGIFY(__DECC_VER)"
  1572. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1573. debuglevel=3
  1574. add_ldflags -Wl,-z,now # calls to libots crash without this
  1575. speed_cflags='-fast'
  1576. size_cflags='-O1'
  1577. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1578. test -d "$sysroot" || die "No valid sysroot specified."
  1579. cc_type=armcc
  1580. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1581. armcc_conf="$PWD/armcc.conf"
  1582. $cc --arm_linux_configure \
  1583. --arm_linux_config_file="$armcc_conf" \
  1584. --configure_sysroot="$sysroot" \
  1585. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1586. die "Error creating armcc configuration file."
  1587. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1588. as_default="${cross_prefix}gcc"
  1589. CC_DEPFLAGS='-MMD'
  1590. AS_DEPFLAGS='-MMD'
  1591. speed_cflags='-O3'
  1592. size_cflags='-Os'
  1593. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1594. cc_type=tms470
  1595. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1596. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1597. CC_O='-fr=$(@D)'
  1598. as_default="${cross_prefix}gcc"
  1599. ld_default="${cross_prefix}gcc"
  1600. TMPO=$(basename $TMPC .c).o
  1601. append TMPFILES $TMPO
  1602. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1603. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1604. AS_DEPFLAGS='-MMD'
  1605. speed_cflags='-O3 -mf=5'
  1606. size_cflags='-O3 -mf=2'
  1607. filter_cflags=tms470_flags
  1608. tms470_flags(){
  1609. for flag; do
  1610. case $flag in
  1611. -march=*|-mcpu=*)
  1612. case "${flag#*=}" in
  1613. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1614. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1615. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1616. armv6*|arm11*) echo -mv=6 ;;
  1617. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1618. echo -mv=5e ;;
  1619. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1620. esac
  1621. ;;
  1622. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1623. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1624. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1625. -msoft-float) echo --float_support=vfplib ;;
  1626. -O[0-3]|-mf=*) echo $flag ;;
  1627. -g) echo -g -mn ;;
  1628. -pds=*) echo $flag ;;
  1629. esac
  1630. done
  1631. }
  1632. elif $cc -v 2>&1 | grep -q clang; then
  1633. cc_type=clang
  1634. cc_version=__VERSION__
  1635. CC_DEPFLAGS='-MMD'
  1636. AS_DEPFLAGS='-MMD'
  1637. speed_cflags='-O3'
  1638. size_cflags='-Os'
  1639. elif $cc -V 2>&1 | grep -q Sun; then
  1640. cc_type=suncc
  1641. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1642. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1643. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1644. speed_cflags='-O5'
  1645. size_cflags='-O5 -xspace'
  1646. filter_cflags=suncc_flags
  1647. suncc_flags(){
  1648. for flag; do
  1649. case $flag in
  1650. -march=*|-mcpu=*)
  1651. case "${flag#*=}" in
  1652. native) echo -xtarget=native ;;
  1653. v9) echo -xarch=sparc ;;
  1654. ultrasparc) echo -xarch=sparcvis ;;
  1655. ultrasparc3|niagara*) echo -xarch=sparcvis2 ;;
  1656. i586|pentium) echo -xchip=pentium ;;
  1657. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1658. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1659. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1660. pentium4*) echo -xtarget=pentium4 ;;
  1661. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1662. *-sse3) echo -xarch=sse3 ;;
  1663. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1664. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1665. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1666. k8|opteron|athlon64|athlon-fx)
  1667. echo -xarch=sse2a ;;
  1668. athlon*) echo -xarch=pentium_proa ;;
  1669. esac
  1670. ;;
  1671. -std=c99) echo -xc99 ;;
  1672. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1673. -fPIC) echo -KPIC -xcode=pic32 ;;
  1674. -W*,*) echo $flag ;;
  1675. -f*-*|-W*) ;;
  1676. *) echo $flag ;;
  1677. esac
  1678. done
  1679. }
  1680. fi
  1681. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1682. : ${as_default:=$cc}
  1683. : ${dep_cc_default:=$cc}
  1684. : ${ld_default:=$cc}
  1685. set_default as dep_cc ld
  1686. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1687. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1688. add_cflags $extra_cflags
  1689. add_asflags $extra_cflags
  1690. if test -n "$sysroot"; then
  1691. case "$cc_type" in
  1692. gcc)
  1693. add_cppflags --sysroot="$sysroot"
  1694. add_ldflags --sysroot="$sysroot"
  1695. ;;
  1696. tms470)
  1697. add_cppflags -I"$sysinclude"
  1698. add_ldflags --sysroot="$sysroot"
  1699. ;;
  1700. clang)
  1701. add_cppflags -isysroot "$sysroot"
  1702. add_ldflags -isysroot "$sysroot"
  1703. ;;
  1704. esac
  1705. fi
  1706. if test "$cpu" = host; then
  1707. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1708. case "$cc_type" in
  1709. gcc)
  1710. check_native(){
  1711. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1712. sed -n "/$1=/{
  1713. s/.*$1=\\([^ ]*\\).*/\\1/
  1714. p
  1715. q
  1716. }" $TMPE
  1717. }
  1718. cpu=$(check_native -march || check_native -mcpu)
  1719. ;;
  1720. esac
  1721. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1722. fi
  1723. # Deal with common $arch aliases
  1724. case "$arch" in
  1725. arm*)
  1726. arch="arm"
  1727. ;;
  1728. mips|mipsel|IP*)
  1729. arch="mips"
  1730. ;;
  1731. mips64*)
  1732. arch="mips"
  1733. subarch="mips64"
  1734. ;;
  1735. parisc|hppa)
  1736. arch="parisc"
  1737. ;;
  1738. parisc64|hppa64)
  1739. arch="parisc"
  1740. subarch="parisc64"
  1741. ;;
  1742. "Power Macintosh"|ppc|powerpc)
  1743. arch="ppc"
  1744. ;;
  1745. ppc64|powerpc64)
  1746. arch="ppc"
  1747. subarch="ppc64"
  1748. ;;
  1749. s390|s390x)
  1750. arch="s390"
  1751. ;;
  1752. sh4|sh)
  1753. arch="sh4"
  1754. ;;
  1755. sun4u|sparc64)
  1756. arch="sparc"
  1757. subarch="sparc64"
  1758. ;;
  1759. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1760. arch="x86"
  1761. ;;
  1762. esac
  1763. is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
  1764. enable $arch
  1765. # Add processor-specific flags
  1766. if test "$cpu" = generic; then
  1767. : do nothing
  1768. elif enabled ppc; then
  1769. case $(tolower $cpu) in
  1770. 601|ppc601|powerpc601)
  1771. cpuflags="-mcpu=601"
  1772. disable altivec
  1773. ;;
  1774. 603*|ppc603*|powerpc603*)
  1775. cpuflags="-mcpu=603"
  1776. disable altivec
  1777. ;;
  1778. 604*|ppc604*|powerpc604*)
  1779. cpuflags="-mcpu=604"
  1780. disable altivec
  1781. ;;
  1782. g3|75*|ppc75*|powerpc75*)
  1783. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1784. disable altivec
  1785. ;;
  1786. g4|745*|ppc745*|powerpc745*)
  1787. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1788. ;;
  1789. 74*|ppc74*|powerpc74*)
  1790. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1791. ;;
  1792. g5|970|ppc970|powerpc970|power4*)
  1793. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1794. ;;
  1795. cell)
  1796. cpuflags="-mcpu=cell"
  1797. enable ldbrx
  1798. ;;
  1799. e500v2)
  1800. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1801. disable altivec
  1802. ;;
  1803. e500)
  1804. cpuflags="-mcpu=8540 -mhard-float"
  1805. disable altivec
  1806. ;;
  1807. esac
  1808. elif enabled x86; then
  1809. case $cpu in
  1810. i[345]86|pentium)
  1811. cpuflags="-march=$cpu"
  1812. disable mmx
  1813. ;;
  1814. # targets that do NOT support conditional mov (cmov)
  1815. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1816. cpuflags="-march=$cpu"
  1817. disable cmov
  1818. ;;
  1819. # targets that do support conditional mov (cmov)
  1820. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
  1821. cpuflags="-march=$cpu"
  1822. enable cmov
  1823. enable fast_cmov
  1824. ;;
  1825. # targets that do support conditional mov but on which it's slow
  1826. pentium4|pentium4m|prescott|nocona)
  1827. cpuflags="-march=$cpu"
  1828. enable cmov
  1829. disable fast_cmov
  1830. ;;
  1831. esac
  1832. elif enabled sparc; then
  1833. case $cpu in
  1834. sparc64)
  1835. cpuflags="-mcpu=v9"
  1836. ;;
  1837. esac
  1838. elif enabled arm; then
  1839. case $cpu in
  1840. armv*)
  1841. cpuflags="-march=$cpu"
  1842. ;;
  1843. *)
  1844. cpuflags="-mcpu=$cpu"
  1845. ;;
  1846. esac
  1847. elif enabled alpha; then
  1848. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1849. elif enabled bfin; then
  1850. cpuflags="-mcpu=$cpu"
  1851. elif enabled mips; then
  1852. cpuflags="-march=$cpu"
  1853. elif enabled avr32; then
  1854. case $cpu in
  1855. ap7[02]0[0-2])
  1856. subarch="avr32_ap"
  1857. cpuflags="-mpart=$cpu"
  1858. ;;
  1859. ap)
  1860. subarch="avr32_ap"
  1861. cpuflags="-march=$cpu"
  1862. ;;
  1863. uc3[ab]*)
  1864. subarch="avr32_uc"
  1865. cpuflags="-mcpu=$cpu"
  1866. ;;
  1867. uc)
  1868. subarch="avr32_uc"
  1869. cpuflags="-march=$cpu"
  1870. ;;
  1871. esac
  1872. fi
  1873. add_cflags $cpuflags
  1874. add_asflags $cpuflags
  1875. # compiler sanity check
  1876. check_exec <<EOF
  1877. int main(void){ return 0; }
  1878. EOF
  1879. if test "$?" != 0; then
  1880. echo "$cc is unable to create an executable file."
  1881. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1882. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1883. echo "Only do this if you know what cross compiling means."
  1884. fi
  1885. die "C compiler test failed."
  1886. fi
  1887. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1888. check_cflags -std=c99
  1889. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1890. #include <stdlib.h>
  1891. EOF
  1892. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1893. #include <stdlib.h>
  1894. EOF
  1895. check_host_cflags -std=c99
  1896. case "$arch" in
  1897. alpha|ia64|mips|parisc|sparc)
  1898. spic=$shared
  1899. ;;
  1900. x86)
  1901. subarch="x86_32"
  1902. check_cc <<EOF && subarch="x86_64"
  1903. int test[(int)sizeof(char*) - 7];
  1904. EOF
  1905. if test "$subarch" = "x86_64"; then
  1906. spic=$shared
  1907. fi
  1908. ;;
  1909. esac
  1910. enable $subarch
  1911. enabled spic && enable pic
  1912. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  1913. # OS specific
  1914. case $target_os in
  1915. beos|haiku|zeta)
  1916. prefix_default="$HOME/config"
  1917. # 3 gcc releases known for BeOS, each with ugly bugs
  1918. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1919. case "$gcc_version" in
  1920. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1921. disable mmx
  1922. ;;
  1923. *20010315*) echo "BeBits gcc"
  1924. add_cflags -fno-expensive-optimizations
  1925. ;;
  1926. esac
  1927. SHFLAGS=-nostart
  1928. # enable BeOS things
  1929. enable audio_beos
  1930. # no need for libm, but the inet stuff
  1931. # Check for BONE
  1932. # XXX: actually should check for NOT net_server
  1933. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1934. network_extralibs="-lbind -lsocket"
  1935. else
  1936. enable beos_netserver
  1937. network_extralibs="-lnet"
  1938. fi ;;
  1939. sunos)
  1940. FFSERVERLDFLAGS=""
  1941. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1942. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1943. network_extralibs="-lsocket -lnsl"
  1944. add_cppflags -D__EXTENSIONS__
  1945. nm_opts='-P -g'
  1946. ;;
  1947. netbsd)
  1948. oss_indev_extralibs="-lossaudio"
  1949. oss_outdev_extralibs="-lossaudio"
  1950. ;;
  1951. openbsd)
  1952. enable malloc_aligned
  1953. # On OpenBSD 4.5. the compiler does not use PIC unless
  1954. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1955. # however the generated executable will not do anything
  1956. # (simply quits with exit-code 1, no crash, no output).
  1957. # Thus explicitly enable PIC here.
  1958. enable pic
  1959. SHFLAGS='-shared'
  1960. oss_indev_extralibs="-lossaudio"
  1961. oss_outdev_extralibs="-lossaudio"
  1962. ;;
  1963. freebsd|dragonfly)
  1964. enable malloc_aligned
  1965. ;;
  1966. bsd/os)
  1967. osextralibs="-lpoll -lgnugetopt"
  1968. strip="strip -d"
  1969. ;;
  1970. darwin)
  1971. enable malloc_aligned
  1972. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1973. strip="strip -x"
  1974. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1975. SLIBSUF=".dylib"
  1976. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1977. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1978. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1979. objformat="macho"
  1980. enabled x86_64 && objformat="macho64"
  1981. enabled_any pic shared ||
  1982. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1983. ;;
  1984. mingw32*)
  1985. if test $target_os = "mingw32ce"; then
  1986. disable network
  1987. else
  1988. target_os=mingw32
  1989. fi
  1990. LIBTARGET=i386
  1991. if enabled x86_64; then
  1992. enable malloc_aligned
  1993. LIBTARGET=x64
  1994. elif enabled arm; then
  1995. LIBTARGET=arm
  1996. fi
  1997. shlibdir_default="$bindir_default"
  1998. disable ffserver
  1999. SLIBPREF=""
  2000. SLIBSUF=".dll"
  2001. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2002. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2003. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2004. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2005. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2006. install -d "$(LIBDIR)"; \
  2007. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2008. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2009. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2010. objformat="win32"
  2011. enable dos_paths
  2012. check_cflags -fno-common
  2013. if ! enabled x86_64; then
  2014. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2015. die "ERROR: MinGW runtime version must be >= 3.15."
  2016. enabled_any avisynth vfwcap_indev &&
  2017. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  2018. die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
  2019. fi
  2020. ;;
  2021. cygwin*)
  2022. target_os=cygwin
  2023. shlibdir_default="$bindir_default"
  2024. SLIBPREF="cyg"
  2025. SLIBSUF=".dll"
  2026. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2027. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2028. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2029. objformat="win32"
  2030. enable dos_paths
  2031. check_cflags -fno-common
  2032. ;;
  2033. *-dos|freedos|opendos)
  2034. disable ffplay ffserver
  2035. disable $INDEV_LIST $OUTDEV_LIST
  2036. network_extralibs="-lsocket"
  2037. objformat="coff"
  2038. enable dos_paths
  2039. ;;
  2040. linux)
  2041. enable dv1394
  2042. ;;
  2043. irix*)
  2044. target_os=irix
  2045. ranlib="echo ignoring ranlib"
  2046. ;;
  2047. os/2*)
  2048. strip="lxlite"
  2049. ln_s="cp -f"
  2050. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  2051. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2052. FFSERVERLDFLAGS=""
  2053. LIBSUF="_s.a"
  2054. SLIBPREF=""
  2055. SLIBSUF=".dll"
  2056. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2057. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2058. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2059. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2060. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2061. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2062. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2063. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2064. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2065. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2066. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2067. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2068. enable dos_paths
  2069. ;;
  2070. gnu/kfreebsd)
  2071. ;;
  2072. gnu)
  2073. ;;
  2074. none)
  2075. ;;
  2076. *)
  2077. die "Unknown OS '$target_os'."
  2078. ;;
  2079. esac
  2080. set_default $PATHS_LIST
  2081. add_extralibs $osextralibs
  2082. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  2083. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  2084. # we need to build at least one lib type
  2085. if ! enabled_any static shared; then
  2086. cat <<EOF
  2087. At least one library type must be built.
  2088. Specify --enable-static to build the static libraries or --enable-shared to
  2089. build the shared libraries as well. To only build the shared libraries specify
  2090. --disable-static in addition to --enable-shared.
  2091. EOF
  2092. exit 1;
  2093. fi
  2094. disabled static && LIBNAME=""
  2095. if enabled_any libfaad libfaadbin ; then
  2096. if check_header faad.h; then
  2097. check_cc <<EOF
  2098. #include <faad.h>
  2099. #ifndef FAAD2_VERSION
  2100. ok faad1
  2101. #endif
  2102. int main(void) { return 0; }
  2103. EOF
  2104. test $? = 0 && enable libfaad2
  2105. else
  2106. die "FAAD test failed."
  2107. fi
  2108. fi
  2109. die_license_disabled() {
  2110. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2111. }
  2112. die_license_disabled gpl libfaad2
  2113. die_license_disabled gpl libx264
  2114. die_license_disabled gpl libxvid
  2115. die_license_disabled gpl postproc
  2116. die_license_disabled gpl x11grab
  2117. die_license_disabled nonfree libfaac
  2118. die_license_disabled version3 libopencore_amrnb
  2119. die_license_disabled version3 libopencore_amrwb
  2120. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2121. check_deps $ARCH_EXT_LIST
  2122. disabled optimizations || check_cflags -fomit-frame-pointer
  2123. enable_pic() {
  2124. enable pic
  2125. add_cppflags -DPIC
  2126. add_cflags -fPIC
  2127. add_asflags -fPIC
  2128. }
  2129. enabled pic && enable_pic
  2130. check_cc <<EOF || die "Symbol mangling check failed."
  2131. int ff_extern;
  2132. EOF
  2133. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2134. extern_prefix=${sym%%ff_extern*}
  2135. check_cc <<EOF && enable inline_asm
  2136. void foo(void) { __asm__ volatile ("" ::); }
  2137. EOF
  2138. _restrict=
  2139. for restrict_keyword in restrict __restrict__ __restrict; do
  2140. check_cc <<EOF && _restrict=$restrict_keyword && break
  2141. void foo(char * $restrict_keyword p);
  2142. EOF
  2143. done
  2144. check_cc <<EOF && enable attribute_packed
  2145. struct { int x; } __attribute__((packed)) x;
  2146. EOF
  2147. check_cc <<EOF && enable attribute_may_alias
  2148. union { int x; } __attribute__((may_alias)) x;
  2149. EOF
  2150. check_cc <<EOF || die "endian test failed"
  2151. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2152. EOF
  2153. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2154. if enabled alpha; then
  2155. check_cflags -mieee
  2156. elif enabled arm; then
  2157. check_cflags -marm
  2158. check_ld <<EOF && enable vfp_args
  2159. __asm__ (".eabi_attribute 28, 1");
  2160. int main(void) { return 0; }
  2161. EOF
  2162. # We have to check if pld is a nop and disable it.
  2163. check_asm pld '"pld [r0]"'
  2164. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2165. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2166. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2167. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2168. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2169. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2170. enabled_all armv6t2 shared !pic && enable_pic
  2171. elif enabled ia64; then
  2172. # HACK: currently fails to build if .bss is > 4MB and shared libs are built
  2173. enabled shared && enable_weak hardcoded_tables
  2174. elif enabled mips; then
  2175. check_asm loongson '"dmult.g $1, $2, $3"'
  2176. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2177. elif enabled ppc; then
  2178. enable local_aligned_8 local_aligned_16
  2179. check_asm dcbzl '"dcbzl 0, 1"'
  2180. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2181. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2182. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2183. if enabled altivec; then
  2184. check_cflags -maltivec -mabi=altivec &&
  2185. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2186. check_cflags -faltivec
  2187. # check if our compiler supports Motorola AltiVec C API
  2188. check_cc <<EOF || disable altivec
  2189. $inc_altivec_h
  2190. int main(void) {
  2191. vector signed int v1, v2, v3;
  2192. v1 = vec_add(v2,v3);
  2193. return 0;
  2194. }
  2195. EOF
  2196. # check if our compiler supports braces for vector declarations
  2197. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2198. $inc_altivec_h
  2199. int main (void) { (vector int) {1}; return 0; }
  2200. EOF
  2201. fi
  2202. elif enabled sparc; then
  2203. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2204. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2205. elif enabled x86; then
  2206. enable local_aligned_8 local_aligned_16
  2207. # check whether EBP is available on x86
  2208. # As 'i' is stored on the stack, this program will crash
  2209. # if the base pointer is used to access it because the
  2210. # base pointer is cleared in the inline assembly code.
  2211. check_exec_crash <<EOF && enable ebp_available
  2212. volatile int i=0;
  2213. __asm__ volatile (
  2214. "xorl %%ebp, %%ebp"
  2215. ::: "%ebp");
  2216. return i;
  2217. EOF
  2218. # check whether EBX is available on x86
  2219. check_asm ebx_available '""::"b"(0)' &&
  2220. check_asm ebx_available '"":::"%ebx"'
  2221. # check whether more than 10 operands are supported
  2222. check_cc <<EOF && enable ten_operands
  2223. int main(void) {
  2224. int x=0;
  2225. __asm__ volatile(
  2226. ""
  2227. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2228. );
  2229. return 0;
  2230. }
  2231. EOF
  2232. # check whether binutils is new enough to compile SSSE3/MMX2
  2233. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2234. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2235. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2236. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2237. enabled x86_64 && append YASMFLAGS "-m amd64"
  2238. enabled pic && append YASMFLAGS "-DPIC"
  2239. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2240. case "$objformat" in
  2241. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2242. esac
  2243. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  2244. case "$cpu" in
  2245. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2246. disable fast_clz
  2247. ;;
  2248. esac
  2249. fi
  2250. if check_func dlopen; then
  2251. ldl=
  2252. elif check_func dlopen -ldl; then
  2253. ldl=-ldl
  2254. fi
  2255. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2256. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2257. check_func fork
  2258. check_func getaddrinfo $network_extralibs
  2259. check_func gethrtime
  2260. check_func getrusage
  2261. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2262. check_func inet_aton $network_extralibs
  2263. check_func isatty
  2264. check_func ${malloc_prefix}memalign && enable memalign
  2265. check_func mkstemp
  2266. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2267. check_func setrlimit
  2268. check_func_headers io.h setmode
  2269. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2270. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2271. check_func_headers windows.h GetProcessTimes
  2272. check_func_headers windows.h VirtualAlloc
  2273. check_header conio.h
  2274. check_header dlfcn.h
  2275. check_header dxva2api.h
  2276. check_header malloc.h
  2277. check_header poll.h
  2278. check_header sys/mman.h
  2279. check_header sys/resource.h
  2280. check_header sys/select.h
  2281. check_header termios.h
  2282. check_header vdpau/vdpau.h
  2283. check_header vdpau/vdpau_x11.h
  2284. check_header X11/extensions/XvMClib.h
  2285. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2286. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2287. enabled_any $need_memalign ; then
  2288. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2289. fi
  2290. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2291. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2292. # check for some common methods of building with pthread support
  2293. # do this before the optional library checks as some of them require pthreads
  2294. if enabled pthreads; then
  2295. if check_func pthread_create; then
  2296. :
  2297. elif check_func pthread_create -pthread; then
  2298. add_cflags -pthread
  2299. add_extralibs -pthread
  2300. elif check_func pthread_create -pthreads; then
  2301. add_cflags -pthreads
  2302. add_extralibs -pthreads
  2303. elif check_func pthread_create -lpthreadGC2; then
  2304. add_extralibs -lpthreadGC2
  2305. elif ! check_lib pthread.h pthread_create -lpthread; then
  2306. die "ERROR: can't find pthreads library"
  2307. fi
  2308. fi
  2309. for thread in $THREADS_LIST; do
  2310. if enabled $thread; then
  2311. test -n "$thread_type" &&
  2312. die "ERROR: Only one thread type must be selected." ||
  2313. thread_type="$thread"
  2314. fi
  2315. done
  2316. check_lib math.h sin -lm
  2317. check_lib va/va.h vaInitialize -lva
  2318. check_mathfunc exp2
  2319. check_mathfunc exp2f
  2320. check_mathfunc llrint
  2321. check_mathfunc log2
  2322. check_mathfunc log2f
  2323. check_mathfunc lrint
  2324. check_mathfunc lrintf
  2325. check_mathfunc round
  2326. check_mathfunc roundf
  2327. check_mathfunc truncf
  2328. # these are off by default, so fail if requested and not available
  2329. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2330. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2331. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2332. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2333. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2334. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2335. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2336. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2337. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2338. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2339. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2340. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2341. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2342. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2343. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2344. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2345. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2346. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2347. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2348. die "ERROR: libx264 version must be >= 0.83."; }
  2349. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2350. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2351. # libdc1394 check
  2352. if enabled libdc1394; then
  2353. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2354. enable libdc1394_2; } ||
  2355. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2356. enable libdc1394_1; } ||
  2357. die "ERROR: No version of libdc1394 found "
  2358. fi
  2359. SDL_CONFIG="${cross_prefix}sdl-config"
  2360. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2361. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2362. sdl_libs=$("${SDL_CONFIG}" --libs)
  2363. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2364. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2365. enable sdl &&
  2366. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2367. fi
  2368. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2369. if enabled network; then
  2370. check_type "sys/types.h sys/socket.h" socklen_t
  2371. check_type netdb.h "struct addrinfo"
  2372. check_type netinet/in.h "struct ipv6_mreq"
  2373. check_type netinet/in.h "struct sockaddr_in6"
  2374. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2375. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2376. # Prefer arpa/inet.h over winsock2
  2377. if check_header arpa/inet.h ; then
  2378. check_func closesocket
  2379. elif check_header winsock2.h ; then
  2380. check_func_headers winsock2.h closesocket -lws2 && \
  2381. network_extralibs="-lws2" || \
  2382. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2383. network_extralibs="-lws2_32"; }
  2384. check_type ws2tcpip.h socklen_t
  2385. check_type ws2tcpip.h "struct addrinfo"
  2386. check_type ws2tcpip.h "struct ipv6_mreq"
  2387. check_type ws2tcpip.h "struct sockaddr_in6"
  2388. check_type ws2tcpip.h "struct sockaddr_storage"
  2389. check_struct winsock2.h "struct sockaddr" sa_len
  2390. else
  2391. disable network
  2392. fi
  2393. fi
  2394. check_header linux/videodev.h
  2395. check_header linux/videodev2.h
  2396. check_header sys/videoio.h
  2397. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2398. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2399. { check_header dev/bktr/ioctl_meteor.h &&
  2400. check_header dev/bktr/ioctl_bt848.h; } ||
  2401. { check_header machine/ioctl_meteor.h &&
  2402. check_header machine/ioctl_bt848.h; } ||
  2403. { check_header dev/video/meteor/ioctl_meteor.h &&
  2404. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2405. check_header dev/ic/bt8xx.h
  2406. check_header sys/soundcard.h
  2407. check_header soundcard.h
  2408. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2409. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2410. enabled x11grab &&
  2411. check_header X11/Xlib.h &&
  2412. check_header X11/extensions/XShm.h &&
  2413. check_header X11/extensions/Xfixes.h &&
  2414. check_func XOpenDisplay -lX11 &&
  2415. check_func XShmCreateImage -lX11 -lXext &&
  2416. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2417. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2418. check_cpp_condition \
  2419. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2420. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2421. disable vdpau; }
  2422. fi
  2423. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2424. # add some useful compiler flags if supported
  2425. check_cflags -Wdeclaration-after-statement
  2426. check_cflags -Wall
  2427. check_cflags -Wno-switch
  2428. check_cflags -Wdisabled-optimization
  2429. check_cflags -Wpointer-arith
  2430. check_cflags -Wredundant-decls
  2431. check_cflags -Wno-pointer-sign
  2432. check_cflags -Wcast-qual
  2433. check_cflags -Wwrite-strings
  2434. check_cflags -Wtype-limits
  2435. check_cflags -Wundef
  2436. check_cflags -Wmissing-prototypes
  2437. enabled extra_warnings && check_cflags -Winline
  2438. # add some linker flags
  2439. check_ldflags -Wl,--warn-common
  2440. check_ldflags -Wl,--as-needed
  2441. 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'
  2442. check_ldflags -Wl,-Bsymbolic
  2443. echo "X{};" > $TMPV
  2444. test_ldflags -Wl,--version-script,$TMPV &&
  2445. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2446. if enabled small; then
  2447. add_cflags $size_cflags
  2448. optimizations="small"
  2449. elif enabled optimizations; then
  2450. add_cflags $speed_cflags
  2451. fi
  2452. check_cflags -fno-math-errno
  2453. check_cflags -fno-signed-zeros
  2454. if enabled icc; then
  2455. # Just warnings, no remarks
  2456. check_cflags -w1
  2457. # -wd: Disable following warnings
  2458. # 144, 167, 556: -Wno-pointer-sign
  2459. # 10006: ignoring unknown option -fno-signed-zeros
  2460. # 10156: ignoring option '-W'; no argument required
  2461. check_cflags -wd144,167,556,10006,10156
  2462. # 11030: Warning unknown option --as-needed
  2463. # 10156: ignoring option '-export'; no argument required
  2464. check_ldflags -wd10156,11030
  2465. # Allow to compile with optimizations
  2466. check_ldflags -march=$cpu
  2467. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2468. enable ebp_available
  2469. elif enabled ccc; then
  2470. # disable some annoying warnings
  2471. add_cflags -msg_disable cvtu32to64
  2472. add_cflags -msg_disable embedcomment
  2473. add_cflags -msg_disable needconstext
  2474. add_cflags -msg_disable nomainieee
  2475. add_cflags -msg_disable ptrmismatch1
  2476. add_cflags -msg_disable unreachcode
  2477. elif enabled gcc; then
  2478. check_cflags -fno-tree-vectorize
  2479. check_cflags -Werror=implicit
  2480. check_cflags -Werror=missing-prototypes
  2481. elif enabled clang; then
  2482. check_cflags -Qunused-arguments
  2483. elif enabled armcc; then
  2484. # 2523: use of inline assembler is deprecated
  2485. add_cflags -Wrvct,--diag_suppress=2523
  2486. add_cflags -Wrvct,--diag_suppress=1207
  2487. elif enabled tms470; then
  2488. add_cflags -pds=824 -pds=837
  2489. fi
  2490. if enabled gprof; then
  2491. add_cflags -p
  2492. add_ldflags -p
  2493. fi
  2494. # Find out if the .align argument is a power of two or not.
  2495. check_asm asmalign_pot '".align 3"'
  2496. enabled_any $DECODER_LIST && enable decoders
  2497. enabled_any $ENCODER_LIST && enable encoders
  2498. enabled_any $HWACCEL_LIST && enable hwaccels
  2499. enabled_any $BSF_LIST && enable bsfs
  2500. enabled_any $DEMUXER_LIST && enable demuxers
  2501. enabled_any $MUXER_LIST && enable muxers
  2502. enabled_any $FILTER_LIST && enable filters
  2503. enabled_any $INDEV_LIST && enable indevs
  2504. enabled_any $OUTDEV_LIST && enable outdevs
  2505. enabled_any $PROTOCOL_LIST && enable protocols
  2506. enabled_any $THREADS_LIST && enable threads
  2507. check_deps $CONFIG_LIST \
  2508. $CONFIG_EXTRA \
  2509. $HAVE_LIST \
  2510. $DECODER_LIST \
  2511. $ENCODER_LIST \
  2512. $HWACCEL_LIST \
  2513. $PARSER_LIST \
  2514. $BSF_LIST \
  2515. $DEMUXER_LIST \
  2516. $MUXER_LIST \
  2517. $FILTER_LIST \
  2518. $INDEV_LIST \
  2519. $OUTDEV_LIST \
  2520. $PROTOCOL_LIST \
  2521. enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
  2522. echo "install prefix $prefix"
  2523. echo "source path $source_path"
  2524. echo "C compiler $cc"
  2525. echo ".align is power-of-two $asmalign_pot"
  2526. echo "ARCH $arch ($cpu)"
  2527. if test "$build_suffix" != ""; then
  2528. echo "build suffix $build_suffix"
  2529. fi
  2530. if test "$extra_version" != ""; then
  2531. echo "version string suffix $extra_version"
  2532. fi
  2533. echo "big-endian ${bigendian-no}"
  2534. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2535. if enabled x86; then
  2536. echo "yasm ${yasm-no}"
  2537. echo "MMX enabled ${mmx-no}"
  2538. echo "MMX2 enabled ${mmx2-no}"
  2539. echo "3DNow! enabled ${amd3dnow-no}"
  2540. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2541. echo "SSE enabled ${sse-no}"
  2542. echo "SSSE3 enabled ${ssse3-no}"
  2543. echo "CMOV enabled ${cmov-no}"
  2544. echo "CMOV is fast ${fast_cmov-no}"
  2545. echo "EBX available ${ebx_available-no}"
  2546. echo "EBP available ${ebp_available-no}"
  2547. echo "10 operands supported ${ten_operands-no}"
  2548. fi
  2549. if enabled arm; then
  2550. echo "ARMv5TE enabled ${armv5te-no}"
  2551. echo "ARMv6 enabled ${armv6-no}"
  2552. echo "ARMv6T2 enabled ${armv6t2-no}"
  2553. echo "ARM VFP enabled ${armvfp-no}"
  2554. echo "IWMMXT enabled ${iwmmxt-no}"
  2555. echo "NEON enabled ${neon-no}"
  2556. fi
  2557. if enabled mips; then
  2558. echo "MMI enabled ${mmi-no}"
  2559. fi
  2560. if enabled ppc; then
  2561. echo "AltiVec enabled ${altivec-no}"
  2562. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2563. echo "dcbzl available ${dcbzl-no}"
  2564. echo "performance report ${powerpc_perf-no}"
  2565. fi
  2566. if enabled sparc; then
  2567. echo "VIS enabled ${vis-no}"
  2568. fi
  2569. echo "gprof enabled ${gprof-no}"
  2570. echo "debug symbols ${debug-no}"
  2571. echo "strip symbols ${stripping-no}"
  2572. echo "optimizations ${optimizations-no}"
  2573. echo "static ${static-no}"
  2574. echo "shared ${shared-no}"
  2575. echo "postprocessing support ${postproc-no}"
  2576. echo "new filter support ${avfilter-no}"
  2577. echo "filters using lavformat ${avfilter_lavf-no}"
  2578. echo "network support ${network-no}"
  2579. echo "threading support ${thread_type-no}"
  2580. echo "SDL support ${sdl-no}"
  2581. echo "Sun medialib support ${mlib-no}"
  2582. echo "AVISynth enabled ${avisynth-no}"
  2583. echo "libdc1394 support ${libdc1394-no}"
  2584. echo "libdirac enabled ${libdirac-no}"
  2585. echo "libfaac enabled ${libfaac-no}"
  2586. echo "libfaad enabled ${libfaad-no}"
  2587. echo "libfaad dlopened ${libfaadbin-no}"
  2588. echo "libgsm enabled ${libgsm-no}"
  2589. echo "libmp3lame enabled ${libmp3lame-no}"
  2590. echo "libnut enabled ${libnut-no}"
  2591. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2592. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2593. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2594. echo "libschroedinger enabled ${libschroedinger-no}"
  2595. echo "libspeex enabled ${libspeex-no}"
  2596. echo "libtheora enabled ${libtheora-no}"
  2597. echo "libvorbis enabled ${libvorbis-no}"
  2598. echo "libx264 enabled ${libx264-no}"
  2599. echo "libxvid enabled ${libxvid-no}"
  2600. echo "zlib enabled ${zlib-no}"
  2601. echo "bzlib enabled ${bzlib-no}"
  2602. echo
  2603. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2604. echo "Enabled ${type}s:"
  2605. eval list=\$$(toupper $type)_LIST
  2606. for part in $list; do
  2607. enabled $part && echo ${part%_*}
  2608. done | sort | pr -3 -t
  2609. echo
  2610. done
  2611. license="LGPL version 2.1 or later"
  2612. if enabled nonfree; then
  2613. license="nonfree and unredistributable"
  2614. elif enabled gplv3; then
  2615. license="GPL version 3 or later"
  2616. elif enabled lgplv3; then
  2617. license="LGPL version 3 or later"
  2618. elif enabled gpl; then
  2619. license="GPL version 2 or later"
  2620. fi
  2621. echo "License: $license"
  2622. echo "Creating config.mak and config.h..."
  2623. # build tree in object directory if source path is different from current one
  2624. if enabled source_path_used; then
  2625. DIRS="
  2626. doc
  2627. libavcodec
  2628. libavcodec/$arch
  2629. libavdevice
  2630. libavfilter
  2631. libavformat
  2632. libavutil
  2633. libavutil/$arch
  2634. libpostproc
  2635. libswscale
  2636. libswscale/$arch
  2637. tests
  2638. tools
  2639. "
  2640. FILES="
  2641. Makefile
  2642. common.mak
  2643. subdir.mak
  2644. doc/texi2pod.pl
  2645. libavcodec/Makefile
  2646. libavdevice/Makefile
  2647. libavfilter/Makefile
  2648. libavformat/Makefile
  2649. libavutil/Makefile
  2650. libpostproc/Makefile
  2651. libswscale/Makefile
  2652. "
  2653. for dir in $DIRS ; do
  2654. mkdir -p $dir
  2655. done
  2656. for f in $FILES ; do
  2657. $ln_s "$source_path/$f" $f
  2658. done
  2659. fi
  2660. enabled stripping || strip="echo skipping strip"
  2661. cat > config.mak <<EOF
  2662. # Automatically generated by configure - do not modify!
  2663. ifndef FFMPEG_CONFIG_MAK
  2664. FFMPEG_CONFIG_MAK=1
  2665. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2666. prefix=$prefix
  2667. LIBDIR=\$(DESTDIR)$libdir
  2668. SHLIBDIR=\$(DESTDIR)$shlibdir
  2669. INCDIR=\$(DESTDIR)$incdir
  2670. BINDIR=\$(DESTDIR)$bindir
  2671. DATADIR=\$(DESTDIR)$datadir
  2672. MANDIR=\$(DESTDIR)$mandir
  2673. SRC_PATH="$source_path"
  2674. SRC_PATH_BARE=$source_path
  2675. BUILD_ROOT="$PWD"
  2676. ARCH=$arch
  2677. CC=$cc
  2678. AS=$as
  2679. LD=$ld
  2680. DEPCC=$dep_cc
  2681. YASM=$yasmexe
  2682. YASMDEP=$yasmexe
  2683. AR=$ar
  2684. RANLIB=$ranlib
  2685. CP=cp -p
  2686. LN_S=$ln_s
  2687. STRIP=$strip
  2688. CPPFLAGS=$CPPFLAGS
  2689. CFLAGS=$CFLAGS
  2690. ASFLAGS=$ASFLAGS
  2691. CC_O=$CC_O
  2692. LDFLAGS=$LDFLAGS
  2693. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2694. SHFLAGS=$SHFLAGS
  2695. YASMFLAGS=$YASMFLAGS
  2696. BUILDSUF=$build_suffix
  2697. FULLNAME=$FULLNAME
  2698. LIBPREF=$LIBPREF
  2699. LIBSUF=$LIBSUF
  2700. LIBNAME=$LIBNAME
  2701. SLIBPREF=$SLIBPREF
  2702. SLIBSUF=$SLIBSUF
  2703. EXESUF=$EXESUF
  2704. EXTRA_VERSION=$extra_version
  2705. DEPFLAGS=$DEPFLAGS
  2706. CCDEP=$CCDEP
  2707. ASDEP=$ASDEP
  2708. CC_DEPFLAGS=$CC_DEPFLAGS
  2709. AS_DEPFLAGS=$AS_DEPFLAGS
  2710. HOSTCC=$host_cc
  2711. HOSTCFLAGS=$host_cflags
  2712. HOSTEXESUF=$HOSTEXESUF
  2713. HOSTLDFLAGS=$host_ldflags
  2714. HOSTLIBS=$host_libs
  2715. TARGET_EXEC=$target_exec
  2716. TARGET_PATH=$target_path
  2717. SDL_LIBS=$sdl_libs
  2718. SDL_CFLAGS=$sdl_cflags
  2719. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2720. EXTRALIBS=$extralibs
  2721. INSTALL=install
  2722. LIBTARGET=${LIBTARGET}
  2723. SLIBNAME=${SLIBNAME}
  2724. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2725. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2726. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2727. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2728. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2729. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2730. EOF
  2731. get_version(){
  2732. name=$1
  2733. file=$source_path/$2
  2734. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2735. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2736. lcname=$(tolower $name)
  2737. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2738. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2739. }
  2740. get_version LIBSWSCALE libswscale/swscale.h
  2741. get_version LIBPOSTPROC libpostproc/postprocess.h
  2742. get_version LIBAVCODEC libavcodec/avcodec.h
  2743. get_version LIBAVDEVICE libavdevice/avdevice.h
  2744. get_version LIBAVFORMAT libavformat/avformat.h
  2745. get_version LIBAVUTIL libavutil/avutil.h
  2746. get_version LIBAVFILTER libavfilter/avfilter.h
  2747. enabled asmalign_pot || align_shift="1 <<"
  2748. cat > $TMPH <<EOF
  2749. /* Automatically generated by configure - do not modify! */
  2750. #ifndef FFMPEG_CONFIG_H
  2751. #define FFMPEG_CONFIG_H
  2752. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2753. #define FFMPEG_LICENSE "$(c_escape $license)"
  2754. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2755. #define CC_TYPE "$cc_type"
  2756. #define CC_VERSION $cc_version
  2757. #define restrict $_restrict
  2758. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2759. #define EXTERN_PREFIX "${extern_prefix}"
  2760. #define EXTERN_ASM ${extern_prefix}
  2761. EOF
  2762. test -n "$malloc_prefix" &&
  2763. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2764. if enabled small || disabled optimizations; then
  2765. echo "#undef av_always_inline" >> $TMPH
  2766. echo "#define av_always_inline" >> $TMPH
  2767. fi
  2768. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2769. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2770. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2771. $CONFIG_EXTRA \
  2772. $DECODER_LIST \
  2773. $ENCODER_LIST \
  2774. $HWACCEL_LIST \
  2775. $PARSER_LIST \
  2776. $BSF_LIST \
  2777. $DEMUXER_LIST \
  2778. $MUXER_LIST \
  2779. $FILTER_LIST \
  2780. $PROTOCOL_LIST \
  2781. $INDEV_LIST \
  2782. $OUTDEV_LIST \
  2783. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2784. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2785. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2786. cp_if_changed $TMPH config.h
  2787. cat > $TMPH <<EOF
  2788. /* Generated by ffconf */
  2789. #ifndef AVUTIL_AVCONFIG_H
  2790. #define AVUTIL_AVCONFIG_H
  2791. EOF
  2792. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2793. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2794. cp_if_changed $TMPH libavutil/avconfig.h
  2795. # build pkg-config files
  2796. pkgconfig_generate(){
  2797. name=$1
  2798. shortname=${name#lib}${build_suffix}
  2799. comment=$2
  2800. version=$3
  2801. libs=$4
  2802. requires=$5
  2803. cat <<EOF > $name/$name.pc
  2804. prefix=$prefix
  2805. exec_prefix=\${prefix}
  2806. libdir=$libdir
  2807. includedir=$incdir
  2808. Name: $name
  2809. Description: $comment
  2810. Version: $version
  2811. Requires: $(enabled shared || echo $requires)
  2812. Requires.private: $(enabled shared && echo $requires)
  2813. Conflicts:
  2814. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2815. Libs.private: $(enabled shared && echo $libs)
  2816. Cflags: -I\${includedir}
  2817. EOF
  2818. cat <<EOF > $name/$name-uninstalled.pc
  2819. prefix=
  2820. exec_prefix=
  2821. libdir=\${pcfiledir}
  2822. includedir=${source_path}
  2823. Name: $name
  2824. Description: $comment
  2825. Version: $version
  2826. Requires: $requires
  2827. Conflicts:
  2828. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2829. Cflags: -I\${includedir}
  2830. EOF
  2831. }
  2832. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2833. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2834. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2835. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2836. enabled avfilter &&
  2837. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2838. enabled postproc &&
  2839. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2840. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"