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.

3140 lines
88KB

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